org.springframework.security.acls.domain
Class DefaultPermissionFactory

java.lang.Object
  extended by org.springframework.security.acls.domain.DefaultPermissionFactory
All Implemented Interfaces:
PermissionFactory

public class DefaultPermissionFactory
extends Object
implements PermissionFactory

Default implementation of PermissionFactory.

Used as a strategy by classes which wish to map integer masks and permission names to Permission instances for use with the ACL implementation.

Maintains a registry of permission names and masks to Permission instances.

Since:
2.0.3
Author:
Ben Alex, Luke Taylor

Constructor Summary
DefaultPermissionFactory()
          Registers the Permission fields from the BasePermission class.
DefaultPermissionFactory(Class<? extends Permission> permissionClass)
          Registers the Permission fields from the supplied class.
DefaultPermissionFactory(Map<String,? extends Permission> namedPermissions)
          Registers a map of named Permission instances.
 
Method Summary
 Permission buildFromMask(int mask)
          Dynamically creates a CumulativePermission or BasePermission representing the active bits in the passed mask.
 Permission buildFromName(String name)
           
 List<Permission> buildFromNames(List<String> names)
           
protected  void registerPermission(Permission perm, String permissionName)
           
protected  void registerPublicPermissions(Class<? extends Permission> clazz)
          Registers the public static fields of type Permission for a give class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPermissionFactory

public DefaultPermissionFactory()
Registers the Permission fields from the BasePermission class.


DefaultPermissionFactory

public DefaultPermissionFactory(Class<? extends Permission> permissionClass)
Registers the Permission fields from the supplied class.


DefaultPermissionFactory

public DefaultPermissionFactory(Map<String,? extends Permission> namedPermissions)
Registers a map of named Permission instances.

Parameters:
namedPermissions - the map of Permissions, keyed by name.
Method Detail

registerPublicPermissions

protected void registerPublicPermissions(Class<? extends Permission> clazz)
Registers the public static fields of type Permission for a give class.

These permissions will be registered under the name of the field. See BasePermission for an example.

Parameters:
clazz - a Permission class with public static fields to register

registerPermission

protected void registerPermission(Permission perm,
                                  String permissionName)

buildFromMask

public Permission buildFromMask(int mask)
Description copied from interface: PermissionFactory
Dynamically creates a CumulativePermission or BasePermission representing the active bits in the passed mask.

Specified by:
buildFromMask in interface PermissionFactory
Parameters:
mask - to build
Returns:
a Permission representing the requested object

buildFromName

public Permission buildFromName(String name)
Specified by:
buildFromName in interface PermissionFactory

buildFromNames

public List<Permission> buildFromNames(List<String> names)
Specified by:
buildFromNames in interface PermissionFactory


Copyright © 2004-2009 SpringSource, Inc. All Rights Reserved.