KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > ext > wsmgmt > WebServiceMgrImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.management.ext.wsmgmt;
25
26 import java.util.Map JavaDoc;
27 import java.util.HashMap JavaDoc;
28 import java.util.HashSet JavaDoc;
29 import java.util.Set JavaDoc;
30 import java.util.Iterator JavaDoc;
31
32 import java.io.Serializable JavaDoc;
33
34 import javax.management.ObjectName JavaDoc;
35
36 import com.sun.appserv.management.base.AMX;
37 import com.sun.appserv.management.base.Util;
38 import com.sun.appserv.management.base.XTypes;
39
40 import com.sun.appserv.management.j2ee.J2EETypes;
41
42 import com.sun.appserv.management.util.jmx.JMXUtil;
43 import com.sun.appserv.management.util.misc.TypeCast;
44
45 import com.sun.appserv.management.ext.wsmgmt.WebServiceMgr;
46 import com.sun.appserv.management.ext.wsmgmt.WebServiceEndpointInfo;
47
48 import com.sun.enterprise.management.support.AMXImplBase;
49
50 import com.sun.enterprise.admin.wsmgmt.WebServiceMgrBackEnd;
51
52
53
54 /**
55  * Manager MBean for web services. This enumerates the list of the web services
56  * deployed in the domain. For each web service, detailed information can be
57  * obtained.
58  */

