Class JoramResourceAdapter

  • All Implemented Interfaces:
    jakarta.jms.ExceptionListener, jakarta.resource.spi.ResourceAdapter, Serializable
    Direct Known Subclasses:
    JoramAdapter

    public class JoramResourceAdapter
    extends Object
    implements jakarta.resource.spi.ResourceAdapter, jakarta.jms.ExceptionListener, Serializable
    A JoramResourceAdapter instance manages connectivities to an underlying JORAM server: outbound connectivity (JCA connection management contract) and inbound connectivity (asynchronous message delivery as specified by the JCA message inflow contract).
    See Also:
    Serialized Form
    • Field Detail

      • serialVersionUID

        private static final long serialVersionUID
        Define serialVersionUID for interoperability.
        See Also:
        Constant Field Values
      • logger

        private static final Logger logger
      • DEBUG

        private static final boolean DEBUG
      • jndiHelper

        protected JndiHelper jndiHelper
        the jndi helper
      • jmxRootName

        protected static String jmxRootName
        Name of the root in the MBean tree
      • boundNames

        private Vector<String> boundNames
        Names of the bound objects.
      • workManager

        private transient jakarta.resource.spi.work.WorkManager workManager
        WorkManager instance provided by the application server.
      • name

        protected String name
        the Joram resource adapter name
      • jndiName

        protected String jndiName
        the Joram resource adapter jndi name
      • consumers

        private transient Hashtable<ActivationSpecImpl,​InboundConsumer> consumers
        Table holding the adapter's InboundConsumer instances, for inbound messaging.

        Key: ActivationSpec instance
        Value: InboundConsumer instance

      • producers

        private transient Vector<ManagedConnectionImpl> producers
        Vector holding the ManagedConnectionImpl instances for managed outbound messaging.
      • connections

        private transient Hashtable<String,​jakarta.jms.XAConnection> connections
        Table holding the adapter's XAConnection instances used for recovering the XA resources.

        Key: user name
        Value: XAConnection instance

    • Constructor Detail

      • JoramResourceAdapter

        public JoramResourceAdapter()
        Constructs a JoramResourceAdapter instance.
      • JoramResourceAdapter

        public JoramResourceAdapter​(MBeanServer jmxServer)
        Constructs a JoramResourceAdapter instance.
    • Method Detail

      • getStatus

        public int getStatus()
      • getStatusInfo

        public String getStatusInfo()
      • setJmxServer

        public void setJmxServer​(MBeanServer jmxServer)
      • setWorkManager

        public void setWorkManager​(jakarta.resource.spi.work.WorkManager workManager)
      • getName

        public String getName()
        Returns:
        the name
      • setName

        public void setName​(String name)
        Parameters:
        name - the name to set
      • getJndiName

        public String getJndiName()
        Returns:
        the jndiName
      • setJndiName

        public void setJndiName​(String jndiName)
        Parameters:
        jndiName - the jndiName to set
      • start

        public void start​(jakarta.resource.spi.BootstrapContext ctx)
                   throws jakarta.resource.spi.ResourceAdapterInternalException
        Initializes the adapter
        Specified by:
        start in interface jakarta.resource.spi.ResourceAdapter
        Throws:
        jakarta.resource.spi.ResourceAdapterInternalException - If the adapter could not be initialized.
      • start

        public void start()
                   throws jakarta.resource.spi.ResourceAdapterInternalException
        Throws:
        jakarta.resource.spi.ResourceAdapterInternalException
      • stop

        public void stop()
        Notifies the adapter to terminate the connections it manages, and if needed.
        Specified by:
        stop in interface jakarta.resource.spi.ResourceAdapter
      • endpointActivation

        public void endpointActivation​(jakarta.resource.spi.endpoint.MessageEndpointFactory endpointFactory,
                                       jakarta.resource.spi.ActivationSpec spec)
                                throws jakarta.resource.ResourceException
        Notifies the adapter to setup asynchronous message delivery for an application server endpoint.
        Specified by:
        endpointActivation in interface jakarta.resource.spi.ResourceAdapter
        Throws:
        jakarta.resource.spi.IllegalStateException - If the adapter is either not started, or stopped.
        jakarta.resource.NotSupportedException - If the provided activation parameters are invalid.
        jakarta.resource.spi.CommException - If the JORAM server is not reachable.
        jakarta.resource.spi.SecurityException - If connecting is not allowed.
        jakarta.resource.ResourceException - Generic exception.
      • getXAResources

        public XAResource[] getXAResources​(jakarta.resource.spi.ActivationSpec[] specs)
                                    throws jakarta.resource.ResourceException
        Returns XA resources given an array of ActivationSpec instances.
        Specified by:
        getXAResources in interface jakarta.resource.spi.ResourceAdapter
        Throws:
        jakarta.resource.spi.IllegalStateException - If the adapter is either not started, or stopped.
        jakarta.resource.NotSupportedException - If provided activation parameters are invalid.
        jakarta.resource.spi.CommException - If the JORAM server is not reachable.
        jakarta.resource.spi.SecurityException - If connecting is not allowed.
        jakarta.resource.ResourceException - Generic exception.
      • addProducer

        void addProducer​(ManagedConnectionImpl managedCx)
        Adds a given managed connection to the list of producers.
      • onException

        public void onException​(jakarta.jms.JMSException exception)
        Specified by:
        onException in interface jakarta.jms.ExceptionListener
      • endpointDeactivation

        public void endpointDeactivation​(jakarta.resource.spi.endpoint.MessageEndpointFactory endpointFactory,
                                         jakarta.resource.spi.ActivationSpec spec)
        Notifies the adapter to deactivate message delivery for a given endpoint.
        Specified by:
        endpointDeactivation in interface jakarta.resource.spi.ResourceAdapter
      • removeProducer

        void removeProducer​(ManagedConnectionImpl managedCx)
        Removes a given managed connection from the list of producers.
      • getJMSVersion

        public String getJMSVersion()
        Gets the JMS API version.
        Returns:
        The JMS API version.
      • getJMSProviderName

        public String getJMSProviderName()
        Get the provider name: Joram.
        Returns:
        The provider name: Joram.
      • getProviderVersion

        public String getProviderVersion()
        Gets the Joram's implementation version.
        Returns:
        The Joram's implementation version.
      • bind

        protected void bind​(String name,
                            Object obj)
        Binds an object to the JNDI context.
      • unbind

        protected void unbind​(String name)
        Unbinds an object from the JNDI context.
      • createCF

        public void createCF​(String name,
                             ManagedConnectionFactoryImpl mcf)
        Creates a non managed connection factory and binds it to JNDI.
        Parameters:
        name - Name of created connection factory.
      • createQueueCF

        public void createQueueCF​(String name,
                                  ManagedConnectionFactoryImpl mcf)
        Creates a non managed PTP connection factory and binds it to JNDI.
        Parameters:
        name - Name of created connection factory.
      • createTopicCF

        public void createTopicCF​(String name,
                                  ManagedConnectionFactoryImpl mcf)
        Creates a non managed PubSub connection factory and binds it to JNDI.
        Parameters:
        name - Name of created connection factory.