org.apache.activemq.ra
Class ActiveMQResourceAdapter

java.lang.Object
  extended by org.apache.activemq.ra.ActiveMQResourceAdapter
All Implemented Interfaces:
java.io.Serializable, javax.resource.spi.ResourceAdapter

public class ActiveMQResourceAdapter
extends java.lang.Object
implements javax.resource.spi.ResourceAdapter, java.io.Serializable

Knows how to connect to one ActiveMQ server. It can then activate endpoints and deliver messages to those end points using the connection configure in the resource adapter.

Must override equals and hashCode (JCA spec 16.4)

Version:
$Revision$
See Also:
Serialized Form

Constructor Summary
ActiveMQResourceAdapter()
           
 
Method Summary
 void endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory endpointFactory, javax.resource.spi.ActivationSpec activationSpec)
           
 void endpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory endpointFactory, javax.resource.spi.ActivationSpec activationSpec)
           
 boolean equals(java.lang.Object o)
           
 javax.resource.spi.BootstrapContext getBootstrapContext()
           
 java.lang.String getBrokerXmlConfig()
           
 java.lang.String getClientid()
           
 ActiveMQConnectionFactory getConnectionFactory()
           
 java.lang.Integer getDurableTopicPrefetch()
           
 ActiveMQConnectionRequestInfo getInfo()
           
 java.lang.Long getInitialRedeliveryDelay()
           
 java.lang.Integer getInputStreamPrefetch()
           
 java.lang.Integer getMaximumRedeliveries()
           
 java.lang.String getPassword()
           
 java.lang.Integer getQueueBrowserPrefetch()
           
 java.lang.Integer getQueuePrefetch()
           
 java.lang.Short getRedeliveryBackOffMultiplier()
           
 java.lang.Boolean getRedeliveryUseExponentialBackOff()
           
 java.lang.String getServerUrl()
           
 java.lang.Integer getTopicPrefetch()
           
 java.lang.Boolean getUseInboundSession()
           
 java.lang.String getUserName()
           
 javax.transaction.xa.XAResource[] getXAResources(javax.resource.spi.ActivationSpec[] activationSpecs)
          We only connect to one resource manager per ResourceAdapter instance, so any ActivationSpec will return the same XAResource.
 int hashCode()
           
 boolean isUseInboundSessionEnabled()
           
 ActiveMQConnection makeConnection()
           
 ActiveMQConnection makeConnection(ActiveMQActivationSpec activationSpec)
           
 ActiveMQConnection makeConnection(ActiveMQConnectionRequestInfo info)
           
 ActiveMQConnection makeConnection(ActiveMQConnectionRequestInfo info, ActiveMQConnectionFactory connectionFactory)
           
 void setAllPrefetchValues(java.lang.Integer i)
           
 void setBrokerXmlConfig(java.lang.String brokerXmlConfig)
          Sets the XML configuration file used to configure the ActiveMQ broker via Spring if using embedded mode.
 void setClientid(java.lang.String clientid)
           
 void setConnectionFactory(ActiveMQConnectionFactory connectionFactory)
          This allows a connection factory to be configured and shared between a ResourceAdaptor and outbound messaging.
 void setDurableTopicPrefetch(java.lang.Integer durableTopicPrefetch)
           
 void setInitialRedeliveryDelay(java.lang.Long value)
           
 void setInputStreamPrefetch(java.lang.Integer inputStreamPrefetch)
           
 void setMaximumRedeliveries(java.lang.Integer value)
           
 void setPassword(java.lang.String password)
           
 void setQueueBrowserPrefetch(java.lang.Integer queueBrowserPrefetch)
           
 void setQueuePrefetch(java.lang.Integer queuePrefetch)
           
 void setRedeliveryBackOffMultiplier(java.lang.Short value)
           
 void setRedeliveryUseExponentialBackOff(java.lang.Boolean value)
           
 void setServerUrl(java.lang.String url)
           
 void setTopicPrefetch(java.lang.Integer topicPrefetch)
           
 void setUseInboundSession(java.lang.Boolean useInboundSession)
           
 void setUserName(java.lang.String userid)
           
 void start(javax.resource.spi.BootstrapContext bootstrapContext)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActiveMQResourceAdapter

public ActiveMQResourceAdapter()
Method Detail

start

public void start(javax.resource.spi.BootstrapContext bootstrapContext)
           throws javax.resource.spi.ResourceAdapterInternalException
Specified by:
start in interface javax.resource.spi.ResourceAdapter
Throws:
javax.resource.spi.ResourceAdapterInternalException
See Also:
ResourceAdapter.start(javax.resource.spi.BootstrapContext)

makeConnection

public ActiveMQConnection makeConnection()
                                  throws javax.jms.JMSException
Throws:
javax.jms.JMSException

makeConnection

public ActiveMQConnection makeConnection(ActiveMQConnectionRequestInfo info)
                                  throws javax.jms.JMSException
Throws:
javax.jms.JMSException

makeConnection

public ActiveMQConnection makeConnection(ActiveMQConnectionRequestInfo info,
                                         ActiveMQConnectionFactory connectionFactory)
                                  throws javax.jms.JMSException
Throws:
javax.jms.JMSException

makeConnection

public ActiveMQConnection makeConnection(ActiveMQActivationSpec activationSpec)
                                  throws javax.jms.JMSException
Parameters:
activationSpec -
Throws:
javax.jms.JMSException

stop

