Class AbstractMessageEndpointFactory

java.lang.Object
org.springframework.jca.endpoint.AbstractMessageEndpointFactory
All Implemented Interfaces:
jakarta.resource.spi.endpoint.MessageEndpointFactory, Aware, BeanNameAware
Direct Known Subclasses:
GenericMessageEndpointFactory, JmsMessageEndpointFactory

public abstract class AbstractMessageEndpointFactory extends Object implements jakarta.resource.spi.endpoint.MessageEndpointFactory, BeanNameAware
Abstract base implementation of the JCA 1.7 MessageEndpointFactory interface, providing transaction management capabilities as well as ClassLoader exposure for endpoint invocations.
Since:
2.5
Author:
Juergen Hoeller
See Also:
  • Field Details

    • logger

      protected final org.apache.commons.logging.Log logger
      Logger available to subclasses.
  • Constructor Details

    • AbstractMessageEndpointFactory

      public AbstractMessageEndpointFactory()
  • Method Details

    • setTransactionManager

      public void setTransactionManager(Object transactionManager)
      Set the XA transaction manager to use for wrapping endpoint invocations, enlisting the endpoint resource in each such transaction.

      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.

      See Also:
    • setTransactionFactory

      public void setTransactionFactory(TransactionFactory transactionFactory)
      Set the Spring TransactionFactory to use for wrapping endpoint invocations, enlisting the endpoint resource in each such transaction.

      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.

      See Also:
    • setTransactionName

      public void setTransactionName(String transactionName)
      Specify the name of the transaction, if any.

      Default is none. A specified name will be passed on to the transaction manager, allowing to identify the transaction in a transaction monitor.

    • setTransactionTimeout

      public void setTransactionTimeout(int transactionTimeout)
      Specify the transaction timeout, if any.

      Default is -1: rely on the transaction manager's default timeout. Specify a concrete timeout to restrict the maximum duration of each endpoint invocation.

    • setBeanName

      public void setBeanName(String beanName)
      Set the name of this message endpoint. Populated with the bean name automatically when defined within Spring's bean factory.
      Specified by:
      setBeanName in interface BeanNameAware
      Parameters:
      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.
    • getActivationName

      public @Nullable String getActivationName()
      Implementation of the JCA 1.7 #getActivationName() method, returning the bean name as set on this MessageEndpointFactory.
      Specified by:
      getActivationName in interface jakarta.resource.spi.endpoint.MessageEndpointFactory
      See Also:
    • getEndpointClass

      public @Nullable Class<?> getEndpointClass()
      Implementation of the JCA 1.7 #getEndpointClass() method, returning null in order to indicate a synthetic endpoint type.
      Specified by:
      getEndpointClass in interface jakarta.resource.spi.endpoint.MessageEndpointFactory
    • isDeliveryTransacted

      public boolean isDeliveryTransacted(Method method) throws NoSuchMethodException
      This implementation returns true if a transaction manager has been specified; false otherwise.
      Specified by:
      isDeliveryTransacted in interface jakarta.resource.spi.endpoint.MessageEndpointFactory
      Throws:
      NoSuchMethodException
      See Also:
    • createEndpoint

      public jakarta.resource.spi.endpoint.MessageEndpoint createEndpoint(XAResource xaResource) throws jakarta.resource.spi.UnavailableException
      The standard JCA 1.5 version of createEndpoint.

      This implementation delegates to createEndpointInternal(), initializing the endpoint's XAResource before the endpoint gets invoked.

      Specified by:
      createEndpoint in interface jakarta.resource.spi.endpoint.MessageEndpointFactory
      Throws:
      jakarta.resource.spi.UnavailableException
    • createEndpoint

      public jakarta.resource.spi.endpoint.MessageEndpoint createEndpoint(XAResource xaResource, long timeout) throws jakarta.resource.spi.UnavailableException
      The alternative JCA 1.6 version of createEndpoint.

      This implementation delegates to createEndpointInternal(), ignoring the specified timeout. It is only here for JCA 1.6 compliance.

      Specified by:
      createEndpoint in interface jakarta.resource.spi.endpoint.MessageEndpointFactory
      Throws:
      jakarta.resource.spi.UnavailableException
    • createEndpointInternal

      protected abstract AbstractMessageEndpointFactory.AbstractMessageEndpoint createEndpointInternal() throws jakarta.resource.spi.UnavailableException
      Create the actual endpoint instance, as a subclass of the AbstractMessageEndpointFactory.AbstractMessageEndpoint inner class of this factory.
      Returns:
      the actual endpoint instance (never null)
      Throws:
      jakarta.resource.spi.UnavailableException - if no endpoint is available at present