KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > container > info > security > MethodSecurityInfo


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: MethodSecurityInfo.java 1121 2006-09-27 08:51:06Z benoitf $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.easybeans.container.info.security;
27
28 import java.security.Permission JavaDoc;
29 import java.util.ArrayList JavaDoc;
30 import java.util.List JavaDoc;
31
32 import org.objectweb.easybeans.api.bean.info.IMethodSecurityInfo;
33
34 /**
35  * Used to describe permission information for a given method.
36  * @author Florent Benoit
37  */

38 public class MethodSecurityInfo implements IMethodSecurityInfo {
39
40     /**
41      * Excluded method ?.
42      */

43     private boolean excluded = false;
44
45     /**
46      * Unchecked method ?.
47      */

48     private boolean unchecked = false;
49
50     /**
51      * List of roles for this method.
52      */

53     private List JavaDoc<String JavaDoc> roles = null;
54
55     /**
56      * Permission for this method.
57      */

58     private Permission JavaDoc permission;
59
60     /**
61      * Default constructor.
62      */

63     public MethodSecurityInfo() {
64         this.roles = new ArrayList JavaDoc<String JavaDoc>();
65     }
66
67
68     /**
69      * This method is excluded (no call allowed if true).
70      * @param excluded boolean true/false.
71      */

72     public void setExcluded(final boolean excluded) {
73         this.excluded = excluded;
74     }
75
76     /**
77      * @return true if the method is excluded.
78      */

79     public boolean isExcluded() {
80         return excluded;
81     }
82
83     /**
84      * This method is unchecked (if true, all calls are allowed to this method).
85      * @param unchecked boolean true/false.
86      */

87     public void setUnchecked(final boolean unchecked) {
88         this.unchecked = unchecked;
89     }
90
91     /**
92      * @return true if the method is unchecked.
93      */

94     public boolean isUnchecked() {
95         return unchecked;
96     }
97
98     /**
99      * Add the given role to the list of roles allowed to call this method.
100      * @param roleName the name of the role.
101      */

102     public void addRole(final String JavaDoc roleName) {
103         this.roles.add(roleName);
104     }
105
106     /**
107      * @return list of roles allowed to call this method.
108      */

109     public List JavaDoc<String JavaDoc> getRoles() {
110         return roles;
111     }
112
113     /**
114      * Sets the permission.
115      * @param permission the permission to set.
116      */

117     public void setPermission(final Permission JavaDoc permission) {
118         this.permission = permission;
119     }
120
121     /**
122      * @return permissions for this method.
123      */

124     public Permission JavaDoc getPermission() {
125         return permission;
126     }
127
128 }
129
Popular Tags