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