org.robokind.impl.messaging.utils
Class ConnectionUtils

java.lang.Object
  extended by org.robokind.impl.messaging.utils.ConnectionUtils

public class ConnectionUtils
extends Object

Author:
Matthew Stevenson

Field Summary
static int QUEUE
          Indicates a JMS Queue where Message go to one consumer.
static int TOPIC
          Indicates a JMS Topic where Message are broadcasted to all consumers.
 
Constructor Summary
ConnectionUtils()
           
 
Method Summary
static boolean ensureConnection(org.osgi.framework.BundleContext context, String conId, javax.jms.Connection con, Properties props)
           
static boolean ensureDestination(org.osgi.framework.BundleContext context, String destId, String destName, int type, Properties props)
          Creates and registers a Destination if there is not one already registered to the given id.
static void ensureDestinations(org.osgi.framework.BundleContext context, Object... destParams)
          Makes calls to ensureDestination with the given parameters.
static boolean ensureSession(org.osgi.framework.BundleContext context, String conId, javax.jms.Connection con, Properties props)
          Registers the Connection if there is not one already registered to the given id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUEUE

public static final int QUEUE
Indicates a JMS Queue where Message go to one consumer.

See Also:
Constant Field Values

TOPIC

public static final int TOPIC
Indicates a JMS Topic where Message are broadcasted to all consumers.

See Also:
Constant Field Values
Constructor Detail

ConnectionUtils

public ConnectionUtils()
Method Detail

ensureSession

public static boolean ensureSession(org.osgi.framework.BundleContext context,
                                    String conId,
                                    javax.jms.Connection con,
                                    Properties props)
Registers the Connection if there is not one already registered to the given id. If a connection already exists, this connection is not registered.

Parameters:
context - BundleContext for OSGi
conId - unique connection id to use
con - connection to register
props - optional OSGi registration properties
Returns:
true if there is a connection with the given id, either pre-existing or the given connection, false if a connection is not available (one did not previously exist and registration failed)

ensureConnection

public static boolean ensureConnection(org.osgi.framework.BundleContext context,
                                       String conId,
                                       javax.jms.Connection con,
                                       Properties props)

ensureDestination

public static boolean ensureDestination(org.osgi.framework.BundleContext context,
                                        String destId,
                                        String destName,
                                        int type,
                                        Properties props)
Creates and registers a Destination if there is not one already registered to the given id.

Parameters:
context - BundleContext for OSGi
destId - unique destination id to use
destName - destination name
type - destination type, QUEUE or TOPIC
props - optional OSGi registration properties
Returns:
true if there is a destination with the given id, either pre-existing or newly created, false if a destination is not available (one did not previously exist and registration failed)

ensureDestinations

public static void ensureDestinations(org.osgi.framework.BundleContext context,
                                      Object... destParams)
Makes calls to ensureDestination with the given parameters.

Parameters:
context - BundleContext for OSGi
destParams - parameters for calls to ensureDestination, must be in multiples of 4 with the correct types


Copyright © 2011-2013. All Rights Reserved.