org.mule.providers.jms
Class JmsConnector

java.lang.Object
  extended byorg.mule.providers.AbstractConnector
      extended byorg.mule.providers.AbstractServiceEnabledConnector
          extended byorg.mule.providers.jms.JmsConnector
All Implemented Interfaces:
ConnectionNotificationListener, Disposable, ExceptionListener, Initialisable, UMOConnectable, UMOConnector, UMOServerNotificationListener
Direct Known Subclasses:
AbstractOracleJmsConnector

public class JmsConnector
extends AbstractServiceEnabledConnector
implements ConnectionNotificationListener

JmsConnector is a JMS 1.0.2b compliant connector that can be used by a Mule endpoint. The connector supports all JMS functionality including topics and queues, durable subscribers, acknowledgement modes and local transactions.


Field Summary
 String password
           
 String username
           
 
Fields inherited from class org.mule.providers.AbstractServiceEnabledConnector
serviceDescriptor, serviceOverrides
 
Fields inherited from class org.mule.providers.AbstractConnector
connected, connecting, createDispatcherPerRequest, createMultipleTransactedReceivers, defaultInboundTransformer, defaultOutboundTransformer, defaultResponseTransformer, dispatcherFactory, dispatchers, disposed, disposing, exceptionListener, initialised, logger, name, receivers, serverSide, sessionHandler, started, startOnConnect
 
Fields inherited from interface org.mule.umo.provider.UMOConnector
INT_VALUE_NOT_SET
 
Constructor Summary
JmsConnector()
           
 
Method Summary
 void close(MessageProducer producer)
          Closes the MessageProducer
 void closeQuietly(MessageProducer producer)
          Closes the MessageProducer without throwing an exception (an error message is logged instead).
protected  Connection createConnection()
           
protected  ConnectionFactory createConnectionFactory()
           
protected  RedeliveryHandler createRedeliveryHandler()
           
 void doConnect()
          Template method where any connections should be made for the connector
 void doDisconnect()
          Template method where any connected resources used by the connector should be disconnected
protected  void doDispose()
          Template method to perform any work when destroying the connectoe
 void doInitialise()
           
 void doStart()
          Template method to perform any work when starting the connectoe
 int getAcknowledgementMode()
           
 String getClientId()
           
 Connection getConnection()
           
 ConnectionFactory getConnectionFactory()
           
 String getConnectionFactoryClass()
           
 String getConnectionFactoryJndiName()
           
 Map getConnectionFactoryProperties()
           
 JmsSupport getJmsSupport()
           
 Context getJndiContext()
           
 String getJndiInitialFactory()
           
 Map getJndiProviderProperties()
           
 String getJndiProviderUrl()
           
 int getMaxRedelivery()
           
 UMOMessageAdapter getMessageAdapter(Object message)
          Gets a UMOMessageAdapter for the endpoint for the given message (data)
 String getPassword()
           
 String getProtocol()
           
protected  Object getReceiverKey(UMOComponent component, UMOEndpoint endpoint)
          The method determines the key used to store the receiver against.
 String getRedeliveryHandler()
           
 ReplyToHandler getReplyToHandler()
           
 Session getSession(boolean transacted, boolean topic)
           
 Session getSession(UMOImmutableEndpoint endpoint)
           
 Object getSessionFactory(UMOEndpoint endpoint)
           
 Session getSessionFromTransaction()
           
 String getSpecification()
           
 String getUsername()
           
protected  void initJndiContext()
           
 boolean isCacheJmsSessions()
           
 boolean isDurable()
           
 boolean isForceJndiDestinations()
           
 boolean isJndiDestinations()
           
 boolean isNoLocal()
           
 boolean isPersistentDelivery()
           
 boolean isRecoverJmsConnections()
           
 boolean isRemoteSyncEnabled()
           
 void onNotification(UMOServerNotification notification)
           
 javax.jms.Message preProcessMessage(javax.jms.Message message, Session session)
          This method may be overridden in order to apply pre-processing to the message as soon as it arrives.
 void setAcknowledgementMode(int acknowledgementMode)
           
 void setCacheJmsSessions(boolean cacheJmsSessions)
           
 void setClientId(String clientId)
           
