org.openide.execution
Class Executor

java.lang.Object
  |
  +--org.openide.ServiceType
        |
        +--org.openide.execution.Executor
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
ProcessExecutor, ThreadExecutor

public abstract class Executor
extends ServiceType

Implements the execution of a class. There may be several different types of executors installed in the system, some of which may only be appropriate for certain types of objects (e.g., applets or servlets). The two standard ones, both assuming a main method (i.e. a standalone Java program), are ThreadExecutor (internal execution) and ProcessExecutor (external execution).

This class currently has a property editor in the default IDE property editor search path.

See Also:
Serialized Form

Inner classes inherited from class org.openide.ServiceType
ServiceType.Handle, ServiceType.Registry
 
Fields inherited from class org.openide.ServiceType
PROP_NAME
 
Constructor Summary
Executor()
           
 
Method Summary
 ExecutorTask execute(DataObject obj)
          Executes a dataobject.
abstract  ExecutorTask execute(ExecInfo info)
          Execute a class given by name with some arguments in this executor.
static Enumeration executors()
          Get all registered executors in the system's execution engine.
static Executor find(Class clazz)
          Find the executor implemented as a given class, among the executors registered to the execution engine.
static Executor find(String name)
          Find the executor with requested name, among the executors registered to the execution engine.
static Executor getDefault()
          Deprecated. The notion of a default executor for all file types is probably meaningless.
 HelpCtx getHelpCtx()
          Get context help for this service type.
 boolean needsIO()
          Instruct the execution engine whether the process might need I/O communication with the user.
 
Methods inherited from class org.openide.ServiceType
addPropertyChangeListener, clone, createClone, displayName, firePropertyChange, getName, removePropertyChangeListener, setName
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Executor

public Executor()
Method Detail

execute

public abstract ExecutorTask execute(ExecInfo info)
                              throws IOException
Execute a class given by name with some arguments in this executor.
Parameters:
info - information describing what to execute
Returns:
a task object that can be used to control the running process
Throws:
IOException - if the execution cannot be started (class is missing, etc.)

execute

public ExecutorTask execute(DataObject obj)
                     throws IOException
Executes a dataobject. The default implementation executes this as a class with main() method with parameters taken from this object's primary file's attributes.
Parameters:
obj - object to execute
Returns:
a task object that can be used to control the running process
Throws:
IOException - if the execution cannot be started (class is missing, etc.)

needsIO

public boolean needsIO()
Instruct the execution engine whether the process might need I/O communication with the user. If I/O is needed, a tab in the output window may be opened for the process; otherwise the output is discarded and reads will fail.

The default implementation returns true.

Returns:
true if the process needs I/O

getHelpCtx

public HelpCtx getHelpCtx()
Description copied from class: ServiceType
Get context help for this service type.
Overrides:
getHelpCtx in class ServiceType
Following copied from class: org.openide.ServiceType
Returns:
context help

executors

public static Enumeration executors()
Get all registered executors in the system's execution engine.
Returns:
enumeration of Executors

find

public static Executor find(Class clazz)
Find the executor implemented as a given class, among the executors registered to the execution engine.

This should be used during (de-)serialization of the specific executor for a data object: only store its class name and then try to find the executor implemented by that class later.

Parameters:
clazz - the class of the executor looked for
Returns:
the desired executor or null if it does not exist

find

public static Executor find(String name)
Find the executor with requested name, among the executors registered to the execution engine.

This should be used during (de-)serialization of the specific executor for a data object: only store its name and then try to find the executor later.

Parameters:
name - (display) name of executor to find
Returns:
the desired executor or null if it does not exist

getDefault

public static Executor getDefault()
Deprecated. The notion of a default executor for all file types is probably meaningless.

Get the default executor for the system's execution engine.

You may actually want ExecSupport.getExecutor(org.openide.loaders.MultiDataObject.Entry).

Returns:
the default executor


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