FileDocCategorySizeDatePackage
ProcessAdaptor.javaAPI DocGlassfish v2 API6298Fri May 04 22:35:02 BST 2007com.sun.enterprise.tools.upgrade.certconversion

ProcessAdaptor

public class ProcessAdaptor extends Object

Fields Summary
private static Logger
_logger
private static com.sun.enterprise.util.i18n.StringManager
sm
Constructors Summary
Methods Summary
public static intexecuteProcess(java.lang.String str, java.io.OutputStream outputStream)

          
        String[] args = str.split(" ");
        return executeProcess(args, outputStream);
    
public static intexecuteProcess(java.lang.String[] str, java.io.OutputStream outputStream)

        int exitVal = -1;
        try{
            Process p = Runtime.getRuntime().exec(str);
            PrintStream errorOut = new PrintStream(p.getErrorStream(), outputStream);
            PrintStream resultOut = new PrintStream(p.getInputStream(), outputStream);
            errorOut.start();
            resultOut.start();
            errorOut.join();
            resultOut.join();
            exitVal = p.waitFor();
            p.destroy();
            return  exitVal;
        }catch(InterruptedException ie){
            _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.certconversion.process_execution_error"),ie);
        }catch(SecurityException se){
            _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.certconversion.process_execution_error"),se);
        }catch(IOException ioe){
            _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.certconversion.process_execution_error"),ioe);
        }
        return  exitVal;
    
public static intexecuteProcess(java.lang.String str, java.io.Writer writer)

        String[] args = str.split(" ");
        int exitVal = executeProcess(args, writer);
        return  exitVal;
    
public static intexecuteProcess(java.lang.String[] str, java.io.Writer writer)

        int exitVal = -1;
        try{
            // Runtime rt = Runtime.getRuntime();
            Process p = Runtime.getRuntime().exec(str);
            PrintStream errorOut = new PrintStream(p.getErrorStream(), writer);
            PrintStream resultOut = new PrintStream(p.getInputStream(), writer);
            errorOut.start();
            resultOut.start();
            errorOut.join();
            resultOut.join();
            exitVal = p.waitFor();
            p.destroy();
            return  exitVal;
        }catch(InterruptedException ie){
            _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.certconversion.process_execution_error"),ie);
        }catch(SecurityException se){
            _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.certconversion.process_execution_error"),se);
        }catch(IOException ioe){
            _logger.log(Level.WARNING,sm.getString("enterprise.tools.upgrade.certconversion.process_execution_error"),ioe);
        }
        return  exitVal;