protected  void setConnection(Connection connection)
           
 void setConnectionFactory(ConnectionFactory connectionFactory)
           
 void setConnectionFactoryClass(String connectionFactoryClass)
           
 void setConnectionFactoryJndiName(String connectionFactoryJndiName)
           
 void setConnectionFactoryProperties(Map connectionFactoryProperties)
           
 void setDurable(boolean durable)
           
 void setForceJndiDestinations(boolean forceJndiDestinations)
           
 void setJmsSupport(JmsSupport jmsSupport)
           
 void setJndiContext(Context jndiContext)
           
 void setJndiDestinations(boolean jndiDestinations)
           
 void setJndiInitialFactory(String jndiInitialFactory)
           
 void setJndiProviderProperties(Map jndiProviderProperties)
           
 void setJndiProviderUrl(String jndiProviderUrl)
           
 void setMaxRedelivery(int maxRedelivery)
           
 void setNoLocal(boolean noLocal)
           
 void setPassword(String password)
           
 void setPersistentDelivery(boolean persistentDelivery)
           
 void setRecoverJmsConnections(boolean recover)
           
 void setRedeliveryHandler(String redeliveryHandler)
           
 void setSpecification(String specification)
           
 void setUsername(String username)
           
 boolean supportsProperty(String property)
          This method may be overridden in case a certain JMS implementation does not support all the standard JMS properties.
 
Methods inherited from class org.mule.providers.AbstractServiceEnabledConnector
createReceiver, getServiceDescriptor, getServiceOverrides, getStreamMessageAdapter, initFromServiceDescriptor, initialiseFromUrl, setServiceOverrides
 
Methods inherited from class org.mule.providers.AbstractConnector
checkDisposed, connect, createDispatcher, destroyReceiver, disconnect, dispose, disposeDispatchers, disposeReceivers, doStop, exceptionThrown, fireNotification, getConnectEventId, getConnectionDescription, getConnectionStrategy, getDefaultInboundTransformer, getDefaultOutboundTransformer, getDefaultResponseTransformer, getDispatcher, getDispatcher, getDispatcherFactory, getDispatchers, getDispatcherThreadingProfile, getExceptionListener, getName, getReceiver, getReceiver, getReceivers, getReceivers, getReceiverThreadingProfile, getSessionHandler, getSupportedProtocols, handleException, handleWorkException, initialise, isConnected, isCreateDispatcherPerRequest, isCreateMultipleTransactedReceivers, isDisposed, isDisposing, isEnableMessageEvents, isServerSide, isStarted, isUseSingleDispatcherThreadPool, isUseSingleReceiverThreadPool, lookupDispatcher, lookupReceiver, registerListener, registerSupportedProtocol, registerSupportedProtocolWithotPrefix, setConnectionStrategy, setCreateDispatcherPerRequest, setCreateMultipleTransactedReceivers, setDefaultInboundTransformer, setDefaultOutboundTransformer, setDefaultResponseTransformer, setDispatcherFactory, setDispatcherThreadingProfile, setEnableMessageEvents, setExceptionListener, setName, setReceiverThreadingProfile, setServerSide, setSessionHandler, setSupportedProtocols, setUseSingleDispatcherThreadPool, setUseSingleReceiverThreadPool, startConnector, stopConnector, supportsProtocol, unregisterListener, unregisterSupportedProtocol, workAccepted, workCompleted, workRejected, workStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

username

public String username

password

public String password
Constructor Detail

JmsConnector

public JmsConnector()
Method Detail

doInitialise

public void doInitialise()
                  throws InitialisationException
Overrides:
doInitialise in class AbstractServiceEnabledConnector
Throws:
InitialisationException

initJndiContext

protected void initJndiContext()
                        throws NamingException,
                               InitialisationException
Throws:
NamingException
InitialisationException

setConnection

protected void setConnection(Connection connection)

createConnectionFactory

protected ConnectionFactory createConnectionFactory()
                                             throws InitialisationException,
                                                    NamingException
Throws:
InitialisationException
NamingException

createConnection

