001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 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 any 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: JonasApplication.java 7467 2005-10-04 12:53:14Z sauthieg $
024: * --------------------------------------------------------------------------
025: */package org.objectweb.jonas_ear.deployment.xml;
026:
027: import org.objectweb.jonas_ear.deployment.api.JonasEarSchemas;
028:
029: import org.objectweb.jonas_lib.deployment.xml.AbsDescriptionElement;
030: import org.objectweb.jonas_lib.deployment.xml.DescriptionGroupXml;
031: import org.objectweb.jonas_lib.deployment.xml.TopLevelElement;
032:
033: /**
034: * This class defines the implementation of the element jonas-application
035: * @author Florent Benoit
036: */
037: public class JonasApplication extends AbsDescriptionElement implements
038: TopLevelElement, DescriptionGroupXml {
039:
040: /**
041: * Header (with right XSD version) for XML
042: */
043: private String header = null;
044:
045: /**
046: * Element jonas-security
047: */
048: private JonasSecurity jonasSecurity = null;
049:
050: /**
051: * jonas-ejb-jar element XML header
052: */
053: public static final String JONAS_APPLICATION_ELEMENT = "<?xml version=\"1.0\"?>\n"
054: + "<jonas-application xmlns=\"http://www.objectweb.org/jonas/ns\"\n"
055: + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
056: + " xsi:schemaLocation=\"http://www.objectweb.org/jonas/ns\n"
057: + " http://www.objectweb.org/jonas/ns/"
058: + JonasEarSchemas.getLastSchema() + "\">\n";
059:
060: /**
061: * Constructor
062: */
063: public JonasApplication() {
064: super ();
065:
066: header = JONAS_APPLICATION_ELEMENT;
067: }
068:
069: /**
070: * Represents this element by it's XML description.
071: * @param indent use this indent for prexifing XML representation.
072: * @return the XML description of this object.
073: */
074: public String toXML(int indent) {
075: StringBuffer sb = new StringBuffer();
076: sb.append(indent(indent));
077: if (header != null) {
078: sb.append(header);
079: } else {
080: sb.append("<jonas-application>\n");
081: }
082: indent += 2;
083:
084: // jonas-security
085: if (jonasSecurity != null) {
086: sb.append(jonasSecurity.toXML(indent));
087: }
088:
089: indent -= 2;
090: sb.append(indent(indent));
091: sb.append("</jonas-application>\n");
092:
093: return sb.toString();
094: }
095:
096: /**
097: * @return the jonasSecurity.
098: */
099: public JonasSecurity getJonasSecurity() {
100: return jonasSecurity;
101: }
102:
103: /**
104: * @param jonasSecurity The jonasSecurity to set.
105: */
106: public void setJonasSecurity(JonasSecurity jonasSecurity) {
107: this .jonasSecurity = jonasSecurity;
108: }
109:
110: /**
111: * @return the header.
112: */
113: public String getHeader() {
114: return header;
115: }
116:
117: /**
118: * @param header The header to set.
119: */
120: public void setHeader(String header) {
121: this.header = header;
122: }
123: }
|