Interface PluginContext

All Superinterfaces:
GlobalContext, ObjectConstructor
All Known Implementing Classes:
AbstractPluginContext, CLIPluginContext, UIPluginContext

public interface PluginContext extends GlobalContext, ObjectConstructor
  • Method Details

    • createChildContext

      PluginContext createChildContext(String label)
      Returns a new plugin context instance, which can be used to invoke other plugins.
      Returns:
      the new plugin context instance
    • getProgress

      Progress getProgress()
      Returns the progress object corresponding to this context
      Returns:
      the progress object corresponding to this context
    • getProgressEventListeners

      ProgressEventListener.ListenerList getProgressEventListeners()
      Returns the list of registered progress listeners
      Returns:
      the list of registered progress listeners
    • getPluginLifeCycleEventListeners

      PluginLifeCycleEventListener.List getPluginLifeCycleEventListeners()
      Returns the list of registered plugin life cycle listeners.
      Returns:
      the list of registered plugin life cycle listeners.
    • getID

      Each PluginContext should carry an ID. This ID is unique within this plugin context's global context.
      Returns:
      the ID of this context
    • getLabel

      String getLabel()
      Returns the label of this context.
      Returns:
    • getPluginDescriptor

      Pair<PluginDescriptor,Integer> getPluginDescriptor()
      Return the plugin descriptor and method index of the plugin which is invoked in this context. This descriptor is set by the PluginDescriptor.invoke() method and will not be set yet before PluginManager.invoke() is called.
      Returns:
      the descriptor of the plugin which is invoked in this context If the plugin is not set yet, a pair of (null,-1) is returned
    • getParentContext

      PluginContext getParentContext()
      Returns the context which created this context or null if it has no parent.
      Returns:
    • getChildContexts

      List<PluginContext> getChildContexts()
      Returns a list of all child contexts which have been created with createChildContext().
      Returns:
    • getResult

      This method returns the PluginExecutionResult of the plugin which is invoked in this context. This future result is set by PluginManager.invoke() and will not be available (will be null) until the invoke() method is called.
      Returns:
      The PluginExecutionResult that represents the result of this plugin invocation
      Throws:
      FieldNotSetException - If the future is not know to this context
    • getFutureResult

      ProMFuture<?> getFutureResult(int i)
      This method should only be used by a plugin, in the body of that plugin. That is the only location, where it is guaranteed that each result object in getResults() can safely be cast to a ProMFuture.
      Parameters:
      i -
      Returns:
    • getExecutor

      Executor getExecutor()
      Returns an executor which can be used to execute plugins in child contexts.
      Returns:
    • isDistantChildOf

      boolean isDistantChildOf(PluginContext context)
      Returns true if this is a distant child of context, i.e. true if getParent.getID().equals(context.getID()) || getParent().isDistantChildOf(context);
      Parameters:
      context -
      Returns:
    • setFuture

      void setFuture(PluginExecutionResult resultToBe)
    • setPluginDescriptor

      void setPluginDescriptor(PluginDescriptor descriptor, int methodIndex) throws FieldSetException, RecursiveCallException
      Throws:
      FieldSetException
      RecursiveCallException
    • hasPluginDescriptorInPath

      boolean hasPluginDescriptorInPath(PluginDescriptor descriptor, int methodIndex)
    • log

      void log(String message, Logger.MessageLevel level)
      The provided String is provided to the context for information. It can for example signal a state change of a plugin. Note that some contexts can completely ignore this message.
      Parameters:
      message - the message to log
      level - the message level
    • log

      void log(String message)
      Same as calling log(message, MessageLevel.NORMAL);
      Parameters:
      message - The message
    • log

      void log(Throwable exception)
      The provided Exception is provided to the context. It signals the context about an error in the plugin, that specifically lead to abnormal termination. The plugin signaling the exception is no longer executing!
      Parameters:
      exception - the exception thrown
    • getLoggingListeners

      Logger.ListenerList getLoggingListeners()
      Returns the list of logging listeners registered to this context.
      Returns:
    • getRootContext

      PluginContext getRootContext()
      Returns the root plugin context. This is an instance of PluginContext of which all other contexts are distant childs.
      Returns:
    • deleteChild

      boolean deleteChild(PluginContext child)
      Delete this child from this context.
      Parameters:
      child -
    • addConnection

      <T extends Connection> T addConnection(T c)
      Registers the given connection in the global context. The implementation is addConnection(this,c);
      Parameters:
      c -
    • clear

      void clear()