Interface PluginContext

    • Method Detail

      • createChildContext

        PluginContext createChildContext​(java.lang.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

        PluginContextID 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

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

        Pair<PluginDescriptor,​java.lang.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

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

        PluginExecutionResult 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

        java.util.concurrent.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:
      • hasPluginDescriptorInPath

        boolean hasPluginDescriptorInPath​(PluginDescriptor descriptor,
                                          int methodIndex)
      • log

        void log​(java.lang.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​(java.lang.String message)
        Same as calling log(message, MessageLevel.NORMAL);
        Parameters:
        message - The message
      • log

        void log​(java.lang.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()