org.openide.execution
Class ThreadExecutor

java.lang.Object
  |
  +--org.openide.ServiceType
        |
        +--org.openide.execution.Executor
              |
              +--org.openide.execution.ThreadExecutor
All Implemented Interfaces:
Serializable

public class ThreadExecutor
extends Executor

Executes a class in a thread in the current VM.

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
ThreadExecutor()
          Create a new thread executor.
 
Method Summary
protected  void checkClass(Class clazz)
          Subclasses of the executor can override this method to check loaded class before its main method is invoked.
protected  ClassLoader createClassLoader(InputOutput io)
          Allows subclasses to provide its own classloader for loading classes.
 ExecutorTask execute(ExecInfo info)
          Execute a class given by name with some arguments in this executor.
protected  void executeClass(Class clazz, String[] params)
          Invokes main method of the class with given parameters.
 HelpCtx getHelpCtx()
          Get context help for this service type.
 
Methods inherited from class org.openide.execution.Executor
execute, executors, find, find, getDefault, needsIO
 
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

ThreadExecutor

public ThreadExecutor()
Create a new thread executor.
Method Detail

execute

public ExecutorTask execute(ExecInfo info)
                     throws IOException
Description copied from class: Executor
Execute a class given by name with some arguments in this executor.
Overrides:
execute in class Executor
Following copied from class: org.openide.execution.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.)

getHelpCtx

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

checkClass

protected void checkClass(Class clazz)
                   throws IOException
Subclasses of the executor can override this method to check loaded class before its main method is invoked.
Parameters:
clazz -  
Throws:
IOException -  

executeClass

protected void executeClass(Class clazz,
                            String[] params)
Invokes main method of the class with given parameters.
Parameters:
clazz -  
params -  

createClassLoader

protected ClassLoader createClassLoader(InputOutput io)
Allows subclasses to provide its own classloader for loading classes. Because the class loader is responsible for redirection of input and output this method takes input output where the I/O should be printed.

Default implementation creates new NbClassLoader (io)

Parameters:
io - the input/output to sent output of the classes to
Returns:
the class loader to use


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