001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999-2004 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * Initial developer: Florent BENOIT
022: * --------------------------------------------------------------------------
023: * $Id: SecurityRoleRefDesc.java 4729 2004-05-11 08:07:50Z sauthieg $
024: * --------------------------------------------------------------------------
025: */package org.objectweb.jonas_lib.deployment.api;
026:
027: import java.security.Permission;
028:
029: import javax.security.jacc.EJBRoleRefPermission;
030: import javax.security.jacc.WebRoleRefPermission;
031:
032: import org.objectweb.jonas_lib.deployment.xml.SecurityRoleRef;
033:
034: /**
035: * Defines a SecurityRoleRefDesc class for the management of
036: * EJBRoleRefPermissions and WebRoleRefPermissions in JACC
037: * @author Florent Benoit
038: */
039: public class SecurityRoleRefDesc {
040:
041: /**
042: * EJBRoleRefPermission
043: */
044: private EJBRoleRefPermission ejbRoleRefPermission = null;
045:
046: /**
047: * WebRoleRefPermission
048: */
049: private WebRoleRefPermission webRoleRefPermission = null;
050:
051: /**
052: * role-link used for addToRole method on PolicyConfiguration
053: */
054: private String roleLink = null;
055:
056: /**
057: * role-name
058: */
059: private String roleName = null;
060:
061: /**
062: * Constructor for SecurityRoleRefDesc
063: * @param componentName name of the EJB or Servlet
064: * @param securityRoleRef the security role of the assembly descriptor
065: * @param isEjb indicate if the is a SecurityRoleRef for an EJB or a Web Component
066: */
067: public SecurityRoleRefDesc(String componentName,
068: SecurityRoleRef securityRoleRef, boolean isEjb) {
069: this .roleLink = securityRoleRef.getRoleLink();
070: this .roleName = securityRoleRef.getRoleName();
071: if (isEjb) {
072: this .ejbRoleRefPermission = new EJBRoleRefPermission(
073: componentName, roleName);
074: } else {
075: this .webRoleRefPermission = new WebRoleRefPermission(
076: componentName, roleName);
077: }
078: }
079:
080: /**
081: * Gets the role-name value
082: * @return role-name
083: */
084: public String getRoleName() {
085: return roleName;
086: }
087:
088: /**
089: * Gets the role-link value
090: * @return role-link
091: */
092: public String getRoleLink() {
093: return roleLink;
094: }
095:
096: /**
097: * @return Returns the EJBRoleRefPermission
098: */
099: public Permission getEJBRoleRefPermission() {
100: return ejbRoleRefPermission;
101: }
102:
103: /**
104: * @return Returns the WebRoleRefPermission
105: */
106: public Permission getWebRoleRefPermission() {
107: return webRoleRefPermission;
108: }
109: }
|