org.zkoss.spring.security.intercept.zkevent
Class ZkEventProcessDefinitionSourceImpl

java.lang.Object
  extended by org.zkoss.spring.security.intercept.zkevent.ZkEventProcessDefinitionSourceImpl
All Implemented Interfaces:
org.springframework.aop.framework.AopInfrastructureBean, org.springframework.security.access.SecurityMetadataSource, ZkEventProcessDefinitionSource

public class ZkEventProcessDefinitionSourceImpl
extends java.lang.Object
implements ZkEventProcessDefinitionSource

Default implementation of ZkEventProcessDefinitionSource.

Stores an ordered map of compiled Component paths and event name to ConfigAttributeDefinitions and provides Component path and event matching against the items stored in this map using the configured UrlMatcher.

The order of registering the regular expressions using the addSecureEvent(java.lang.String, java.lang.String, java.util.Collection) is very important. The matching is done per the following rules:

  1. The event-specific matches will take precedence over any Component paths which are registered without an event name.
  2. The system will identify the first matching expression for a given Component path. It will not proceed to evaluate later expressions if a match has already been found.
Accordingly, the most specific expressions should be registered first, with the most general regular expressions registered last.

Since:
1.0
Author:
henrichen
See Also:
ZkEventProcessDefinitionSourceBeanDefinitionParser

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Constructor Summary
ZkEventProcessDefinitionSourceImpl(org.springframework.security.web.util.UrlMatcher pathMatcher)
           
ZkEventProcessDefinitionSourceImpl(org.springframework.security.web.util.UrlMatcher pathMatcher, java.util.LinkedHashMap requestMap)
          Builds the internal request map from the supplied map.
 
Method Summary
 void addSecureEvent(java.lang.String path, java.lang.String event, java.util.Collection<org.springframework.security.access.ConfigAttribute> attr)
           
 java.util.Collection<org.springframework.security.access.ConfigAttribute> getAllConfigAttributes()
           
 java.util.Collection<org.springframework.security.access.ConfigAttribute> getAttributes(java.lang.Object object)
           
 java.util.Collection getConfigAttributeDefinitions()
           
 java.util.Collection<org.springframework.security.access.ConfigAttribute> lookupAttributes(java.lang.String path, java.lang.String event)
          Performs the actual lookup of the relevant ConfigAttributeDefinition for the specified Event.
 boolean supports(java.lang.Class clazz)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

ZkEventProcessDefinitionSourceImpl

public ZkEventProcessDefinitionSourceImpl(org.springframework.security.web.util.UrlMatcher pathMatcher)

ZkEventProcessDefinitionSourceImpl

public ZkEventProcessDefinitionSourceImpl(org.springframework.security.web.util.UrlMatcher pathMatcher,
                                          java.util.LinkedHashMap requestMap)
Builds the internal request map from the supplied map. The key elements should be of type EventProcessKey, which contains a Component path and an event name (may be null). The path stored in the key will depend on the type of the supplied UrlMatcher.

Parameters:
pathMatcher - typically an ant or regular expression matcher.
requestMap - order-preserving map of .
Method Detail

addSecureEvent

public void addSecureEvent(java.lang.String path,
                           java.lang.String event,
                           java.util.Collection<org.springframework.security.access.ConfigAttribute> attr)

getAttributes

public java.util.Collection<org.springframework.security.access.ConfigAttribute> getAttributes(java.lang.Object object)
                                                                                        throws java.lang.IllegalArgumentException
Specified by:
getAttributes in interface org.springframework.security.access.SecurityMetadataSource
Throws:
java.lang.IllegalArgumentException

lookupAttributes

public java.util.Collection<org.springframework.security.access.ConfigAttribute> lookupAttributes(java.lang.String path,
                                                                                                  java.lang.String event)
Performs the actual lookup of the relevant ConfigAttributeDefinition for the specified Event.

By default, iterates through the stored Path map and calls the UrlMatcher.pathMatchesUrl(Object pattern, String path) method until a match is found.

Subclasses can override if required to perform any modifications to the path.

Parameters:
path - the Component path to retrieve configuration attributes for
event - the event name
Returns:
the ConfigAttributeDefinition that applies to the specified Event or null if no match is foud

getConfigAttributeDefinitions

public java.util.Collection getConfigAttributeDefinitions()

supports

public boolean supports(java.lang.Class clazz)
Specified by:
supports in interface org.springframework.security.access.SecurityMetadataSource

getAllConfigAttributes

public java.util.Collection<org.springframework.security.access.ConfigAttribute> getAllConfigAttributes()
Specified by:
getAllConfigAttributes in interface org.springframework.security.access.SecurityMetadataSource


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.