Package com.sun.enterprise.util

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


    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

    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

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

    }

  
    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

    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

    */
    @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

  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

            path2Auths = System.getProperty("PATH_2_AUTHS");
        if (System.getProperty("AUTH_TOKEN") != null)
            at = System.getProperty("AUTH_TOKEN");
        try {
            final String[] cmd = new String[]{path2Auths, user};
            ProcessExecutor pe = new ProcessExecutor(cmd);
            pe.setExecutionRetentionFlag(true);
            pe.execute();
            auths.append(pe.getLastExecutionOutput());
            final StringTokenizer st = new StringTokenizer(pe.getLastExecutionOutput(), at);
            while (st.hasMoreTokens()) {
                String t = st.nextToken();
                if (t != null)
                    t = t.trim();
                if (AUTH1.equals(t) || AUTH2.equals(t) || AUTH3.equals(t)) {
View Full Code Here

    private boolean serviceNameExists(final String sn) {
        boolean exists = false;
        try {
            final String[] cmd = new String[]{"/usr/bin/svcs", sn};
            ProcessExecutor pe = new ProcessExecutor(cmd);
            pe.setExecutionRetentionFlag(true);
            pe.execute();
            exists = true;
        }
        catch (final Exception e) {
            //returns a non-zero status -- the service does not exist, status is already set
        }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.util.ProcessExecutor

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.