public abstract class AbstractPluginContext extends java.lang.Object implements PluginContext
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPluginContext(AbstractPluginContext context,
java.lang.String label) |
|
AbstractPluginContext(GlobalContext context,
java.lang.String label)
Create a new root plugin instance context.
|
| Modifier and Type | Method and Description |
|---|---|
<T extends Connection> |
addConnection(T c)
Registers the given connection in the global context.
|
void |
clear() |
PluginContext |
createChildContext(java.lang.String label)
Returns a new plugin context instance, which can be used to invoke other
plugins.
|
PluginContextID |
createNewPluginContextID()
The GlobalContext implementation should create IDs for all PluginContexts
instantiated for it.
|
protected abstract PluginContext |
createTypedChildContext(java.lang.String label) |
boolean |
deleteChild(PluginContext child)
Delete this child from this context.
|
boolean |
equals(java.lang.Object o) |
java.util.List<PluginContext> |
getChildContexts()
Returns a list of all child contexts which have been created with
createChildContext().
|
ConnectionManager |
getConnectionManager()
Returns the connection manager.
|
ProMFuture<?> |
getFutureResult(int i)
This method should only be used by a plugin, in the body of that plugin.
|
GlobalContext |
getGlobalContext() |
PluginContextID |
getID()
Each PluginContext should carry an ID.
|
java.lang.String |
getLabel()
Returns the label of this context.
|
Logger.ListenerList |
getLoggingListeners()
Returns the list of logging listeners registered to this context.
|
PluginContext |
getParentContext()
Returns the context which created this context or null if it has no
parent.
|
java.lang.Class<? extends PluginContext> |
getPluginContextType()
Returns the specific type of the PluginContext.
|
Pair<PluginDescriptor,java.lang.Integer> |
getPluginDescriptor()
Return the plugin descriptor and method index of the plugin which is
invoked in this context.
|
PluginLifeCycleEventListener.List |
getPluginLifeCycleEventListeners()
Returns the list of registered plugin life cycle listeners.
|
PluginManager |
getPluginManager()
Returns the plugin manager.
|
Progress |
getProgress()
Returns the progress object corresponding to this context
|
ProgressEventListener.ListenerList |
getProgressEventListeners()
Returns the list of registered progress listeners
|
ProvidedObjectManager |
getProvidedObjectManager()
Returns the providedObject manager.
|
PluginExecutionResult |
getResult()
This method returns the PluginExecutionResult of the plugin which is
invoked in this context.
|
PluginContext |
getRootContext()
Returns the root plugin context.
|
boolean |
hasPluginDescriptorInPath(PluginDescriptor plugin,
int methodIndex) |
void |
invokeBinding(PluginParameterBinding binding,
java.lang.Object... objects)
This method invokes the specified binding in a context which is a child
of the main plugin context maintained by this globalContext.
|
void |
invokePlugin(PluginDescriptor plugin,
int index,
java.lang.Object... objects)
This method invokes the specified plugin in a context which is a child of
the main plugin context maintained by this globalContext;
|
boolean |
isDistantChildOf(PluginContext context)
Returns true if this is a distant child of context, i.e.
|
void |
log(java.lang.String message)
Same as calling log(message, MessageLevel.NORMAL);
|
void |
log(java.lang.String message,
Logger.MessageLevel level)
The provided String is provided to the context for information.
|
void |
log(java.lang.Throwable exception)
The provided Exception is provided to the context.
|
void |
setFuture(PluginExecutionResult futureToBe) |
void |
setPluginDescriptor(PluginDescriptor descriptor,
int methodIndex) |
java.lang.String |
toString() |
<T,C extends Connection> |
tryToFindOrConstructAllObjects(java.lang.Class<T> type,
java.lang.Class<C> connectionType,
java.lang.String role,
java.lang.Object... input)
Finds as many objects of the given type as can be found through the
connections of the other given type.
|
<T,C extends Connection> |
tryToFindOrConstructFirstNamedObject(java.lang.Class<T> type,
java.lang.String name,
java.lang.Class<C> connectionType,
java.lang.String role,
java.lang.Object... input)
Returns the first object of the given type as can be found through the
connections of the other given type.
|
<T,C extends Connection> |
tryToFindOrConstructFirstObject(java.lang.Class<T> type,
java.lang.Class<C> connectionType,
java.lang.String role,
java.lang.Object... input)
Returns the first object of the given type as can be found through the
connections of the other given type.
|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetExecutorprotected Progress progress
public AbstractPluginContext(GlobalContext context, java.lang.String label)
context - the global context in which this instance context is usedprotected AbstractPluginContext(AbstractPluginContext context, java.lang.String label)
public Pair<PluginDescriptor,java.lang.Integer> getPluginDescriptor()
PluginContextgetPluginDescriptor in interface PluginContextpublic GlobalContext getGlobalContext()
public PluginLifeCycleEventListener.List getPluginLifeCycleEventListeners()
PluginContextgetPluginLifeCycleEventListeners in interface PluginContextpublic ProgressEventListener.ListenerList getProgressEventListeners()
PluginContextgetProgressEventListeners in interface PluginContextpublic Progress getProgress()
PluginContextgetProgress in interface PluginContextpublic PluginContextID getID()
PluginContextgetID in interface PluginContextpublic ConnectionManager getConnectionManager()
GlobalContextgetConnectionManager in interface GlobalContextpublic java.lang.String getLabel()
PluginContextgetLabel in interface PluginContextpublic boolean hasPluginDescriptorInPath(PluginDescriptor plugin, int methodIndex)
hasPluginDescriptorInPath in interface PluginContextpublic void setPluginDescriptor(PluginDescriptor descriptor, int methodIndex) throws FieldSetException, RecursiveCallException
setPluginDescriptor in interface PluginContextFieldSetExceptionRecursiveCallExceptionpublic PluginContext createChildContext(java.lang.String label)
PluginContextcreateChildContext in interface PluginContextpublic java.util.List<PluginContext> getChildContexts()
PluginContextgetChildContexts in interface PluginContextpublic PluginContext getParentContext()
PluginContextgetParentContext in interface PluginContextprotected abstract PluginContext createTypedChildContext(java.lang.String label)
public PluginExecutionResult getResult()
getResult in interface PluginContextFieldNotSetException - If the future is not know to this contextpublic ProMFuture<?> getFutureResult(int i)
PluginContextgetFutureResult in interface PluginContextpublic void setFuture(PluginExecutionResult futureToBe)
setFuture in interface PluginContextpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean isDistantChildOf(PluginContext context)
PluginContextisDistantChildOf in interface PluginContextpublic void log(java.lang.String message,
Logger.MessageLevel level)
log in interface PluginContextmessage - the message to loglevel - the message levelpublic void log(java.lang.String message)
log in interface PluginContextmessage - The messagepublic void log(java.lang.Throwable exception)
log in interface PluginContextexception - the exception thrownpublic PluginManager getPluginManager()
getPluginManager in interface GlobalContextpublic ProvidedObjectManager getProvidedObjectManager()
getProvidedObjectManager in interface GlobalContextpublic PluginContextID createNewPluginContextID()
createNewPluginContextID in interface GlobalContextpublic void invokePlugin(PluginDescriptor plugin, int index, java.lang.Object... objects)
invokePlugin in interface GlobalContextplugin - objects - The objects to serve as input. Note that all elements should
implement Object, or be a ProMFuture>.index - The index of the plugin method that should be invoked.public void invokeBinding(PluginParameterBinding binding, java.lang.Object... objects)
GlobalContextinvokeBinding in interface GlobalContextbinding - The binding that should be invoked by the frameworkobjects - The objects to serve as input as accepted by the given
binding.public Logger.ListenerList getLoggingListeners()
PluginContextgetLoggingListeners in interface PluginContextpublic PluginContext getRootContext()
PluginContextgetRootContext in interface PluginContextpublic boolean deleteChild(PluginContext child)
PluginContextdeleteChild in interface PluginContextpublic <T extends Connection> T addConnection(T c)
PluginContextaddConnection in interface PluginContextpublic java.lang.Class<? extends PluginContext> getPluginContextType()
GlobalContextgetPluginContextType in interface GlobalContextpublic <T,C extends Connection> java.util.Collection<T> tryToFindOrConstructAllObjects(java.lang.Class<T> type, java.lang.Class<C> connectionType, java.lang.String role, java.lang.Object... input) throws ConnectionCannotBeObtained
ObjectConstructortryToFindOrConstructAllObjects in interface ObjectConstructorT - The type of the return object required.type - the type of the return object required.connectionType - the type of the connections to use when trying to find the
objects.role - the assumed role of the object in the connection. Given a
connection, the object can be retrieved through the role.input - the input on which the plugin should workConnectionCannotBeObtainedpublic <T,C extends Connection> T tryToFindOrConstructFirstObject(java.lang.Class<T> type, java.lang.Class<C> connectionType, java.lang.String role, java.lang.Object... input) throws ConnectionCannotBeObtained
ObjectConstructortryToFindOrConstructFirstObject in interface ObjectConstructorT - The type of the return object required.type - the type of the return object required.connectionType - the type of the connections to use when trying to find the
objects.role - the assumed role of the object in the connection. Given a
connection, the object can be retrieved through the role.input - the input on which the plugin should workConnectionCannotBeObtainedpublic <T,C extends Connection> T tryToFindOrConstructFirstNamedObject(java.lang.Class<T> type, java.lang.String name, java.lang.Class<C> connectionType, java.lang.String role, java.lang.Object... input) throws ConnectionCannotBeObtained
ObjectConstructortryToFindOrConstructFirstNamedObject in interface ObjectConstructorT - The type of the return object required.type - the type of the return object required.name - the name of the plugin to use.connectionType - the type of the connections to use when trying to find the
objects.role - the assumed role of the object in the connection. Given a
connection, the object can be retrieved through the role.input - the input on which the plugin should workConnectionCannotBeObtainedpublic void clear()
clear in interface PluginContext