Examples of WFSRoot


Examples of org.jdesktop.wonderland.web.wfs.WFSRoot

        if(runner == null || runner.getStatus() != Status.NOT_RUNNING) {
            return Response.status(Response.Status.BAD_REQUEST).cacheControl(NO_CACHE).build();
                   
        }

        WFSRoot root = getRoot(snapshotID);
        runner.setWFSName(root.getRootPath());
        runner.forceColdstart();
       
        return Response.ok().cacheControl(NO_CACHE).build();
    }
View Full Code Here

Examples of org.jdesktop.wonderland.web.wfs.WFSRoot

        LOGGER.info("received: " +snapshotID);
        if(runner == null || runner.getStatus() != Status.NOT_RUNNING) {
            return Response.status(Response.Status.BAD_REQUEST).cacheControl(NO_CACHE).build();
        }

        WFSRoot root = getRoot(snapshotID);
        runner.setWFSName(root.getRootPath());

        LOGGER.info("Snapshot made current! (SUCCESS)");

        return Response.ok().cacheControl(NO_CACHE).build();
    }
View Full Code Here

Examples of org.jdesktop.wonderland.web.wfs.WFSRoot

        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!");
            return Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
                   
        }                               
        WFSRootInfo info = new WFSRootInfo();
        if(current instanceof WFSSnapshot) {
            info.setIsRoot(false);
            WFSSnapshot snapshot = (WFSSnapshot)current;
            info.setDate(snapshot.getTimestamp().toString());
            info.setDescription(snapshot.getDescription());
        }
        info.setPath(current.getRootPath());
        info.setRootName(current.getName());
       
        return Response.ok(info).build();
    }
View Full Code Here

Examples of org.jdesktop.wonderland.web.wfs.WFSRoot

        return runners.iterator().next();
    }
   
    protected WFSRoot getRoot(String id) {
        WFSRoot root = null;
       
                // decide if it is a world or a snapshot
        if (id.startsWith(WFSRoot.WORLDS_DIR)) {
            String worldName = id.substring(WFSRoot.WORLDS_DIR.length() + 1);
            if (worldName.equals(new EmptyWorld().getName())) {
View Full Code Here

Examples of org.jdesktop.wonderland.web.wfs.WFSRoot

        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) {
                    return -1;
                }
               
                return -1 * o1.getTimestamp().compareTo(o2.getTimestamp());
            }           
        });
        request.setAttribute("snapshots", snapshots);

        // find the current snapshot
        WFSRoot currentRoot = getCurrentRoot(wfsRoots, snapshots);
        request.setAttribute("currentroot", currentRoot);

        RequestDispatcher rd =
                getServletContext().getRequestDispatcher("/snapshots.jsp");
        rd.forward(request, response);
View Full Code Here

Examples of org.jdesktop.wonderland.web.wfs.WFSRoot

    /**
     * Get a WFS root from the request
     * @param request the request to get the root from
     */
    protected WFSRoot getRoot(HttpServletRequest request) {
        WFSRoot root = null;

        String rootName = request.getParameter("root");
        if (rootName == null) {
            return null;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.