org.figure8.join.services.scripting
Class ScriptLauncherJMSAdapter

java.lang.Object
  extended by org.figure8.join.services.scripting.ScriptLauncherAdapterSupport
      extended by org.figure8.join.services.scripting.ScriptLauncherJMSAdapter
All Implemented Interfaces:
javax.jms.MessageListener, Configurable, JMSConsumerBean
Direct Known Subclasses:
AntScriptLauncherJMSAdapter, GroovyScriptLauncherJMSAdapter, JSR223ScriptLauncherJMSAdapter, RubyScriptLauncherJMSAdapter

public abstract class ScriptLauncherJMSAdapter
extends ScriptLauncherAdapterSupport
implements JMSConsumerBean

This is a base class for JMS consumers that wants to launch scripts when a new message arrive. It acts as an adapter between the JMS world and the ScriptLauncher facilities.
This class is a JMSConsumerBean that is Configurable : it defines an optional parameter that should be a PropertiesExtractor impl. This extractor help tha transition from a JMS view (that is object message based) to a general script view (that is properties and arguments based).
Extensions of this class should specifiy which ScriptLauncher implementation to use when running scripts.

Version:
$Revision: 1.2 $
Author:
Laurent Broudoux
See Also:
Configurable, JMSConsumerBean, PropertiesExtractor

Field Summary
protected static ParameterDefinition extractionParam
          ParameterDefinition representation of parameter denoting the propertiesExtractor to use.
static java.lang.String EXTRACTOR_PARAM
          Name of configurable parameter denoting the propertiesExtractor to use for getting props.
protected static java.util.List parameters
          List of ParameterDefinitions supported by this adapter
 
Fields inherited from class org.figure8.join.services.scripting.ScriptLauncherAdapterSupport
name
 
Constructor Summary
ScriptLauncherJMSAdapter()
           
 
Method Summary
 java.util.List getParameterDefinitionsAsList()
          Get this object parameters definitions as a list
 void onMessage(javax.jms.Message message)
          This method is executed on message delivery.
 void setParameter(java.lang.String parameterName, java.lang.String parameterValue)
          Set the value of a parameter using its name
 void setPropertiesExtractorClass(java.lang.String extractorClass)
          Specify the class of PropertiesExtractor implementation to use
 void stop()
          Implement this method to stop current process and free resources.
 
Methods inherited from class org.figure8.join.services.scripting.ScriptLauncherAdapterSupport
createNewLogFile, getName, getParameterDefinitions, getScriptLauncher, saveLogInfoIfAvailable, setName, setParameter, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.figure8.join.core.messaging.JMSConsumerBean
getName, setName
 

Field Detail

EXTRACTOR_PARAM

public static final java.lang.String EXTRACTOR_PARAM
Name of configurable parameter denoting the propertiesExtractor to use for getting props.

See Also:
Constant Field Values

parameters

protected static java.util.List parameters
List of ParameterDefinitions supported by this adapter


extractionParam

protected static final ParameterDefinition extractionParam
ParameterDefinition representation of parameter denoting the propertiesExtractor to use.

Constructor Detail

ScriptLauncherJMSAdapter

public ScriptLauncherJMSAdapter()
Method Detail

setPropertiesExtractorClass

public void setPropertiesExtractorClass(java.lang.String extractorClass)
                                 throws InvalidParameterException
Specify the class of PropertiesExtractor implementation to use

Parameters:
extractorClass - The FQN of Java class representing PropertiesExtractor impl
Throws:
InvalidParameterException - if extractorClass is not found or does not implement the PropertiesExtractor interface

onMessage

public void onMessage(javax.jms.Message message)
This method is executed on message delivery. This implementation only process message of type ObjectMessage. The process is the following :
first: retrieve object from message and eventually extract its properties,

Specified by:
onMessage in interface javax.jms.MessageListener
Parameters:
message -

stop

public void stop()
Implement this method to stop current process and free resources. This method should not throw exceptions.

Specified by:
stop in interface JMSConsumerBean

getParameterDefinitionsAsList

public java.util.List getParameterDefinitionsAsList()
Get this object parameters definitions as a list

Specified by:
getParameterDefinitionsAsList in interface Configurable
Overrides:
getParameterDefinitionsAsList in class ScriptLauncherAdapterSupport
Returns:
A list of ParameterDefinition objects

setParameter

public void setParameter(java.lang.String parameterName,
                         java.lang.String parameterValue)
                  throws InvalidParameterException
Set the value of a parameter using its name

Specified by:
setParameter in interface Configurable
Overrides:
setParameter in class ScriptLauncherAdapterSupport
Parameters:
parameterName - The name of parameter so set value for
parameterValue - The value of the paramater
Throws:
InvalidParameterException - if this parameter is not supported by this object


Copyright © 2005-2008 Join. All Rights Reserved.