com.j_spaces.jms.utils
Class GSJMSAdmin

java.lang.Object
  extended by com.j_spaces.jms.utils.GSJMSAdmin

public class GSJMSAdmin
extends Object

Admin util for the GigaSpaces JMS implementation. It is used by client to obtain JMS resources like connection factories and destinations. If an instance of the class already exists we return the same static instance. It caches the JMS resources.


Method Summary
 void createAndBindDestination(boolean isQueue, String destinationName)
          Creates a Destination (GSTopicImpl or GSQueueImpl) and then binds it to the jndi registry.
 void destroyAndUnBindDestination(String destinationName)
          Destroys a Destination (GSTopicImpl or GSQueueImpl) and then unbinds from the jndi registry.
 int getCompressionMinSize()
           
 ConnectionFactory getConnectionFactory(IJSpace space)
           
 ConnectionFactory getConnectionFactory(IJSpace space, IMessageConverter messageConverter)
          Returns a ConnectionFactory that works with the specified space proxy.
 ConnectionFactory getConnectionFactory(String spaceURL)
           
 ConnectionFactory getConnectionFactory(String spaceURL, IMessageConverter messageConverter)
          Returns a ConnectionFactory that works with the space in the specified spaceURL.
static GSJMSAdmin getInstance()
          Returns a GSJMSAdmin instance.
 Queue getQueue(String name)
          Returns a Queue with the specified name.
 QueueConnectionFactory getQueueConnectionFactory(IJSpace space)
           
 QueueConnectionFactory getQueueConnectionFactory(IJSpace space, IMessageConverter messageConverter)
          Returns a QueueConnectionFactory that works with the specified space proxy.
 QueueConnectionFactory getQueueConnectionFactory(String spaceURL)
           
 QueueConnectionFactory getQueueConnectionFactory(String spaceURL, IMessageConverter messageConverter)
          Returns a QueueConnectionFactory that works with the space in the specified spaceURL.
 Topic getTopic(String name)
          Returns a Topic with the specified name.
 TopicConnectionFactory getTopicConnectionFactory(IJSpace space)
           
 TopicConnectionFactory getTopicConnectionFactory(IJSpace space, IMessageConverter messageConverter)
          Returns a TopicConnectionFactory that works with the specified space proxy.
 TopicConnectionFactory getTopicConnectionFactory(String spaceURL)
           
 TopicConnectionFactory getTopicConnectionFactory(String spaceURL, IMessageConverter messageConverter)
          Returns a TopicConnectionFactory that works with the space in the specified spaceURL.
 XAConnectionFactory getXAConnectionFactory(IJSpace space)
           
 XAConnectionFactory getXAConnectionFactory(IJSpace space, IMessageConverter messageConverter)
          Returns a XAConnectionFactory that works with the specified space proxy.
 XAConnectionFactory getXAConnectionFactory(String spaceURL)
           
 XAConnectionFactory getXAConnectionFactory(String spaceURL, IMessageConverter messageConverter)
          Returns a XAConnectionFactory that works with the space in the specified spaceURL.
 XAQueueConnectionFactory getXAQueueConnectionFactory(IJSpace space)
           
 XAQueueConnectionFactory getXAQueueConnectionFactory(IJSpace space, IMessageConverter messageConverter)
          Returns a XAQueueConnectionFactory that works with the specified space proxy.
 XAQueueConnectionFactory getXAQueueConnectionFactory(String spaceURL)
           
 XAQueueConnectionFactory getXAQueueConnectionFactory(String spaceURL, IMessageConverter messageConverter)
          Returns a XAQueueConnectionFactory that works with the space in the specified spaceURL.
 XATopicConnectionFactory getXATopicConnectionFactory(IJSpace space)
           
 XATopicConnectionFactory getXATopicConnectionFactory(IJSpace space, IMessageConverter messageConverter)
          Returns a XATopicConnectionFactory that works with the specified space proxy.
 XATopicConnectionFactory getXATopicConnectionFactory(String spaceURL)
           
 XATopicConnectionFactory getXATopicConnectionFactory(String spaceURL, IMessageConverter messageConverter)
          Returns a XATopicConnectionFactory that works with the space in the specified spaceURL.
 Object jndiLookup(String name)
          Creates a JNDI API InitialContext object if none exists yet.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static GSJMSAdmin getInstance()
Returns a GSJMSAdmin instance.

Returns:
a GSJMSAdmin instance.

getConnectionFactory

public ConnectionFactory getConnectionFactory(String spaceURL)
                                       throws JMSException
Throws:
JMSException

getConnectionFactory

public ConnectionFactory getConnectionFactory(String spaceURL,
                                              IMessageConverter messageConverter)
                                       throws JMSException
Returns a ConnectionFactory that works with the space in the specified spaceURL. First it tries to find a cached ConnectionFactory. If the required instance doesn't exist in the cache, it finds the space and creates a new ConnectionFactory to work with that space.

