org.objectweb.easybeans.container.mdb
Class MDBMessageEndPointFactory

java.lang.Object
  extended by org.objectweb.easybeans.container.AbsFactory<EasyBeansMDB>
      extended by org.objectweb.easybeans.container.mdb.MDBFactory
          extended by org.objectweb.easybeans.container.mdb.MDBMessageEndPointFactory
All Implemented Interfaces:
javax.resource.spi.endpoint.MessageEndpointFactory, Factory<EasyBeansMDB,java.lang.Long>, PoolFactory<EasyBeansMDB,java.lang.Long>

public class MDBMessageEndPointFactory
extends MDBFactory
implements javax.resource.spi.endpoint.MessageEndpointFactory

Defines a class that will manage the message end point factory for the MDB. The super class will manage the pool of message end point.

Author:
Florent Benoit

Field Summary
private  javax.resource.spi.ActivationSpec activationSpec
          ActivationSpec object linked to this factory (used to activate or deactive an endpoint factory (us).
static java.lang.String DEFAULT_ACTIVATION_SPEC_NAME
          Default name of the activation spec (JORAM).
private  javax.resource.spi.ResourceAdapter resourceAdapter
          Resource adapter that provides the activation spec implementation.
 
Constructor Summary
MDBMessageEndPointFactory(java.lang.String className, EZBContainer container, javax.resource.spi.ActivationSpec activationSpec, javax.resource.spi.ResourceAdapter resourceAdapter)
          Default constructor (delegate to super class).
 
Method Summary
private  void activate()
          Activate this endpoint factory on resource adapter with the activation spec object.
 javax.resource.spi.endpoint.MessageEndpoint createEndpoint(javax.transaction.xa.XAResource xaResource)
          This is used to create a message endpoint.
 void init()
          Init the factory.
private  void initActivationSpec()
          Call setters method on the activation spec object.
 boolean isDeliveryTransacted(java.lang.reflect.Method method)
          This is used to find out whether message deliveries to a target method on a message listener interface that is implemented by a message endpoint will be transacted or not.
protected  void releaseEndPoint(MDBMessageEndPoint mdbMessageEndPoint)
          Release an endpoint created by this factory.
 void stop()
          Stops the factory.
private  void validateActivationSpec()
          Validate the configuration used p, tje activation spec object.
 
Methods inherited from class org.objectweb.easybeans.container.mdb.MDBFactory
create, getBeanInfo, getMessageDrivenInfo, isMatching, localCall, rpcInvoke, setMessageDrivenInfo, validate
 
Methods inherited from class org.objectweb.easybeans.container.AbsFactory
getBeanClass, getClassName, getContainer, getHashes, getId, getJavaContext, getNamingManager, getPool, injectResources, remove, setBeanClass, setHashes, setJavaContext, setPool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.easybeans.pool.PoolFactory
remove
 

Field Detail

DEFAULT_ACTIVATION_SPEC_NAME

public static final java.lang.String DEFAULT_ACTIVATION_SPEC_NAME
Default name of the activation spec (JORAM).

See Also:
Constant Field Values

activationSpec

private javax.resource.spi.ActivationSpec activationSpec
ActivationSpec object linked to this factory (used to activate or deactive an endpoint factory (us).


resourceAdapter

private javax.resource.spi.ResourceAdapter resourceAdapter
Resource adapter that provides the activation spec implementation.

Constructor Detail

MDBMessageEndPointFactory

public MDBMessageEndPointFactory(java.lang.String className,
                                 EZBContainer container,
                                 javax.resource.spi.ActivationSpec activationSpec,
                                 javax.resource.spi.ResourceAdapter resourceAdapter)
                          throws FactoryException
Default constructor (delegate to super class).

Parameters:
className - name of this factory (name of class that is managed)
container - the root component of this factory.
activationSpec - the activation Spec object used for activating/deactivating.
resourceAdapter - the resource adapter used to activate/deactivate ourself.
Throws:
FactoryException - if super constructor fails
Method Detail

init

public void init()
          throws FactoryException
Init the factory.

Specified by:
init in interface Factory<EasyBeansMDB,java.lang.Long>
Overrides:
init in class AbsFactory<EasyBeansMDB>
Throws:
FactoryException - if the initialization fails.

initActivationSpec

private void initActivationSpec()
                         throws FactoryException
Call setters method on the activation spec object.

Throws:
FactoryException - if activation spec object is not configured.

validateActivationSpec

private void validateActivationSpec()
                             throws FactoryException
Validate the configuration used p, tje activation spec object.

Throws:
FactoryException - if the validation of the activation spec implementation object fails.

activate

private void activate()
               throws FactoryException
Activate this endpoint factory on resource adapter with the activation spec object.

Throws:
FactoryException - if the activation fails.

createEndpoint

public javax.resource.spi.endpoint.MessageEndpoint createEndpoint(javax.transaction.xa.XAResource xaResource)
                                                           throws javax.resource.spi.UnavailableException
This is used to create a message endpoint. The message endpoint is expected to implement the correct message listener type.

Specified by:
createEndpoint in interface javax.resource.spi.endpoint.MessageEndpointFactory
Parameters:
xaResource - an optional XAResource instance used to get transaction notifications when the message delivery is transacted.
Returns:
a message endpoint instance.
Throws:
javax.resource.spi.UnavailableException - indicates a transient failure in creating a message endpoint. Subsequent attempts to create a message endpoint might succeed.

releaseEndPoint

protected void releaseEndPoint(MDBMessageEndPoint mdbMessageEndPoint)
Release an endpoint created by this factory.

Parameters:
mdbMessageEndPoint - the endpoint to release.

isDeliveryTransacted

public boolean isDeliveryTransacted(java.lang.reflect.Method method)
                             throws java.lang.NoSuchMethodException
This is used to find out whether message deliveries to a target method on a message listener interface that is implemented by a message endpoint will be transacted or not. The message endpoint may indicate its transacted delivery preferences (at a per method level) through its deployment descriptor. The message delivery preferences must not change during the lifetime of a message endpoint.

Specified by:
isDeliveryTransacted in interface javax.resource.spi.endpoint.MessageEndpointFactory
Parameters:
method - description of a target method. This information about the intended target method allows an application server to find out whether the target method call will be transacted or not.
Returns:
boolean whether the specified method is transacted
Throws:
java.lang.NoSuchMethodException - exception to throw

stop

public void stop()
Stops the factory.

Specified by:
stop in interface Factory<EasyBeansMDB,java.lang.Long>
Overrides:
stop in class MDBFactory