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: MethodPermission.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.JLinkedList;
030:
031: /**
032: * This class defines the implementation of the element method-permission
033: *
034: * @author JOnAS team
035: */
036:
037: public class MethodPermission extends AbsElement {
038:
039: /**
040: * description
041: */
042: private String description = null;
043:
044: /**
045: * role-name
046: */
047: private JLinkedList roleNameList = null;
048:
049: /**
050: * unchecked
051: */
052: private boolean unchecked = false;
053:
054: /**
055: * method
056: */
057: private JLinkedList methodList = null;
058:
059: /**
060: * Constructor
061: */
062: public MethodPermission() {
063: super ();
064: roleNameList = new JLinkedList("role-name");
065: methodList = new JLinkedList("method");
066: }
067:
068: /**
069: * Gets the description
070: * @return the description
071: */
072: public String getDescription() {
073: return description;
074: }
075:
076: /**
077: * Set the description
078: * @param description description
079: */
080: public void setDescription(String description) {
081: this .description = description;
082: }
083:
084: /**
085: * Gets the role-name
086: * @return the role-name
087: */
088: public JLinkedList getRoleNameList() {
089: return roleNameList;
090: }
091:
092: /**
093: * Set the role-name
094: * @param roleNameList roleName
095: */
096: public void setRoleNameList(JLinkedList roleNameList) {
097: this .roleNameList = roleNameList;
098: }
099:
100: /**
101: * Add a new role-name element to this object
102: * @param roleName the roleNameobject
103: */
104: public void addRoleName(String roleName) {
105: roleNameList.add(roleName);
106: }
107:
108: /**
109: * Gets the unchecked status
110: * @return true if it is unchecked
111: */
112: public boolean isUnchecked() {
113: return unchecked;
114: }
115:
116: /**
117: * Set the unchecked
118: */
119: public void setUnchecked() {
120: this .unchecked = true;
121: }
122:
123: /**
124: * Gets the method
125: * @return the method
126: */
127: public JLinkedList getMethodList() {
128: return methodList;
129: }
130:
131: /**
132: * Set the method
133: * @param methodList method
134: */
135: public void setMethodList(JLinkedList methodList) {
136: this .methodList = methodList;
137: }
138:
139: /**
140: * Add a new method element to this object
141: * @param method the methodobject
142: */
143: public void addMethod(Method method) {
144: methodList.add(method);
145: }
146:
147: /**
148: * Represents this element by it's XML description.
149: * @param indent use this indent for prexifing XML representation.
150: * @return the XML description of this object.
151: */
152: public String toXML(int indent) {
153: StringBuffer sb = new StringBuffer();
154: sb.append(indent(indent));
155: sb.append("<method-permission>\n");
156:
157: indent += 2;
158:
159: // description
160: sb.append(xmlElement(description, "description", indent));
161: // role-name
162: sb.append(roleNameList.toXML(indent));
163: // unchecked
164: if (unchecked) {
165: sb.append(indent(indent));
166: sb.append("<unchecked></unchecked>\n");
167: }
168: // method
169: sb.append(methodList.toXML(indent));
170: indent -= 2;
171: sb.append(indent(indent));
172: sb.append("</method-permission>\n");
173:
174: return sb.toString();
175: }
176: }
|