Parameters:
spaceURL - space URL
Returns:
a ConnectionFactory instance
Throws:
JMSException - if the was a problem to return the factory

getConnectionFactory

public ConnectionFactory getConnectionFactory(IJSpace space)
                                       throws JMSException
Throws:
JMSException

getConnectionFactory

public ConnectionFactory getConnectionFactory(IJSpace space,
                                              IMessageConverter messageConverter)
                                       throws JMSException
Returns a ConnectionFactory that works with the specified space proxy. First it tries to find a cached ConnectionFactory. If the required instance doesn't exist in the cache, it creates a new ConnectionFactory to work with that space.

Parameters:
space - the space proxy
Returns:
a ConnectionFactory instance
Throws:
JMSException - if the was a problem to return the factory

getQueueConnectionFactory

public QueueConnectionFactory getQueueConnectionFactory(String spaceURL)
                                                 throws JMSException
Throws:
JMSException

getQueueConnectionFactory

public QueueConnectionFactory getQueueConnectionFactory(String spaceURL,
                                                        IMessageConverter messageConverter)
                                                 throws JMSException
Returns a QueueConnectionFactory that works with the space in the specified spaceURL. First it tries to find a cached QueueConnectionFactory. If the required instance doesn't exist in the cache, it finds the space and creates a new QueueConnectionFactory to work with that space.

Parameters:
spaceURL - space URL
Returns:
a QueueConnectionFactory instance
Throws:
JMSException - if the was a problem to return the factory

getTopicConnectionFactory

public TopicConnectionFactory getTopicConnectionFactory(String spaceURL)
                                                 throws JMSException
Throws:
JMSException

getTopicConnectionFactory

public TopicConnectionFactory getTopicConnectionFactory(String spaceURL,
                                                        IMessageConverter messageConverter)
                                                 throws JMSException
Returns a TopicConnectionFactory that works with the space in the specified spaceURL. First it tries to find a cached TopicConnectionFactory. If the required instance doesn't exist in the cache, it finds the space and creates a new TopicConnectionFactory to work with that space.

Parameters:
spaceURL - space URL
Returns:
a TopicConnectionFactory instance
Throws:
JMSException - if the was a problem to return the factory

getQueueConnectionFactory

public QueueConnectionFactory getQueueConnectionFactory(IJSpace space)
                                                 throws JMSException
Throws:
JMSException

getQueueConnectionFactory

public QueueConnectionFactory getQueueConnectionFactory(IJSpace space,
                                                        IMessageConverter messageConverter)
                                                 throws JMSException
Returns a QueueConnectionFactory that works with the specified space proxy. First it tries to find a cached QueueConnectionFactory. If the required instance doesn't exist in the cache, it creates a new QueueConnectionFactory to work with that space.

Parameters:
space - the space proxy
Returns:
a QueueConnectionFactory instance
Throws:
JMSException - if the was a problem to return the factory

getTopicConnectionFactory

public TopicConnectionFactory getTopicConnectionFactory(IJSpace space)
                                                 throws JMSException
Throws:
JMSException

getTopicConnectionFactory

public TopicConnectionFactory getTopicConnectionFactory(IJSpace space,
                                                        IMessageConverter messageConverter)
                                                 throws JMSException
Returns a TopicConnectionFactory that works with the specified space proxy. First it tries to find a cached TopicConnectionFactory. If the required instance doesn't exist in the cache, it creates a new TopicConnectionFactory to work with that space.

Parameters:
space - the space proxy
Returns:
a TopicConnectionFactory instance
Throws:
JMSException - if the was a problem to return the factory

getXAConnectionFactory

public XAConnectionFactory getXAConnectionFactory(String spaceURL)
                                           throws JMSException
Throws:
JMSException

getXAConnectionFactory

public XAConnectionFactory getXAConnectionFactory(String spaceURL,
                                                  IMessageConverter messageConverter)
                                           throws JMSException
Returns a XAConnectionFactory that works with the space in the specified spaceURL. First it tries to find a cached XAConnectionFactory. If the required instance doesn't exist in the cache, it finds the space and creates a new XAConnectionFactory to work with that space.

Parameters:
spaceURL - space URL
Returns:
a XAConnectionFactory instance
Throws:
JMSException - if the was a problem to return the factory

getXAConnectionFactory

public XAConnectionFactory getXAConnectionFactory(IJSpace space)
                                           throws JMSException
Throws:
JMSException

getXAConnectionFactory

public XAConnectionFactory getXAConnectionFactory(IJSpace space,
                                                  IMessageConverter messageConverter)
                                           throws JMSException
Returns a XAConnectionFactory that works with the specified space proxy. First it tries to find a cached XAConnectionFactory. If the required instance doesn't exist in the cache, it creates a new XAConnectionFactory to work with that space.

