org.mule.transport.jms
Class DefaultJmsTopicResolver

java.lang.Object
  extended by org.mule.transport.jms.DefaultJmsTopicResolver
All Implemented Interfaces:
JmsTopicResolver
Direct Known Subclasses:
WeblogicJmsTopicResolver

public class DefaultJmsTopicResolver
extends Object
implements JmsTopicResolver

A default implementation of the resolver uses endpoint's resource info and Java's instanceof operator to detect JMS topics.


Field Summary
protected static Log logger
          logger used by this class
 
Constructor Summary
DefaultJmsTopicResolver(JmsConnector connector)
          Create an instance of the resolver.
 
Method Summary
protected  void checkInvariants(Destination destination)
          Perform some sanity checks, will complain in the log.
 JmsConnector getConnector()
          Getter for property 'connector'.
 boolean isTopic(Destination destination)
          Will use an instanceof operator.
 boolean isTopic(ImmutableEndpoint endpoint)
          Will use endpoint's resource info to detect a topic, as in jms://topic:trade.PriceUpdatesTopic.
 boolean isTopic(ImmutableEndpoint endpoint, boolean fallbackToEndpointProperties)
          Use endpoint configuration to detect a topic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Log logger
logger used by this class

Constructor Detail

DefaultJmsTopicResolver

public DefaultJmsTopicResolver(JmsConnector connector)
Create an instance of the resolver.

Parameters:
connector - owning connector
Method Detail

getConnector

public JmsConnector getConnector()
Getter for property 'connector'.

Returns:
Value for property 'connector'.

isTopic

public boolean isTopic(ImmutableEndpoint endpoint)
Will use endpoint's resource info to detect a topic, as in jms://topic:trade.PriceUpdatesTopic. This method will call isTopic(org.mule.api.endpoint.ImmutableEndpoint, boolean) with fallback flag set to true.

NOTE: When using topics, use the '.' (dot) symbol for subcontext separation, as opposed to '/'. Otherwise the resource info may not get properly translated for the topic endpoint due to the way URI's are parsed.

Specified by:
isTopic in interface JmsTopicResolver
Parameters:
endpoint - endpoint to test
Returns:
true if the endpoint has a topic configuration
See Also:
isTopic(org.mule.api.endpoint.ImmutableEndpoint, boolean)

isTopic

public boolean isTopic(ImmutableEndpoint endpoint,
                       boolean fallbackToEndpointProperties)
Use endpoint configuration to detect a topic. Additionally, specify a fallback mechanism to search in endpoint's properties in case resource info yields false. In case resource info returned true no endpoint properties would be consulted.

Specified by:
isTopic in interface JmsTopicResolver
Parameters:
endpoint - endpoint to test
fallbackToEndpointProperties - whether to check endpoint's properties if resource info returned false
Returns:
true if endpoint's config tells it's a topic

isTopic

public boolean isTopic(Destination destination)
Will use an instanceof operator. Keep in mind that may fail for JMS systems implementing both a javax.jms.Topic and javax.jms.Queue in a single destination class implementation.

Specified by:
isTopic in interface JmsTopicResolver
Parameters:
destination - a jms destination to test
Returns:
true if the destination is a topic

checkInvariants

protected void checkInvariants(Destination destination)
Perform some sanity checks, will complain in the log.

Parameters:
destination - destination to test


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.