Overview | Package | Class | Use | Tree | Deprecated | Index | Help
|  | BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.rfid.edge.toolkit.workflow
Class AbstractWorkflowModulePlugin

    java.lang.Object
      com.connecterra.util.event.AbstractEventProcessor
          com.bea.rfid.edge.toolkit.workflow.AbstractWorkflowModulePlugin

All Implemented Interfaces:
  WorkflowModulePlugin, EventProcessor

    public abstract class AbstractWorkflowModulePlugin

extends AbstractEventProcessor
implements WorkflowModulePlugin

Abstract base class for edge flow modules.

This class uses event handling mechanism used by the edge server to queue up incoming messages. This ensures that messages come into the module only one at a time and hence the module can assume single threaded operation for incoming messages.

This class also provides some utility methods -- to send output to other modules, to create output/input port plugin parameter meta group, to log messages to instance specific logger etc.

Nested Class Summary
`class` | `AbstractWorkflowModulePlugin.OneWayInputPortImpl` Inner class implementation of `OneWayInputPort`.

Nested classes/interfaces inherited from class com.connecterra.util.event.AbstractEventProcessor
`AbstractEventProcessor.PeriodicEventHandle`

Field Summary
`protected static Port` | `ERROR_OUT_PORT` Error output port that could be used by any module with error output port.
`protected static String` | `ERROR_OUT_PORT_KEY` Name of the plugin configuration parameter for error output port.
`protected static String` | `I18N_INPUT_PORTS_PARAM_GROUP` Internationalized name of the plugin configuration parameter that groups input ports.
`protected static String` | `I18N_OUTPUT_PORTS_PARAM_GROUP` Internationalized name of the plugin configuration parameter that groups output ports.
`protected static String` | `INPUT_PORTS_PARAM_GROUP` Name of the plugin configuration parameter that groups all input ports together.
`protected static String` | `OUTPUT_PORTS_PARAM_GROUP` Name of the plugin configuration parameter that groups all output ports together.

Constructor Summary
`AbstractWorkflowModulePlugin()`

Method Summary
`static PluginParameterMeta` | `createInputPortsSubConfig(DynamicConfigFactory factory, List ports)` Utility method to create input ports sub-configuration parameter meta.
`protected abstract ModuleDescriptor` | `createModuleDescriptor()` Abstract method that creates the module descriptor for this module.
`protected static PluginParameterMeta` | `createOutputPortsSubConfig(DynamicConfigFactory factory, List ports)` Utility method to create output ports sub-configuration parameter meta.
`protected void` | `doStartup()` Any startup operations that need to be done for the module should go into this method.
`ModuleDescriptor` | `getModuleDescriptor()` Returns `ModuleDescriptor` for this module.
`String` | `getName()` Returns the name of this module.
`protected static List` | `getOutputModulesList(PluginConfig config, String paramName)` Utility method to get output modules list for a given output port parameter from a pluginconfig.
`static List` | `getStringList(PluginConfig config, String paramName)` Utility method to get a List value for the given parameter from the given plugin config.
`static String` | `getStringValue(PluginConfig config, String paramName)` Utility method to get the string value for a given configuration parameter from the given plugin configuration.
`static String` | `getStringValue(PluginConfig config, String subConfigName, String paramName)` Utility method to get the string value for a given configuration parameter with in the given sub-configuration from a plugin configuration.
`WorkflowManager` | `getWorkflowManager()` Returns a reference to the workflow manager set up during initialization time.
`void` | `initialize(String name, WorkflowManager workflowManager)` Interface method implementation.
`protected void` | `log(Level severity, String errorMsg)` Utility method to log a message from a module.
`protected void` | `log(Level severity, String errorMsg, Throwable thrown)` Utility method to log an exception from a module.
`void` | `receiveMessage(Object msg, String portName)` Accepts a message to the specified port of this module.
`protected void` | `sendErrorOutput(Level severity, String errorMsg, Throwable exc)` Utility method to create an ErrorOutput object for an exception within a module and send it to error output modules.
`protected void` | `sendToModules(Object msg, List destList)` Utility method to send a message to a specified list of <module>:<port> strings.
`protected void` | `setupErrorOutputs(PluginConfig config)` Extracts error destination configuration parameter values and saves it within the module.
`void` | `shutdown()` Interface method implementation.
`void` | `startup()` Interface method implementation.

Methods inherited from class com.connecterra.util.event.AbstractEventProcessor
`doASAP, doASAPOrBlock, doASAPOrDrop, doASAPOrThrow, doLater, doPeriodic, getEventReceiver`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface com.bea.rfid.edge.api.workflow.WorkflowModulePlugin
`configure`

Methods inherited from interface com.connecterra.util.event.EventProcessor
`handleEvent`

Field Detail

### INPUT_PORTS_PARAM_GROUP

    protected static final String INPUT_PORTS_PARAM_GROUP

  Name of the plugin configuration parameter that groups all input ports together.

  See Also:
    Constant Field Values