59 public class WebServiceMgrImpl extends AMXImplBase
60         // implements WebServiceMgr
61
{
62     /**
63      * Default constructor for WebServiceMgrImpl
64      */

65     public WebServiceMgrImpl() {
66     }
67     
68     /**
69      * Returns the Group information of this MBean.
70      *
71      * @return the group name (AMX.GROUP_OTHER)
72      */

73     public final String JavaDoc getGroup() {
74         return( AMX.GROUP_OTHER );
75     }
76     
77     /**
78      * Returns a Map containing web services and the fully qualified name for
79      * each web service. This fully qualified name must be used to get more
80      * details about this web service.
81      *
82      * @return Map of web service name and its fully qualified name
83      */

84     public Map JavaDoc<Object JavaDoc,String JavaDoc> getWebServiceEndpointKeys()
85     {
86         final Map JavaDoc<?,?> m = WebServiceMgrBackEnd.getManager().getWebServicesMap();
87         
88         final Map JavaDoc<Object JavaDoc,String JavaDoc> result =
89             TypeCast.checkMap( m, Object JavaDoc.class, String JavaDoc.class );
90         
91         return result;
92     }
93     
94     /**
95      * Return WebServiceInfo for a web service.
96      *
97      * @param name Fully qualified name of the web service
98      *
99      * @return WebServiceInfo for a web service
100      */

101         public Map JavaDoc<String JavaDoc, Serializable JavaDoc>
102     getWebServiceEndpointInfo(Object JavaDoc name)
103     {
104         if ( name instanceof String JavaDoc)
105         {
106             return TypeCast.asMap(
107                 WebServiceMgrBackEnd.getManager().getWebServiceInfoMap((String JavaDoc)name) );
108         }
109         else
110         {
111             throw new IllegalArgumentException JavaDoc();
112         }
113     }
114     
115     
116     
117     /**
118      * Returns the set of WebServiceEndpoint runtime mbeans for the specified
119      * Web Service Endpoint name on the specified server instance.
120      *
121      * @param webServiceInfoKey Web Service Info Key
122      * @param sName Name of the server instance
123      *
124      * @return Set of WebServiceEndpoint runtime mbeans
125      */

126     public Set JavaDoc<ObjectName JavaDoc> getWebServiceEndpointObjectNameSet(
127             Object JavaDoc webServiceInfoKey , String JavaDoc sName) {
128         
129         String JavaDoc objNamePat = WebServiceMgrBackEnd.getManager().
130                 getWebServiceEndpointObjectNames(webServiceInfoKey, sName);
131         if (objNamePat == null) {
132             return new HashSet JavaDoc<ObjectName JavaDoc>();
133         } else {
134             return getQueryMgr().queryPropsObjectNameSet(objNamePat);
135         }
136     }
137     
138     /**
139      * Returns list of configured web service registry access points.
140      */

141     public String JavaDoc[] listRegistryLocations() {
142         return WebServiceMgrBackEnd.getManager().listRegistryLocations();
143     }
144     
145     /**
146      * Publishes the WSDL of webService to the registries specified by the
147      * JNDI Names
148      *
149      * @param registryLocations array of jndi names of the connector resources
150      * pointing to different registries
151      *
152      * @param webServiceEndpointKey web service endpoint(key) whose WSDL has to
153      * be published;
154      * format is appName#moduleName#webserviceName
155      * This is opaque, as returned by the method getWebServiceEndpointKeys
156      *
157      * @param optional optional map contains the following:
158      * <pre>
159      * lbhost, host name or ip address of the loadbalancer where this
160      * service is publicly exposed
161      * lbport, loadbalancer port used to expose this service
162      * lbsslport, secure port in loadbalancer used to expose this service
163      * categories, Categories under which this web service endpoint should be
164      * published. This is an array of Strings.
165      * description, Description of the web service endpoint
166      * </pre>
167      */

168     public void publishToRegistry(String JavaDoc[] registryLocations,
169             Object JavaDoc webServiceEndpointKey, Map JavaDoc<String JavaDoc,String JavaDoc> optional) {
170         WebServiceMgrBackEnd.getManager().
171                 publishToRegistry(registryLocations, webServiceEndpointKey,
172                 optional);
173     }
174     
175     /**
176      * Unpublish WSDL of the specified webservice from the registries specified
177      * via their JNDI names
178      * @param registryLocations array of jndi names of the connector resources
179      * pointing to different registries
180      * @param webServiceEndpointKey web service endpoint(key) whose WSDL has to
181      * be published;
182      * format is appName#moduleName#webserviceName
183      * This is opaque, as returned by the method getWebServiceEndpointKeys
184      */

185     public void unpublishFromRegistry(String JavaDoc[] registryLocations,
186             Object JavaDoc webServiceEndpointKey) {
187         WebServiceMgrBackEnd.getManager().
188                 unpublishFromRegistry(registryLocations,
189                 webServiceEndpointKey);
190     }
191     /**
192      * Removes the registry specific resources from the domain.
193      * Peeks at the connector-resource element to obtain the
194      * connector-connection-pool name. Using this pool name, removes the
195      * connector-connection-pool, proceeds further to remove the
196      * connector-resource
197      * @param jndiNameOfRegistry whose resources are to be removed from the domain
198      */

199     public void removeRegistryConnectionResources(String JavaDoc jndiNameOfRegistry){
200         WebServiceMgrBackEnd.getManager().removeRegistryConnectionResources(jndiNameOfRegistry);
201     }
202     /**
203      * Adds registry specific resources to the domain.
204      * Adds a connector connection pool and then proceeds to add a connector
205      * resource
206      *
207      * @param jndiName of the connector-resource that points to the registry
208      *
209      * @param description of the connector-resource and the connector-connection
210      * -pool name
211      *
212      * @param type type of registry.
213      *
214      * {@link com.sun.appserv.management.ext.wsmgmt.WebServiceMgr#UDDI_KEY}
215      * {@link com.sun.appserv.management.ext.wsmgmt.WebServiceMgr#EBXML_KEY}
216      *
217      * @param properties a map of key, value pair that encapsulate the properties
218      * of the connection pool that connects to the registry. Properties are
219      *
220      * {@link WebServiceMgr#PUBLISH_URL_KEY}
221      * {@link WebServiceMgr#QUERY_URL_KEY}
222      * {@link WebServiceMgr#USERNAME_KEY}
223      * {@link WebServiceMgr#PASSWORD_KEY}
224      */

225     public void addRegistryConnectionResources(String JavaDoc jndiName,
226             String JavaDoc description, String JavaDoc type , Map JavaDoc<String JavaDoc, String JavaDoc> properties) {
227         WebServiceMgrBackEnd.getManager().
228                 addRegistryConnectionResources(jndiName, description, type, properties);
229     }
230 }
231
232
Popular Tags