01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.jetspeed.security.impl;
18:
19: import java.security.Principal;
20: import java.util.prefs.Preferences;
21:
22: import org.apache.jetspeed.security.Role;
23:
24: /**
25: * <p>A role made of a {@link Principal} and the user {@link Preferences}.</p>
26: * @author <a href="mailto:dlestrat@apache.org">David Le Strat</a>
27: */
28: public class RoleImpl implements Role {
29:
30: /**
31: * <p>Default constructor.</p>
32: */
33: public RoleImpl() {
34: }
35:
36: /**
37: * <p>{@link Role} constructor given a role principal and preferences.</p>
38: * @param rolePrincipal The role principal.
39: * @param preferences The preferences.
40: */
41: public RoleImpl(Principal rolePrincipal, Preferences preferences) {
42: this .rolePrincipal = rolePrincipal;
43: this .preferences = preferences;
44: }
45:
46: private Principal rolePrincipal;
47:
48: /**
49: * @see org.apache.jetspeed.security.Role#getPrincipal()
50: */
51: public Principal getPrincipal() {
52: return this .rolePrincipal;
53: }
54:
55: /**
56: * @see org.apache.jetspeed.security.Role#setPrincipal(java.security.Principal)
57: */
58: public void setPrincipal(Principal rolePrincipal) {
59: this .rolePrincipal = rolePrincipal;
60: }
61:
62: private Preferences preferences;
63:
64: /**
65: * @see org.apache.jetspeed.security.Role#getPreferences()
66: */
67: public Preferences getPreferences() {
68: return this .preferences;
69: }
70:
71: /**
72: * @see org.apache.jetspeed.security.Role#setPreferences(java.util.prefs.Preferences)
73: */
74: public void setPreferences(Preferences preferences) {
75: this.preferences = preferences;
76: }
77:
78: }
|