org.idoox.security.pstore
Class AbstractUserStore

java.lang.Object
  extended byorg.idoox.security.pstore.AbstractUserStore
All Implemented Interfaces:
UserStore
Direct Known Subclasses:
UserStoreProxy

public abstract class AbstractUserStore
extends java.lang.Object
implements UserStore

This abstract class provides basic functionality to register and unregister notification listener, to test matching of userId agains userFilter.

Since:
4.0
Component:
Security-Core

Field Summary
protected  java.util.Vector listeners
           
 
Fields inherited from interface org.idoox.security.pstore.UserStore
DELETE_USER_ACTION, FILTER_STRING, IMAGE_PROPERTY, PASSWORD_PROPERTY, X509CERTIFICATE_PROPERTY, X509CERTIFICATECHAIN_PROPERTY
 
Constructor Summary
AbstractUserStore()
           
 
Method Summary
 void addNotificationListener(NotificationListener listener)
          Registers notification listener.
 void destroy()
          Release allocated resources.
protected  void fireDeleteUserAction(java.lang.String userName)
          Fires the delete user notification event to all listeners.
protected  boolean match(java.lang.String userId, java.lang.String pureUserFilter, boolean checkStart, boolean checkEnd)
          Tests if the userId matches the userFilter string.
 void removeNotificationListener(NotificationListener listener)
          Deregisters notification listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.idoox.security.pstore.UserStore
deleteUser, getPropertySerializer, getSupportedAttributes, getUserIds, getUserProperties, getUserProperty, getUsers, getUsers, hasUser, removeUserProperty, setPropertySerializer, setUserProperties, setUserProperty, setUserStoreSource
 

Field Detail

listeners

protected java.util.Vector listeners
Constructor Detail

AbstractUserStore

public AbstractUserStore()
Method Detail

addNotificationListener

public void addNotificationListener(NotificationListener listener)
Registers notification listener.

Specified by:
addNotificationListener in interface UserStore
Parameters:
listener - notification listener to register
See Also:
NotificationEvent

removeNotificationListener

public void removeNotificationListener(NotificationListener listener)
Deregisters notification listener.

Specified by:
removeNotificationListener in interface UserStore
Parameters:
listener - notification listener to deregister
See Also:
NotificationEvent

match

protected boolean match(java.lang.String userId,
                        java.lang.String pureUserFilter,
                        boolean checkStart,
                        boolean checkEnd)
Tests if the userId matches the userFilter string. The semantics of userFilter is carried by checkStart and checkEnd parameters. Following pseudocode describes the semantics of search string.

 VAR FILTER_FUNCTION;

 IF (checkStart)
   IF (checkEnd)
     FILTER_METHOD = contains_function ;
   ELSE
     FILTER_METHOD = startsWith_function ;
   ENDIF
 ELSE
   IF (checkEnd)
     FILTER_METHOD = endsWith_function ;
   ELSE
     FILTER_METHOD = equals_function ;
   ENDIF
 ENDIF
 

Parameters:
userId - user identifier
pureUserFilter - This string carries pure filter string, it means the semantics of filtering is carried by checkStart and checkEnd parameters. It can be null to sileghtly return true.
checkStart - described above
checkEnd - described above
Returns:
true if the userId string matches search filter
Since:
4.5

fireDeleteUserAction

protected void fireDeleteUserAction(java.lang.String userName)
Fires the delete user notification event to all listeners. This method should be invoked from the deleteUser method to notify all registered listeners about user removal.

Parameters:
userName - name of user that is being deleted from underlaying database

destroy

public void destroy()
Release allocated resources. Custom implementation of UserStore should override this if it uses some resorces that needs to be freed. This method is called during SecurityModule shutdown.

Since:
4.7