001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999-2004 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: * --------------------------------------------------------------------------
022: * $Id: JonasServiceRef.java 5408 2004-09-10 11:37:56Z sauthieg $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas_lib.deployment.xml;
025:
026: /**
027: * This class defines the implementation of the element jonas-service-ref.
028: * @author Florent Benoit
029: */
030: public class JonasServiceRef extends AbsElement {
031:
032: /**
033: * Name of this jonas-service-ref
034: */
035: private String serviceRefName = null;
036:
037: /**
038: * URL pointing to an alternate WSDL Definition
039: */
040: private String altWsdl = null;
041:
042: /**
043: * List of init parameters
044: */
045: private JLinkedList jonasInitParamList = null;
046:
047: /**
048: * List of jonas-port-component-ref
049: */
050: private JLinkedList jonasPortComponentRefList = null;
051:
052: /**
053: * Constructor : build a new JonasServiceRef object
054: */
055: public JonasServiceRef() {
056: jonasInitParamList = new JLinkedList("jonas-init-param");
057: jonasPortComponentRefList = new JLinkedList(
058: "jonas-port-component-ref");
059: }
060:
061: // Setters
062:
063: /**
064: * Sets the name
065: * @param serviceRefName the name to use
066: */
067: public void setServiceRefName(String serviceRefName) {
068: this .serviceRefName = serviceRefName;
069: }
070:
071: /**
072: * Add a parameter
073: * @param jonasInitParam the JonasInitParam object to add to our list
074: */
075: public void addJonasInitParam(JonasInitParam jonasInitParam) {
076: jonasInitParamList.add(jonasInitParam);
077: }
078:
079: /**
080: * Add a parameter
081: * @param jonasPortComponentRef the JonasPortComponentRef object to add to our list
082: */
083: public void addJonasPortComponentRef(
084: JonasPortComponentRef jonasPortComponentRef) {
085: jonasPortComponentRefList.add(jonasPortComponentRef);
086: }
087:
088: /**
089: * @param altWsdl The altWsdl to set.
090: */
091: public void setAltWsdl(String altWsdl) {
092: this .altWsdl = altWsdl;
093: }
094:
095: // Getters
096:
097: /**
098: * @return the name of the service-ref
099: */
100: public String getServiceRefName() {
101: return serviceRefName;
102: }
103:
104: /**
105: * @return the list of init parameters
106: */
107: public JLinkedList getJonasInitParamList() {
108: return jonasInitParamList;
109: }
110:
111: /**
112: * @return the list of jonas port component ref
113: */
114: public JLinkedList getJonasPortComponentRefList() {
115: return jonasPortComponentRefList;
116: }
117:
118: /**
119: * @return Returns the altWsdl.
120: */
121: public String getAltWsdl() {
122: return altWsdl;
123: }
124:
125: /**
126: * Represents this element by it's XML description.
127: * @param indent use this indent for prexifing XML representation.
128: * @return the XML description of this object.
129: */
130: public String toXML(int indent) {
131: StringBuffer sb = new StringBuffer();
132: sb.append(indent(indent));
133: sb.append("<jonas-service-ref>\n");
134:
135: indent += 2;
136:
137: // name
138: sb
139: .append(xmlElement(serviceRefName, "service-ref-name",
140: indent));
141:
142: // jonas port component ref
143: sb.append(jonasPortComponentRefList.toXML(indent));
144:
145: // alt-wsdl
146: sb.append(xmlElement(altWsdl, "alt-wsdl", indent));
147:
148: // init parameters
149: sb.append(jonasInitParamList.toXML(indent));
150:
151: indent -= 2;
152: sb.append(indent(indent));
153: sb.append("</jonas-service-ref>\n");
154: return sb.toString();
155: }
156:
157: }
|