IBM Rational Software Modeler
Release 6.0

com.ibm.xtools.pluglets.engine
Class PlugletExecutor

java.lang.Object
  extended bycom.ibm.xtools.pluglets.engine.PlugletExecutor

public class PlugletExecutor
extends Object

Provides an engine for executing a Java source file or class file as a pluglet.

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.


Field Summary
static String PLUGLETMAIN
          The name of a pluglet main entry point.
static String[] PLUGLETMAIN_ARGS
          The argument types of a pluglet main entry point.
 
Constructor Summary
PlugletExecutor(IPlugletHost host)
          Constructs a PlugletExecutor instance.
 
Method Summary
 Object executePluglet(String plugletClassName, String[] plugletArgs, String plugletPath, String plugletClasspathDir)
          Executes a pluglet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PLUGLETMAIN

public static final String PLUGLETMAIN
The name of a pluglet main entry point.

See Also:
Constant Field Values

PLUGLETMAIN_ARGS

public static final String[] PLUGLETMAIN_ARGS
The argument types of a pluglet main entry point.

Constructor Detail

PlugletExecutor

public PlugletExecutor(IPlugletHost host)
Constructs a PlugletExecutor instance.

Parameters:
host - The optional pluglet host interface.
Method Detail

executePluglet

public Object executePluglet(String plugletClassName,
                             String[] plugletArgs,
                             String plugletPath,
                             String plugletClasspathDir)
                      throws Throwable
Executes a pluglet.

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.

Parameters:
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.
Returns:
Returns the value returned by the main entry point of the pluglet. If the pluglet main entry point has no return value it returns a value of null.
Throws:
PlugletException - Thrown when the specified pluglet does not exist, fails to compile, or the main entry point does not exist.
Throwable - Thrown when the execution of the pluglet throws an unhandled exception. The exception is propagated to the caller of executePluglet.

IBM Rational Software Modeler
Release 6.0


Guidelines for using Eclipse APIs.

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