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: AbsJonasParam.java 5049 2004-07-01 15:35:10Z sauthieg $
024: * --------------------------------------------------------------------------
025: */package org.objectweb.jonas_lib.deployment.xml;
026:
027: /**
028: * This class defines the implementation of the element jonas-param
029: * @author Guillaume Sauthier
030: */
031: public abstract class AbsJonasParam extends AbsElement {
032:
033: /**
034: * Name of this parameter
035: */
036: private String paramName = null;
037:
038: /**
039: * Value of this parameter
040: */
041: private String paramValue = null;
042:
043: /**
044: * Element name
045: */
046: private String elementName = null;
047:
048: /**
049: * Construct a JOnASParam with given Element name.
050: * @param ename Element name
051: */
052: protected AbsJonasParam(String ename) {
053: elementName = ename;
054: }
055:
056: // Setters
057:
058: /**
059: * Sets the name
060: * @param paramName the name to use
061: */
062: public void setParamName(String paramName) {
063: this .paramName = paramName;
064: }
065:
066: /**
067: * Sets the value
068: * @param paramValue the value
069: */
070: public void setParamValue(String paramValue) {
071: this .paramValue = paramValue;
072: }
073:
074: // Getters
075:
076: /**
077: * @return the name of the parameter
078: */
079: public String getParamName() {
080: return paramName;
081: }
082:
083: /**
084: * @return the value of the parameter
085: */
086: public String getParamValue() {
087: return paramValue;
088: }
089:
090: /**
091: * Represents this element by it's XML description.
092: * @param indent use this indent for prexifing XML representation.
093: * @return the XML description of this object.
094: */
095: public String toXML(int indent) {
096: StringBuffer sb = new StringBuffer();
097: sb.append(indent(indent));
098: sb.append("<" + elementName + ">\n");
099:
100: indent += 2;
101:
102: // name
103: sb.append(xmlElement(paramName, "param-name", indent));
104:
105: // value
106: sb.append(xmlElement(paramValue, "param-value", indent));
107:
108: indent -= 2;
109: sb.append(indent(indent));
110: sb.append("</" + elementName + ">\n");
111:
112: return sb.toString();
113: }
114:
115: }
|