ie.nuigalway.ecrg.jade.jmsagentgateway
Class Util

java.lang.Object
  |
  +--ie.nuigalway.ecrg.jade.jmsagentgateway.Util

public class Util
extends java.lang.Object

General utility class for agent

Version:
0.5 12 January 2004
Author:
Edward Curry

Field Summary
static boolean DURABLE
          Durable subscription setting
private static org.apache.log4j.Category log
           
static boolean NON_DURABLE
          Non durable subscription setting
static boolean NON_PERSISTENT
          Non persistent message setting
static boolean PERSISTENT
          Persistent message setting
static boolean QUEUE
          Queue setting
static boolean TOPIC
          Topic setting
 
Constructor Summary
Util()
           
 
Method Summary
static java.lang.String convertObjectToString(java.io.Serializable obj)
          Convert an object to a BASE64 string
static java.io.Serializable convertStringToObject(java.lang.String payload)
          Convert a BASE64 string payload to a serializable object
static JmsMessage createMessage(java.lang.String destination, java.io.Serializable payload, boolean deliveryMode)
          General utility method for creating a message
static ProviderInfo createProviderInfo(boolean destType, java.lang.String providerURL, java.lang.String providerICF)
          Utility method for creating server information
static Subscription createSubscription(java.lang.String destination, boolean durable)
          Utility method to create a Subscription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PERSISTENT

public static final boolean PERSISTENT
Persistent message setting

See Also:
Constant Field Values

NON_PERSISTENT

public static final boolean NON_PERSISTENT
Non persistent message setting

See Also:
Constant Field Values

TOPIC

public static final boolean TOPIC
Topic setting

See Also:
Constant Field Values

QUEUE

public static final boolean QUEUE
Queue setting

See Also:
Constant Field Values

DURABLE

public static final boolean DURABLE
Durable subscription setting

See Also:
Constant Field Values

NON_DURABLE

public static final boolean NON_DURABLE
Non durable subscription setting

See Also:
Constant Field Values

log

private static org.apache.log4j.Category log
Constructor Detail

Util

public Util()
Method Detail

createMessage

public static JmsMessage createMessage(java.lang.String destination,
                                       java.io.Serializable payload,
                                       boolean deliveryMode)
                                throws java.lang.Exception
General utility method for creating a message

Parameters:
destination - destination of message
payload - The messages payload (Can be any Serializable Java object)
deliveryMode - Persistent setting of the message
Returns:
Newly created Jms Message
Throws:
java.lang.Exception - Error creating the message

createSubscription

public static Subscription createSubscription(java.lang.String destination,
                                              boolean durable)
Utility method to create a Subscription

Parameters:
destination - Topic or Queue to subscribe to
durable - Subsctiptions durability setting
Returns:
Newley created subscription info

createProviderInfo

public static ProviderInfo createProviderInfo(boolean destType,
                                              java.lang.String providerURL,
                                              java.lang.String providerICF)
Utility method for creating server information

Parameters:
providerURL - URL of the server
providerICF - Initial Connection Factory Class
destType - Queue or Topic Destination
Returns:
Returns a server information object

convertStringToObject

public static java.io.Serializable convertStringToObject(java.lang.String payload)
                                                  throws java.lang.Exception
Convert a BASE64 string payload to a serializable object

Parameters:
payload - BASE64 string messages payload
Returns:
Serialized payload string
Throws:
java.lang.Exception - Error during conversion

convertObjectToString

public static java.lang.String convertObjectToString(java.io.Serializable obj)
                                              throws java.lang.Exception
Convert an object to a BASE64 string

Parameters:
obj - Payload object
Returns:
Payload object converted to a BASE64 string
Throws:
java.lang.Exception - Error during object to string conversion