org.openide.execution
Class NbProcessDescriptor

java.lang.Object
  |
  +--org.openide.execution.NbProcessDescriptor
All Implemented Interfaces:
Serializable

public final class NbProcessDescriptor
extends Object
implements Serializable

Encapsulates start information for a process. It allows the user to specify the process name to execute and arguments to provide. The progammer then uses method exec to start the process and can pass additional format that will be applied to arguments.

This allows to define arguments in format -user {USER_NAME} -do {ACTION} and then use MapFormat with defined values for USER_NAME and ACTION that will be substitued by into the arguments.

See Also:
Serialized Form

Constructor Summary
NbProcessDescriptor(String processName, String arguments)
          Create a new descriptor for the specified process, classpath switch, and classpath.
NbProcessDescriptor(String processName, String arguments, String info)
          Create a new descriptor for the specified process, classpath switch, and classpath.
 
Method Summary
 boolean equals(Object o)
           
 Process exec()
          Executes the process with arguments provided in constructor.
 Process exec(Format format)
          Executes the process with arguments formatted by the provided format.
 Process exec(Format format, String[] envp)
          Executes the process with arguments formatted by the provided format.
 Process exec(Format format, String[] envp, boolean appendEnv, File cwd)
          Executes the process with arguments formatted by the provided format.
 Process exec(Format format, String[] envp, File cwd)
          Executes the process with arguments formatted by the provided format.
 String getArguments()
          Getter the execution arguments of the process.
 String getInfo()
          Getter for the human readable info about the arguments.
 String getProcessName()
          Get the name of the executable to run.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NbProcessDescriptor

public NbProcessDescriptor(String processName,
                           String arguments)
Create a new descriptor for the specified process, classpath switch, and classpath.
Parameters:
processName - the name of the executable to run
argument - string for formating of arguments (may be quoted)

NbProcessDescriptor

public NbProcessDescriptor(String processName,
                           String arguments,
                           String info)
Create a new descriptor for the specified process, classpath switch, and classpath.
Parameters:
processName - the name of the executable to run
argument - string for formating of arguments (may be quoted)
info - info how to format the arguments (human-readable string)
Method Detail

getProcessName

public String getProcessName()
Get the name of the executable to run.
Returns:
the name

getArguments

public String getArguments()
Getter the execution arguments of the process.
Returns:
the switch that the executable uses for passing the classpath as its command-line parameter

getInfo

public String getInfo()
Getter for the human readable info about the arguments.
Returns:
the info string or null

exec

public Process exec(Format format,
                    String[] envp,
                    File cwd)
             throws IOException
Executes the process with arguments formatted by the provided format. Also the envp properties are passed to the executed process, and a working directory may be supplied (this requires JDK 1.3 to work correctly).
Parameters:
format - format to be applied to arguments, process and envp supplied by user. It can be null if no formatting should be done.
envp - list of properties to be applied to the process, or null to leave unspecified
cwd - the working directory to use, or null if this should not be specified
Returns:
handle to executed process.
Throws:
IOException - if the start of the process fails, or if setting the working directory is not supported

exec

public Process exec(Format format,
                    String[] envp,
                    boolean appendEnv,
                    File cwd)
             throws IOException
Executes the process with arguments formatted by the provided format. Also the envp properties are passed to the executed process, and a working directory may be supplied (this requires JDK 1.3 to work correctly). Optionally the environment variables of the IDE may be appended to (replaced when there is overlap) instead of specifying all of the environment variables from scratch. This requires the IDE's launcher to translate environment variables to system properties prefixed by Env- in order to work correctly.
Parameters:
format - format to be applied to arguments, process and envp supplied by user. It can be null if no formatting should be done.
envp - list of properties to be applied to the process, or null to leave unspecified
appendEnv - if true and envp is not null, append or replace IDE's environment
cwd - the working directory to use, or null if this should not be specified
Returns:
handle to executed process.
Throws:
IOException - if the start of the process fails, or if setting the working directory is not supported
Since:
1.15

exec

public Process exec(Format format,
                    String[] envp)
             throws IOException
Executes the process with arguments formatted by the provided format. Also the envp properties are passed to the executed process.
Parameters:
format - format to be aplied to arguments, process and envp suplied by user. It can be null if no formatting should be done.
envp - list of properties to be applied to the process, or null to leave unspecified
Returns:
handle to executed process.
Throws:
IOException - if the start of the process fails

exec

public Process exec(Format format)
             throws IOException
Executes the process with arguments formatted by the provided format.
Parameters:
format - format to be aplied to arguments and process. It can be null if no formatting should be done.
Returns:
handle to executed process.
Throws:
IOException - if the start of the process fails

exec

public Process exec()
             throws IOException
Executes the process with arguments provided in constructor.
Returns:
handle to executed process.
Throws:
IOException - if the start of the process fails

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object


Built on December 12 2001.  |  Portions Copyright 1997-2001 Sun Microsystems, Inc. All rights reserved.