Package org.glassfish.embeddable

Examples of org.glassfish.embeddable.CommandResult


   }
  
   private void executeCommand(String command, String... parameterList) throws Throwable
   {
      CommandRunner runner = glassfish.getCommandRunner();
      CommandResult result = runner.run(command, parameterList);

      switch(result.getExitStatus())
      {
         case FAILURE:
         case WARNING:
            throw result.getFailureCause();
         case SUCCESS:
            log.info("command " + command + " result: " + result.getOutput());
            break;
      }
   }
View Full Code Here


    public void configure(Properties props) throws GlassFishException {
        CommandRunner commandRunner = habitat.getService(CommandRunner.class);
        for (Object obj : props.keySet()) {
            String key = (String) obj;
            if (key.startsWith(CONFIG_PROP_PREFIX)) {
                CommandResult result = commandRunner.run("set",
                        key.substring(CONFIG_PROP_PREFIX.length()) + "=" + props.getProperty(key));
                if (result.getExitStatus() != CommandResult.ExitStatus.SUCCESS) {
                    throw new GlassFishException(result.getOutput());
                }
            }
        }
    }
View Full Code Here

        return actionReport;
    }

    private CommandResult convert(final ActionReport actionReport) {
        return new CommandResult(){
            public ExitStatus getExitStatus() {
                final ActionReport.ExitCode actionExitCode = actionReport.getActionExitCode();
                switch (actionExitCode) {
                    case SUCCESS:
                        return ExitStatus.SUCCESS;
View Full Code Here

            }
        };
    }

    private CommandResult convert(final Exception e) {
        return new CommandResult() {
            public ExitStatus getExitStatus() {
                return ExitStatus.FAILURE;
            }

            public String getOutput() {
View Full Code Here

        return actionReport;
    }

    private CommandResult convert(final ActionReport actionReport) {
        return new CommandResult(){
            public ExitStatus getExitStatus() {
                final ActionReport.ExitCode actionExitCode = actionReport.getActionExitCode();
                switch (actionExitCode) {
                    case SUCCESS:
                        return ExitStatus.SUCCESS;
View Full Code Here

            }
        };
    }

    private CommandResult convert(final Exception e) {
        return new CommandResult() {
            public ExitStatus getExitStatus() {
                return ExitStatus.FAILURE;
            }

            public String getOutput() {
View Full Code Here

   }
  
   private void executeCommand(String command, String... parameterList) throws Throwable
   {
      CommandRunner runner = glassfish.getCommandRunner();
      CommandResult result = runner.run(command, parameterList);

      switch(result.getExitStatus())
      {
         case FAILURE:
         case WARNING:
            throw result.getFailureCause();
         case SUCCESS:
            log.info("command " + command + " result: " + result.getOutput());
            break;
      }
   }
View Full Code Here

            for (int i = 1; i < split.length; i++) {
                commandParams[i - 1] = split[i].trim();
            }
        }
        CommandRunner cr = glassfish.getCommandRunner();
        CommandResult result = commandParams == null ?
                cr.run(command) : cr.run(command, commandParams);
        System.out.println("Executed command [" + commandLine +
                "]. Output : \n" + result.getOutput());
    }
View Full Code Here

            for (int i = 1; i < split.length; i++) {
                commandParams[i - 1] = split[i].trim();
            }
        }
        CommandRunner cr = glassfish.getCommandRunner();
        CommandResult result = commandParams == null ?
                cr.run(command) : cr.run(command, commandParams);
        System.out.println("Executed command [" + commandLine +
                "]. Output : \n" + result.getOutput());
    }
View Full Code Here

            for (int i = 1; i < split.length; i++) {
                commandParams[i - 1] = split[i].trim();
            }
        }
        CommandRunner cr = glassfish.getCommandRunner();
        CommandResult result = commandParams == null ?
                cr.run(command) : cr.run(command, commandParams);
        System.out.println("Executed command [" + commandLine +
                "]. Output : \n" + result.getOutput());
    }
View Full Code Here

TOP

Related Classes of org.glassfish.embeddable.CommandResult

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.