com.ibm.wsspi.rawrapper
Class JNDIActivationSpec
- java.lang.Object
com.ibm.wsspi.rawrapper.JNDIActivationSpec
All implemented interfaces:
javax.resource.spi.ActivationSpec, javax.resource.spi.ResourceAdapterAssociation
- public class JNDIActivationSpec
- extends java.lang.Object
- implements javax.resource.spi.ActivationSpec
To set these properties, call the various setter methods.
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 |
---|
JNDIActivationSpec()
Zero arg constructor ONLY for use as a java bean containing three fields
|
Method Summary
Modifier and Type | Method and Description |
---|---|
|
getActSpecJndiName()
Gets the JNDI name of the activation spec to use.
|
|
getApplicationEndpointID()
gets the application endpoint name.
|
|
getDestinationJndiName()
Get the overridden jndi name of the destination
|
|
getResourceAdapter()
This method is part of the activation spec inteface and is not expected
to be called by the user
|
|
setActSpecJndiName(java.lang.String actSpecJndiName)
Sets the JNDI name of the activation spec to use
|
|
setApplicationEndpointID(java.lang.String applicationEndpointID)
This method sets the required application endpoint ID property.
|
|
setDestinationJndiName(java.lang.String destJndiName)
Optional: Sets the JNDI name of the destination to use.
|
|
setResourceAdapter(javax.resource.spi.ResourceAdapter ra)
This method is part of the activation spec inteface and is not expected
to be called by the user
|
|
toString()
This to string method will print out the property values along with the
objects memory address
|
|
validate()
This method is called by the WAS framework to validate the activation
spec, this will check this object activation spec and NOT the activation
spec specified by the actSpecJndiName property.
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail
JNDIActivationSpec
- public JNDIActivationSpec()
Zero arg constructor ONLY for use as a java bean containing three fields
Method Detail
getActSpecJndiName
- public java.lang.String getActSpecJndiName( )
Gets the JNDI name of the activation spec to use.
Returns:
the _jmsActSpecJndiName
setActSpecJndiName
- public void setActSpecJndiName( java.lang.String actSpecJndiName)
Sets the JNDI name of the activation spec to use
Parameters:
actSpecJndiName
- the _jmsActSpecJndiName to set getDestinationJndiName
- public java.lang.String getDestinationJndiName( )
Get the overridden jndi name of the destination
Returns:
the _jmsDestJndiName
setDestinationJndiName
- public void setDestinationJndiName( java.lang.String destJndiName)
Optional: Sets the JNDI name of the destination to use. This will
override the destination JNDI name specified in the activation spec that
ActSpecJndiName refers to
Parameters:
destJndiName
- the _jmsDestJndiName to set getApplicationEndpointID
- public java.lang.String getApplicationEndpointID( )
gets the application endpoint name. This field must be set by the creator
of the JNDIActivationSpec object
Returns:
the application endpoint ID
setApplicationEndpointID
- public void setApplicationEndpointID( java.lang.String applicationEndpointID)
This method sets the required application endpoint ID property. This
property is used to uniquely identify an endpoint within the scope of an
application.
Parameters:
applicationEndpointID
- validate
- public void validate()
- throws javax.resource.spi.InvalidPropertyException
This method is called by the WAS framework to validate the activation
spec, this will check this object activation spec and NOT the activation
spec specified by the actSpecJndiName property. Validate that we have at
least a JMS activation spec JNDI name specified and an application
endpoint ID specified.
Specified by:
validate
in interface javax.resource.spi.ActivationSpec
Throws:
javax.resource.spi.InvalidPropertyException
toString
- public java.lang.String toString( )
This to string method will print out the property values along with the
objects memory address
Overrides:
toString
in class java.lang.Object
getResourceAdapter
- public javax.resource.spi.ResourceAdapter getResourceAdapter( )
This method is part of the activation spec inteface and is not expected
to be called by the user
Specified by:
getResourceAdapter
in interface javax.resource.spi.ResourceAdapterAssociation
setResourceAdapter
- public void setResourceAdapter( javax.resource.spi.ResourceAdapter ra)
- throws javax.resource.ResourceException
This method is part of the activation spec inteface and is not expected
to be called by the user
Specified by:
setResourceAdapter
in interface javax.resource.spi.ResourceAdapterAssociation
Throws:
javax.resource.ResourceException