### I18N_INPUT_PORTS_PARAM_GROUP

    protected static final String I18N_INPUT_PORTS_PARAM_GROUP

  Internationalized name of the plugin configuration parameter that groups input ports.

### OUTPUT_PORTS_PARAM_GROUP

    protected static final String OUTPUT_PORTS_PARAM_GROUP

  Name of the plugin configuration parameter that groups all output ports together.

  See Also:
    Constant Field Values

### I18N_OUTPUT_PORTS_PARAM_GROUP

    protected static final String I18N_OUTPUT_PORTS_PARAM_GROUP

  Internationalized name of the plugin configuration parameter that groups output ports.

### ERROR_OUT_PORT_KEY

    protected static final String ERROR_OUT_PORT_KEY

  Name of the plugin configuration parameter for error output port.

  See Also:
    Constant Field Values

### ERROR_OUT_PORT

    protected static final Port ERROR_OUT_PORT

  Error output port that could be used by any module with error output port.

Constructor Detail

### AbstractWorkflowModulePlugin

    public AbstractWorkflowModulePlugin()

Method Detail

### initialize

    public void initialize(String name,
                           WorkflowManager workflowManager)

  Interface method implementation. It does the following at initialization time:
  - Sets up the event queueing mechanism that will be used for handling incoming messages to this module.
  - Stores a reference to the `WorkflowManager` which may be used by the modules to get to other resources within the edge server.
  - A java.util.logging.Logger is created for this specific instance at initialization time, which can be used to turn on/off logging for this specific instance or for all modules of this class.
  - Uses the abstract method `createModuleDescriptor` to set up this module's ModuleDescriptor.

  Specified by:
    `initialize` in interface `WorkflowModulePlugin`
  Parameters:
    `name` - Name of this module.
    `workflowManager` - Reference to WorkflowManager that modules could use to get to edge server services

### getName

    public String getName()

  Description copied from interface: `WorkflowModulePlugin`
  Returns the name of this module.

  Specified by:
    `getName` in interface `WorkflowModulePlugin`
  Returns:
    Name of the module.

### getModuleDescriptor

    public ModuleDescriptor getModuleDescriptor()

  Description copied from interface: `WorkflowModulePlugin`
  Returns `ModuleDescriptor` for this module. The module descriptor contains information about the input and output ports of the module.

  Specified by:
    `getModuleDescriptor` in interface `WorkflowModulePlugin`
  Returns:
    The `ModuleDescriptor` for this module.

### getWorkflowManager

    public WorkflowManager getWorkflowManager()

  Returns a reference to the workflow manager set up during initialization time.

  Returns:
    Reference to workflow manager.

### createModuleDescriptor

    protected abstract ModuleDescriptor createModuleDescriptor()

  Abstract method that creates the module descriptor for this module. This method is used at initialization time to set up the module descriptor for this module.

  Returns:
    ModuleDescriptor for this module.

### receiveMessage

    public void receiveMessage(Object msg,
                               String portName)

  Description copied from interface: `WorkflowModulePlugin`
  Accepts a message to the specified port of this module.

  Specified by:
    `receiveMessage` in interface `WorkflowModulePlugin`
  Parameters:
    `msg` - The message to this module.
    `portName` - Name of the port to which this message is being sent.

### shutdown

    public void shutdown()

  Interface method implementation. The event processing mechanism is shutdown by the base implementation. If modules override this method, they should call `super.shutdown` to make sure that this happens.

  Specified by:
    `shutdown` in interface `WorkflowModulePlugin`
  Overrides:
    `shutdown` in class `AbstractEventProcessor`

### startup

    public final void startup()

  Interface method implementation. This implementation ensures that startup operations happen in the event processing thread and not in the thread that initializes the edge flow module. This is so that any long operation that should happen during startup will not slow down the edge initialization process. This also means that if the module startup fails, an error will not be sent back to the client side. The error will be logged in the log output.

  This method calls the method `doStartup` using the event handling mechanism. Edge flow module implementations that extend this class should implement startup operations in that method.

  Specified by:
    `startup` in interface `WorkflowModulePlugin`

### doStartup

    protected void doStartup()
                      throws Exception

  Any startup operations that need to be done for the module should go into this method. A default empty method is provided here since most modules will not have anything to do. If a module needs to perform startup steps, it should override this method.

  Throws:
    `Exception` - If an error occurs during startup. Generic exception is defined here since the exceptions that may occur in different modules are specific to the module implementation. The default handling of exception in this abstract base class is to log the error as a startup failure. If a module needs different handling, it should catch exceptions and handle them appropriately.

### setupErrorOutputs

    protected void setupErrorOutputs(PluginConfig config)
                              throws PluginException

  Extracts error destination configuration parameter values and saves it within the module. This method assumes that error output port parameter is `ERROR_OUT_PORT_KEY` with in the sub-configuration parameter `OUTPUT_PORTS_PARAM_GROUP`.

  Parameters:
    `config` - The `PluginConfig` with the configuration information.
  Throws:
    `PluginException`