protected Connection createConnection()
                               throws NamingException,
                                      JMSException,
                                      InitialisationException
Throws:
NamingException
JMSException
InitialisationException

doConnect

public void doConnect()
               throws ConnectException
Description copied from class: AbstractConnector
Template method where any connections should be made for the connector

Overrides:
doConnect in class AbstractConnector
Throws:
ConnectException

doDisconnect

public void doDisconnect()
                  throws ConnectException
Description copied from class: AbstractConnector
Template method where any connected resources used by the connector should be disconnected

Overrides:
doDisconnect in class AbstractConnector
Throws:
ConnectException

getMessageAdapter

public UMOMessageAdapter getMessageAdapter(Object message)
                                    throws MessagingException
Description copied from class: AbstractServiceEnabledConnector
Gets a UMOMessageAdapter for the endpoint for the given message (data)

Specified by:
getMessageAdapter in interface UMOConnector
Overrides:
getMessageAdapter in class AbstractServiceEnabledConnector
Parameters:
message - the data with which to initialise the UMOMessageAdapter
Returns:
the UMOMessageAdapter for the endpoint
Throws:
MessagingException - if the message parameter is not supported
See Also:
UMOMessageAdapter

getReceiverKey

protected Object getReceiverKey(UMOComponent component,
                                UMOEndpoint endpoint)
Description copied from class: AbstractConnector
The method determines the key used to store the receiver against.

Overrides:
getReceiverKey in class AbstractConnector
Parameters:
component - the component for which the endpoint is being registered
endpoint - the endpoint being registered for the component
Returns:
the key to store the newly created receiver against

getSessionFactory

public Object getSessionFactory(UMOEndpoint endpoint)

getSessionFromTransaction

public Session getSessionFromTransaction()

getSession

public Session getSession(boolean transacted,
                          boolean topic)
                   throws JMSException
Throws:
JMSException

doStart

public void doStart()
             throws UMOException
Description copied from class: AbstractConnector
Template method to perform any work when starting the connectoe

Overrides:
doStart in class AbstractConnector
Throws:
UMOException - if the method fails

getProtocol

public String getProtocol()
Specified by:
getProtocol in interface UMOConnector
Specified by:
getProtocol in class AbstractConnector

doDispose

protected void doDispose()
Description copied from class: AbstractConnector
Template method to perform any work when destroying the connectoe

Overrides:
doDispose in class AbstractConnector

getAcknowledgementMode

public int getAcknowledgementMode()
Returns:
Returns the acknowledgeMode.

setAcknowledgementMode

public void setAcknowledgementMode(int acknowledgementMode)
Parameters:
acknowledgementMode - The acknowledgementMode to set.

getConnectionFactoryJndiName

public String getConnectionFactoryJndiName()
Returns:
Returns the connectionFactoryJndiName.

setConnectionFactoryJndiName

public void setConnectionFactoryJndiName(String connectionFactoryJndiName)
Parameters:
connectionFactoryJndiName - The connectionFactoryJndiName to set.

isDurable

public boolean isDurable()
Returns:
Returns the durable.

setDurable

public void setDurable(boolean durable)
Parameters:
durable - The durable to set.

isNoLocal

public boolean isNoLocal()
Returns:
Returns the noLocal.

setNoLocal

public void setNoLocal(boolean noLocal)
Parameters:
noLocal - The noLocal to set.

isPersistentDelivery

public boolean isPersistentDelivery()
Returns:
Returns the persistentDelivery.

setPersistentDelivery

public void setPersistentDelivery(boolean persistentDelivery)
Parameters:
persistentDelivery - The persistentDelivery to set.

getJndiProviderProperties

public Map getJndiProviderProperties()
Returns:
Returns the JNDI providerProperties.
Since:
1.1

setJndiProviderProperties

public void setJndiProviderProperties(Map jndiProviderProperties)
Parameters:
jndiProviderProperties - The JNDI providerProperties to set.
Since:
1.1

getConnectionFactoryProperties

public Map getConnectionFactoryProperties()
Returns:
Returns underlying connection factory properties.

setConnectionFactoryProperties

