KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_lib > deployment > xml > ServiceRef


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or 1any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer: Florent BENOIT
22  * --------------------------------------------------------------------------
23  * $Id: ServiceRef.java,v 1.2 2004/05/10 12:04:39 sauthieg Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.jonas_lib.deployment.xml;
28
29 /**
30  * This class defines the implementation of the element service-ref.
31  * @author Florent Benoit
32  */

33 public class ServiceRef extends AbsElement {
34
35     /**
36      * Service name
37      */

38     private String JavaDoc serviceRefName = null;
39
40
41     /**
42      * Service Interface
43      */

44     private String JavaDoc serviceInterface = null;
45
46     /**
47      * Mapping jaxrpc
48      */

49     private String JavaDoc jaxrpcMappingFile = null;
50
51     /**
52      * WSDL file
53      */

54     private String JavaDoc wsdlFile = null;
55
56
57     /**
58      * Service-qname element
59      */

60     private Qname serviceQname = null;
61
62     /**
63      * List of elements port-component-ref
64      */

65     private JLinkedList portComponentRefList = null;
66
67
68     /**
69      * List of elements handler
70      */

71     private JLinkedList handlerList = null;
72
73
74     /**
75      * Constructor : build a new ServiceRef object
76      */

77     public ServiceRef() {
78         super();
79         portComponentRefList = new JLinkedList("port-component-ref");
80         handlerList = new JLinkedList("handler");
81     }
82
83
84     // Setters
85

86     /**
87      * Add a new port-component-ref element to this object
88      * @param portComponentRef the port-component-ref object
89      */

90     public void addPortComponentRef(PortComponentRef portComponentRef) {
91         portComponentRefList.add(portComponentRef);
92     }
93
94     /**
95      * Add a new handler element to this object
96      * @param handler the handler object
97      */

98     public void addHandler(Handler handler) {
99         handlerList.add(handler);
100     }
101
102     /**
103      * Sets the service-ref-name of the service-ref
104      * @param serviceRefName of the service-ref
105      */

106     public void setServiceRefName(String JavaDoc serviceRefName) {
107         this.serviceRefName = serviceRefName;
108     }
109
110
111     /**
112      * Sets the service-interface of the service-ref
113      * @param serviceInterface name of the service-ref
114      */

115     public void setServiceInterface(String JavaDoc serviceInterface) {
116         this.serviceInterface = serviceInterface;
117     }
118
119
120     /**
121      * Sets the jaxrpc-mapping-file element of the service-ref
122      * @param jaxrpcMappingFile jaxrpc-mapping-file of the service-ref
123      */

124     public void setJaxrpcMappingFile(String JavaDoc jaxrpcMappingFile) {
125         this.jaxrpcMappingFile = jaxrpcMappingFile;
126     }
127
128
129     /**
130      * Sets the wsdl-file element of the service-ref
131      * @param wsdlFile name of the service-ref
132      */

133     public void setWsdlFile(String JavaDoc wsdlFile) {
134         this.wsdlFile = wsdlFile;
135     }
136
137
138     /**
139      * Sets the service-qname of the service-ref
140      * @param serviceQname of the service-ref
141      */

142     public void setServiceQname(Qname serviceQname) {
143         this.serviceQname = serviceQname;
144     }
145
146     // Getters
147

148     /**
149      * @return the service-ref-name of the service-ref
150      */

151     public String JavaDoc getServiceRefName() {
152         return serviceRefName;
153     }
154
155     /**
156      * @return the service-interface of the service-ref
157      */

158     public String JavaDoc getServiceInterface() {
159         return serviceInterface;
160     }
161
162     /**
163      * @return the Jaxrpc-mapping-file of the service-ref
164      */

165     public String JavaDoc getJaxrpcMappingFile() {
166         return jaxrpcMappingFile;
167     }
168
169     /**
170      * @return the wsdl-file of the service-ref
171      */

172     public String JavaDoc getWsdlFile() {
173         return wsdlFile;
174     }
175
176
177     /**
178      * @return the service-qname element
179      */

180     public Qname getServiceQname() {
181         return serviceQname;
182     }
183
184     /**
185      * @return the list of all handler elements
186      */

187     public JLinkedList getHandlerList() {
188         return handlerList;
189     }
190
191     /**
192      * @return the list of all port-component-ref elements
193      */

194     public JLinkedList getPortComponentRefList() {
195         return portComponentRefList;
196     }
197
198     /**
199      * Represents this element by it's XML description.
200      * @param indent use this indent for prexifing XML representation.
201      * @return the XML description of this object.
202      */

203     public String JavaDoc toXML(int indent) {
204         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
205         sb.append(indent(indent));
206         sb.append("<service-ref>\n");
207
208         indent += 2;
209
210         // service-ref-name
211
sb.append(xmlElement(serviceRefName, "service-ref-name", indent));
212
213         // service-interface
214
sb.append(xmlElement(serviceInterface, "service-interface", indent));
215
216         // wsdl-file
217
sb.append(xmlElement(wsdlFile, "wsdl-file", indent));
218
219         // jaxrpc-mapping-file
220
sb.append(xmlElement(jaxrpcMappingFile, "jaxrpc-mapping-file", indent));
221
222         //service-qname
223
if (serviceQname != null) {
224             sb.append(serviceQname.toXML(indent));
225         }
226
227         // port-component-ref
228
sb.append(portComponentRefList.toXML(indent));
229
230         // handler
231
sb.append(handlerList.toXML(indent));
232
233         indent -= 2;
234         sb.append(indent(indent));
235         sb.append("</service-ref>\n");
236
237         return sb.toString();
238     }
239
240
241 }
242
Popular Tags