Last update: 2011-06-23

org.proteios.core.plugin
Interface InteractivePlugin

All Superinterfaces:
Plugin

public interface InteractivePlugin
extends Plugin

An interactive plugin is a Plugin that supports interactive configuration in a user session. What this means is that a client application may ask the plugin for the parameters it needs using the getRequestInformation(GuiContext, String) method. The client then displays some sort of interactive interface that asks the user to supply values to those parameters and then calls the configure(GuiContext, Request, Response) method to let the plugin verify and store those parameters in the database.

When configuring a plugin or job the following sequence is followed:

  1. Create a plugin object, using the default constructor
  2. Call the Plugin.init(SessionControl, ParameterValues, ParameterValues) method which gives the plugin access to it's current configuration and job-specific parameters
  3. Call the getRequestInformation(GuiContext, String) method with a command value of Request.COMMAND_CONFIGURE_PLUGIN or Request.COMMAND_CONFIGURE_JOB
  4. Call the configure(GuiContext, Request, Response) method
  5. If the return status is Response.Status.CONTINUE the previous two steps will be repeated with the a command
  6. Call the Plugin.done() method
  7. After done has been called, the plugin instance is not

Version:
2.0
Author:
Nicklas
Last modified
$Date: 2009-04-09 08:48:11 +0200 (Thu, 09 Apr 2009) $

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.proteios.core.plugin.Plugin
Plugin.MainType
 
Method Summary
 void configure(GuiContext context, Request request, Response response)
          Configure the plugin.
 Set<GuiContext> getGuiContexts()
          Get a set containing all items that the plugin handles.
 RequestInformation getRequestInformation(GuiContext context, String command)
          This method will return the RequestInformation for a given command, i.e.
 boolean isInContext(GuiContext context, Object item)
          Check if the plugin can be used on the specified object.
 
Methods inherited from interface org.proteios.core.plugin.Plugin
done, getAbout, getMainType, init, run
 

Method Detail

getGuiContexts

Set<GuiContext> getGuiContexts()
Get a set containing all items that the plugin handles. Ie. if the plugin imports peaks, return a set containing Item.PROTEIOS_PEAK. This information is used by client applications to put the plugin in the proper place in the user interface.

Returns:
A Set containing Item:s, or null if the plugin is not concerned about items

isInContext

boolean isInContext(GuiContext context,
                    Object item)
Check if the plugin can be used on the specified object. The item is either a BasicItem or BasicData object. A client application calls this method if the plugin has specified a GuiContext for that type of item with a GuiContext.getType() context type.

Parameters:
context - The current context of the client application, it is one of the values found in set returned by getGuiContexts()
item - The currently active item, it's type should match the GuiContext.getItem() type
Returns:
TRUE if the plugin can use that item, FALSE otherwise

getRequestInformation

RequestInformation getRequestInformation(GuiContext context,
                                         String command)
                                         throws BaseException
This method will return the RequestInformation for a given command, i.e. the list of parameters and some nice help text.

Parameters:
context - The current context of the client application, it is one of the values found in set returned by getGuiContexts()
command - The command
Returns:
The RequestInformation for the command
Throws:
BaseException - if there is an error

configure

void configure(GuiContext context,
               Request request,
               Response response)
Configure the plugin. Hopefully the client is supplying values for the parameters specified by getRequestInformation(GuiContext, String).

Parameters:
context - The current context of the client application, it is one of the values found in set returned by getGuiContexts()
request - Request object with the command and parameters
response - Response object in for the plugin to response through

Last update: 2011-06-23