public void stop()
Specified by:
stop in interface javax.resource.spi.ResourceAdapter
See Also:
ResourceAdapter.stop()

getBootstrapContext

public javax.resource.spi.BootstrapContext getBootstrapContext()
Returns:

endpointActivation

public void endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory endpointFactory,
                               javax.resource.spi.ActivationSpec activationSpec)
                        throws javax.resource.ResourceException
Specified by:
endpointActivation in interface javax.resource.spi.ResourceAdapter
Throws:
javax.resource.ResourceException
See Also:
ResourceAdapter.endpointActivation(javax.resource.spi.endpoint.MessageEndpointFactory, javax.resource.spi.ActivationSpec)

endpointDeactivation

public void endpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory endpointFactory,
                                 javax.resource.spi.ActivationSpec activationSpec)
Specified by:
endpointDeactivation in interface javax.resource.spi.ResourceAdapter
See Also:
ResourceAdapter.endpointDeactivation(javax.resource.spi.endpoint.MessageEndpointFactory, javax.resource.spi.ActivationSpec)

getXAResources

public javax.transaction.xa.XAResource[] getXAResources(javax.resource.spi.ActivationSpec[] activationSpecs)
                                                 throws javax.resource.ResourceException
We only connect to one resource manager per ResourceAdapter instance, so any ActivationSpec will return the same XAResource.

Specified by:
getXAResources in interface javax.resource.spi.ResourceAdapter
Throws:
javax.resource.ResourceException
See Also:
ResourceAdapter.getXAResources(javax.resource.spi.ActivationSpec[])

getClientid

public java.lang.String getClientid()
Returns:

getPassword

public java.lang.String getPassword()
Returns:

getServerUrl

public java.lang.String getServerUrl()
Returns:

getUserName

public java.lang.String getUserName()
Returns:

setClientid

public void setClientid(java.lang.String clientid)
Parameters:
clientid -

setPassword

public void setPassword(java.lang.String password)
Parameters:
password -

setServerUrl

public void setServerUrl(java.lang.String url)
Parameters:
url -

setUserName

public void setUserName(java.lang.String userid)
Parameters:
userid -

getBrokerXmlConfig

public java.lang.String getBrokerXmlConfig()

setBrokerXmlConfig

public void setBrokerXmlConfig(java.lang.String brokerXmlConfig)
Sets the XML configuration file used to configure the ActiveMQ broker via Spring if using embedded mode.

Parameters:
brokerXmlConfig - is the filename which is assumed to be on the classpath unless a URL is specified. So a value of foo/bar.xml would be assumed to be on the classpath whereas file:dir/file.xml would use the file system. Any valid URL string is supported.
See Also:
#setUseEmbeddedBroker(Boolean)

getDurableTopicPrefetch

public java.lang.Integer getDurableTopicPrefetch()

getInitialRedeliveryDelay

public java.lang.Long getInitialRedeliveryDelay()

getInputStreamPrefetch

public java.lang.Integer getInputStreamPrefetch()

getMaximumRedeliveries

public java.lang.Integer getMaximumRedeliveries()

getQueueBrowserPrefetch

public java.lang.Integer getQueueBrowserPrefetch()

getQueuePrefetch

public java.lang.Integer getQueuePrefetch()

getRedeliveryBackOffMultiplier

public java.lang.Short getRedeliveryBackOffMultiplier()

getRedeliveryUseExponentialBackOff

public java.lang.Boolean getRedeliveryUseExponentialBackOff()

getTopicPrefetch

public java.lang.Integer getTopicPrefetch()

isUseInboundSessionEnabled

public boolean isUseInboundSessionEnabled()

setAllPrefetchValues

public void setAllPrefetchValues(java.lang.Integer i)

setDurableTopicPrefetch

public void setDurableTopicPrefetch(java.lang.Integer durableTopicPrefetch)

setInitialRedeliveryDelay

public void setInitialRedeliveryDelay(java.lang.Long value)

setInputStreamPrefetch

public void setInputStreamPrefetch(java.lang.Integer inputStreamPrefetch)

setMaximumRedeliveries

public void setMaximumRedeliveries(java.lang.Integer value)

setQueueBrowserPrefetch

public void setQueueBrowserPrefetch(java.lang.Integer queueBrowserPrefetch)

setQueuePrefetch

public void setQueuePrefetch(java.lang.Integer queuePrefetch)

setRedeliveryBackOffMultiplier

public void setRedeliveryBackOffMultiplier(java.lang.Short value)

setRedeliveryUseExponentialBackOff

public void setRedeliveryUseExponentialBackOff(java.lang.Boolean value)

setTopicPrefetch

public void setTopicPrefetch(java.lang.Integer topicPrefetch)

getInfo

public ActiveMQConnectionRequestInfo getInfo()
Returns:
Returns the info.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

getUseInboundSession

public java.lang.Boolean getUseInboundSession()

setUseInboundSession

public void setUseInboundSession(java.lang.Boolean useInboundSession)

getConnectionFactory

public ActiveMQConnectionFactory getConnectionFactory()

setConnectionFactory

public void setConnectionFactory(ActiveMQConnectionFactory connectionFactory)
This allows a connection factory to be configured and shared between a ResourceAdaptor and outbound messaging. Note that setting the connectionFactory will overload many of the properties on this POJO such as the redelivery and prefetch policies; the properties on the connectionFactory will be used instead.



Copyright © 2009 Apache Software Foundation. All Rights Reserved.