KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > lib > deployment > webservice > WebServiceConnector


1 /*
2  * CoadunationLib: The coaduntion implementation library.
3  * Copyright (C) 2006 Rift IT Contracting
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
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 JavaDoc;
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     /**
53      * This method will be responsible for initializing the web service
54      * connector.
55      *
56      * @param webServiceManager The reference to the web service manager.
57      */

58     public static synchronized void init(WebServiceManager webServiceManager) {
59         if (singleton == null) {
60             singleton = new WebServiceConnector(webServiceManager);
61         }
62     }
63     
64     
65     /**
66      * This method returns the WebService connector instance.
67      *
68      * @return The reference to the web service connector.
69      * @exception JMXException
70      */

71     public static synchronized WebServiceConnector getInstance()
72             throws WebServiceException {
73         if (singleton == null) {
74             throw new WebServiceException (
75                     "The Web Service connector has not been initialized.");
76         }
77         return singleton;
78     }
79     
80     
81     /**
82      * Retrieve the list of web servies.
83      *
84      * @return The list of web services managed by this object.
85      */

86     public Set JavaDoc getServices() {
87         return webServiceManager.getServices();
88     }
89     
90     
91     /**
92      * This method retrieve the service identified by the path
93      *
94      * @return The service identified by the path.
95      * @param path The path identifying the path.
96      */

97     public Object JavaDoc getService(String JavaDoc path) {
98         return webServiceManager.getService(path);
99     }
100 }
101
Popular Tags