IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.pluglets.host
Class PlugletHost

java.lang.Object
  extended bycom.ibm.xtools.pluglets.host.PlugletHost
All Implemented Interfaces:
IPlugletHost

public class PlugletHost
extends Object
implements IPlugletHost

The default implementation of the IPlugletHost interface.

Pluglet hosts can use this class verbatim, subclass the class, or provide their own implementation.


Constructor Summary
PlugletHost(URLClassLoader[] context, IPlugletCompiler compiler, PrintWriter output, IPlugletMessageDialog dialog, boolean tracing)
          Constructs a default IPlugletHost implementation.
 
Method Summary
 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.
 URLClassLoader[] getContext()
          Used by the pluglet engine to retrieve the URLClassLoader objects.
 IPlugletMessageDialog getDialog()
          Used by the pluglet engine to retrieve the IPlugletMessageDialog implementation.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlugletHost

public PlugletHost(URLClassLoader[] context,
                   IPlugletCompiler compiler,
                   PrintWriter output,
                   IPlugletMessageDialog dialog,
                   boolean tracing)
Constructs a default IPlugletHost implementation.

Parameters:
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.
Method Detail

getCompiler

public IPlugletCompiler getCompiler()
Description copied from interface: IPlugletHost
Used by the pluglet engine to retrieve the optional compiler invocation interface.

You can use the PlugletCompiler class to construct a compiler or you can construct your own implementation of the IPlugletCompiler interface.

Specified by:
getCompiler in interface IPlugletHost
Returns:
Returns the implementation of the host's pluglet compiler interface.

getContext

public URLClassLoader[] getContext()
Description copied from interface: IPlugletHost
Used by the pluglet engine to retrieve the URLClassLoader objects.

The URLClassLoader objects define what classes are visible to the pluglets that are executed from this host.

Specified by:
getContext in interface IPlugletHost
Returns:
Returns the host class loaders that the pluglets access.

getDialog

public IPlugletMessageDialog getDialog()
Description copied from interface: IPlugletHost
Used by the pluglet engine to retrieve the IPlugletMessageDialog implementation.

This method is used by the Pluglet class to implement dialog methods.

Specified by:
getDialog in interface IPlugletHost
Returns:
Returns the IPlugletMessageDialog implementation of the host.

getOutput

public PrintWriter getOutput()
Description copied from interface: IPlugletHost
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.

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.

Specified by:
getOutput in interface IPlugletHost
Returns:
The host's PrintWriter for pluglet output.

enableTracing

public boolean enableTracing()
Description copied from interface: IPlugletHost
Used by the pluglet engine to determine whether the host has tracing enabled.

The PlugletExecutor tracing is enabled if this returns a boolean value of true.

Specified by:
enableTracing in interface IPlugletHost
Returns:
Returns a boolean that has a value of true when tracing is enabled. Otherwise, it returns a value of false.

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2004. All rights reserved.