01: /*
02: * CoadunationLib: The coaduntion implementation library.
03: * Copyright (C) 2006 Rift IT Contracting
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18: *
19: * JMXBeanConnector.java
20: *
21: * This singleton is responsible for supplying access to the web services.
22: */
23:
24: // package path
25: package com.rift.coad.lib.deployment.webservice;
26:
27: // java imports
28: import java.util.Set;
29:
30: // coadunation imports
31: import com.rift.coad.lib.webservice.WebServiceWrapper;
32:
33: /**
34: * This singleton is responsible for supplying access to the web services.
35: *
36: * @author Brett Chaldecott
37: */
38: public class WebServiceConnector {
39:
40: // the classes private member variables
41: private static WebServiceConnector singleton = null;
42: private WebServiceManager webServiceManager = null;
43:
44: /**
45: * Creates a new instance of WebServiceConnector
46: */
47: private WebServiceConnector(WebServiceManager webServiceManager) {
48: this .webServiceManager = webServiceManager;
49: }
50:
51: /**
52: * This method will be responsible for initializing the web service
53: * connector.
54: *
55: * @param webServiceManager The reference to the web service manager.
56: */
57: public static synchronized void init(
58: WebServiceManager webServiceManager) {
59: if (singleton == null) {
60: singleton = new WebServiceConnector(webServiceManager);
61: }
62: }
63:
64: /**
65: * This method returns the WebService connector instance.
66: *
67: * @return The reference to the web service connector.
68: * @exception JMXException
69: */
70: public static synchronized WebServiceConnector getInstance()
71: throws WebServiceException {
72: if (singleton == null) {
73: throw new WebServiceException(
74: "The Web Service connector has not been initialized.");
75: }
76: return singleton;
77: }
78:
79: /**
80: * Retrieve the list of web servies.
81: *
82: * @return The list of web services managed by this object.
83: */
84: public Set getServices() {
85: return webServiceManager.getServices();
86: }
87:
88: /**
89: * This method retrieve the service identified by the path
90: *
91: * @return The service identified by the path.
92: * @param path The path identifying the path.
93: */
94: public Object getService(String path) {
95: return webServiceManager.getService(path);
96: }
97: }
|