Package org.jdesktop.wonderland.web.wfs

Examples of org.jdesktop.wonderland.web.wfs.WFSManager$WFSManagerHolder


   
    @GET
    @Path("/current")
    @Produces({"application/xml", "application/json"})
    public Response getCurrentSnapshot() {
        WFSManager manager = WFSManager.getWFSManager();
       
        List<WFSRoot> roots = manager.getWFSRoots();
        List<WFSSnapshot> snapshots = manager.getWFSSnapshots();
       
        WFSRoot current = getCurrentRoot(roots, snapshots);
       
        if(current == null) {
            LOGGER.warning("Darkstar is pointing toward missing WFSROOT!");
View Full Code Here


     */
    protected void processRequest(HttpServletRequest request,
                                  HttpServletResponse response)
        throws ServletException, IOException
    {
        WFSManager m = WFSManager.getWFSManager();

        String action = request.getParameter("action");
        if (action == null) {
            action = "view";
        }

        WFSRoot root = getRoot(request);
        WFSSnapshot snapshot = null;
        if (root instanceof WFSSnapshot) {
            snapshot = (WFSSnapshot) root;
        }

        SnapshotResult result = null;
        if (action.equalsIgnoreCase("update")) {
            result = doUpdate(request, response, snapshot);
        } else if (action.equalsIgnoreCase("edit")) {
            result = doEdit(request, response, snapshot);
        } else if (action.equalsIgnoreCase("remove")) {
            result = doRemove(request, response, snapshot);
        } else if (action.equalsIgnoreCase("snapshot")) {
            result = doSnapshot(request, response);
        } else if (action.equalsIgnoreCase("current")) {
            result = doCurrent(request, response, root);
        } else if (action.equalsIgnoreCase("restore")) {
            result = doRestore(request, response, root);
        }

        if (result != null) {
            // make the error visible
            request.setAttribute("error", result.getError());
            if (result.hasError()) {
                logger.warning("Error processing action " + action + ": " +
                               result.getError());
            }

            // redirect to the requested page
            if (result.hasRedirect()) {
                RequestDispatcher rd = getServletContext().getRequestDispatcher(result.getRedirect());
                rd.forward(request, response);
                return;
            }
        }

        // if we get here, we are going to display the main page

        // store the wfs roots in a variable
        List<WFSRoot> wfsRoots = m.getWFSRoots();
        wfsRoots.add(0, EMPTY_WORLD);
        request.setAttribute("roots", wfsRoots);

        // store the wfs snapshots in a variable.  Sort the snapshots by date
        List<WFSSnapshot> snapshots = m.getWFSSnapshots();
        Collections.sort(snapshots, new Comparator<WFSSnapshot>() {
            public int compare(WFSSnapshot o1, WFSSnapshot o2) {
                if (o1.getTimestamp() == null) {
                    return (o2.getTimestamp() == null)?0:1;
                } else if (o2.getTimestamp() == null) {
View Full Code Here

       
        /*
         * Fetch the wfs manager and the individual root names. If the roots
         * is null, then return a blank response.
         */
        WFSManager wfsm = WFSManager.getWFSManager();
        List<WFSRoot> rootList = wfsm.getWFSRoots();
        List<String> rootNames = new ArrayList<String>(rootList.size());
        for (WFSRoot root : rootList) {
            rootNames.add(root.getRootPath());
        }
        WorldRootList wfsRoots = new WorldRootList(rootNames.toArray(new String[0]));
View Full Code Here

       
        /*
         * Fetch the wfs manager and the WFS. If invalid, then return a bad
         * response.
         */
        WFSManager wfsm = WFSManager.getWFSManager();
        WFS wfs = wfsm.getWFS(wfsName);
        if (wfs == null) {
            logger.warning("Unable to find WFS with name " + wfsName);
            ResponseBuilder rb = Response.status(Response.Status.BAD_REQUEST);
            return rb.build();
        }
View Full Code Here

    @GET
    @Produces({"application/xml", "application/json"})
    public Response createWFSSnapshot(@QueryParam("name") String name) {
        // Do some basic stuff, get the WFS manager class, etc
        Logger logger = Logger.getLogger(CreateWFSSnapshotResource.class.getName());
        WFSManager manager = WFSManager.getWFSManager();
       
        // if no name is given, use the current date
        if (name == null) {
            DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
            name = df.format(new Date());
        }

        // Create the WFS check return value is not null (error if so)
        WFSSnapshot snapshot = manager.createWFSSnapshot(name);
        if (snapshot == null) {
            logger.warning("[WFS] Unable to create snapshot " + name);
            ResponseBuilder rb = Response.status(Response.Status.BAD_REQUEST);
            return rb.build();
        }
View Full Code Here

       
        /*
         * Fetch the wfs manager and the WFS. If invalid, then return a bad
         * response.
         */
        WFSManager wfsm = WFSManager.getWFSManager();
        WFS wfs = wfsm.getWFS(wfsName);
        if (wfs == null) {
            logger.warning("Unable to find WFS with name " + wfsName);
            ResponseBuilder rb = Response.status(Response.Status.BAD_REQUEST);
            return rb.build();
        }
View Full Code Here

    @POST
    @Consumes({"application/xml"})
    public Response createWFSCell(CellDescriptor cellDescriptor) {
        // Do some basic stuff, get the WFS manager class, etc
        Logger logger = Logger.getLogger(CreateWFSCellResource.class.getName());
        WFSManager manager = WFSManager.getWFSManager();
               
        // Fetch the WFS for the world root path, flag an error if it does
        // not yet exist.
        String rootPath = cellDescriptor.getRootPath().getRootPath();
        WFS wfs = manager.getWFS(cellDescriptor.getRootPath());
        if (wfs == null) {
            logger.warning("[WFS] The WFS " + rootPath + " does not exist.");
            return Response.status(Status.BAD_REQUEST).build();
        }
       
View Full Code Here

    @GET
    @Produces({"application/xml", "application/json"})
    public Response createWFSRecording(@QueryParam("name") String name) {
        // Do some basic stuff, get the WFS manager class, etc
        Logger logger = Logger.getLogger(CreateWFSRecordingResource.class.getName());
        WFSManager manager = WFSManager.getWFSManager();
       

        // Create the WFS check return value is not null (error if so)
        WFSRecording recording = manager.createWFSRecording(name);
        if (recording == null) {
            logger.warning("[WFS] Unable to create recording " + name);
            ResponseBuilder rb = Response.status(Response.Status.BAD_REQUEST);
            return rb.build();
        }
View Full Code Here

    public Response getRecordings() {
        /*
         * Fetch the wfs manager and the individual recording names. If the recordings
         * is null, then return a blank response.
         */
        WFSManager wfsm = WFSManager.getWFSManager();
        List<WFSRecording> recordingList = wfsm.getWFSRecordings();
        List<String> recordingNames = new ArrayList<String>(recordingList.size());
        for (WFSRecording recording : recordingList) {
            recordingNames.add(recording.getName());
        }
        WFSRecordingList wfsRecordings = new WFSRecordingList(recordingNames.toArray(new String[0]));
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.web.wfs.WFSManager$WFSManagerHolder

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.