org.apache.jackrabbit.core.security.authorization
Class PrivilegeRegistry

java.lang.Object
  extended by org.apache.jackrabbit.core.security.authorization.PrivilegeRegistry

public final class PrivilegeRegistry
extends Object

The PrivilegeRegistry defines the set of Privileges known to the repository.


Field Summary
static int ADD_CHILD_NODES
           
static int ALL
           
static int MODIFY_AC
           
static int MODIFY_PROPERTIES
           
static int NO_PRIVILEGE
           
static int READ
           
static int READ_AC
           
static int REMOVE_CHILD_NODES
           
static int REMOVE_NODE
           
static int WRITE
           
 
Constructor Summary
PrivilegeRegistry(NameResolver resolver)
          Create a new PrivilegeRegistry instance.
 
Method Summary
static int getBits(Privilege[] privileges)
           
 Privilege getPrivilege(String privilegeName)
          Returns the privilege with the specified privilegeName.
 Privilege[] getPrivileges(int bits)
          Returns an array of registered Privileges.
 Privilege[] getRegisteredPrivileges()
          Returns all registered privileges.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_PRIVILEGE

public static final int NO_PRIVILEGE
See Also:
Constant Field Values

READ

public static final int READ
See Also:
Constant Field Values

MODIFY_PROPERTIES

public static final int MODIFY_PROPERTIES
See Also:
Constant Field Values

ADD_CHILD_NODES

public static final int ADD_CHILD_NODES
See Also:
Constant Field Values

REMOVE_CHILD_NODES

public static final int REMOVE_CHILD_NODES
See Also:
Constant Field Values

REMOVE_NODE

public static final int REMOVE_NODE
See Also:
Constant Field Values

READ_AC

public static final int READ_AC
See Also:
Constant Field Values

MODIFY_AC

public static final int MODIFY_AC
See Also:
Constant Field Values

WRITE

public static final int WRITE
See Also:
Constant Field Values

ALL

public static final int ALL
See Also:
Constant Field Values
Constructor Detail

PrivilegeRegistry

public PrivilegeRegistry(NameResolver resolver)
Create a new PrivilegeRegistry instance.

Parameters:
resolver - NameResolver used to calculate the JCR name of the privileges.
Method Detail

getRegisteredPrivileges

public Privilege[] getRegisteredPrivileges()
Returns all registered privileges.

Returns:
all registered privileges.

getPrivilege

public Privilege getPrivilege(String privilegeName)
                       throws AccessControlException,
                              RepositoryException
Returns the privilege with the specified privilegeName.

Parameters:
privilegeName -
Returns:
the privilege with the specified privilegeName.
Throws:
AccessControlException - If no privilege with the given name exists.
RepositoryException - If another error occurs.

getPrivileges

public Privilege[] getPrivileges(int bits)
Returns an array of registered Privileges. If the specified bits represent a registered privilege the returned array contains a single element. Otherwise the returned array contains the individual registered privileges that are combined in the givent bits. If bits is 0 or does not match to any registered privilege an empty array will be returned.

Parameters:
bits -
Returns:
Array of Privileges that are presented by the given it or an empty array if bits is lower than READ or cannot be resolved to registered Privileges.

getBits

public static int getBits(Privilege[] privileges)
                   throws AccessControlException
Parameters:
privileges -
Returns:
Throws:
AccessControlException - If the specified array is null or if it contains an unregistered privilege.


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.