001: /*
002: * Copyright 2002,2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016:
017: package org.apache.catalina.users;
018:
019: import org.apache.catalina.Role;
020: import org.apache.catalina.UserDatabase;
021:
022: /**
023: * <p>Convenience base class for {@link Role} implementations.</p>
024: *
025: * @author Craig R. McClanahan
026: * @version $Revision: 1.3 $ $Date: 2004/02/27 14:58:50 $
027: * @since 4.1
028: */
029:
030: public abstract class AbstractRole implements Role {
031:
032: // ----------------------------------------------------- Instance Variables
033:
034: /**
035: * The description of this Role.
036: */
037: protected String description = null;
038:
039: /**
040: * The role name of this Role.
041: */
042: protected String rolename = null;
043:
044: // ------------------------------------------------------------- Properties
045:
046: /**
047: * Return the description of this role.
048: */
049: public String getDescription() {
050:
051: return (this .description);
052:
053: }
054:
055: /**
056: * Set the description of this role.
057: *
058: * @param description The new description
059: */
060: public void setDescription(String description) {
061:
062: this .description = description;
063:
064: }
065:
066: /**
067: * Return the role name of this role, which must be unique
068: * within the scope of a {@link UserDatabase}.
069: */
070: public String getRolename() {
071:
072: return (this .rolename);
073:
074: }
075:
076: /**
077: * Set the role name of this role, which must be unique
078: * within the scope of a {@link UserDatabase}.
079: *
080: * @param rolename The new role name
081: */
082: public void setRolename(String rolename) {
083:
084: this .rolename = rolename;
085:
086: }
087:
088: /**
089: * Return the {@link UserDatabase} within which this Role is defined.
090: */
091: public abstract UserDatabase getUserDatabase();
092:
093: // --------------------------------------------------------- Public Methods
094:
095: // ------------------------------------------------------ Principal Methods
096:
097: /**
098: * Make the principal name the same as the role name.
099: */
100: public String getName() {
101:
102: return (getRolename());
103:
104: }
105:
106: }
|