|
Carrot2 Framework
API Specification |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.carrot2.core.controller.loaders.BeanShellFactoryDescriptionLoader
public class BeanShellFactoryDescriptionLoader
A ComponentFactoryLoader for creating component factories from a
BeanShell script. The provided BeanShell script must return an instance of
LoadedComponentFactory class. This class contains the essential
information needed to use the factory.
BeanShell scripts are very versatile; the controller uses BeanShell 2.0-series, which includes support for dynamic class creation.
An example component factory script may look as shown below:
factory = new LocalComponentFactory() {
public LocalComponent getInstance() {
LocalComponent c = new StubOutputComponent();
c.setProperty("property", "value");
return c;
}
};
return new LoadedComponentFactory("stub-output", factory);
A bug in BeanShell 2.0b1 prevents scripts that declare new classes (named or anonymous) from being evaluated more than once (a "duplicated class definition" error is thrown). Normal scenario of using the controller is to add processes only once and in such case, the scripts may declare new classes that override methods of their Java super classes.
| Constructor Summary | |
|---|---|
BeanShellFactoryDescriptionLoader()
|
|
| Method Summary | |
|---|---|
LoadedComponentFactory |
load(InputStream dataStream)
Loads a component factory from the data stream. |
void |
setGlobals(Map globalVars)
Sets a map of global variables registered in the beanshell interpreter. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BeanShellFactoryDescriptionLoader()
| Method Detail |
|---|
public void setGlobals(Map globalVars)
public LoadedComponentFactory load(InputStream dataStream)
throws IOException,
ComponentInitializationException
load in interface ComponentFactoryLoaderdataStream - The data stream to load from.
LoadedComponentFactory object.
IOException - If an i/o error occurs.
ComponentInitializationException
|
Please refer to project documentation at
http://project.carrot2.org |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||