public void saveToDb(PopulateDb.ConflictHandler ch) {
public void saveToDb(DBConflictHandler ch) {
  public void saveToDb(PopulateDb.ConflictHandler ch) {    try {      updateNameServerHostName(); // Be sure this is up-to-date      Set writtenNodes = new HashSet();      List components = getComponents();      NodeComponent[] nodesToWrite = getNodes();      ComponentData theSoc = new GenericComponentData();      theSoc.setType(ComponentData.SOCIETY);      theSoc.setName(getExperimentName()); // this should be experiment: trial FIXME      theSoc.setClassName("java.lang.Object"); // Must not be null      theSoc.setOwner(this); // the experiment      theSoc.setParent(null);      addDefaultNodeArguments(theSoc);      //      PopulateDb pdb =      //        new PopulateDb("CMT", "CSHNA", "CSMI", getExperimentName(),      //                       getExperimentID(), trialID, !isCloned(), ch);      // TODO: isCloned argument to PopulateDB is going away      PopulateDb pdb =        new PopulateDb("CMT", "CSHNA", "CSMI", getExperimentName(),                       getExperimentID(), trialID, true, ch);      setExperimentID(pdb.getExperimentId());      trialID = pdb.getTrialId();      // For each node, create a GenericComponentData, and add it to the society      for (Iterator i = hosts.iterator(); i.hasNext(); ) {        ExperimentHost host = (ExperimentHost) i.next();        ComponentData hc = new GenericComponentData();        hc.setType(ComponentData.HOST);        hc.setName(host.getShortName());        hc.setClassName("");        hc.setOwner(this);        hc.setParent(theSoc);        addPropertiesAsParameters(hc, host);        theSoc.addChild(hc);        NodeComponent[] nodes = host.getNodes();        for (int j = 0; j < nodes.length; j++) {          saveNodeToDb(nodes[j], hc);          writtenNodes.add(nodes[j]);        }      }      for (int i = 0; i < nodesToWrite.length; i++) {        if (writtenNodes.contains(nodesToWrite[i])) continue;        saveNodeToDb(nodesToWrite[i], theSoc);        writtenNodes.add(nodesToWrite[i]);      }      // Some components will want access to the complete set of Nodes      // in the society, etc. To get that, they must get back to the      // root soc object, and do a getOwner and go from there. Ugly.          // Now ask each component in turn to add its stuff      boolean componentWasRemoved = false;      for (int i = 0, n = components.size(); i < n; i++) {        ComponentProperties soc = (ComponentProperties) components.get(i);//          System.out.println(soc + ".addComponentData");        soc.addComponentData(theSoc);        componentWasRemoved |= soc.componentWasRemoved();      }      if (componentWasRemoved) pdb.repopulateCMT(theSoc);      pdb.populateHNA(theSoc);      //      if (pdb.populateHNA(theSoc)) setCloned(true);      // then give everyone a chance to modify what they've collectively produced      for (int i = 0, n = components.size(); i < n; i++) {        ComponentProperties soc = (ComponentProperties) components.get(i);        soc.modifyComponentData(theSoc, pdb);        if (soc.componentWasRemoved()) {          pdb.repopulateCMT(theSoc);        }        pdb.populateCSMI(theSoc);        //        if (pdb.populateCSMI(theSoc)) setCloned(true);      }      pdb.setModRecipes(recipes);      pdb.close();      theWholeSoc = theSoc;    } catch (Exception sqle) {      sqle.printStackTrace();    }  }