com.evermind.security
Class AbstractUserManager


java.lang.Object

  |

  +--com.evermind.security.AbstractUserManager

All Implemented Interfaces:
Config, UserManager
Direct Known Subclasses:
DataSourceUserManager, EJBUserManager

public abstract class AbstractUserManager
extends java.lang.Object
implements UserManager

UserManager with default implementation for common methods.


Constructor Summary
AbstractUserManager()
           
 
Method Summary
 void addDefaultGroup(java.lang.String name)
          Adds a group to the set of default groups which all users of this manager are members of.
 boolean containsDefaultGroup(java.lang.String name)
          Check if this manager contains the named default group.
 void create(java.net.URL url)
          Default implementation, does nothing.
 Group createGroup(java.lang.String name)
          Creates a new Group.
 User createUser(java.lang.String username, java.lang.String password)
          This method throws UnsupportedOperationException for UserManagers that dont support user creation (overriden by managers who do).
 User getAdminUser()
          Delegates to parent manager if present, otherwise returns null.
 User getAnonymousUser()
          Delegates to parent manager if present, otherwise returns null.
 java.util.Set getDefaultGroups()
          Gets the Set of default groups for this UserManager.
 Group getGroup(java.lang.String name)
          Delegates to parent manager if present, otherwise returns null.
 int getGroupCount()
          Return the number of users contained in this manager.
 java.util.List getGroups(int start, int max)
          Returns a list of Groups (between the specified indexes) contained in this manager.
 UserManager getParent()
          Gets this UserManagers parent.
 User getUser(java.lang.String username)
          Delegates to parent manager if present, otherwise returns null.
 User getUser(java.lang.String issuerDN, java.math.BigInteger serial)
          Returns null or delegates to the parent since certificates arent supported by default.
 User getUser(java.security.cert.X509Certificate certificate)
          Propagates the call to getUser(String issuer, BigDecimal serial)
 int getUserCount()
          Return the number of users contained in this manager.
 java.util.List getUsers(int start, int max)
          Returns a list of Users (between the specified indexes) contained in this manager.
 void init(java.util.Properties properties)
          Default implementation, does nothing.
 void invalidate()
          Default implementation, does nothing.
 boolean isUpdated()
          Default implementation, always returns false.
 boolean remove(Group group)
          Default implementation, does nothing and returns false (no group removed).
 boolean remove(User user)
          Default implementation, does nothing and returns false (no user removed).
 void setParent(UserManager parent)
          Sets this UserManagers parent.
 void store()
          Default implementation, does nothing.
 void update()
          Default implementation, does nothing.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractUserManager


public AbstractUserManager()
Method Detail

init


public void init(java.util.Properties properties)
          throws java.lang.InstantiationException
Default implementation, does nothing.
Specified by:
init in interface UserManager
Following copied from interface: com.evermind.security.UserManager
Throws:
java.lang.InstantiationException - if the init() fails.

getUser


public User getUser(java.lang.String username)
Delegates to parent manager if present, otherwise returns null.
Specified by:
getUser in interface UserManager

getAnonymousUser


public User getAnonymousUser()
Delegates to parent manager if present, otherwise returns null.
Specified by:
getAnonymousUser in interface UserManager

getGroup


public Group getGroup(java.lang.String name)
Delegates to parent manager if present, otherwise returns null.
Specified by:
getGroup in interface UserManager

setParent


public void setParent(UserManager parent)
Sets this UserManagers parent.
Specified by:
setParent in interface UserManager

getParent


public UserManager getParent()
Gets this UserManagers parent.
Specified by:
getParent in interface UserManager

getAdminUser


public User getAdminUser()
Delegates to parent manager if present, otherwise returns null.
Specified by:
getAdminUser in interface UserManager

invalidate


public void invalidate()
Default implementation, does nothing.
Specified by:
invalidate in interface Config

create


public void create(java.net.URL url)
Default implementation, does nothing.
Specified by:
create in interface Config

isUpdated


public boolean isUpdated()
Default implementation, always returns false.
Specified by:
isUpdated in interface Config

store


public void store()
Default implementation, does nothing.
Specified by:
store in interface Config

update


public void update()
Default implementation, does nothing.
Specified by:
update in interface Config

remove


public boolean remove(User user)
Default implementation, does nothing and returns false (no user removed).
Specified by:
remove in interface UserManager

remove


public boolean remove(Group group)
Default implementation, does nothing and returns false (no group removed).
Specified by:
remove in interface UserManager

getDefaultGroups


public java.util.Set getDefaultGroups()
Description copied from interface: UserManager
Gets the Set of default groups for this UserManager.
Specified by:
getDefaultGroups in interface UserManager

addDefaultGroup


public void addDefaultGroup(java.lang.String name)
Description copied from interface: UserManager
Adds a group to the set of default groups which all users of this manager are members of.
Specified by:
addDefaultGroup in interface UserManager

getUser


public User getUser(java.lang.String issuerDN,
                    java.math.BigInteger serial)
Returns null or delegates to the parent since certificates arent supported by default.
Specified by:
getUser in interface UserManager

getUser


public User getUser(java.security.cert.X509Certificate certificate)
Propagates the call to getUser(String issuer, BigDecimal serial)
Specified by:
getUser in interface UserManager

containsDefaultGroup


public boolean containsDefaultGroup(java.lang.String name)
Check if this manager contains the named default group.

createGroup


public Group createGroup(java.lang.String name)
                  throws java.lang.InstantiationException
Creates a new Group. This implementation delegates the creation to the parent.
Specified by:
createGroup in interface UserManager
Throws:
java.lang.InstantiationException - if the group exists.

getUserCount


public int getUserCount()
Description copied from interface: UserManager
Return the number of users contained in this manager. Throws UnsupportedOperationException if not supported.
Specified by:
getUserCount in interface UserManager

getGroupCount


public int getGroupCount()
Description copied from interface: UserManager
Return the number of users contained in this manager. Throws UnsupportedOperationException if not supported.
Specified by:
getGroupCount in interface UserManager

getUsers


public java.util.List getUsers(int start,
                               int max)
Description copied from interface: UserManager
Returns a list of Users (between the specified indexes) contained in this manager. Throws UnsupportedOperationException if not supported.
Specified by:
getUsers in interface UserManager

getGroups


public java.util.List getGroups(int start,
                                int max)
Description copied from interface: UserManager
Returns a list of Groups (between the specified indexes) contained in this manager. Throws UnsupportedOperationException if not supported.
Specified by:
getGroups in interface UserManager

createUser


public User createUser(java.lang.String username,
                       java.lang.String password)
                throws java.lang.InstantiationException,
                       UserAlreadyExistsException
This method throws UnsupportedOperationException for UserManagers that dont support user creation (overriden by managers who do).
Specified by:
createUser in interface UserManager
Following copied from interface: com.evermind.security.UserManager
Throws:
java.lang.InstantiationException - if the user exists.