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.om;
18  
19  import java.io.Serializable;
20  import java.util.Collection;
21  import java.sql.Timestamp;
22  
23  /***
24   * <p>
25   * Interface representing a policy principal. This will be used by the
26   * {@link org.apache.jetspeed.security.impl.RdbmsPolicy}to retrieve specify
27   * which permissions are applied on which principal according to the JAAS
28   * policy:
29   * </p>
30   * 
31   * <pre>
32   * <code>
33   * grant [SignedBy &quot;signer_names&quot;] [, CodeBase &quot;URL&quot;]
34   *              [, InternalPrincipal [principal_class_name] &quot;principal_name&quot;]
35   *              [, InternalPrincipal [principal_class_name] &quot;principal_name&quot;] ... 
36   *        {
37   *                   permission permission_class_name [ &quot;target_name&quot; ] 
38   *                                                    [, &quot;action&quot;] [, SignedBy &quot;signer_names&quot;];
39   *                   permission ...
40   *        };
41   *  
42   * </code>
43   * </pre>
44   * 
45   * @author <a href="mailto:dlestrat@apache.org">David Le Strat </a>
46   */
47  public interface InternalPrincipal extends Serializable, Cloneable
48  {
49  
50      /***
51       * <p>
52       * Getter for the principal id.
53       * </p>
54       * 
55       * @return The principal id.
56       */
57      long getPrincipalId();
58  
59      /***
60       * <p>
61       * Setter for the principal id.
62       * </p>
63       * 
64       * @param principalId The principal id.
65       */
66      void setPrincipalId(long principalId);
67  
68      /***
69       * <p>
70       * Getter for the principal classname.
71       * </p>
72       * 
73       * @return The principal classname.
74       */
75      String getClassname();
76  
77      /***
78       * <p>
79       * Setter for the principal classname.
80       * </p>
81       * 
82       * @param classname The principal classname.
83       */
84      void setClassname(String classname);
85  
86      /***
87       * <p>
88       * Getter for isMappingOnly.
89       * </p>
90       * 
91       * @return The isMappingOnly.
92       */
93      boolean isMappingOnly();
94  
95      /***
96       * <p>
97       * Setter for isMappingOnly.
98       * </p>
99       * 
100      * @param isMappingOnly The isMappingOnly.
101      */
102     void setMappingOnly(boolean isMappingOnly);
103 
104     /***
105      * <p>
106      * Getter for the principal full path.
107      * </p>
108      * <p>
109      * The full path allows to retrieve the principal preferences from the
110      * preferences services.
111      * </p>
112      * 
113      * @return The principal full path.
114      */
115     String getFullPath();
116 
117     /***
118      * <p>
119      * Setter for the principal name.
120      * </p>
121      * <p>
122      * The full path allows to retrieve the principal preferences from the
123      * preferences services.
124      * </p>
125      * 
126      * @param fullPath The principal full path.
127      */
128     void setFullPath(String fullPath);
129 
130     /***
131      * <p>
132      * Getter for the principal permissions.
133      * </p>
134      * 
135      * @return The principal permissions.
136      */
137     Collection getPermissions();
138 
139     /***
140      * <p>
141      * Setter for the principal permissions.
142      * </p>
143      * 
144      * @param permissions The principal permissions.
145      */
146     void setPermissions(Collection permissions);
147 
148     /***
149      * <p>
150      * Getter for creation date.
151      * </p>
152      * 
153      * @return The creation date.
154      */
155     Timestamp getCreationDate();
156 
157     /***
158      * <p>
159      * Setter for the creation date.
160      * </p>
161      * 
162      * @param creationDate The creation date.
163      */
164     void setCreationDate(Timestamp creationDate);
165 
166     /***
167      * <p>
168      * Getter for the modified date.
169      * </p>
170      * 
171      * @return The modified date.
172      */
173     Timestamp getModifiedDate();
174 
175     /***
176      * <p>
177      * Setter for the modified date.
178      * </p>
179      * 
180      * @param modifiedDate The modified date.
181      */
182     void setModifiedDate(Timestamp modifiedDate);
183 
184     /***
185      * <p>Getter for the enabled state</p>
186      * @return true if enabled
187      */
188     boolean isEnabled();
189     
190     /***
191      * Setter for the enabled state</p>
192      * @param enabled The enabled state
193      */
194     void setEnabled(boolean enabled);    
195 }