### sendToModules

    protected void sendToModules(Object msg,
                                 List destList)

  Utility method to send a message to a specified list of <module>:<port> strings. If any of the specified module-port is incorrect or not found, this will just log a warning and continue. An exception is not thrown in that case.

  Parameters:
    `msg` - The message that is to be sent.
    `destList` - List of output <module>:<port> strings.

### log

    protected void log(Level severity,
                       String errorMsg)

  Utility method to log a message from a module. This method adds context information, module name, to the error message.

  Parameters:
    `severity` - The severity level of the error.
    `errorMsg` - The error message.

### log

    protected void log(Level severity,
                       String errorMsg,
                       Throwable thrown)

  Utility method to log an exception from a module. This method adds context information, module name, to the error message.

  Parameters:
    `severity` - The severity level of the error.
    `errorMsg` - The error message.
    `thrown` - The exception that is to be logged.

### sendErrorOutput

    protected void sendErrorOutput(Level severity,
                                   String errorMsg,
                                   Throwable exc)

  Utility method to create an ErrorOutput object for an exception within a module and send it to error output modules. This method will create the `ErrorOutput` with the appropriate source name and timestamp.

  Parameters:
    `severity` - The severity level of the error.
    `errorMsg` - The error message.
    `exc` - The exception that is the cause of the error.

### getOutputModulesList

    protected static List getOutputModulesList(PluginConfig config,
                                               String paramName)
                                        throws PluginException

  Utility method to get output modules list for a given output port parameter from a pluginconfig. This method will look for the output parameter in the sub-config `OUTPUT_PORTS_PARAM_GROUP`. This assumption is that output ports are always grouped under that sub-configuration.

  Parameters:
    `config` - The PluginConfig object that contains the output connections configuration parameter.
    `paramName` - The key name of the output connections parameter.
  Returns:
    List The list of module-ports specified in the parameter. This returns empty list if output connections are not specified in the plugin config.
  Throws:
    `PluginException` - If it can be determined that the output module destination specified is not valid.

### getStringList

    public static List getStringList(PluginConfig config,
                                     String paramName)

  Utility method to get a List value for the given parameter from the given plugin config.

  Parameters:
    `config` - The `PluginConfig` that contains the configuration values.
    `paramName` - The key name of the parameter for which the string list value is to be found.
  Returns:
    List with the configured values.
  Throws:
    `ClassCastException` - If this parameter does not contain List.

### getStringValue

    public static String getStringValue(PluginConfig config,
                                        String paramName)

  Utility method to get the string value for a given configuration parameter from the given plugin configuration. This method will return null, instead of `NoSuchNameException` if the parameter value is not specified.

  Parameters:
    `config` - The `PluginConfig` containing the configuration values.
    `paramName` - The name of the configuration parameter whose string value is to be found.
  Returns:
    The string value of the parameter. Returns null if the parameter value is not specified.

### getStringValue

    public static String getStringValue(PluginConfig config,
                                        String subConfigName,
                                        String paramName)

  Utility method to get the string value for a given configuration parameter with in the given sub-configuration from a plugin configuration. This method will return null, instead of `NoSuchNameException` if the parameter value is not specified or if the sub-configuration parameter value is not specified.

  Parameters:
    `config` - The `PluginConfig` containing the configuration values.
    `subConfigName` - The name of the sub-configuration.
    `paramName` - The name of the configuration parameter whose string value is to be found.
  Returns:
    The string value of the parameter. Returns null if the parameter value is not specified or if the sub-configuration parameter value is not specified.

### createOutputPortsSubConfig

    protected static PluginParameterMeta createOutputPortsSubConfig(DynamicConfigFactory factory,
                                                                    List ports)

  Utility method to create output ports sub-configuration parameter meta. This method will create the output ports specified in the list of ports passed in under the sub-configuration `OUTPUT_PORTS_PARAM_GROUP`.

  Parameters:
    `factory` - `DynamicConfigFactory` that is to be used to create the plugin meta objects.
    `ports` - The list of ports with the output port information.
  Returns:
    PluginParamterMeta for the output ports sub-configuration, which has the output port configuration parameters as children.

### createInputPortsSubConfig

    public static PluginParameterMeta createInputPortsSubConfig(DynamicConfigFactory factory,
                                                                List ports)

  Utility method to create input ports sub-configuration parameter meta. This method will create the input ports specified in the list of ports passed in under the sub-configuration `INPUT_PORTS_PARAM_GROUP`.

  Parameters:
    `factory` - `DynamicConfigFactory` that is to be used to create the plugin meta objects.
    `ports` - The list of ports with the input port information.
  Returns:
    PluginParamterMeta for the input ports sub-configuration, which has the input port configuration parameters as children.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Documentation is available at ${DOCSWEBROOT} Copyright 2007 BEA Systems Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD