com.j_spaces.jms.utils
Class GSJMSAdmin

java.lang.Object
  extended by com.j_spaces.jms.utils.GSJMSAdmin
All Implemented Interfaces:
Serializable

public class GSJMSAdmin
extends Object
implements Serializable

Admin util for the GigaSpaces JMS implementation. it contains static methods for AdministrationObjects jndi lookup, such as Topic/Queue/TopicConnectionFactory/QueueConnectionFactory and its XA variations. It initializes JNDI InitialContext according to the details supplied in the jms-config.xml configuration file. If an instance of the class is already exist we return the same static instance but if there is custom user defined jmsConfigFileName which differ from the default config/jms/jms-config.xml file, we reload the right xml config file. The GigaSpaces Log util is used for jms debugging and output redirections.

See Also:
Serialized Form

Field Summary
static String DUR_SUB_CLIENT_ID
           
static String DUR_SUB_CONNECTION_ID
           
static String DUR_SUB_SESSION_ID
           
static String DUR_SUB_SUBSCRIPTION_NAME
           
static String DUR_SUB_TOPIC_NAME
           
static String DUR_SUBSCRIBERS_TAG
           
static String JMS_TAG
           
 
Method Summary
 void addNewDurableSubscriberDetailsIntoXML(Hashtable<String,String> _subscriberDetailsHash)
          Adds new Durable subsriber client id details into a structure and persist it to the config file.
 Destination createAndBindDestination(boolean isQueue, String destinationName)
          Creates a Destination (GSTopicImpl or GSQueueImpl) and then binds it to the jndi registry.
 Destination createAndBindTempDestination(GSSessionImpl session)
          Create a temporary destination and bind it into the jndi reg.
 void destroyAndUnBindDestination(String destinationName)
          Destroys a Destination (GSTopicImpl or GSQueueImpl) and then unbinds from the jndi registry.
static void exit(int result)
           
 String getBondedDestPrefixName()
           
 String getBondedQueueFacName()
           
 String getBondedTopicFacName()
           
 String getBondedXAQueueFacName()
           
 String getBondedXATopicFacName()
           
 int getCompressionMinSize()
           
 Destination getDestination(String destinationName)
           
 Hashtable getDurableSubscriberDetailsFromXML(String topicName, String subscriptionName)
           
static GSJMSAdmin getInstance()
          Returns instance of the GSJMSAdmin utility.
static GSJMSAdmin getInstance(String jmsConfigFileName)
          Returns instance of the GSJMSAdmin utility.
 String getOverwrittenConnFacSpaceURL()
           
 GSQueueImpl getQueue(String name)
          Returns a GSQueueImpl object, which is found, using the jndi lookup service.
 GSQueueConnectionFactoryImpl getQueueConnectionFactory()
          Returns a GSQueueConnectionFactoryImpl object which is found, using the jndi lookup service.
 GSTopicImpl getTopic(String name)
          Returns a GSTopicImpl object.
 GSTopicConnectionFactoryImpl getTopicConnectionFactory()
          Returns a GSTopicConnectionFactoryImpl object, which is found, using the jndi lookup service.
 com.j_spaces.jms.GSXAQueueConnectionFactoryImpl getXAQueueConnectionFactory()
          Returns a GSXAQueueConnectionFactoryImpl object which is found, using the jndi lookup service.
 com.j_spaces.jms.GSXATopicConnectionFactoryImpl getXATopicConnectionFactory()
          Returns a GSXATopicConnectionFactoryImpl object, which is found, using the jndi lookup service.
 Object jndiLookup(String name)
          Creates a JNDI API InitialContext object if none exists yet.
 void rebindToJNDI(String name, Object obj)
          Rebinding to a JNDI registry using the jndi Context details provided in the config file.
 void unbindFromJNDI(String name)
          Unbinding from the JNDI registry using the jndi Context details provided in the config file.
 void unsubscribeDurableSubscriberDetailsFromXML(Hashtable _subscriberDetailsHash)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DUR_SUBSCRIBERS_TAG

public static final String DUR_SUBSCRIBERS_TAG
See Also:
Constant Field Values

DUR_SUB_CLIENT_ID

public static final String DUR_SUB_CLIENT_ID
See Also:
Constant Field Values

DUR_SUB_SESSION_ID

public static final String DUR_SUB_SESSION_ID
See Also:
Constant Field Values

DUR_SUB_CONNECTION_ID

public static final String DUR_SUB_CONNECTION_ID
See Also:
Constant Field Values

DUR_SUB_TOPIC_NAME

public static final String DUR_SUB_TOPIC_NAME
See Also:
Constant Field Values

DUR_SUB_SUBSCRIPTION_NAME

public static final String DUR_SUB_SUBSCRIPTION_NAME
See Also:
Constant Field Values

JMS_TAG

public static final String JMS_TAG
See Also:
Constant Field Values
Method Detail

getOverwrittenConnFacSpaceURL

public final String getOverwrittenConnFacSpaceURL()
Returns:
Returns the overwrittenConnFacSpaceURL.

getInstance

public static GSJMSAdmin getInstance(String jmsConfigFileName)
                              throws JMSException
Returns instance of the GSJMSAdmin utility. If it is already exist we return the same static instance but if there is jmsConfigFileName which differ from the default config/jms/jms-config.xml file, we reload the right xml config file.

Parameters:
jmsConfigFileName - OTHER custom config file name which the user may define.
Returns:
adminInstance a GSJMSAdmin instance
Throws:
JMSException

getInstance

public static GSJMSAdmin getInstance()
                              throws JMSException
Returns instance of the GSJMSAdmin utility. Uses the default config/jms/jms-config.xml config file.

Returns:
adminInstance a GSJMSAdmin instance
Throws:
JMSException

addNewDurableSubscriberDetailsIntoXML

public void addNewDurableSubscriberDetailsIntoXML(Hashtable<String,String> _subscriberDetailsHash)
                                           throws JMSException
Adds new Durable subsriber client id details into a structure and persist it to the config file.

Parameters:
_subscriberDetailsHash -
Throws:
JMSException

unsubscribeDurableSubscriberDetailsFromXML

public void unsubscribeDurableSubscriberDetailsFromXML(Hashtable _subscriberDetailsHash)
                                                throws JMSException
Parameters:
_subscriberDetailsHash -
Throws:
JMSException

getDurableSubscriberDetailsFromXML

public Hashtable getDurableSubscriberDetailsFromXML(String topicName,
                                                    String subscriptionName)
Parameters:
topicName -
subscriptionName -
Returns:
clientDetailsHash durable subscribers details hashtable elements

getQueueConnectionFactory

public GSQueueConnectionFactoryImpl getQueueConnectionFactory()
                                                       throws JMSException,
                                                              NamingException
Returns a GSQueueConnectionFactoryImpl object which is found, using the jndi lookup service.

Returns:
a GSQueueConnectionFactoryImpl object
Throws:
NamingException - if name cannot be found
JMSException - thrown if GS space failed to load.

getTopicConnectionFactory

public GSTopicConnectionFactoryImpl getTopicConnectionFactory()
                                                       throws JMSException,
                                                              NamingException
Returns a GSTopicConnectionFactoryImpl object, which is found, using the jndi lookup service.

Returns:
a GSTopicConnectionFactoryImpl object
Throws:
NamingException - if name cannot be found
JMSException - thrown if GS space failed to load.

getXAQueueConnectionFactory

public com.j_spaces.jms.GSXAQueueConnectionFactoryImpl getXAQueueConnectionFactory()
                                                                            throws JMSException,
                                                                                   NamingException
Returns a GSXAQueueConnectionFactoryImpl object which is found, using the jndi lookup service.

Returns:
a GSXAQueueConnectionFactoryImpl object
Throws:
NamingException - if name cannot be found
JMSException - thrown if GS space failed to load.

getXATopicConnectionFactory

public com.j_spaces.jms.GSXATopicConnectionFactoryImpl getXATopicConnectionFactory()
                                                                            throws JMSException,
                                                                                   NamingException
Returns a GSXATopicConnectionFactoryImpl object, which is found, using the jndi lookup service.

Returns:
a GSXATopicConnectionFactoryImpl object
Throws:
NamingException - if name cannot be found
JMSException - thrown if GS space failed to load.

createAndBindTempDestination

public Destination createAndBindTempDestination(GSSessionImpl session)
                                         throws JMSException,
                                                NamingException
Create a temporary destination and bind it into the jndi reg.

Parameters:
session - the session to create the destination with
Returns:
the new destination
Throws:
JMSException - if the destination cannot be created
NamingException

createAndBindDestination

public Destination 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

getQueue

public GSQueueImpl getQueue(String name)
                     throws NamingException,
                            JMSException
Returns a GSQueueImpl object, which is found, using the jndi lookup service.

Parameters:
name - String specifying topic name (e.g. MyQueue) when this destination will be bound to the jndi registry, we add to the name a prefix such as: GigaSpaces;pc-gershon;JavaSpaces;jms;queues;
Returns:
a GSQueueImpl object
Throws:
NamingException - (or other exception) if name cannot be found
JMSException

getTopic

public GSTopicImpl getTopic(String name)
                     throws NamingException,
                            JMSException
Returns a GSTopicImpl object.

Parameters:
name - String specifying topic name (e.g. MyTopic) when this destination will be bound to the jndi registry, we add to the name a prefix such as: GigaSpaces;pc-gershon;JavaSpaces;jms;topics;
Returns:
a GSTopicImpl object
Throws:
NamingException - (or other exception) if name cannot be found
JMSException

getDestination

public Destination getDestination(String destinationName)
                           throws NamingException,
                                  JMSException
Throws:
NamingException
JMSException

jndiLookup

public Object jndiLookup(String name)
                  throws NamingException,
                         JMSException
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 be looked up
Returns:
the JMS administrated object bound to name.
Throws:
NamingException - (or other exception) if name cannot be found
JMSException

rebindToJNDI

public void rebindToJNDI(String name,
                         Object obj)
                  throws NamingException,
                         JMSException
Rebinding to a JNDI registry using the jndi Context details provided in the config file.

Parameters:
name -
obj -
Throws:
NamingException
JMSException

unbindFromJNDI

public void unbindFromJNDI(String name)
                    throws NamingException,
                           JMSException
Unbinding from the JNDI registry using the jndi Context details provided in the config file.

Parameters:
name -
Throws:
NamingException
JMSException

exit

public static void exit(int result)

getBondedQueueFacName

public String getBondedQueueFacName()
Returns:
bondedQueueFacName

getBondedTopicFacName

public String getBondedTopicFacName()
Returns:
bondedTopicFacName

getBondedXAQueueFacName

public String getBondedXAQueueFacName()
Returns:
bondedXAQueueFacName

getBondedXATopicFacName

public String getBondedXATopicFacName()
Returns:
bondedXATopicFacName

getBondedDestPrefixName

public String getBondedDestPrefixName()
Returns:
bondedDestPrefixName e.g. GigaSpaces; ; ;jms;destinations;

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