KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > wsdl > impl > WSDLServiceImpl


1 /*
2  * Copyright 2004,2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.wsdl.impl;
17
18 import org.apache.wsdl.WSDLEndpoint;
19 import org.apache.wsdl.WSDLInterface;
20 import org.apache.wsdl.WSDLService;
21
22 import javax.xml.namespace.QName JavaDoc;
23 import java.util.HashMap JavaDoc;
24
25 /**
26  * @author chathura@opensource.lk
27  */

28 public class WSDLServiceImpl extends ComponentImpl implements WSDLService {
29     /**
30      * The QName that identifies the Service. This namespace of the QName
31      * should be the target namespace defined in the Definitions component.
32      */

33     private QName JavaDoc name;
34
35     /**
36      * The Interface that this Service is an instance of.
37      */

38     private WSDLInterface serviceInterface;
39
40     /**
41      *
42      */

43     private HashMap JavaDoc endpoints = new HashMap JavaDoc();
44
45     /**
46      * Method getEndpoints
47      *
48      * @return
49      */

50     public HashMap JavaDoc getEndpoints() {
51         return endpoints;
52     }
53
54     /**
55      * Method setEndpoints
56      *
57      * @param endpoints
58      */

59     public void setEndpoints(HashMap JavaDoc endpoints) {
60         this.endpoints = endpoints;
61     }
62
63     /**
64      * Will add a WSDLEndpoint object to the WOM keyed with qname;
65      *
66      * @param endpoint
67      */

68     public void setEndpoint(WSDLEndpoint endpoint) {
69         this.endpoints.put(endpoint.getName(), endpoint);
70     }
71
72     /**
73      * Endpoint will be retrived by its qname.
74      *
75      * @param qName qname of the Service
76      * @return <code>WSDLEndpoint</code> Object.
77      */

78     public WSDLEndpoint getEndpoint(QName JavaDoc qName) {
79         return (WSDLEndpoint) this.endpoints.get(qName);
80         
81     }
82
83     /**
84      * Method getName
85      *
86      * @return
87      */

88     public QName JavaDoc getName() {
89         return name;
90     }
91
92     /**
93      * Method setName
94      *
95      * @param name
96      */

97     public void setName(QName JavaDoc name) {
98         this.name = name;
99     }
100
101     /**
102      * If the Name of the <code>WSDLService</code> is not set a
103      * <code>WSDLProcessingException</code> will be thrown.
104      *
105      * @return Target Namespace as a <code>String</code>
106      */

107     public String JavaDoc getNamespace() {
108         if (null == this.name) {
109             throw new WSDLProcessingException(
110                     "Target Namespace not set and the Service Name is null");
111         }
112         return this.name.getNamespaceURI();
113     }
114
115     /**
116      * Method getServiceInterface
117      *
118      * @return
119      */

120     public WSDLInterface getServiceInterface() {
121         return serviceInterface;
122     }
123
124     /**
125      * Method setServiceInterface
126      *
127      * @param serviceInterface
128      */

129     public void setServiceInterface(WSDLInterface serviceInterface) {
130         this.serviceInterface = serviceInterface;
131     }
132 }
133
Popular Tags