Package org.jdesktop.wonderland.common.wfs

Examples of org.jdesktop.wonderland.common.wfs.CellList


    private void loadWFSRoot(String rootName) {
        /* A queue (last-in, first-out) containing a list of cell to search down */
        LinkedList<CellList> children = new LinkedList<CellList>();

        /* Find the children in the top-level directory and go! */
        CellList dir = CellImporterUtils.getWFSRootChildren(rootName);
        if (dir == null) {
            /* Log an error and return, though this should never happen */
            logger.warning("WFSLoader: did not find root directory for wfs " + rootName);
            return;
        }
        children.addFirst(dir);
       
        /*
         * Loop until the 'children' Queue is entirely empty, which means that
         * we have loaded all of the cells and have searched all possible sub-
         * directories. The loadCells() method will add entries to children as
         * needed.
         */
        while (children.isEmpty() == false) {
            /* Fetch and remove the first on the list and load */
            CellList childdir = children.removeFirst();
            if (childdir == null) {
                /* Log an error and continue, though this should never happen */
                logger.warning("WFSLoader: could not fetch child dir in WFS " + rootName);
                continue;
            }
            logger.info("WFSLoader: processing children in " + childdir.getRelativePath());
           
            /* Recursively load the cells for this child */
            this.loadCells(rootName, childdir, children);
        }
    }
View Full Code Here


            logger.info(setup.toString());
           
            /*
             * See if the cell has any children and add to the linked list.
             */
            CellList newChildren = CellImporterUtils.getWFSChildren(root, cellPath);
            if (newChildren != null) {
                logger.fine("WFSLoader: for path " + cellPath + " # of " +
                        "children is " + newChildren.getChildren());
                children.addLast(newChildren);
            }
        }
    }
View Full Code Here

                // Otherwise, if the final path does not have a Cell directory,
                // this is ok. It just means that Cell has no children, so we
                // return an empty list.
                LOGGER.fine("Did not find a WFS Cell directory for path " +
                        path + ". This is ok, returning empty list.");
                CellList children = new CellList(path, new Cell[] {});
                return Response.ok(children).build();
            }
        }
       
        // If we have reached here, we have 'dir' with the directory in which
        // the cells should be. Create a WFSCellChildren object which is used
        // to serialize the result.
        String names[] = dir.getCellNames();
        if (names == null) {
            // If the directory exists, yet there are no children, this is ok.
            // Just return an empty list.
            LOGGER.fine("Did not find WFS Cell children for path " + path +
                    ". This is ok, returning empty list.");
            CellList children = new CellList(path, new Cell[]{});
            return Response.ok(children).build();
        }

        LOGGER.fine("For WFS Cell " + path + " # Children " + names.length);
       
        // Loop through and create the WFSCellChildren object, we need to
        // include the last modified time so that the client can check whether
        // the cell has been modified or not.
        LinkedList<Cell> list = new LinkedList<Cell>();
        for (String name : names) {
            WFSCell cell = dir.getCellByName(name);
            if (cell == null) {
                LOGGER.warning("No WFS cell exists with name " + name);
                continue;
            }
            LOGGER.fine("Found WFS child " + name + " in path " + path);
            list.add(new Cell(name, cell.getLastModified()));
        }
       
        // Convert the list of CellChilds to an array, form into a CellList and
        // send the CellList directly to the client.
        Cell[] childs = list.toArray(new Cell[] {});
        LOGGER.fine("For WFS Cell " + path + " setting children array " +
                childs);
        CellList children = new CellList(path, childs);
        return Response.ok(children).build();
    }
View Full Code Here

            this.loadCells(childdir, children, cellList);
        }
       
        /* Convert the list of CellChilds to an array */
        Cell[] childs = cellList.toArray(new Cell[] {});
        CellList wfsCellList = new CellList("", childs);
       
        /* Send the serialized cell names to the client */
        ResponseBuilder rb = Response.ok(wfsCellList);
        return rb.build();
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.common.wfs.CellList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.