View Javadoc

1   /*** 
2    * JFoxSOAF, Service-Oriented Application Framework
3    * 
4    * Copyright (C) www.huihoo.org
5    *
6    * Distributable under GNU LGPL
7    * 
8    * For more information, please visit: http://www.huihoo.org/jfox/jfoxsoaf
9    */
10  
11  package org.huihoo.jfox.soaf.services.ejb;
12  
13  import java.net.URL;
14  
15  import javax.ejb.EJBHome;
16  import javax.ejb.EJBLocalHome;
17  import javax.jms.Queue;
18  import javax.jms.QueueConnectionFactory;
19  import javax.jms.Topic;
20  import javax.jms.TopicConnectionFactory;
21  import javax.mail.Session;
22  import javax.sql.DataSource;
23  
24  import org.huihoo.jfox.soaf.exception.ServiceLocatorException;
25  
26  /***
27   * <p>
28   * This class is an implementation of the Service Locator pattern. It is used to
29   * looukup resources such as EJBHomes, JMS Destinations, etc. This
30   * implementation uses the "singleton instance" strategy and also the "caching"
31   * strategy.
32   * </p>
33   * 
34   * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
35   * @version $Revision: 1.4 $ $Date: 2004/11/02 04:15:25 $
36   * @version Revision: 1.0
37   */
38  
39  public interface ServiceLocator {
40  
41      /***
42       * will get the ejb Local home factory. If this ejb home factory has already
43       * been clients need to cast to the type of EJBHome they desire
44       * 
45       * @return the EJB Home corresponding to the homeName
46       */
47      public EJBLocalHome getLocalHome(String jndiHomeName)
48              throws ServiceLocatorException;
49  
50      /***
51       * will get the ejb Remote home factory. If this ejb home factory has
52       * already been clients need to cast to the type of EJBHome they desire
53       * 
54       * @return the EJB Home corresponding to the homeName
55       */
56      public EJBHome getRemoteHome(String jndiHomeName, Class className)
57              throws ServiceLocatorException;
58  
59      /***
60       * @return the factory for the factory to get queue connections from
61       */
62      public QueueConnectionFactory getQueueConnectionFactory(
63              String qConnFactoryName) throws ServiceLocatorException;
64  
65      /***
66       * @return the Queue Destination to send messages to
67       */
68      public Queue getQueue(String queueName) throws ServiceLocatorException;
69  
70      /***
71       * This method helps in obtaining the topic factory
72       * 
73       * @return the factory for the factory to get topic connections from
74       */
75      public TopicConnectionFactory getTopicConnectionFactory(
76              String topicConnFactoryName) throws ServiceLocatorException;
77  
78      /***
79       * This method obtains the topc itself for a caller
80       * 
81       * @return the Topic Destination to send messages to
82       */
83      public Topic getTopic(String topicName) throws ServiceLocatorException;
84  
85      /***
86       * This method obtains the datasource itself for a caller
87       * 
88       * @return the DataSource corresponding to the name parameter
89       */
90      public DataSource getDataSource(String dataSourceName)
91              throws ServiceLocatorException;
92  
93      /***
94       * This method obtains the mail seesion itself for a caller
95       * 
96       * @return the Session corresponding to the name parameter
97       */
98      public Session getMailSession(String mailSessionName)
99              throws ServiceLocatorException;
100 
101     /***
102      * @return the URL value corresponding to the env entry name.
103      */
104     public URL getUrl(String envName) throws ServiceLocatorException;
105 
106     /***
107      * @return the boolean value corresponding to the env entry such as
108      *         SEND_CONFIRMATION_MAIL property.
109      */
110     public boolean getBoolean(String envName) throws ServiceLocatorException;
111 
112     /***
113      * @return the String value corresponding to the env entry name.
114      */
115     public String getString(String envName) throws ServiceLocatorException;
116 
117 }