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: *
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or 1any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
020: * USA
021: *
022: * Initial developer: JOnAS team
023: * --------------------------------------------------------------------------
024: * $Id: JonasWebservices.java 7467 2005-10-04 12:53:14Z sauthieg $
025: * --------------------------------------------------------------------------
026: */package org.objectweb.jonas_ws.deployment.xml;
027:
028: import org.objectweb.jonas_lib.deployment.xml.AbsElement;
029: import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
030: import org.objectweb.jonas_lib.deployment.xml.TopLevelElement;
031:
032: import org.objectweb.jonas_ws.deployment.api.JonasWsSchemas;
033:
034: /**
035: * This class defines the implementation of the element jonas-webservices
036: *
037: * @author JOnAS team
038: */
039:
040: public class JonasWebservices extends AbsElement implements
041: TopLevelElement {
042:
043: /**
044: * Header (with right XSD version) for XML
045: */
046: private String header = null;
047:
048: /**
049: * war
050: */
051: private String war = null;
052:
053: /**
054: * context-root
055: */
056: private String contextRoot = null;
057:
058: /**
059: * jonas-webservice-description
060: */
061: private JLinkedList jwsDescList = null;
062:
063: /**
064: * jonas-webservices element XML header
065: */
066: public static final String JONAS_WEBSERVICES_ELEMENT = "<?xml version=\"1.0\"?>\n"
067: + "<jonas-webservices xmlns=\"http://www.objectweb.org/jonas/ns\"\n"
068: + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
069: + " xsi:schemaLocation=\"http://www.objectweb.org/jonas/ns\n"
070: + " http://www.objectweb.org/jonas/ns/"
071: + JonasWsSchemas.getLastSchema() + "\">\n";
072:
073: /**
074: * Constructor
075: */
076: public JonasWebservices() {
077: super ();
078: jwsDescList = new JLinkedList("jonas-webservice-description");
079: }
080:
081: /**
082: * Gets the war
083: * @return the war
084: */
085: public String getWar() {
086: return war;
087: }
088:
089: /**
090: * Set the war
091: * @param war war
092: */
093: public void setWar(String war) {
094: this .war = war;
095: }
096:
097: /**
098: * @return Returns the contextRoot.
099: */
100: public String getContextRoot() {
101: return contextRoot;
102: }
103:
104: /**
105: * @param contextRoot The contextRoot to set.
106: */
107: public void setContextRoot(String contextRoot) {
108: this .contextRoot = contextRoot;
109: }
110:
111: /**
112: * Gets the jonas-webservice-description
113: * @return the jonas-webservice-description
114: */
115: public JLinkedList getJonasWebserviceDescriptionList() {
116: return jwsDescList;
117: }
118:
119: /**
120: * Add a new jonas-webservice-description element to this object
121: * @param jwsd the jonas-webservice-description
122: */
123: public void addJonasWebserviceDescription(
124: JonasWebserviceDescription jwsd) {
125: jwsDescList.add(jwsd);
126: }
127:
128: /**
129: * Represents this element by it's XML description.
130: * @param indent use this indent for prexifing XML representation.
131: * @return the XML description of this object.
132: */
133: public String toXML(int indent) {
134: StringBuffer sb = new StringBuffer();
135: sb.append(indent(indent));
136: sb.append(JONAS_WEBSERVICES_ELEMENT);
137:
138: indent += 2;
139:
140: // war
141: if (war != null) {
142: sb.append(xmlElement(war, "war", indent));
143: }
144: // context-root
145: if (contextRoot != null) {
146: sb.append(xmlElement(contextRoot, "context-root", indent));
147: }
148: // jonas-webservice-description
149: sb.append(getJonasWebserviceDescriptionList().toXML(indent));
150:
151: indent -= 2;
152: sb.append(indent(indent));
153: sb.append("</jonas-webservices>\n");
154:
155: return sb.toString();
156: }
157:
158: /**
159: * @return the header.
160: */
161: public String getHeader() {
162: return header;
163: }
164:
165: /**
166: * @param header The header to set.
167: */
168: public void setHeader(String header) {
169: this.header = header;
170: }
171:
172: }
|