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: VariableMapping.java 4704 2004-05-06 08:53:55Z sauthieg $
025: * --------------------------------------------------------------------------
026: */package org.objectweb.jonas_ws.deployment.xml;
027:
028: import org.objectweb.jonas_lib.deployment.xml.AbsElement;
029:
030: /**
031: * This class defines the implementation of the element variable-mapping
032: *
033: * @author JOnAS team
034: */
035:
036: public class VariableMapping extends AbsElement {
037:
038: /**
039: * java-variable-name
040: */
041: private String javaVariableName = null;
042:
043: /**
044: * data-member
045: */
046: private boolean dataMember = false;
047:
048: /**
049: * xml-element-name
050: */
051: private String xmlElementName = null;
052:
053: /**
054: * Constructor
055: */
056: public VariableMapping() {
057: super ();
058: }
059:
060: /**
061: * Gets the java-variable-name
062: * @return the java-variable-name
063: */
064: public String getJavaVariableName() {
065: return javaVariableName;
066: }
067:
068: /**
069: * Set the java-variable-name
070: * @param javaVariableName javaVariableName
071: */
072: public void setJavaVariableName(String javaVariableName) {
073: this .javaVariableName = javaVariableName;
074: }
075:
076: /**
077: * Gets the data-member
078: * @return true if data-member
079: */
080: public boolean isDataMember() {
081: return dataMember;
082: }
083:
084: /**
085: * Set the data-member
086: */
087: public void setDataMember() {
088: this .dataMember = true;
089: }
090:
091: /**
092: * Gets the xml-element-name
093: * @return the xml-element-name
094: */
095: public String getXmlElementName() {
096: return xmlElementName;
097: }
098:
099: /**
100: * Set the xml-element-name
101: * @param xmlElementName xmlElementName
102: */
103: public void setXmlElementName(String xmlElementName) {
104: this .xmlElementName = xmlElementName;
105: }
106:
107: /**
108: * Represents this element by it's XML description.
109: * @param indent use this indent for prexifing XML representation.
110: * @return the XML description of this object.
111: */
112: public String toXML(int indent) {
113: StringBuffer sb = new StringBuffer();
114: sb.append(indent(indent));
115: sb.append("<variable-mapping>\n");
116:
117: indent += 2;
118:
119: // java-variable-name
120: sb.append(xmlElement(javaVariableName, "java-variable-name",
121: indent));
122: // data-member
123: if (dataMember) {
124: sb.append(indent(indent));
125: sb.append("<data-member/>");
126: }
127: // xml-element-name
128: sb
129: .append(xmlElement(xmlElementName, "xml-element-name",
130: indent));
131: indent -= 2;
132: sb.append(indent(indent));
133: sb.append("</variable-mapping>\n");
134:
135: return sb.toString();
136: }
137: }
|