Package org.jdesktop.wonderland.modules.darkstar.api.weblib

Examples of org.jdesktop.wonderland.modules.darkstar.api.weblib.DarkstarRunner


        // XXX support multiple Darkstar servers XXX
        Collection<DarkstarRunner> ds =
                RunManager.getInstance().getAll(DarkstarRunner.class);
        if (ds.size() > 0) {
            DarkstarRunner d = ds.iterator().next();
            if (d.getStatus() != Status.NOT_CONNECTED) {
                darkstarHostname = d.getHostname();
            }
        }

        Properties props = new Properties();
        props.setProperty("voicebridge.sip.port", "5060");
View Full Code Here


    public void sessionStatusChanged(WonderlandSession session,
                                     WonderlandSession.Status status)
    {
        if (status == WonderlandSession.Status.DISCONNECTED) {
            // find the runner associated with this session
            DarkstarRunner dr = null;
            synchronized (sessions) {
                for (Entry<DarkstarRunner, ServerManagerSession> e :
                     sessions.entrySet())
                {
                    if (e.getValue().equals(session)) {
View Full Code Here

   
    @GET
    @Path("/take/snapshot")
    @Produces({"application/xml", "application/json"})
    public Response takeSnapshot() {
        DarkstarRunner runner = getRunner();
        if(runner == null || runner.getStatus() != Status.NOT_RUNNING) {
            return Response.status(Response.Status.BAD_REQUEST).cacheControl(NO_CACHE).build();
        }
       
        // use a default name based on the current data
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss.SS");
        String snapshotName = df.format(new Date());
              
        try {
            runner.createSnapshot(snapshotName);           
        } catch (RunnerException re) {
            LOGGER.warning("Error creating snapshot!");
            return Response.status(Response.Status.INTERNAL_SERVER_ERROR).cacheControl(NO_CACHE).build();
        }
       
View Full Code Here

   
    @GET
    @Path("/restore/{snapshotID}")
    public Response restoreSnapshot(@PathParam("snapshotID") String snapshotID) {
        snapshotID = snapshotID.replace("&", "/");
        DarkstarRunner runner = getRunner();
        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

   
    @GET
    @Path("/make/current/{snapshotID}")
    public Response makeSnapshotCurrent(@PathParam("snapshotID") String snapshotID) {
        snapshotID = snapshotID.replace("&", "/");
        DarkstarRunner runner = getRunner();
        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

    }
   
    @GET
    @Path("/stop")
    public Response stopServer() {
        DarkstarRunner runner = getRunner();
        if(runner == null) {
            LOGGER.warning("No Darkstar servers available!");
            return Response.status(Response.Status.BAD_REQUEST).cacheControl(NO_CACHE).build();
        }
       
        if(runner.getStatus() != Status.NOT_RUNNING) {
            try {
                StatusWaiter waiter = RunManager.getInstance().stop(runner, true);
                waiter.waitFor(Status.NOT_RUNNING);
            } catch (InterruptedException ex) {
                LOGGER.warning("Wait for NOT_RUNNING interrupted!\n" +ex.getLocalizedMessage());
View Full Code Here

    }
   
    @GET
    @Path("/start")
    public Response startServer() {
        DarkstarRunner runner = getRunner();
        if(runner == null) {
            LOGGER.warning("No Darkstar servers available!");
            return Response.status(Response.Status.BAD_REQUEST).cacheControl(NO_CACHE).build();
        }
       
        if(runner.getStatus() == Status.NOT_RUNNING) {
            try {
               
                StatusWaiter waiter = RunManager.getInstance().start(runner, true);
                waiter.waitFor(Status.RUNNING);
            } catch (InterruptedException ex) {
View Full Code Here

    }
   
    protected WFSRoot getCurrentRoot(List<WFSRoot> roots,
                                     List<WFSSnapshot> snapshots)
    {
        DarkstarRunner dr = getRunner();
        if (dr == null) {
            return null;
        }

        System.out.println("Get current root: " + dr.getWFSName());

        if (dr.getWFSName() == null) {
            return new EmptyWorld();
        }

        for (WFSRoot root : roots) {
            if (root.getRootPath().equals(dr.getWFSName())) {
                return root;
            }
        }

        for (WFSRoot root : snapshots) {
            if (root.getRootPath().equals(dr.getWFSName())) {
                return root;
            }
        }

        // not found
View Full Code Here

        }

        logger.info("User " + getUsername(request) + " created snapshot " +
                    name);

        DarkstarRunner runner = getRunner();

        // make sure the runner is stopped
        SnapshotResult res = requestRestart(request, runner, "snapshot");
        if (res != null) {
            return res;
        }

        try {
            runner.createSnapshot(name);
        } catch (RunnerException re) {
            throw new ServletException(re);
        }

        completeRestart(request, runner);
View Full Code Here

        throws ServletException, IOException
    {
        logger.info("User " + getUsername(request) + " set current snapshot " +
                    "to " + root.getRootPath());

        DarkstarRunner runner = getRunner();

        // make sure the runner is stopped
        SnapshotResult res = requestRestart(request, runner, "current&root=" +
                                            getRootName(root));
        if (res != null) {
            return res;
        }

        // set the name
        runner.setWFSName(root.getRootPath());

        // finsh restarting
        completeRestart(request, runner);
        return null;
    }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.darkstar.api.weblib.DarkstarRunner

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.