Parameters:
space - the space proxy
Returns:
a XAConnectionFactory instance
Throws:
JMSException - if the was a problem to return the factory

getXAQueueConnectionFactory

public XAQueueConnectionFactory getXAQueueConnectionFactory(String spaceURL)
                                                     throws JMSException
Throws:
JMSException

getXAQueueConnectionFactory

public XAQueueConnectionFactory getXAQueueConnectionFactory(String spaceURL,
                                                            IMessageConverter messageConverter)
                                                     throws JMSException
Returns a XAQueueConnectionFactory that works with the space in the specified spaceURL. First it tries to find a cached XAQueueConnectionFactory. If the required instance doesn't exist in the cache, it finds the space and creates a new XAQueueConnectionFactory to work with that space.

Parameters:
spaceURL - space URL
Returns:
a XAQueueConnectionFactory instance
Throws:
JMSException - if the was a problem to return the factory

getXATopicConnectionFactory

public XATopicConnectionFactory getXATopicConnectionFactory(String spaceURL)
                                                     throws JMSException
Throws:
JMSException

getXATopicConnectionFactory

public XATopicConnectionFactory getXATopicConnectionFactory(String spaceURL,
                                                            IMessageConverter messageConverter)
                                                     throws JMSException
Returns a XATopicConnectionFactory that works with the space in the specified spaceURL. First it tries to find a cached XATopicConnectionFactory. If the required instance doesn't exist in the cache, it finds the space and creates a new XATopicConnectionFactory to work with that space.

Parameters:
spaceURL - space URL
Returns:
a XATopicConnectionFactory instance
Throws:
JMSException - if the was a problem to return the factory

getXAQueueConnectionFactory

public XAQueueConnectionFactory getXAQueueConnectionFactory(IJSpace space)
                                                     throws JMSException
Throws:
JMSException

getXAQueueConnectionFactory

public XAQueueConnectionFactory getXAQueueConnectionFactory(IJSpace space,
                                                            IMessageConverter messageConverter)
                                                     throws JMSException
Returns a XAQueueConnectionFactory that works with the specified space proxy. First it tries to find a cached XAQueueConnectionFactory. If the required instance doesn't exist in the cache, it creates a new XAQueueConnectionFactory to work with that space.

Parameters:
space - the space proxy
Returns:
a XAQueueConnectionFactory instance
Throws:
JMSException - if the was a problem to return the factory

getXATopicConnectionFactory

public XATopicConnectionFactory getXATopicConnectionFactory(IJSpace space)
                                                     throws JMSException
Throws:
JMSException

getXATopicConnectionFactory

public XATopicConnectionFactory getXATopicConnectionFactory(IJSpace space,
                                                            IMessageConverter messageConverter)
                                                     throws JMSException
Returns a XATopicConnectionFactory that works with the specified space proxy. First it tries to find a cached XATopicConnectionFactory. If the required instance doesn't exist in the cache, it creates a new XATopicConnectionFactory to work with that space.

Parameters:
space - the space proxy
Returns:
a XATopicConnectionFactory instance
Throws:
JMSException - if the was a problem to return the factory

getQueue

public Queue getQueue(String name)
Returns a Queue with the specified name.

Parameters:
url - the space URL.
name - the name of the Queue
Returns:
a Queue instance

getTopic

public Topic getTopic(String name)
Returns a Topic with the specified name.

Parameters:
url - the space URL.
name - the name of the Topic
Returns:
a Topic instance

getCompressionMinSize

public int getCompressionMinSize()
Returns:
Returns the compressionMinSize. The minimum size (in bytes) which from where we start to compress all the message body. e.g. if a 1 MB Text JMSMessage body is sent, and the compressionMinSize value is 500000 (0.5MB) then we will compress that message body (only), otherwise we will send (write) it as is. TODO Currently this configured via system property later will be part of the JMS-config.xml default value is 0.5 MB

jndiLookup

public Object jndiLookup(String name)
                  throws NamingException
Creates a JNDI API InitialContext object if none exists yet. Then looks up the string argument and returns the associated JMS administrated object.

Parameters:
name - the name of the object to look for
Returns:
the JMS administrated object bound to the name.
Throws:
NamingException - if name cannot be found

createAndBindDestination

public void createAndBindDestination(boolean isQueue,
                                     String destinationName)
                              throws NamingException,
                                     JMSException
Creates a Destination (GSTopicImpl or GSQueueImpl) and then binds it to the jndi registry.

Parameters:
isQueue -
destinationName -
Throws:
NamingException
JMSException

destroyAndUnBindDestination

public void destroyAndUnBindDestination(String destinationName)
                                 throws JMSException
Destroys a Destination (GSTopicImpl or GSQueueImpl) and then unbinds from the jndi registry.

Parameters:
destinationName -
Throws:
NamingException
JMSException