public void setConnectionFactoryProperties(Map connectionFactoryProperties)
Parameters:
connectionFactoryProperties - properties to be set on the underlying ConnectionFactory.

getJndiInitialFactory

public String getJndiInitialFactory()

setJndiInitialFactory

public void setJndiInitialFactory(String jndiInitialFactory)

getJndiProviderUrl

public String getJndiProviderUrl()

setJndiProviderUrl

public void setJndiProviderUrl(String jndiProviderUrl)

getSession

public Session getSession(UMOImmutableEndpoint endpoint)
                   throws Exception
Throws:
Exception

getConnectionFactory

public ConnectionFactory getConnectionFactory()

setConnectionFactory

public void setConnectionFactory(ConnectionFactory connectionFactory)

getConnectionFactoryClass

public String getConnectionFactoryClass()

setConnectionFactoryClass

public void setConnectionFactoryClass(String connectionFactoryClass)

getJmsSupport

public JmsSupport getJmsSupport()

setJmsSupport

public void setJmsSupport(JmsSupport jmsSupport)

getSpecification

public String getSpecification()

setSpecification

public void setSpecification(String specification)

isJndiDestinations

public boolean isJndiDestinations()

setJndiDestinations

public void setJndiDestinations(boolean jndiDestinations)

isForceJndiDestinations

public boolean isForceJndiDestinations()

setForceJndiDestinations

public void setForceJndiDestinations(boolean forceJndiDestinations)

getJndiContext

public Context getJndiContext()

setJndiContext

public void setJndiContext(Context jndiContext)

setRecoverJmsConnections

public void setRecoverJmsConnections(boolean recover)

isRecoverJmsConnections

public boolean isRecoverJmsConnections()

createRedeliveryHandler

protected RedeliveryHandler createRedeliveryHandler()
                                             throws IllegalAccessException,
                                                    NoSuchMethodException,
                                                    InvocationTargetException,
                                                    InstantiationException,
                                                    ClassNotFoundException
Throws:
IllegalAccessException
NoSuchMethodException
InvocationTargetException
InstantiationException
ClassNotFoundException

getReplyToHandler

public ReplyToHandler getReplyToHandler()
Overrides:
getReplyToHandler in class AbstractConnector

getUsername

public String getUsername()

setUsername

public void setUsername(String username)

getPassword

public String getPassword()

setPassword

public void setPassword(String password)

getConnection

public Connection getConnection()
Returns:
Returns the connection.

getClientId

public String getClientId()

setClientId

public void setClientId(String clientId)

getMaxRedelivery

public int getMaxRedelivery()

setMaxRedelivery

public void setMaxRedelivery(int maxRedelivery)

getRedeliveryHandler

public String getRedeliveryHandler()

setRedeliveryHandler

public void setRedeliveryHandler(String redeliveryHandler)

isRemoteSyncEnabled

public boolean isRemoteSyncEnabled()
Specified by:
isRemoteSyncEnabled in interface UMOConnector
Overrides:
isRemoteSyncEnabled in class AbstractConnector

onNotification

public void onNotification(UMOServerNotification notification)
Specified by:
onNotification in interface UMOServerNotificationListener

isCacheJmsSessions

public boolean isCacheJmsSessions()

setCacheJmsSessions

public void setCacheJmsSessions(boolean cacheJmsSessions)

supportsProperty

public boolean supportsProperty(String property)
This method may be overridden in case a certain JMS implementation does not support all the standard JMS properties.


preProcessMessage

public javax.jms.Message preProcessMessage(javax.jms.Message message,
                                           Session session)
                                    throws Exception
This method may be overridden in order to apply pre-processing to the message as soon as it arrives.

Parameters:
message - - the incoming message
session - - the JMS session
Returns:
the preprocessed message
Throws:
Exception

close

public void close(MessageProducer producer)
           throws JMSException
Closes the MessageProducer

Parameters:
producer -
Throws:
JMSException

closeQuietly

public void closeQuietly(MessageProducer producer)
Closes the MessageProducer without throwing an exception (an error message is logged instead).

Parameters:
producer -


Copyright © 2003-2006 MuleSource Inc.. All Rights Reserved.