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.sql.DataSource;
22
23 import org.huihoo.jfox.soaf.exception.ServiceLocatorException;
24
25 /***
26 * <p>
27 * This class is an implementation of the Service Locator pattern. It is used to
28 * looukup resources such as EJBHomes, JMS Destinations, etc. This
29 * implementation uses the "singleton instance" strategy and also the "caching"
30 * strategy.
31 * </p>
32 *
33 * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
34 * @version $Revision: 1.3 $ $Date: 2004/10/13 10:59:46 $
35 * @version Revision: 1.0
36 */
37
38 public interface ServiceLocator {
39
40 /***
41 * will get the ejb Local home factory. If this ejb home factory has already
42 * been clients need to cast to the type of EJBHome they desire
43 *
44 * @return the EJB Home corresponding to the homeName
45 */
46 public EJBLocalHome getLocalHome(String jndiHomeName)
47 throws ServiceLocatorException;
48
49 /***
50 * will get the ejb Remote home factory. If this ejb home factory has
51 * already been clients need to cast to the type of EJBHome they desire
52 *
53 * @return the EJB Home corresponding to the homeName
54 */
55 public EJBHome getRemoteHome(String jndiHomeName, Class className)
56 throws ServiceLocatorException;
57
58 /***
59 * @return the factory for the factory to get queue connections from
60 */
61 public QueueConnectionFactory getQueueConnectionFactory(
62 String qConnFactoryName) throws ServiceLocatorException;
63
64 /***
65 * @return the Queue Destination to send messages to
66 */
67 public Queue getQueue(String queueName) throws ServiceLocatorException;
68
69 /***
70 * This method helps in obtaining the topic factory
71 *
72 * @return the factory for the factory to get topic connections from
73 */
74 public TopicConnectionFactory getTopicConnectionFactory(
75 String topicConnFactoryName) throws ServiceLocatorException;
76
77 /***
78 * This method obtains the topc itself for a caller
79 *
80 * @return the Topic Destination to send messages to
81 */
82 public Topic getTopic(String topicName) throws ServiceLocatorException;
83
84 /***
85 * This method obtains the datasource itself for a caller
86 *
87 * @return the DataSource corresponding to the name parameter
88 */
89 public DataSource getDataSource(String dataSourceName)
90 throws ServiceLocatorException;
91
92 /***
93 * @return the URL value corresponding to the env entry name.
94 */
95 public URL getUrl(String envName) throws ServiceLocatorException;
96
97 /***
98 * @return the boolean value corresponding to the env entry such as
99 * SEND_CONFIRMATION_MAIL property.
100 */
101 public boolean getBoolean(String envName) throws ServiceLocatorException;
102
103 /***
104 * @return the String value corresponding to the env entry name.
105 */
106 public String getString(String envName) throws ServiceLocatorException;
107
108 }