Package org.glassfish.embeddable

Examples of org.glassfish.embeddable.CommandResult


        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

                    for (int i = 1; i < split.length; i++) {
                        commandParams[i - 1] = split[i].trim();
                    }
                }
                try {
                    CommandResult result = commandParams == null ?
                            cr.run(command) : cr.run(command, commandParams);
                    System.out.println("\n" + result.getOutput());
                } catch (Exception ex) {
                    System.out.println(ex.getMessage());
                }
            }
        }
View Full Code Here

            if (key.startsWith(CONFIG_PROP_PREFIX)) {
                if (commandRunner == null) {
                    // only create the CommandRunner if needed
                    commandRunner = habitat.getService(CommandRunner.class);
                }
                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

                    for (int i = 1; i < split.length; i++) {
                        commandParams[i - 1] = split[i].trim();
                    }
                }
                try {
                    CommandResult result = commandParams == null ?
                            cr.run(command) : cr.run(command, commandParams);
                    System.out.println("\n" + result.getOutput());
                } catch (Exception ex) {
                    System.out.println(ex.getMessage());
                }
            }
        }
View Full Code Here

    public void configure(Properties props) throws GlassFishException {
        CommandRunner commandRunner = habitat.getComponent(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

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

      String output = null;
      switch(result.getExitStatus())
      {
         case FAILURE:
         case WARNING:
            throw result.getFailureCause();
         case SUCCESS:
            output = result.getOutput();
            log.info("command " + command + " parameters" + parameterList + " result: " + output);
            break;
      }
      return output;
   }
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

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.