Package org.rhq.enterprise.communications.command.impl.start

Examples of org.rhq.enterprise.communications.command.impl.start.StartCommandResponse


     *
     * @return the results of the command execution
     */
    public StartCommandResponse execute(StartCommand command) {
        org.rhq.core.util.exec.ProcessExecutor exec = new org.rhq.core.util.exec.ProcessExecutor();
        StartCommandResponse response;

        try {
            StartCommand startCommand = new StartCommand(command);
            ProcessToStart process = new ProcessToStart();

            process.setArguments(command.getArguments());
            process.setBackupOutputFile(command.isBackupOutputFile());
            process.setCaptureOutput(command.isCaptureOutput());
            process.setEnvironment(command.getEnvironment());
            process.setInputDirectory(command.getInputDirectory());
            process.setInputFile(command.getInputFile());
            process.setOutputDirectory(command.getOutputDirectory());
            process.setOutputFile(command.getOutputFile());
            process.setProgramDirectory(command.getProgramDirectory());
            process.setProgramExecutable(command.getProgramExecutable());
            process.setProgramTitle(command.getProgramTitle());
            process.setWaitForExit(command.getWaitForExit());
            process.setWorkingDirectory(command.getWorkingDirectory());

            ProcessExecutorResults results = exec.execute(process);
            Integer exitCode = results.getExitCode();
            Throwable error = results.getError();

            if (error == null) {
                response = new StartCommandResponse(startCommand, exitCode);
            } else {
                response = new StartCommandResponse(startCommand, error);
            }
        } catch (Exception e) {
            response = new StartCommandResponse(command, e);
        }

        return response;
    }
View Full Code Here


        keytool_cmd.setArguments(new String[] { "-genkey", "-alias", key_alias, "-dname", domain_name, "-keystore",
            keystore.getAbsolutePath(), "-storepass", keystore_password, "-keypass", key_password, "-keyalg",
            key_algorithm, "-validity", Integer.toString(validity) });

        StartCommandResponse keytool_results = new ProcessExec().execute(keytool_cmd);

        if (!keytool_results.isSuccessful() || !keystore.exists()) {
            throw new RuntimeException(LOG.getMsgString(CommI18NResourceKeys.KEYSTORE_CREATION_FAILURE,
                keytool_results, Arrays.asList(keytool_cmd.getArguments()).toString()), keytool_results.getException());
        }

        LOG.debug(CommI18NResourceKeys.KEYSTORE_CREATED, keystore.getAbsolutePath());

        return;
View Full Code Here

TOP

Related Classes of org.rhq.enterprise.communications.command.impl.start.StartCommandResponse

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.