The Spring Framework

org.springframework.jms.support.destination
Class DynamicDestinationResolver

java.lang.Object
  extended by org.springframework.jms.support.destination.DynamicDestinationResolver
All Implemented Interfaces:
DestinationResolver

public class DynamicDestinationResolver
extends Object
implements DestinationResolver

Simple DestinationResolver implementation resolving destination names as dynamic destinations.

This implementation will work on both JMS 1.1 and JMS 1.0.2, because it uses the QueueSession or TopicSession methods if possible, falling back to JMS 1.1's generic Session methods.

Since:
1.1
Author:
Juergen Hoeller
See Also:
QueueSession.createQueue(java.lang.String), TopicSession.createTopic(java.lang.String), Session.createQueue(java.lang.String), Session.createTopic(java.lang.String)

Constructor Summary
DynamicDestinationResolver()
           
 
Method Summary
 Destination resolveDestinationName(Session session, String destinationName, boolean pubSubDomain)
          Resolve the specified destination name as a dynamic destination.
protected  Queue resolveQueue(Session session, String queueName)
          Resolve the given destination name to a Queue.
protected  Topic resolveTopic(Session session, String topicName)
          Resolve the given destination name to a Topic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicDestinationResolver

public DynamicDestinationResolver()
Method Detail

resolveDestinationName

public Destination resolveDestinationName(Session session,
                                          String destinationName,
                                          boolean pubSubDomain)
                                   throws JMSException
Resolve the specified destination name as a dynamic destination.

Specified by:
resolveDestinationName in interface DestinationResolver
Parameters:
session - the current JMS Session
destinationName - the name of the destination
pubSubDomain - true if the domain is pub-sub, false if P2P
Returns:
the JMS destination (either a topic or a queue)
Throws:
JMSException - if resolution failed
See Also:
resolveTopic(javax.jms.Session, String), resolveQueue(javax.jms.Session, String)

resolveTopic

protected Topic resolveTopic(Session session,
                             String topicName)
                      throws JMSException
Resolve the given destination name to a Topic.

Parameters:
session - the current JMS Session
topicName - the name of the desired Topic
Returns:
the JMS Topic
Throws:
JMSException - if resolution failed
See Also:
Session.createTopic(String)

resolveQueue

protected Queue resolveQueue(Session session,
                             String queueName)
                      throws JMSException
Resolve the given destination name to a Queue.

Parameters:
session - the current JMS Session
queueName - the name of the desired Queue
Returns:
the JMS Queue
Throws:
JMSException - if resolution failed
See Also:
Session.createQueue(String)

The Spring Framework

Copyright © 2002-2007 The Spring Framework.