Examples of ProcessExecutor


Examples of com.sun.enterprise.util.ProcessExecutor

            final List cmdInput = new ArrayList();
            cmdInput.add(broker.getAbsolutePath());
            cmdInput.add("-init");
            cmdInput.add("-varhome");
            cmdInput.add(mqVarHome.getAbsolutePath());
            ProcessExecutor pe = new ProcessExecutor
            ((String[])cmdInput.toArray(new String[cmdInput.size()]));
            pe.execute(false, false);
        } catch (Exception ioe) {
             /*
             Dont do anything.

             IMQ instance is created just to make sure that
View Full Code Here

Examples of com.sun.enterprise.util.ProcessExecutor

                                                      "asupgrade", "-c", "-s",
                                                      domainDir+File.separator+domainName,
                                                      "-t", installDir +File.separator+ "domains",
                                                      "-noprompt" };
               
                ProcessExecutor pe = new ProcessExecutor(upgradeCmd, UPGRADE_TIMEOUT);
                /*
                 * ProcessExecutor's constructor replaces all the '/'s with '\' in case the OS is Windows.
                 * We don't want that for CMD /c. Hence need to replace it again
                 */
                if(OS.isWindows())
                        upgradeCmd[1] ="/c";

                CLILogger.getInstance().printDetailMessage((getLocalizedString("StartingUpgrade")));
                pe.execute()// timeout in 600sec or 10min
                Process process = pe.getSubProcess();
                int exitValue = process.waitFor();
                if (exitValue != 0) {
                    throw new CommandException(getLocalizedString("UpgradeFailed"));
                }else {
                    CLILogger.getInstance().printDetailMessage((getLocalizedString("UpgradeSuccessful")));
View Full Code Here

Examples of com.sun.enterprise.util.ProcessExecutor

        command=new String[alCmd.size()];
        command=(String[])alCmd.toArray(command);

        try {
            // exec process directly to exercise needed control
            ProcessExecutor exec = new ProcessExecutor(command, securityInfo);
            // set verbose flag so process error stream get redirected to stderr
            exec.setVerbose(verbose);
            // call execute so it will not be timed out
            exec.execute(false, false);
            process=exec.getSubProcess();
            // this will force process to wait for executing process
            int exitValue=process.waitFor();
            System.exit(exitValue);
        } catch (Exception e) {
            throw new InstanceException(_strMgr.getString("procExecError"), e);
        }

    } else {
        // add arguments to main command, native must come first
        if (nativeLauncher) {
            // use native launcher, add in argument
            alCmd.add("native");
        }

        // check to see if debug is enabled
        if (debug) {
            alCmd.add("debug");
        }

        // addin command line args
        if (commandLineArgs != null) {
            for(int ii=0; ii < commandLineArgs.length; ii++) {
                alCmd.add(commandLineArgs[ii]);
            }
        }

        // extract full command
        command=new String[alCmd.size()];
        command=(String[])alCmd.toArray(command);

        // call method for executing so can be overriden in descendants
        // also, keep executor for any error information
        ProcessExecutor processExec=startInstanceExecute(command, securityInfo);
        process=processExec.getSubProcess();
      waitUntilStarting(processExec);
      waitUntilStarted();
        postStart();
  }
View Full Code Here

Examples of com.sun.enterprise.util.ProcessExecutor

    void execute(File script) throws InstanceException
    {
        try
        {
            ProcessExecutor exec = new ProcessExecutor(
                                   new String[] {script.getAbsolutePath()});
            exec.execute();
        }
        catch (Exception e)
        {
            throw new InstanceException(_strMgr.getString("procExecError"), e);
        }
View Full Code Here

Examples of com.sun.enterprise.util.ProcessExecutor

    ProcessExecutor execute(String[] command, String[] interativeOptions) throws InstanceException
    {
        try
        {
            ProcessExecutor exec = new ProcessExecutor(command, interativeOptions);
            if (nativeLauncher) {
                // native processes don't return, so don't wait
                // this follows the methodology for se, but should be revisted to make
                // sure timeouts for state transitions are reasonable
                exec.execute(false, false);
            } else {
                // expect the process to return
                exec.execute();
            }


            // this signature for execute will terminiate the process
            // if it goes on too long, reason for return signature is for SE ProcessManager watchdog
View Full Code Here

Examples of com.sun.enterprise.util.ProcessExecutor

public class ProcessInstanceExternal extends AbstractProcessInstance {
   

    public void startInstance() throws ProcessManagerException {
        try {
            ProcessExecutor pe=new ProcessExecutor(getStartCommandAsArray());
            pe.execute(false, false);
            setProcess(pe.getSubProcess());
        } catch (Exception e) {
            throw new ProcessManagerException(e);
        }
    }
View Full Code Here

Examples of com.sun.enterprise.util.ProcessExecutor

    }

  
    public void stopInstance() throws ProcessManagerException {
        try {
            ProcessExecutor pe=new ProcessExecutor(getStopCommandAsArray());
            pe.execute(false, false);
        } catch (Exception e) {
            throw new ProcessManagerException(e);
        }
    }
View Full Code Here

Examples of com.sun.enterprise.util.ProcessExecutor

    private static int reconfig(String instanceName) {
        int retval = 0;
        String[] cmd = getReconfigCommand(instanceName);
        if (cmd != null) {
            ProcessExecutor pe = new ProcessExecutor(cmd);
            try {
                pe.execute();
            } catch (ExecException ee) {
                AdminChannel.debug(ee);
                retval = 1;
            }
        }
View Full Code Here

Examples of com.sun.enterprise.util.ProcessExecutor

    */
    @Override
    protected ProcessExecutor startInstanceExecute(String[] command, String[] interativeOptions) throws InstanceException {
        try
        {
            ProcessExecutor exec=new ProcessExecutor(command, interativeOptions);
            // call execute so no output lines are returned and
            // process does not have a time limit to start
            exec.execute(false, false);
            return exec;
        }
        catch (Exception e)
        {
            throw new InstanceException(_strMgr.getString("procExecError"), e);
View Full Code Here

Examples of com.sun.enterprise.util.ProcessExecutor

  private Object[] runProcess(List<String> commandsList)
  {
    try
    {
      String[] commands = commandsList.toArray(new String[commandsList.size()]);
      ProcessExecutor pe  = new ProcessExecutor(commands);
      String[]    out = pe.execute(true)
      Arrays.toString(out);
      int retVal = pe.getProcessExitValue();

      Object[] ret = new Object[3];
      ret[0] = "Output Strings:";
      ret[1] = Arrays.toString(out);
      ret[2] = "Return Value: " + retVal;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.