View Javadoc

1   /* 
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     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      /***
32       * <p>Default constructor.</p>
33       */
34      public RoleImpl()
35      {
36      }
37  
38      /***
39       * <p>{@link Role} constructor given a role principal and preferences.</p>
40       * @param rolePrincipal The role principal.
41       * @param preferences The preferences.
42       */
43      public RoleImpl(Principal rolePrincipal, Preferences preferences)
44      {
45          this.rolePrincipal = rolePrincipal;
46          this.preferences = preferences;
47      }
48  
49      private Principal rolePrincipal;
50      
51      /***
52       * @see org.apache.jetspeed.security.Role#getPrincipal()
53       */
54      public Principal getPrincipal()
55      {
56          return this.rolePrincipal;
57      }
58  
59      /***
60       * @see org.apache.jetspeed.security.Role#setPrincipal(java.security.Principal)
61       */
62      public void setPrincipal(Principal rolePrincipal)
63      {
64          this.rolePrincipal = rolePrincipal;
65      }
66  
67      private Preferences preferences;
68  
69      /***
70       * @see org.apache.jetspeed.security.Role#getPreferences()
71       */
72      public Preferences getPreferences()
73      {
74          return this.preferences;
75      }
76  
77      /***
78       * @see org.apache.jetspeed.security.Role#setPreferences(java.util.prefs.Preferences)
79       */
80      public void setPreferences(Preferences preferences)
81      {
82          this.preferences = preferences;
83      }
84  
85  }