/*
* Create the cell and pass it the setup information
*/
String className = setup.getServerClassName();
CellMO cellMO = CellMOFactory.loadCellMO(className);
if (cellMO == null) {
/* Log a warning and move onto the next cell */
logger.warning("Unable to load cell MO: " + className);
continue;
}
/* Set the cell name */
// cellMO.setName(child.name);
/** XXX TODO: add an import details cell component XXX */
/* Call the cell's setup method */
try {
cellMO.setServerState(setup);
} catch (ClassCastException cce) {
logger.log(Level.WARNING, "Error setting up new cell " +
cellMO.getName() + " of type " +
cellMO.getClass(), cce);
continue;
}
/*
* Add the child to the cell hierarchy. If the cell has no parent,
* then we insert it directly into the world
*/
try {
if (parentRef == null) {
WonderlandContext.getCellManager().insertCellInWorld(cellMO);
}
else {
logger.info("WFSLoader: Adding child (ID=" + cellMO.getCellID().toString() +
") to parent (ID=" + parentRef.get().getCellID().toString() + ")");
parentRef.get().addChild(cellMO);
logger.info("WFSLoader: Parent Cell ID=" + cellMO.getParent().getCellID().toString());
Collection<ManagedReference<CellMO>> refs = cellMO.getParent().getAllChildrenRefs();
Iterator<ManagedReference<CellMO>> it = refs.iterator();
while (it.hasNext() == true) {
logger.info("WFSLoader: Child Cell=" + it.next().get().getCellID().toString());
}
logger.info("WFSLoader: Cell Live: " + cellMO.isLive());
}
} catch (MultipleParentException excp) {
logger.log(Level.WARNING, "Attempting to add a new cell with " +
"multiple parents: " + cellMO.getName());
continue;
}
/*
* Since we are loading cells for the first time, we put the cell
* in both the cell object and last modified reference map. We
* add the cell to its parent. If the parent is null, we add to the
* root.
*/
ManagedReference<CellMO> cellRef = AppContext.getDataManager().createReference(cellMO);
this.cellMOMap.put(cellPath, cellRef);
logger.info("WFSLoader: putting " + cellPath + " (ID=" + cellMO.getCellID().toString() + ") into map with " + child.lastModified);
logger.info(setup.toString());
/*
* See if the cell has any children and add to the linked list.
*/