org.acegisecurity.intercept.method
Class MethodDefinitionMap

java.lang.Object
  extended by org.acegisecurity.intercept.method.AbstractMethodDefinitionSource
      extended by org.acegisecurity.intercept.method.MethodDefinitionMap
All Implemented Interfaces:
MethodDefinitionSource, ObjectDefinitionSource

public class MethodDefinitionMap
extends AbstractMethodDefinitionSource

Stores a ConfigAttributeDefinition for each method signature defined in a bean context.

For consistency with MethodDefinitionAttributes as well as support for MethodDefinitionSourceAdvisor, this implementation will return a ConfigAttributeDefinition containing all configuration attributes defined against:

In general you should therefore define the interface methods of your secure objects, not the implementations. For example, define com.company.Foo.findAll=ROLE_TEST but not com.company.FooImpl.findAll=ROLE_TEST.

Version:
$Id: MethodDefinitionMap.java 1784 2007-02-24 21:00:24Z luke_t $
Author:
Ben Alex

Field Summary
protected  Map methodMap
          Map from Method to ApplicationDefinition
 
Constructor Summary
MethodDefinitionMap()
           
 
Method Summary
 void addSecureMethod(Class clazz, String mappedName, ConfigAttributeDefinition attr)
          Add configuration attributes for a secure method.
 void addSecureMethod(Method method, ConfigAttributeDefinition attr)
          Add configuration attributes for a secure method.
 void addSecureMethod(String name, ConfigAttributeDefinition attr)
          Add configuration attributes for a secure method.
 Iterator getConfigAttributeDefinitions()
          Obtains the configuration attributes explicitly defined against this bean.
 int getMethodMapSize()
          Obtains the number of configuration attributes explicitly defined against this bean.
protected  ConfigAttributeDefinition lookupAttributes(Method method)
          Performs the actual lookup of the relevant ConfigAttributeDefinition for the specified Method which is subject of the method invocation.
 void setMappings(List mappings)
          Easier configuration of the instance, using MethodDefinitionSourceMapping.
 
Methods inherited from class org.acegisecurity.intercept.method.AbstractMethodDefinitionSource
getAttributes, supports
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

methodMap

protected Map methodMap
Map from Method to ApplicationDefinition

Constructor Detail

MethodDefinitionMap

public MethodDefinitionMap()
Method Detail

addSecureMethod

public void addSecureMethod(Method method,
                            ConfigAttributeDefinition attr)
Add configuration attributes for a secure method. Method names can end or start with * for matching multiple methods.

Parameters:
method - the method to be secured
attr - required authorities associated with the method

addSecureMethod

public void addSecureMethod(String name,
                            ConfigAttributeDefinition attr)
Add configuration attributes for a secure method. Method names can end or start with * for matching multiple methods.

Parameters:
name - class and method name, separated by a dot
attr - required authorities associated with the method
Throws:
IllegalArgumentException - DOCUMENT ME!

addSecureMethod

public void addSecureMethod(Class clazz,
                            String mappedName,
                            ConfigAttributeDefinition attr)
Add configuration attributes for a secure method. Method names can end or start with * for matching multiple methods.

Parameters:
clazz - target interface or class
mappedName - mapped method name
attr - required authorities associated with the method
Throws:
IllegalArgumentException - DOCUMENT ME!

getConfigAttributeDefinitions

public Iterator getConfigAttributeDefinitions()
Obtains the configuration attributes explicitly defined against this bean. This method will not return implicit configuration attributes that may be returned by lookupAttributes(Method) as it does not have access to a method invocation at this time.

Returns:
the attributes explicitly defined against this bean

getMethodMapSize

public int getMethodMapSize()
Obtains the number of configuration attributes explicitly defined against this bean. This method will not return implicit configuration attributes that may be returned by lookupAttributes(Method) as it does not have access to a method invocation at this time.

Returns:
the number of configuration attributes explicitly defined against this bean

lookupAttributes

protected ConfigAttributeDefinition lookupAttributes(Method method)
Description copied from class: AbstractMethodDefinitionSource
Performs the actual lookup of the relevant ConfigAttributeDefinition for the specified Method which is subject of the method invocation.

Provided so subclasses need only to provide one basic method to properly interface with the MethodDefinitionSource.

Returns null if there are no matching attributes for the method.

Specified by:
lookupAttributes in class AbstractMethodDefinitionSource
Parameters:
method - the method being invoked for which configuration attributes should be looked up
Returns:
the ConfigAttributeDefinition that applies to the specified Method

setMappings

public void setMappings(List mappings)
Easier configuration of the instance, using MethodDefinitionSourceMapping.

Parameters:
mappings - List of MethodDefinitionSourceMapping objects.


Copyright © 2004-2011 Interface21, Inc. All Rights Reserved.