org.springframework.jms.connection
Class SingleConnectionFactory102

java.lang.Object
  extended byorg.springframework.jms.connection.SingleConnectionFactory
      extended byorg.springframework.jms.connection.SingleConnectionFactory102
All Implemented Interfaces:
ConnectionFactory, DisposableBean, InitializingBean, QueueConnectionFactory, TopicConnectionFactory

public class SingleConnectionFactory102
extends SingleConnectionFactory

A subclass of SingleConnectionFactory that uses the JMS 1.0.2 specification, rather than the JMS 1.1 methods used by SingleConnectionFactory itself. This class can be used for JMS 1.0.2 providers, offering the same API as SingleConnectionFactory does for JMS 1.1 providers.

You need to set the pubSubDomain property accordingly, as this class will always create either a QueueConnection or a TopicConnection.

Since:
1.1
Author:
Juergen Hoeller
See Also:
SingleConnectionFactory.setTargetConnectionFactory(javax.jms.ConnectionFactory), setPubSubDomain(boolean)

Field Summary
 
Fields inherited from class org.springframework.jms.connection.SingleConnectionFactory
logger
 
Constructor Summary
SingleConnectionFactory102()
          Create a new SingleConnectionFactory102 for bean-style usage.
SingleConnectionFactory102(ConnectionFactory connectionFactory, boolean pubSubDomain)
          Create a new SingleConnectionFactory102 that always returns a single Connection that it will lazily create via the given target ConnectionFactory.
 
Method Summary
 void afterPropertiesSet()
          In addition to checking if the connection factory is set, make sure that the supplied connection factory is of the appropriate type for the specified destination type: QueueConnectionFactory for queues, and TopicConnectionFactory for topics.
protected  Connection doCreateConnection()
          This implementation overrides the superclass method to use JMS 1.0.2 API.
 boolean isPubSubDomain()
          Return whether the Publish/Subscribe domain (Topics) is used.
 void setPubSubDomain(boolean pubSubDomain)
          Configure the factory with knowledge of the JMS domain used.
 
Methods inherited from class org.springframework.jms.connection.SingleConnectionFactory
createConnection, createConnection, createQueueConnection, createQueueConnection, createTopicConnection, createTopicConnection, destroy, getCloseSuppressingConnectionProxy, getTargetConnectionFactory, init, setTargetConnectionFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleConnectionFactory102

public SingleConnectionFactory102()
Create a new SingleConnectionFactory102 for bean-style usage.


SingleConnectionFactory102

public SingleConnectionFactory102(ConnectionFactory connectionFactory,
                                  boolean pubSubDomain)
Create a new SingleConnectionFactory102 that always returns a single Connection that it will lazily create via the given target ConnectionFactory.

Parameters:
connectionFactory - the target ConnectionFactory
pubSubDomain - whether the Publish/Subscribe domain (Topics) or Point-to-Point domain (Queues) should be used
Method Detail

setPubSubDomain

public void setPubSubDomain(boolean pubSubDomain)
Configure the factory with knowledge of the JMS domain used. This tells the JMS 1.0.2 provider which class hierarchy to use for creating Connections. Default is Point-to-Point (Queues).

Parameters:
pubSubDomain - true for Publish/Subscribe domain (Topics), false for Point-to-Point domain (Queues)

isPubSubDomain

public boolean isPubSubDomain()
Return whether the Publish/Subscribe domain (Topics) is used. Otherwise, the Point-to-Point domain (Queues) is used.


afterPropertiesSet

public void afterPropertiesSet()
In addition to checking if the connection factory is set, make sure that the supplied connection factory is of the appropriate type for the specified destination type: QueueConnectionFactory for queues, and TopicConnectionFactory for topics.

Specified by:
afterPropertiesSet in interface InitializingBean
Overrides:
afterPropertiesSet in class SingleConnectionFactory

doCreateConnection

protected Connection doCreateConnection()
                                 throws JMSException
This implementation overrides the superclass method to use JMS 1.0.2 API.

Overrides:
doCreateConnection in class SingleConnectionFactory
Returns:
the new JMS Connection
Throws:
JMSException - if thrown by JMS API methods


Copyright (C) 2003-2004 The Spring Framework Project.