001: /**
002: * EasyBeans
003: * Copyright (C) 2007 Bull S.A.S.
004: * Contact: easybeans@ow2.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: * --------------------------------------------------------------------------
022: * $Id: MethodPermission.java 2059 2007-11-22 17:22:33Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.deployment.xml.struct;
025:
026: import java.util.ArrayList;
027: import java.util.List;
028:
029: import org.ow2.easybeans.deployment.xml.struct.common.MethodDD;
030:
031: /**
032: * Defines a method permission used within an assembly descriptor.
033: * @author Florent BENOIT
034: */
035: public class MethodPermission {
036:
037: /**
038: * Name of this element.
039: */
040: public static final String NAME = "method-permission";
041:
042: /**
043: * List of methods on which apply this method permission block.
044: */
045: private List<MethodDD> methods = null;
046:
047: /**
048: * Unchecked method block ?
049: */
050: private boolean unchecked = false;
051:
052: /**
053: * Name of the roles.
054: */
055: private List<String> roleNameList = null;
056:
057: /**
058: * Default constructor.
059: */
060: public MethodPermission() {
061: this .roleNameList = new ArrayList<String>();
062: this .methods = new ArrayList<MethodDD>();
063: }
064:
065: /**
066: * Sets the unchecked flag.
067: * @param unchecked the given boolean value.
068: */
069: public void setUnchecked(final boolean unchecked) {
070: this .unchecked = unchecked;
071: }
072:
073: /**
074: * Is it unchecked ?.
075: * @return true if it is unchecked, else false.
076: */
077: public boolean isUnchecked() {
078: return this .unchecked;
079: }
080:
081: /**
082: * Add a new Method.
083: * @param method the given method.
084: */
085: public void addMethod(final MethodDD method) {
086: this .methods.add(method);
087: }
088:
089: /**
090: * @return list of methods.
091: */
092: public List<MethodDD> getMethods() {
093: return this .methods;
094: }
095:
096: /**
097: * Gets the name of the role.
098: * @return the role's name.
099: */
100: public List<String> getRoleNameList() {
101: return this .roleNameList;
102: }
103:
104: /**
105: * Add the given role.
106: * @param roleName the name of the role.
107: */
108: public void addRoleName(final String roleName) {
109: this.roleNameList.add(roleName);
110: }
111: }
|