KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_lib > deployment > api > SecurityRoleRefDesc


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999-2004 Bull S.A.
4  * Contact: jonas-team@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  * Initial developer: Florent BENOIT
22  * --------------------------------------------------------------------------
23  * $Id: SecurityRoleRefDesc.java,v 1.4 2004/05/11 08:07:50 sauthieg Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.jonas_lib.deployment.api;
28
29 import java.security.Permission JavaDoc;
30
31 import javax.security.jacc.EJBRoleRefPermission JavaDoc;
32 import javax.security.jacc.WebRoleRefPermission JavaDoc;
33
34 import org.objectweb.jonas_lib.deployment.xml.SecurityRoleRef;
35
36 /**
37  * Defines a SecurityRoleRefDesc class for the management of
38  * EJBRoleRefPermissions and WebRoleRefPermissions in JACC
39  * @author Florent Benoit
40  */

41 public class SecurityRoleRefDesc {
42
43     /**
44      * EJBRoleRefPermission
45      */

46     private EJBRoleRefPermission JavaDoc ejbRoleRefPermission = null;
47
48
49     /**
50      * WebRoleRefPermission
51      */

52     private WebRoleRefPermission JavaDoc webRoleRefPermission = null;
53
54
55     /**
56      * role-link used for addToRole method on PolicyConfiguration
57      */

58     private String JavaDoc roleLink = null;
59
60
61     /**
62      * role-name
63      */

64     private String JavaDoc roleName = null;
65
66
67     /**
68      * Constructor for SecurityRoleRefDesc
69      * @param componentName name of the EJB or Servlet
70      * @param securityRoleRef the security role of the assembly descriptor
71      * @param isEjb indicate if the is a SecurityRoleRef for an EJB or a Web Component
72      */

73     public SecurityRoleRefDesc(String JavaDoc componentName, SecurityRoleRef securityRoleRef, boolean isEjb) {
74         this.roleLink = securityRoleRef.getRoleLink();
75         this.roleName = securityRoleRef.getRoleName();
76         if (isEjb) {
77             this.ejbRoleRefPermission = new EJBRoleRefPermission JavaDoc(componentName, roleName);
78         } else {
79             this.webRoleRefPermission = new WebRoleRefPermission JavaDoc(componentName, roleName);
80         }
81     }
82
83
84
85     /**
86      * Gets the role-name value
87      * @return role-name
88      */

89     public String JavaDoc getRoleName() {
90         return roleName;
91     }
92
93
94     /**
95      * Gets the role-link value
96      * @return role-link
97      */

98     public String JavaDoc getRoleLink() {
99         return roleLink;
100     }
101
102     /**
103      * @return Returns the EJBRoleRefPermission
104      */

105     public Permission JavaDoc getEJBRoleRefPermission() {
106         return ejbRoleRefPermission;
107     }
108
109     /**
110      * @return Returns the WebRoleRefPermission
111      */

112     public Permission JavaDoc getWebRoleRefPermission() {
113         return webRoleRefPermission;
114     }
115 }
116
Popular Tags