Package org.jdesktop.wonderland.runner

Examples of org.jdesktop.wonderland.runner.RunnerException


        RunManager rm = RunManager.getInstance();

        try {
            Runner r = rm.get(runner);
            if (r == null) {
                throw new RunnerException("Request for unknown runner: " +
                                          runner);
            }
       
            if (!(r instanceof DarkstarRunner)) {
                throw new RunnerException("Only Darkstar runner supported");
            }

            DarkstarRunner dr = (DarkstarRunner) r;

            if (action.equalsIgnoreCase("snapshot")) {
                if (nameParam == null) {
                    throw new RunnerException("Name is required");
                }
                dr.createSnapshot(nameParam);
            } else if (action.equalsIgnoreCase("setwfsname")) {
                if (nameParam == null) {
                    throw new RunnerException("Name is required");
                }
                dr.setWFSName(nameParam);
            } else if (action.equalsIgnoreCase("coldstart")) {
                dr.forceColdstart();
            } else {
                throw new RunnerException("Unkown action " + action);     
            }
           
            ResponseBuilder rb = Response.ok();
            return rb.build();
        } catch (RunnerException re) {
View Full Code Here


    public void createSnapshot(String name) throws RunnerException {
        try {
            URL serviceURL = getDarkstarURL("snapshot", name);
            connectTo(serviceURL);
        } catch (IOException ex) {
            throw new RunnerException(ex);
        }
    }
View Full Code Here

            // setup the other Darkstar properties
            try {
                setDarkstarProperties(props);
            } catch (IOException ioe) {
                throw new RunnerException(ioe);
            }
           
            // make sure coldstart is false, otherwise we'll overwrite
            // the database before taking the snapshot
            props.remove("sgs.coldstart");
View Full Code Here

                    if (w != null) {
                        waiters.add(w);
                    }
                }
            } else {
                throw new RunnerException("Unkown action " + action);     
            }

            // wait for a bit so that everything gets cleaned up
            try {
                Thread.sleep(getRestartDelay() * 1000);
 
View Full Code Here

        RunManager rm = RunManager.getInstance();

        try {
            Runner r = rm.get(runner);
            if (r == null) {
                throw new RunnerException("Request for unknown runner: " +
                                          runner);
            }
       
            boolean wait = false;
            if (waitParam != null) {
                wait = Boolean.parseBoolean(waitParam);
            }
            StatusWaiter waiter = null;
           
            if (action.equalsIgnoreCase("start")) {
                waiter = rm.start(r, wait);
            } else if (action.equalsIgnoreCase("stop")) {
                waiter = rm.stop(r, wait);
            } else if (action.equalsIgnoreCase("restart")) {
                // stop the runner and wait for it to stop
                waiter = rm.stop(r, true);
                if (waiter != null) {
                    waiter.waitFor();
                }
               
                // wait for a bit so that everything gets cleaned up
                try {
                    Thread.sleep(ActionResource.getRestartDelay() * 1000);
                } catch (InterruptedException ie) {
                    // oh well
                }

                // restart the runner
                waiter = rm.start(r, wait);
            } else if (action.equalsIgnoreCase("log")) {
                // read the log file
                if (r.getLogFile() != null) {
                    BufferedReader reader = new BufferedReader(
                                                new FileReader(r.getLogFile()));
                    StringBuffer sb = new StringBuffer();
                    String line;
                    while ((line = reader.readLine()) != null) {
                        sb.append(line);
                        sb.append("\n");
                    }

                    ResponseBuilder rb = Response.ok(sb.toString());
                    return rb.build();
                }
            } else {
                throw new RunnerException("Unkown action " + action);     
            }
           
            // if necessary, wait for the runner
            if (waiter != null) {
                waiter.waitFor();
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.runner.RunnerException

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.