org.objectweb.easybeans.server.ra
Class EasyBeansResourceAdapter

java.lang.Object
  extended by org.objectweb.easybeans.server.ra.EasyBeansResourceAdapter
All Implemented Interfaces:
javax.resource.spi.ResourceAdapter

public class EasyBeansResourceAdapter
extends java.lang.Object
implements javax.resource.spi.ResourceAdapter

Defines a resource adapter which allow to embed the EJB3 server in Application Server. application server.

Author:
Florent Benoit

Nested Class Summary
 class EasyBeansResourceAdapter.EmbeddedStarter
          This inner class will wait until the JOnAS server is ready and start the embedded server.
 
Field Summary
private  Embedded embedded
          Embedded instance.
 
Constructor Summary
EasyBeansResourceAdapter()
           
 
Method Summary
 void endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory endpointFactory, javax.resource.spi.ActivationSpec spec)
          This is called during the activation of a message endpoint.
 void endpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory endpointFactory, javax.resource.spi.ActivationSpec spec)
          This is called when a message endpoint is deactivated.
protected  Embedded getEmbedded()
          Gets the embedded object.
 javax.transaction.xa.XAResource[] getXAResources(javax.resource.spi.ActivationSpec[] specs)
          This method is called by the application server during crash recovery.
 void start(javax.resource.spi.BootstrapContext ctx)
          Starts the embedded server.
 void stop()
          Stopp the embedded server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

embedded

private Embedded embedded
Embedded instance.

Constructor Detail

EasyBeansResourceAdapter

public EasyBeansResourceAdapter()
Method Detail

start

public void start(javax.resource.spi.BootstrapContext ctx)
           throws javax.resource.spi.ResourceAdapterInternalException
Starts the embedded server.

Specified by:
start in interface javax.resource.spi.ResourceAdapter
Parameters:
ctx - - a bootstrap context containing references to useful facilities that could be used by a resource adapter instance.
Throws:
javax.resource.spi.ResourceAdapterInternalException - indicates bootstrap failure.

stop

public void stop()
Stopp the embedded server.

Specified by:
stop in interface javax.resource.spi.ResourceAdapter

endpointActivation

public void endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory endpointFactory,
                               javax.resource.spi.ActivationSpec spec)
                        throws javax.resource.ResourceException
This is called during the activation of a message endpoint.

Specified by:
endpointActivation in interface javax.resource.spi.ResourceAdapter
Parameters:
endpointFactory - - a message endpoint factory instance.
spec - an activation spec JavaBean instance.
Throws:
javax.resource.ResourceException - - indicates message endpoint activation rejection due to incorrect activation setup information.

endpointDeactivation

public void endpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory endpointFactory,
                                 javax.resource.spi.ActivationSpec spec)
This is called when a message endpoint is deactivated. The instances passed as arguments to this method call should be identical to those passed in for the corresponding endpointActivation call. This causes the resource adapter to stop delivering messages to the message endpoint. Any exception thrown by this method is ignored. After this method call, the endpoint is deemed inactive.

Specified by:
endpointDeactivation in interface javax.resource.spi.ResourceAdapter
Parameters:
endpointFactory - a message endpoint factory instance.
spec - an activation spec JavaBean instance.

getXAResources

public javax.transaction.xa.XAResource[] getXAResources(javax.resource.spi.ActivationSpec[] specs)
                                                 throws javax.resource.ResourceException
This method is called by the application server during crash recovery.

Specified by:
getXAResources in interface javax.resource.spi.ResourceAdapter
Parameters:
specs - an array of ActivationSpec JavaBeans each of which corresponds to an deployed endpoint application that was active prior to the system crash.
Returns:
an array of XAResource objects each of which represents a unique resource manager.
Throws:
javax.resource.ResourceException - generic exception if operation fails due to an error condition.

getEmbedded

protected Embedded getEmbedded()
Gets the embedded object.

Returns:
embedded server.