gov.nih.nci.caarray.services.util
Class ServiceLocator

java.lang.Object
  extended by gov.nih.nci.caarray.services.util.ServiceLocator

public class ServiceLocator
extends java.lang.Object

This class is an implementation of the Service Locator pattern. It is used to look up resources such as EJBHome's, JMS service components, etc. This implementation uses the "singleton" strategy and also the "caching" strategy. This class is intended to be used on the web tier and not on the EJB tier.

Author:
tranp

Method Summary
 javax.sql.DataSource getDataSource()
           
static ServiceLocator getInstance()
           
 javax.ejb.EJBLocalHome getLocalHome(java.lang.String jndiHomeName)
          Retrieve a LocalHome object for an EJB.
 org.apache.ojb.broker.core.PersistenceBrokerFactoryIF getPersistenceBrokerFactory()
          Looks up the PBF implementation.
 javax.jms.Queue getQueue(java.lang.String queueName)
           
 javax.jms.QueueConnectionFactory getQueueConnectionFactory()
           
 javax.jms.QueueConnectionFactory getQueueConnectionFactory(java.lang.String jndiName)
           
 javax.ejb.EJBHome getRemoteHome(java.lang.String jndiHomeName, java.lang.Class className)
          Retrieve the EJBHome object given an EJB Home and its corresponding JNDI name.
 javax.sql.DataSource getSecurityDataSource()
           
 javax.jms.Topic getTopic(java.lang.String topicName)
           
 javax.jms.TopicConnectionFactory getTopicConnectionFactory()
           
 javax.jms.TopicConnectionFactory getTopicConnectionFactory(java.lang.String jdniName)
          Obtain the TopicConnectionFactory for sending/receiving JMS messages
 javax.transaction.UserTransaction getUserTransaction()
          Looks up UserTransaction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ServiceLocator getInstance()

getLocalHome

public javax.ejb.EJBLocalHome getLocalHome(java.lang.String jndiHomeName)
                                    throws ServiceLookupException
Retrieve a LocalHome object for an EJB.

Parameters:
jndiHomeName -
Returns:
The EJBLocalHome object corresponding to the jndiHomeName
Throws:
ServiceLookupException

getRemoteHome

public javax.ejb.EJBHome getRemoteHome(java.lang.String jndiHomeName,
                                       java.lang.Class className)
                                throws ServiceLookupException
Retrieve the EJBHome object given an EJB Home and its corresponding JNDI name.

Parameters:
-
Returns:
The EJBHome corresponding to the JNDI name.
Throws:
ServiceLookupException

getQueueConnectionFactory

public javax.jms.QueueConnectionFactory getQueueConnectionFactory()
                                                           throws ServiceLookupException
Throws:
ServiceLookupException

getQueueConnectionFactory

public javax.jms.QueueConnectionFactory getQueueConnectionFactory(java.lang.String jndiName)
                                                           throws ServiceLookupException
Returns:
The factory to get JMS queue connections from
Throws:
ServiceLookupException

getQueue

public javax.jms.Queue getQueue(java.lang.String queueName)
                         throws ServiceLookupException
Returns:
The Queue destination to send JMS messages to
Throws:
ServiceLookupException

getTopicConnectionFactory

public javax.jms.TopicConnectionFactory getTopicConnectionFactory()
                                                           throws ServiceLookupException
Throws:
ServiceLookupException

getTopicConnectionFactory

public javax.jms.TopicConnectionFactory getTopicConnectionFactory(java.lang.String jdniName)
                                                           throws ServiceLookupException
Obtain the TopicConnectionFactory for sending/receiving JMS messages

Returns:
The factory to get topic connections from
Throws:
ServiceLookupException

getTopic

public javax.jms.Topic getTopic(java.lang.String topicName)
                         throws ServiceLookupException
Returns:
The Topic destination to send messages to
Throws:
ServiceLookupException

getUserTransaction

public javax.transaction.UserTransaction getUserTransaction()
                                                     throws ServiceLookupException
Looks up UserTransaction.

Returns:
The UserTransaction.
Throws:
ServiceLookupException

getSecurityDataSource

public javax.sql.DataSource getSecurityDataSource()
                                           throws ServiceLookupException
Throws:
ServiceLookupException

getPersistenceBrokerFactory

public org.apache.ojb.broker.core.PersistenceBrokerFactoryIF getPersistenceBrokerFactory()
Looks up the PBF implementation. This is deployed as ojb.sar as shown at http://db.apache.org/ojb


getDataSource

public javax.sql.DataSource getDataSource()
                                   throws ServiceLookupException
Throws:
ServiceLookupException