public class PlugletExecutor
extends java.lang.Object
Each instance of this class represents a context in
which pluglets are executed. The context specifies the pluglet
visibility to other classes and the pluglet output.
Use the executePluglet
method
to execute the pluglet.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PLUGLETMAIN
The name of a pluglet main entry point.
|
static java.lang.String[] |
PLUGLETMAIN_ARGS
The argument types of a pluglet main entry point.
|
Constructor and Description |
---|
PlugletExecutor(IPlugletHost host)
Constructs a
PlugletExecutor instance. |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
executePluglet(java.lang.String plugletClassName,
java.lang.String[] plugletArgs,
java.lang.String plugletPath,
java.lang.String plugletClasspathDir)
Executes a pluglet.
|
public static final java.lang.String PLUGLETMAIN
public static final java.lang.String[] PLUGLETMAIN_ARGS
public PlugletExecutor(IPlugletHost host)
PlugletExecutor
instance.host
- The optional pluglet host interface.public java.lang.Object executePluglet(java.lang.String plugletClassName, java.lang.String[] plugletArgs, java.lang.String plugletPath, java.lang.String plugletClasspathDir) throws java.lang.Throwable
A pluglet is a Java class with a public
non-static method called plugletmain
that has a single
String[]
parameter.
For example, public void plugletmain(String[] args)
.
A pluglet class must also have a public parameterless constructor,
either implicit or explicit.
plugletClassName
- The full name of the pluglet class. For example,
"com.abc.xyz.ExamplePluglet".plugletArgs
- The arguments to pass to the pluglet.plugletPath
- The pathname of a Java source file or class
file. If the plugletPath parameter value is null
the
pluglet is assumed to be a built-in pluglet. That is, defined
in one of the context class loaders.plugletClasspathDir
- If the plugletPath parameter refers
to a class file, this parameter can specify the root classpath
directory for the pluglet. For example, if plugletPath is
"C:\SamplePluglets\com\abc\xyz\ExamplePluglet.class", then
plugletClasspathDir might be "C:\SamplePluglets". If
plugletClasspathDir
is null
, the directory containing the class file
is used. The pluglet is assumed to be a top-level class and
not contained in a package.null
.PlugletException
- Thrown when the specified pluglet does
not exist, fails to compile, or the main entry point does not
exist.java.lang.Throwable
- Thrown when the execution of the pluglet throws an
unhandled exception. The exception is propagated to the caller of
executePluglet.