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, wait
getExecutor
protected 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()
PluginContext
getPluginDescriptor
in interface PluginContext
public GlobalContext getGlobalContext()
public PluginLifeCycleEventListener.List getPluginLifeCycleEventListeners()
PluginContext
getPluginLifeCycleEventListeners
in interface PluginContext
public ProgressEventListener.ListenerList getProgressEventListeners()
PluginContext
getProgressEventListeners
in interface PluginContext
public Progress getProgress()
PluginContext
getProgress
in interface PluginContext
public PluginContextID getID()
PluginContext
getID
in interface PluginContext
public ConnectionManager getConnectionManager()
GlobalContext
getConnectionManager
in interface GlobalContext
public java.lang.String getLabel()
PluginContext
getLabel
in interface PluginContext
public boolean hasPluginDescriptorInPath(PluginDescriptor plugin, int methodIndex)
hasPluginDescriptorInPath
in interface PluginContext
public void setPluginDescriptor(PluginDescriptor descriptor, int methodIndex) throws FieldSetException, RecursiveCallException
setPluginDescriptor
in interface PluginContext
FieldSetException
RecursiveCallException
public PluginContext createChildContext(java.lang.String label)
PluginContext
createChildContext
in interface PluginContext
public java.util.List<PluginContext> getChildContexts()
PluginContext
getChildContexts
in interface PluginContext
public PluginContext getParentContext()
PluginContext
getParentContext
in interface PluginContext
protected abstract PluginContext createTypedChildContext(java.lang.String label)
public PluginExecutionResult getResult()
getResult
in interface PluginContext
FieldNotSetException
- If the future is not know to this contextpublic ProMFuture<?> getFutureResult(int i)
PluginContext
getFutureResult
in interface PluginContext
public void setFuture(PluginExecutionResult futureToBe)
setFuture
in interface PluginContext
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isDistantChildOf(PluginContext context)
PluginContext
isDistantChildOf
in interface PluginContext
public void log(java.lang.String message, Logger.MessageLevel level)
log
in interface PluginContext
message
- the message to loglevel
- the message levelpublic void log(java.lang.String message)
log
in interface PluginContext
message
- The messagepublic void log(java.lang.Throwable exception)
log
in interface PluginContext
exception
- the exception thrownpublic PluginManager getPluginManager()
getPluginManager
in interface GlobalContext
public ProvidedObjectManager getProvidedObjectManager()
getProvidedObjectManager
in interface GlobalContext
public PluginContextID createNewPluginContextID()
createNewPluginContextID
in interface GlobalContext
public void invokePlugin(PluginDescriptor plugin, int index, java.lang.Object... objects)
invokePlugin
in interface GlobalContext
plugin
- 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)
GlobalContext
invokeBinding
in interface GlobalContext
binding
- 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()
PluginContext
getLoggingListeners
in interface PluginContext
public PluginContext getRootContext()
PluginContext
getRootContext
in interface PluginContext
public boolean deleteChild(PluginContext child)
PluginContext
deleteChild
in interface PluginContext
public <T extends Connection> T addConnection(T c)
PluginContext
addConnection
in interface PluginContext
public java.lang.Class<? extends PluginContext> getPluginContextType()
GlobalContext
getPluginContextType
in interface GlobalContext
public <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
ObjectConstructor
tryToFindOrConstructAllObjects
in interface ObjectConstructor
T
- 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 workConnectionCannotBeObtained
public <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
ObjectConstructor
tryToFindOrConstructFirstObject
in interface ObjectConstructor
T
- 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 workConnectionCannotBeObtained
public <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
ObjectConstructor
tryToFindOrConstructFirstNamedObject
in interface ObjectConstructor
T
- 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 workConnectionCannotBeObtained
public void clear()
clear
in interface PluginContext