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