org.jboss.soa.esb.actions
Class EJBProcessor

java.lang.Object
  extended by org.jboss.soa.esb.actions.AbstractActionLifecycle
      extended by org.jboss.soa.esb.actions.EJBProcessor
All Implemented Interfaces:
ActionLifecycle

public class EJBProcessor
extends AbstractActionLifecycle

EJBProcessor is an action that can call stateless session beans deployed in an application server.

This implementation currently supports EJB2.x and EJB3.x session beans. Example EJB 2.x configuration:

<action name="EJBTest" class="org.jboss.soa.esb.actions.EJBProcessor">
    <property name="ejb-name" value="MyBean" />
    <property name="jndi-name" value="ejb/MyBean" />
    <property name="initial-context-factory" value="org.jnp.interfaces.NamingContextFactory" />
    <property name="security-principal" value="username" />
    <property name="security-credentials" value="password" />
    <!-- Optional property for JAAS login -->"
    <property name="security-login-module" value="securityDomain" />
    <property name="provider-url" value="localhost:1099" />
    <property name="method" value="login" />

    <!-- Optional output location, defaults to "DEFAULT_EJB_OUT"
    <property name="esb-out-var" value="MY_OUT_LOCATION"/> -->
    <property name="ejb-params">
    <!-- arguments of the operation and where to find them in the message -->
        <arg0 type="java.lang.String">username</arg0>
        <arg1 type="java.lang.String">password</arg1>
    </property>
 </action>
 
Example EJB 3.x configuration:
<action name="EJBTest" class="org.jboss.soa.esb.actions.EJBProcessor">
    <property name="ejb3" value="true" />
    <property name="jndi-name" value="ejb/MyBean" />
    <property name="initial-context-factory" value="org.jnp.interfaces.NamingContextFactory" />
    <property name="security-principal" value="username" />
    <property name="security-credentials" value="password" />
    <!-- Optional property for JAAS login -->"
    <property name="security-login-module" value="securityDomain" />
    <property name="provider-url" value="localhost:1099" />
    <property name="method" value="login" />

    <!-- Optional output location, defaults to "DEFAULT_EJB_OUT"
    <property name="esb-out-var" value="MY_OUT_LOCATION"/> -->
    <property name="ejb-params">
    <!-- arguments of the operation and where to find them in the message -->
        <arg0 type="java.lang.String">username</arg0>
        <arg1 type="java.lang.String">password</arg1>
    </property>
 </action>
 


Field Summary
static int ARG_PREFIX_LENGTH
           
protected  ConfigTree configTree
           
static java.lang.String DEFAULT_OUT
           
static java.lang.String EJB_METHOD
           
static java.lang.String EJB_NAME
           
static java.lang.String EJB3_ATTRIBUTE
           
static java.lang.String INICTXFACTORY
           
static java.lang.String JAVA_TYPE
           
static java.lang.String JNDI_NAME
           
static java.lang.String OUT_VAR
           
static java.lang.String PROVIDERURL
           
static java.lang.String SECURITY_CREDENTIALS
           
static java.lang.String SECURITY_LOGIN_MODULE
           
static java.lang.String SECURITY_PRINCIPAL
           
 
Constructor Summary
EJBProcessor(ConfigTree config)
           
 
Method Summary
protected  javax.security.auth.callback.CallbackHandler createCallbackHandler(ConfigTree config)
          Creates an AppCallbackHandler that takes a username and password.
 void destroy()
          Destroy the action instance.
 void initialise()
          Initialise the action instance.
 Message process(Message msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EJB_NAME

public static final java.lang.String EJB_NAME
See Also:
Constant Field Values

JNDI_NAME

public static final java.lang.String JNDI_NAME
See Also:
Constant Field Values

EJB_METHOD

public static final java.lang.String EJB_METHOD
See Also:
Constant Field Values

JAVA_TYPE

public static final java.lang.String JAVA_TYPE
See Also:
Constant Field Values

INICTXFACTORY

public static final java.lang.String INICTXFACTORY
See Also:
Constant Field Values

PROVIDERURL

public static final java.lang.String PROVIDERURL
See Also:
Constant Field Values

OUT_VAR

public static final java.lang.String OUT_VAR
See Also:
Constant Field Values

DEFAULT_OUT

public static final java.lang.String DEFAULT_OUT
See Also:
Constant Field Values

EJB3_ATTRIBUTE

public static final java.lang.String EJB3_ATTRIBUTE
See Also:
Constant Field Values

SECURITY_PRINCIPAL

public static final java.lang.String SECURITY_PRINCIPAL
See Also:
Constant Field Values

SECURITY_CREDENTIALS

public static final java.lang.String SECURITY_CREDENTIALS
See Also:
Constant Field Values

SECURITY_LOGIN_MODULE

public static final java.lang.String SECURITY_LOGIN_MODULE
See Also:
Constant Field Values

ARG_PREFIX_LENGTH

public static final int ARG_PREFIX_LENGTH
See Also:
Constant Field Values

configTree

protected ConfigTree configTree
Constructor Detail

EJBProcessor

public EJBProcessor(ConfigTree config)
Method Detail

process

public Message process(Message msg)
                throws ActionProcessingException,
                       ConfigurationException
Throws:
ActionProcessingException
ConfigurationException

initialise

public void initialise()
                throws ActionLifecycleException
Description copied from class: AbstractActionLifecycle
Initialise the action instance.

This method is called after the action instance has been instantiated so that configuration options can be validated.

Specified by:
initialise in interface ActionLifecycle
Overrides:
initialise in class AbstractActionLifecycle
Throws:
ActionLifecycleException - for errors during initialisation.

createCallbackHandler

protected javax.security.auth.callback.CallbackHandler createCallbackHandler(ConfigTree config)
Creates an AppCallbackHandler that takes a username and password. This method is protected to let subclasses override it to implement other security authentication mechanisms.

Parameters:
config - The configuration for this action. Gives access to all config parameters.
Returns:
CallbackHandler A callback handler that suitable for the login module configured.

destroy

public void destroy()
Description copied from class: AbstractActionLifecycle
Destroy the action instance.

This method is called prior to the release of the action instance. All resources associated with this action instance should be released as the instance will no longer be used.

Specified by:
destroy in interface ActionLifecycle
Overrides:
destroy in class AbstractActionLifecycle