public abstract class AbstractMessageEndpointFactory extends Object implements MessageEndpointFactory, BeanNameAware
MessageEndpointFactory
interface,
providing transaction management capabilities as well as ClassLoader
exposure for endpoint invocations.setTransactionManager(java.lang.Object)
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractMessageEndpointFactory.AbstractMessageEndpoint
Inner class for actual endpoint implementations, based on template
method to allow for any kind of concrete endpoint implementation.
|
Modifier and Type | Field and Description |
---|---|
protected Log |
logger
Logger available to subclasses
|
Constructor and Description |
---|
AbstractMessageEndpointFactory() |
Modifier and Type | Method and Description |
---|---|
MessageEndpoint |
createEndpoint(XAResource xaResource)
The standard JCA 1.5 version of
createEndpoint . |
MessageEndpoint |
createEndpoint(XAResource xaResource,
long timeout)
The alternative JCA 1.6 version of
createEndpoint . |
protected abstract AbstractMessageEndpointFactory.AbstractMessageEndpoint |
createEndpointInternal()
Create the actual endpoint instance, as a subclass of the
AbstractMessageEndpointFactory.AbstractMessageEndpoint inner class of this factory. |
String |
getActivationName()
Implementation of the JCA 1.7
#getActivationName() method,
returning the bean name as set on this MessageEndpointFactory. |
Class<?> |
getEndpointClass()
Implementation of the JCA 1.7
#getEndpointClass() method,
returning null in order to indicate a synthetic endpoint type. |
boolean |
isDeliveryTransacted(Method method)
This implementation returns
true if a transaction manager
has been specified; false otherwise. |
void |
setBeanName(String beanName)
Set the name of this message endpoint.
|
void |
setTransactionFactory(TransactionFactory transactionFactory)
Set the Spring TransactionFactory to use for wrapping endpoint
invocations, enlisting the endpoint resource in each such transaction.
|
void |
setTransactionManager(Object transactionManager)
Set the XA transaction manager to use for wrapping endpoint
invocations, enlisting the endpoint resource in each such transaction.
|
void |
setTransactionName(String transactionName)
Specify the name of the transaction, if any.
|
void |
setTransactionTimeout(int transactionTimeout)
Specify the transaction timeout, if any.
|
protected final Log logger
public void setTransactionManager(Object transactionManager)
The passed-in object may be a transaction manager which implements
Spring's TransactionFactory
interface, or a plain TransactionManager
.
If no transaction manager is specified, the endpoint invocation will simply not be wrapped in an XA transaction. Check out your resource provider's ActivationSpec documentation for local transaction options of your particular provider.
public void setTransactionFactory(TransactionFactory transactionFactory)
Alternatively, specify an appropriate transaction manager through
the "transactionManager"
property.
If no transaction factory is specified, the endpoint invocation will simply not be wrapped in an XA transaction. Check out your resource provider's ActivationSpec documentation for local transaction options of your particular provider.
public void setTransactionName(String transactionName)
Default is none. A specified name will be passed on to the transaction manager, allowing to identify the transaction in a transaction monitor.
public void setTransactionTimeout(int transactionTimeout)
Default is -1: rely on the transaction manager's default timeout. Specify a concrete timeout to restrict the maximum duration of each endpoint invocation.
public void setBeanName(String beanName)
setBeanName
in interface BeanNameAware
beanName
- the name of the bean in the factory.
Note that this name is the actual bean name used in the factory, which may
differ from the originally specified name: in particular for inner bean
names, the actual bean name might have been made unique through appending
"#..." suffixes. Use the BeanFactoryUtils.originalBeanName(String)
method to extract the original bean name (without suffix), if desired.@Nullable public String getActivationName()
#getActivationName()
method,
returning the bean name as set on this MessageEndpointFactory.getActivationName
in interface MessageEndpointFactory
setBeanName(java.lang.String)
@Nullable public Class<?> getEndpointClass()
#getEndpointClass()
method,
returning null in order to indicate a synthetic endpoint type.getEndpointClass
in interface MessageEndpointFactory
public boolean isDeliveryTransacted(Method method) throws NoSuchMethodException
true
if a transaction manager
has been specified; false
otherwise.isDeliveryTransacted
in interface MessageEndpointFactory
NoSuchMethodException
setTransactionManager(java.lang.Object)
,
setTransactionFactory(org.springframework.transaction.jta.TransactionFactory)
public MessageEndpoint createEndpoint(XAResource xaResource) throws UnavailableException
createEndpoint
.
This implementation delegates to createEndpointInternal()
,
initializing the endpoint's XAResource before the endpoint gets invoked.
createEndpoint
in interface MessageEndpointFactory
UnavailableException
public MessageEndpoint createEndpoint(XAResource xaResource, long timeout) throws UnavailableException
createEndpoint
.
This implementation delegates to createEndpointInternal()
,
ignoring the specified timeout. It is only here for JCA 1.6 compliance.
createEndpoint
in interface MessageEndpointFactory
UnavailableException
protected abstract AbstractMessageEndpointFactory.AbstractMessageEndpoint createEndpointInternal() throws UnavailableException
AbstractMessageEndpointFactory.AbstractMessageEndpoint
inner class of this factory.null
)UnavailableException
- if no endpoint is available at present