Fields Summary |
---|
private static final Logger | log |
protected boolean | traceWhether trace is enabled |
protected org.jboss.ejb3.mdb.MessagingContainer | containerOur container |
protected HashMap | propertiesThe activation properties |
protected Class | messagingTypeClassThe messaging type class |
protected String | resourceAdapterNameThe resource adapter name |
protected ObjectName | resourceAdapterObjectName |
protected javax.resource.spi.ActivationSpec | activationSpecThe activation spec |
protected Class[] | interfacesThe interfaces |
protected EDU.oswego.cs.dl.util.concurrent.SynchronizedInt | nextProxyIdThe next proxy id |
protected String[] | createActivationSpecSigThe signature for createActivationSpec |
protected String[] | activationSigThe signature for activate/deactivateEndpint |
Methods Summary |
---|
protected void | activate()Activate
Object[] params = new Object[] { this, activationSpec };
try
{
KernelAbstractionFactory.getInstance().invoke(resourceAdapterObjectName, "endpointActivation", params, activationSig);
}
catch (Throwable t)
{
t = JMXExceptionDecoder.decode(t);
DeploymentException.rethrowAsDeploymentException("Endpoint activation failed ra=" + resourceAdapterObjectName +
" activationSpec=" + activationSpec, t);
}
|
protected void | createActivationSpec()Create the activation spec
properties = new HashMap(container.getActivationConfigProperties());
Object[] params = new Object[]
{
messagingTypeClass,
properties.values()
};
try
{
activationSpec = (ActivationSpec) KernelAbstractionFactory.getInstance().invoke(resourceAdapterObjectName, "createActivationSpec", params, createActivationSpecSig);
}
catch (Throwable t)
{
t = JMXExceptionDecoder.decode(t);
DeploymentException.rethrowAsDeploymentException("Unable to create activation spec ra=" + resourceAdapterObjectName +
" messaging-type=" + messagingTypeClass.getName() + " properties=" + container.getActivationConfigProperties(), t);
}
|
public javax.resource.spi.endpoint.MessageEndpoint | createEndpoint(javax.transaction.xa.XAResource resource)
trace = log.isTraceEnabled();
if (trace)
log.trace("createEndpoint " + this + " xaResource=" + resource);
MessageEndpoint endpoint = createProxy(resource);
if (trace)
log.trace("Created endpoint " + endpoint + " from " + this);
return endpoint;
|
protected javax.resource.spi.endpoint.MessageEndpoint | createProxy(javax.transaction.xa.XAResource resource)
try
{
Class proxyClass = java.lang.reflect.Proxy.getProxyClass(container.getBeanClass().getClassLoader(), interfaces);
final Class[] constructorParams = {InvocationHandler.class};
java.lang.reflect.Constructor proxyConstructor = proxyClass.getConstructor(constructorParams);
MessageInflowLocalProxy proxy = new MessageInflowLocalProxy(container);
proxy.setXaResource(resource);
proxy.setMessageEndpointFactory(this);
Object[] args = {proxy};
MessageEndpoint endpoint = (MessageEndpoint)proxyConstructor.newInstance(args);
return endpoint;
} catch (Exception e)
{
e.printStackTrace();
return null;
}
|
protected void | deactivate()Deactivate
Object[] params = new Object[] { this, activationSpec };
try
{
KernelAbstractionFactory.getInstance().invoke(resourceAdapterObjectName, "endpointDeactivation", params, activationSig);
}
catch (Throwable t)
{
t = JMXExceptionDecoder.decode(t);
log.warn("Endpoint activation failed ra=" + resourceAdapterObjectName +
" activationSpec=" + activationSpec, t);
}
|
public org.jboss.ejb3.mdb.MessagingContainer | getContainer()Get the message driven container
return container;
|
public boolean | isDeliveryTransacted(java.lang.reflect.Method method)
TransactionManagementType mtype = TxUtil.getTransactionManagementType(container);
if (mtype == javax.ejb.TransactionManagementType.BEAN) return false;
TransactionAttribute attr = (TransactionAttribute)container.resolveAnnotation(method, TransactionAttribute.class);
if (attr == null)
{
attr =(TransactionAttribute)container.resolveAnnotation(TransactionAttribute.class);
}
TransactionAttributeType type = TransactionAttributeType.REQUIRED;
if (attr != null) type = attr.value();
return type == javax.ejb.TransactionAttributeType.REQUIRED;
|
protected void | resolveMessageListener()Resolve message listener class
messagingTypeClass = container.getMessagingType();
|
protected void | resolveResourceAdapter()
try
{
resourceAdapterObjectName = new ObjectName("jboss.jca:service=RARDeployment,name='" + resourceAdapterName + "'");
// todo register with kernel and push dependencies to kernel
}
catch (MalformedObjectNameException e)
{
throw new RuntimeException(e);
}
|
protected void | resolveResourceAdapterName()Resolve the resource adapter name
resourceAdapterName = container.getResourceAdaptorName();
|
public void | setContainer(org.jboss.ejb3.Container container)Set the container for which this is an invoker to.
this.container = (MessagingContainer) container;
|
public void | start()
// Resolve the message listener
resolveMessageListener();
resolveResourceAdapterName();
// Resolve the resource adapter
resolveResourceAdapter();
// Create the activation config
createActivationSpec();
// Set up proxy parameters
// Set the interfaces
interfaces = new Class[] { MessageEndpoint.class, messagingTypeClass};
// Activate
activate();
|
public void | stop()
// Deactivate
deactivate();
|
public java.lang.String | toString()Return a string representation of the current config state.
StringBuffer buffer = new StringBuffer(100);
buffer.append(super.toString());
buffer.append("{ resourceAdapter=").append(resourceAdapterName);
buffer.append(", messagingType=").append(container.getMessagingType());
buffer.append(", ejbName=").append(container.getEjbName());
buffer.append(", activationConfig=").append(properties.values());
buffer.append(", activationSpec=").append(activationSpec);
buffer.append("}");
return buffer.toString();
|