public class PlugletHost extends java.lang.Object implements IPlugletHost2
IPlugletHost
interface and the
optional IPlugletHost2
interface.
Pluglet hosts can use this class verbatim, subclass the class, or provide their own implementation.
Constructor and Description |
---|
PlugletHost(java.net.URLClassLoader[] context,
IPlugletCompiler compiler,
java.io.PrintWriter output,
IPlugletMessageDialog dialog,
boolean tracing)
Constructs a default
IPlugletHost and IPlugletHost2
implementation. |
PlugletHost(java.net.URLClassLoader[] context,
IPlugletCompiler compiler,
java.io.PrintWriter output,
IPlugletMessageDialog dialog,
boolean tracing,
java.lang.String[] extraClasspathEntries)
Constructs a default
IPlugletHost and IPlugletHost2
implementation. |
Modifier and Type | Method and Description |
---|---|
boolean |
enableTracing()
Used by the pluglet engine to determine whether the host
has tracing enabled.
|
IPlugletCompiler |
getCompiler()
Used by the pluglet engine to retrieve the optional
compiler invocation interface.
|
java.net.URLClassLoader[] |
getContext()
Used by the pluglet engine to retrieve the
URLClassLoader objects. |
IPlugletMessageDialog |
getDialog()
Used by the pluglet engine to retrieve the
IPlugletMessageDialog implementation. |
java.lang.String[] |
getExtraClasspathEntries()
Used by the pluglet engine to retrieve the extra
classpath entries, if any.
|
java.io.PrintWriter |
getOutput()
Used by the pluglet engine to retrieve the stream used for the
pluglet output, the pluglet engine's tracing output, and the compiler
error messages.
|
public PlugletHost(java.net.URLClassLoader[] context, IPlugletCompiler compiler, java.io.PrintWriter output, IPlugletMessageDialog dialog, boolean tracing, java.lang.String[] extraClasspathEntries)
IPlugletHost
and IPlugletHost2
implementation.context
- The host classloaders that the pluglets access.compiler
- The host's pluglet compiler interface implementation.output
- The host's PrintWriter
for pluglet output.dialog
- The host's IPlugletMessageDialog
implementation.tracing
- The host's indication of whether tracing is enabled.extraClasspathEntries
- The host's extra classpath entries.public PlugletHost(java.net.URLClassLoader[] context, IPlugletCompiler compiler, java.io.PrintWriter output, IPlugletMessageDialog dialog, boolean tracing)
IPlugletHost
and IPlugletHost2
implementation.context
- The host classloaders that the pluglets access.compiler
- The host's pluglet compiler interface implementation.output
- The host's PrintWriter
for pluglet output.dialog
- The host's IPlugletMessageDialog
implementation.tracing
- The host's indication of whether tracing is enabled.public IPlugletCompiler getCompiler()
IPlugletHost
You can use the PlugletCompiler
class to construct a
compiler or you can construct your own implementation of the
IPlugletCompiler
interface.
getCompiler
in interface IPlugletHost
public java.net.URLClassLoader[] getContext()
IPlugletHost
URLClassLoader
objects.
The URLClassLoader
objects define what classes
are visible to the pluglets that are executed from this host.
getContext
in interface IPlugletHost
public IPlugletMessageDialog getDialog()
IPlugletHost
IPlugletMessageDialog
implementation.
This method is used by the Pluglet
class to
implement dialog methods.
getDialog
in interface IPlugletHost
public java.io.PrintWriter getOutput()
IPlugletHost
Because the pluglet engine assigns the value returned by this method
to the Pluglet.out
class
variable, the output of the pluglet is displayed to this output stream.
If tracing is enabled, the
PlugletExecutor
tracing output is also displayed to this stream. Depending on
the implementation of the IPlugletCompiler
interface, all
compiler error messages are displayed to this stream.
getOutput
in interface IPlugletHost
PrintWriter
for pluglet output.public boolean enableTracing()
IPlugletHost
The PlugletExecutor
tracing is enabled if this returns a boolean
value
of true
.
enableTracing
in interface IPlugletHost
boolean
that has a value of
true
when tracing is enabled. Otherwise, it
returns a value of false
.public java.lang.String[] getExtraClasspathEntries()
IPlugletHost2
The extra classpath entries are used when compiling and executing the pluglets that are executed from this host.
getExtraClasspathEntries
in interface IPlugletHost2