com.ibm.wsspi.rawrapper
Class RAWrapperFactory
- java.lang.Object
com.ibm.wsspi.rawrapper.RAWrapperFactory
- public class RAWrapperFactory
- extends java.lang.Object
Authentication aliases
Example:
Resource ref from the xml file:
<resource-ref id="ResourceRef_ID">
<description>com.ibm.ejs.models.base.resources.j2c.J2CActivationSpec</description>
<res-ref-name>ExampleResAuthName</res-ref-name>
<res-type>J2CActivationSpec</res-type>
<res-auth>Container</res-auth> <-- thiscouldalsobesettoapplication,butfortheresourcereftouseit,itmustbesettocontainer
<res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>
Bindings information from the bindings file.
<resource-ref name="ExampleResAuthName" binding-name="notused"> <-- thismustbeset,butisnotused
<authentication-alias name="my_auth_alias" />
</resource-ref>
Java 2 Security
Transactional Behaviour
Implementations of Message Endpoint can optionally implement the following method: public void markInboundTransaction () This method tells the message endpoint that there is a transaction on the thread when message delivery occurs. This method is called reflectively during before-delivery processing, before the run time calls the isDeliveryTransacted method on the MessageEndpointFactory interface.
Example activation
public void exampleActivate () throws ResourceException{
try
{
ResourceAdapter ra = RAWrapperFactory.getRAWrapper();
JNDIActivationSpec jndiActSpec = new JNDIActivationSpec ();
jndiActSpec.setActSpecJndiName("jms/actSpec");
jndiActSpec.setApplicationEndpointID("id");
MessageEndpointFactory mef = new ExampleMEFImplentation (); // See ExampleMEFImplemention below
ra.endpointActivation(mef, jndiActSpec);
}
catch (ResourceException ex)
{
ex.printStackTrace ();
}
}
import java.lang.reflect.Method;
import javax.resource.spi.UnavailableException;
import javax.resource.spi.endpoint.MessageEndpoint;
import javax.resource.spi.endpoint.MessageEndpointFactory;
import javax.transaction.xa.XAResource;
public class ExampleMEFImplentation implements MessageEndpointFactory
{
public MessageEndpoint createEndpoint(XAResource arg0)
throws UnavailableException
{
return new ExampleMessageEndpoint (); // See ExampleMessageEndpoint below
}
public boolean isDeliveryTransacted(Method arg0)
throws NoSuchMethodException
{
return false;
}
}
The message endpoint class must implement both MessageEndpoint interface (for J2C activation) and MessageListener interface for the JMS provider to send messages to.
import java.lang.reflect.Method;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.resource.ResourceException;
import javax.resource.spi.endpoint.MessageEndpoint;
public class ExampleMessageEndpoint implements MessageEndpoint, MessageListener {
public void afterDelivery() throws ResourceException {
}
public void beforeDelivery(Method arg0) throws NoSuchMethodException,
ResourceException {
}
public void release() {
}
public void onMessage(Message arg0) {
}
}
Constructor Summary
Constructor and Description |
---|
RAWrapperFactory()
|
Method Summary
Modifier and Type | Method and Description |
---|---|
|
getRAWrapper()
This static method is called to obtain a new instance of a resource
adapter object and is the entry point for users wishing to use the
RAWrapper functionality.
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail
RAWrapperFactory
- public RAWrapperFactory()
Method Detail
getRAWrapper
- public static javax.resource.spi.ResourceAdapter getRAWrapper( )
Returns:
A new instance of a resource adapter used to wrap a messaging
resource adapter. If the property com.ibm.wsspi.rawrapper.enabled
on the server has not been set to true this will return null.
Throws:
java.security.AccessControlException
- if the calling code fails the java 2 security check
This method will perform a java 2 security check (using the RAFactoryPermission object with the permission name getRAWrapper).
If the feature has not been enabled (by setting the server property com.ibm.wsspi.rawrapper.enabled to true) then a null will be returned.