KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jcr > access > AccessManager


1 /*
2  * $Id: AccessManager.java,v 1.2 2004/07/24 00:16:22 benjmestrallet Exp $
3  *
4  * Copyright 2002-2004 Day Management AG, Switzerland.
5  *
6  * Licensed under the Day RI License, Version 2.0 (the "License"),
7  * as a reference implementation of the following specification:
8  *
9  * Content Repository API for Java Technology, revision 0.12
10  * <http://www.jcp.org/en/jsr/detail?id=170>
11  *
12  * You may not use this file except in compliance with the License.
13  * You may obtain a copy of the License files at
14  *
15  * http://www.day.com/content/en/licenses/day-ri-license-2.0
16  * http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */

24 package javax.jcr.access;
25
26 import javax.jcr.RepositoryException;
27 import javax.jcr.PathNotFoundException;
28
29 /**
30  * The access manager object.
31  * <p/>
32  * <b>Level 2 only</b>
33  * <p/>
34  * Acquired via <code>{@link javax.jcr.Workspace#getAccessManager()}</code>.
35  *
36  * @author Peeter Piegaze
37  * @author Stefan Guggisberg
38  */

39 public interface AccessManager {
40
41   /**
42    * Returns the status of the item at <code>absPath</code> regarding
43    * the specified <code>permissions</code> (under the rights held by current
44    * ticket). See <code>{@link Permission}</code> for more details.
45    *
46    * @param absPath an absolute path to an item.
47    * @param permissions A combination of one or more of the following constants
48    * encoded as a bitmask value:
49    * <ul>
50    * <li><code>Permission.ADD_NODE</code></li>
51    * <li><code>Permission.SET_PROPERTY</code></li>
52    * <li><code>Permission.REMOVE_ITEM</code></li>
53    * <li><code>Permission.READ_ITEM</code></li>
54    * </ul>
55    * See <code>{@link Permission}</code>.
56    * @return <code>true</code> if <code>permissions</code> are true for the
57    * item at <code>absPath</code>; <code>false</code> otherwise.
58    * @throws PathNotFoundException if no <code>Item</code> exists at
59    * <code>absPath</code>.
60    * @throws RepositoryException if an unexpected error occurs.
61    * @throws IllegalArgumentException if <code>permissions</code> specifies
62    * invalid permissions.
63    */

64   public boolean isGranted(String JavaDoc absPath, long permissions) throws PathNotFoundException, RepositoryException;
65
66   /**
67    * Returns the set of permissions that are <code>true</code> for the item
68    * at <code>absPath</code>.
69    *
70    * @param absPath an absolute path to an item.
71    * @return A set of permissions encoded in a bitmask of permission constants
72    * defined in <code>{@link Permission}</code>
73    * @throws PathNotFoundException if no <code>Item</code> exists at
74    * <code>absPath</code>.
75    * @throws RepositoryException if an unexpected error occurs.
76    */

77   public long getPermissions(String JavaDoc absPath) throws PathNotFoundException, RepositoryException;
78
79   /**
80    * Returns an array of <code>{@link Permission}</code> objects describing
81    * all permissions supported by this repository.
82    *
83    * @return An array of <code>Permission</code>s.
84    */

85   public Permission[] getSupportedPermissions();
86 }
87
Popular Tags