org.alfresco.repo.security.person
Class RegexHomeFolderProvider

java.lang.Object
  extended by org.alfresco.repo.security.person.AbstractHomeFolderProvider2
      extended by org.alfresco.repo.security.person.UsernameHomeFolderProvider
          extended by org.alfresco.repo.security.person.RegexHomeFolderProvider
All Implemented Interfaces:
HomeFolderProvider2, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean

public class RegexHomeFolderProvider
extends UsernameHomeFolderProvider

Implementation that returns a tree structure for a home folder based on a property (typically userName) from the supplied person. The parent folder names are derived from regular expression groups matched against the property value. The final folder name is the full property value.

For example, given the value "adavis" and the regular expression "^(..)" the resulting home folder path would be "/ad/adavis". However with the regular expression "^(.)(.?)" the home folder path would be "/a/d/adavis". If any group matches a zero length string, it is just ignored.

Note: In order to choose an efficient distribution scheme, be aware that, when m users are distributed into n leaf folders, when m >> n log n the statistical maximum load is m/n + O( sqrt((m log n)/n)), w.h.p


Constructor Summary
RegexHomeFolderProvider()
           
 
Method Summary
 java.util.List getHomeFolderPath(org.alfresco.service.cmr.repository.NodeRef person)
          Returns a preferred path (a list of folder names) for the home folder relative to the root path.
 void setGroupOrder(java.lang.String groupOrderString)
           
 void setPattern(java.lang.String patternString)
           
 void setPropertyName(java.lang.String propertyName)
           
 
Methods inherited from class org.alfresco.repo.security.person.UsernameHomeFolderProvider
getHomeFolder, getTemplateNodeRef, setTemplatePath
 
Methods inherited from class org.alfresco.repo.security.person.AbstractHomeFolderProvider2
afterPropertiesSet, getHomeFolderManager, getName, getOnCreatePermissionsManager, getOnReferencePermissionsManager, getOwner, getRootPath, getStoreUrl, setBeanName, setHomeFolderManager, setOnCreatePermissionsManager, setOnReferencePermissionsManager, setOwner, setRootPath, setStoreUrl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RegexHomeFolderProvider

public RegexHomeFolderProvider()
Method Detail

setPropertyName

public void setPropertyName(java.lang.String propertyName)
Parameters:
propertyName - String the cm:person property used as the key, such as userName or organizationId.

setPattern

public void setPattern(java.lang.String patternString)
Parameters:
patternString - the regex pattern against the cm:person property value. Regex groups define the parent folder structure.

setGroupOrder

public void setGroupOrder(java.lang.String groupOrderString)
Parameters:
groupOrderString - String the order (as a comma separated list) in which the regex pattern groups should be assembled into folders (such as 2,1). The default ordering is as they appear.

getHomeFolderPath

public java.util.List getHomeFolderPath(org.alfresco.service.cmr.repository.NodeRef person)
Description copied from interface: HomeFolderProvider2
Returns a preferred path (a list of folder names) for the home folder relative to the root path. If all users share the root, the returned value should be an empty List or null. When all users have their own folder under the root there should be just one element in the List. Multiple elements should be returned when a nested folder structure is preferred.

Specified by:
getHomeFolderPath in interface HomeFolderProvider2
Overrides:
getHomeFolderPath in class UsernameHomeFolderProvider
Parameters:
person - NodeRef from which a property (normally the userName) is used as a hash key to create a nested directory structure.
Returns:
the path to be used.


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.