001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or 1any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * Initial developer: Florent BENOIT
022: * --------------------------------------------------------------------------
023: * $Id: ServiceRef.java 4718 2004-05-10 12:06:09Z sauthieg $
024: * --------------------------------------------------------------------------
025: */package org.objectweb.jonas_lib.deployment.xml;
026:
027: /**
028: * This class defines the implementation of the element service-ref.
029: * @author Florent Benoit
030: */
031: public class ServiceRef extends AbsElement {
032:
033: /**
034: * Service name
035: */
036: private String serviceRefName = null;
037:
038: /**
039: * Service Interface
040: */
041: private String serviceInterface = null;
042:
043: /**
044: * Mapping jaxrpc
045: */
046: private String jaxrpcMappingFile = null;
047:
048: /**
049: * WSDL file
050: */
051: private String wsdlFile = null;
052:
053: /**
054: * Service-qname element
055: */
056: private Qname serviceQname = null;
057:
058: /**
059: * List of elements port-component-ref
060: */
061: private JLinkedList portComponentRefList = null;
062:
063: /**
064: * List of elements handler
065: */
066: private JLinkedList handlerList = null;
067:
068: /**
069: * Constructor : build a new ServiceRef object
070: */
071: public ServiceRef() {
072: super ();
073: portComponentRefList = new JLinkedList("port-component-ref");
074: handlerList = new JLinkedList("handler");
075: }
076:
077: // Setters
078:
079: /**
080: * Add a new port-component-ref element to this object
081: * @param portComponentRef the port-component-ref object
082: */
083: public void addPortComponentRef(PortComponentRef portComponentRef) {
084: portComponentRefList.add(portComponentRef);
085: }
086:
087: /**
088: * Add a new handler element to this object
089: * @param handler the handler object
090: */
091: public void addHandler(Handler handler) {
092: handlerList.add(handler);
093: }
094:
095: /**
096: * Sets the service-ref-name of the service-ref
097: * @param serviceRefName of the service-ref
098: */
099: public void setServiceRefName(String serviceRefName) {
100: this .serviceRefName = serviceRefName;
101: }
102:
103: /**
104: * Sets the service-interface of the service-ref
105: * @param serviceInterface name of the service-ref
106: */
107: public void setServiceInterface(String serviceInterface) {
108: this .serviceInterface = serviceInterface;
109: }
110:
111: /**
112: * Sets the jaxrpc-mapping-file element of the service-ref
113: * @param jaxrpcMappingFile jaxrpc-mapping-file of the service-ref
114: */
115: public void setJaxrpcMappingFile(String jaxrpcMappingFile) {
116: this .jaxrpcMappingFile = jaxrpcMappingFile;
117: }
118:
119: /**
120: * Sets the wsdl-file element of the service-ref
121: * @param wsdlFile name of the service-ref
122: */
123: public void setWsdlFile(String wsdlFile) {
124: this .wsdlFile = wsdlFile;
125: }
126:
127: /**
128: * Sets the service-qname of the service-ref
129: * @param serviceQname of the service-ref
130: */
131: public void setServiceQname(Qname serviceQname) {
132: this .serviceQname = serviceQname;
133: }
134:
135: // Getters
136:
137: /**
138: * @return the service-ref-name of the service-ref
139: */
140: public String getServiceRefName() {
141: return serviceRefName;
142: }
143:
144: /**
145: * @return the service-interface of the service-ref
146: */
147: public String getServiceInterface() {
148: return serviceInterface;
149: }
150:
151: /**
152: * @return the Jaxrpc-mapping-file of the service-ref
153: */
154: public String getJaxrpcMappingFile() {
155: return jaxrpcMappingFile;
156: }
157:
158: /**
159: * @return the wsdl-file of the service-ref
160: */
161: public String getWsdlFile() {
162: return wsdlFile;
163: }
164:
165: /**
166: * @return the service-qname element
167: */
168: public Qname getServiceQname() {
169: return serviceQname;
170: }
171:
172: /**
173: * @return the list of all handler elements
174: */
175: public JLinkedList getHandlerList() {
176: return handlerList;
177: }
178:
179: /**
180: * @return the list of all port-component-ref elements
181: */
182: public JLinkedList getPortComponentRefList() {
183: return portComponentRefList;
184: }
185:
186: /**
187: * Represents this element by it's XML description.
188: * @param indent use this indent for prexifing XML representation.
189: * @return the XML description of this object.
190: */
191: public String toXML(int indent) {
192: StringBuffer sb = new StringBuffer();
193: sb.append(indent(indent));
194: sb.append("<service-ref>\n");
195:
196: indent += 2;
197:
198: // service-ref-name
199: sb
200: .append(xmlElement(serviceRefName, "service-ref-name",
201: indent));
202:
203: // service-interface
204: sb.append(xmlElement(serviceInterface, "service-interface",
205: indent));
206:
207: // wsdl-file
208: sb.append(xmlElement(wsdlFile, "wsdl-file", indent));
209:
210: // jaxrpc-mapping-file
211: sb.append(xmlElement(jaxrpcMappingFile, "jaxrpc-mapping-file",
212: indent));
213:
214: //service-qname
215: if (serviceQname != null) {
216: sb.append(serviceQname.toXML(indent));
217: }
218:
219: // port-component-ref
220: sb.append(portComponentRefList.toXML(indent));
221:
222: // handler
223: sb.append(handlerList.toXML(indent));
224:
225: indent -= 2;
226: sb.append(indent(indent));
227: sb.append("</service-ref>\n");
228:
229: return sb.toString();
230: }
231:
232: }
|