Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.acegisecurity.intercept.method
Class MethodDefinitionMap  view MethodDefinitionMap download MethodDefinitionMap.java

java.lang.Object
  extended byorg.acegisecurity.intercept.method.AbstractMethodDefinitionSource
      extended byorg.acegisecurity.intercept.method.MethodDefinitionMap
All Implemented Interfaces:
MethodDefinitionSource, org.acegisecurity.intercept.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,v 1.6 2005/11/17 00:56:09 benalex Exp $

Field Summary
private static org.apache.commons.logging.Log logger
           
protected  java.util.Map methodMap
          Map from Method to ApplicationDefinition
private  java.util.Map nameMap
          Map from Method to name pattern used for registration
 
Constructor Summary
MethodDefinitionMap()
           
 
Method Summary
 void addSecureMethod(java.lang.Class clazz, java.lang.String mappedName, ConfigAttributeDefinition attr)
          Add configuration attributes for a secure method.
 void addSecureMethod(java.lang.reflect.Method method, ConfigAttributeDefinition attr)
          Add configuration attributes for a secure method.
 void addSecureMethod(java.lang.String name, ConfigAttributeDefinition attr)
          Add configuration attributes for a secure method.
 java.util.Iterator getConfigAttributeDefinitions()
          Obtains the configuration attributes explicitly defined against this bean.
 int getMethodMapSize()
          Obtains the number of configuration attributes explicitly defined against this bean.
private  boolean isMatch(java.lang.String methodName, java.lang.String mappedName)
          Return if the given method name matches the mapped name.
protected  ConfigAttributeDefinition lookupAttributes(java.lang.reflect.Method method)
          Performs the actual lookup of the relevant ConfigAttributeDefinition for the specified Method which is subject of the method invocation.
private  void merge(ConfigAttributeDefinition definition, ConfigAttributeDefinition toMerge)
           
 
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

logger

private static final org.apache.commons.logging.Log logger

methodMap

protected java.util.Map methodMap
Map from Method to ApplicationDefinition


nameMap

private java.util.Map nameMap
Map from Method to name pattern used for registration

Constructor Detail

MethodDefinitionMap

public MethodDefinitionMap()
Method Detail

getConfigAttributeDefinitions

public java.util.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) 55 as it does not have access to a method invocation at this time.


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) 55 as it does not have access to a method invocation at this time.


addSecureMethod

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


addSecureMethod

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


addSecureMethod

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


lookupAttributes

protected ConfigAttributeDefinition lookupAttributes(java.lang.reflect.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

isMatch

private boolean isMatch(java.lang.String methodName,
                        java.lang.String mappedName)
Return if the given method name matches the mapped name. The default implementation checks for "xxx" and "xxx" matches.


merge

private void merge(ConfigAttributeDefinition definition,
                   ConfigAttributeDefinition toMerge)