KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ejb > deployment > xml > MethodPermission


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  *
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or 1any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA
21  *
22  * Initial developer: JOnAS team
23  * --------------------------------------------------------------------------
24  * $Id: MethodPermission.java,v 1.9 2004/05/10 11:45:44 sauthieg Exp $
25  * --------------------------------------------------------------------------
26  */

27 package org.objectweb.jonas_ejb.deployment.xml;
28
29 import org.objectweb.jonas_lib.deployment.xml.AbsElement;
30 import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
31 /**
32  * This class defines the implementation of the element method-permission
33  *
34  * @author JOnAS team
35  */

36
37 public class MethodPermission extends AbsElement {
38
39     /**
40      * description
41      */

42     private String JavaDoc description = null;
43
44     /**
45      * role-name
46      */

47     private JLinkedList roleNameList = null;
48
49     /**
50      * unchecked
51      */

52     private boolean unchecked = false;
53
54     /**
55      * method
56      */

57     private JLinkedList methodList = null;
58
59
60     /**
61      * Constructor
62      */

63     public MethodPermission() {
64         super();
65         roleNameList = new JLinkedList("role-name");
66         methodList = new JLinkedList("method");
67     }
68
69     /**
70      * Gets the description
71      * @return the description
72      */

73     public String JavaDoc getDescription() {
74         return description;
75     }
76
77     /**
78      * Set the description
79      * @param description description
80      */

81     public void setDescription(String JavaDoc description) {
82         this.description = description;
83     }
84
85     /**
86      * Gets the role-name
87      * @return the role-name
88      */

89     public JLinkedList getRoleNameList() {
90         return roleNameList;
91     }
92
93     /**
94      * Set the role-name
95      * @param roleNameList roleName
96      */

97     public void setRoleNameList(JLinkedList roleNameList) {
98         this.roleNameList = roleNameList;
99     }
100
101     /**
102      * Add a new role-name element to this object
103      * @param roleName the roleNameobject
104      */

105     public void addRoleName(String JavaDoc roleName) {
106         roleNameList.add(roleName);
107     }
108
109     /**
110      * Gets the unchecked status
111      * @return true if it is unchecked
112      */

113     public boolean isUnchecked() {
114         return unchecked;
115     }
116
117     /**
118      * Set the unchecked
119      */

120     public void setUnchecked() {
121         this.unchecked = true;
122     }
123
124     /**
125      * Gets the method
126      * @return the method
127      */

128     public JLinkedList getMethodList() {
129         return methodList;
130     }
131
132     /**
133      * Set the method
134      * @param methodList method
135      */

136     public void setMethodList(JLinkedList methodList) {
137         this.methodList = methodList;
138     }
139
140     /**
141      * Add a new method element to this object
142      * @param method the methodobject
143      */

144     public void addMethod(Method method) {
145         methodList.add(method);
146     }
147
148     /**
149      * Represents this element by it's XML description.
150      * @param indent use this indent for prexifing XML representation.
151      * @return the XML description of this object.
152      */

153     public String JavaDoc toXML(int indent) {
154         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
155         sb.append(indent(indent));
156         sb.append("<method-permission>\n");
157
158         indent += 2;
159
160         // description
161
sb.append(xmlElement(description, "description", indent));
162         // role-name
163
sb.append(roleNameList.toXML(indent));
164         // unchecked
165
if (unchecked) {
166             sb.append(indent(indent));
167             sb.append("<unchecked></unchecked>\n");
168         }
169         // method
170
sb.append(methodList.toXML(indent));
171         indent -= 2;
172         sb.append(indent(indent));
173         sb.append("</method-permission>\n");
174
175         return sb.toString();
176     }
177 }
178
Popular Tags