gate.security
Class UserImpl

java.lang.Object
  |
  +--gate.security.UserImpl
All Implemented Interfaces:
EventListener, GateListener, ObjectModificationListener, User

public class UserImpl
extends Object
implements User, ObjectModificationListener


Field Summary
private  AccessControllerImpl ac
          reference to the security factory
private  Connection conn
          Connection to the data store used for updates
private  int dbType
          ---
private  List groups
          list of groups the user belongs to
private  Long id
          user ID (must be unique)
private  String name
          user name (must be unique)
private  Vector omCreationListeners
          list of objects that should be modified when this object is created
private  Vector omDeletionListeners
          list of objects that should be modified when this object is deleted
private  Vector omModificationListeners
          list of objects that should be modified when the state of this object is changed
 
Fields inherited from interface gate.security.User
OBJECT_CHANGE_NAME
 
Constructor Summary
UserImpl(Long id, String name, List groups, AccessControllerImpl ac, Connection conn)
          ---
 
Method Summary
 boolean equals(Object obj)
          this one is necessary for the contains() operations in Lists It is possible that two users have two different UserImpl that refer to the very same user in the DB, because they got it fromt he security factory at different times.
private  void fireObjectModifiedEvent(ObjectModificationEvent e)
          sends ObjectModificationEvent of type OBJECT_MODIFIED to all who have already registered
 List getGroups()
          returns a list with the groups that the user is member of
 Long getID()
          returns the ID of the user user IDs are uniques in the same data store
 String getName()
          returns the name of the user user names are unique in the same data store
 void objectCreated(ObjectModificationEvent e)
          callback that is invoked from objects that were created and this user object is interested in NOTE that this events are just ignored
 void objectDeleted(ObjectModificationEvent e)
          callback that is invoked from objects that were deleted and this user object is interested in Useful when a group is deleted from the security factory and this user should be notified so that it will remove the reference to the group from its internal collections (the user is no longer member of the group)
 void objectModified(ObjectModificationEvent e)
          callback that is invoked from objects that were modified and this user object is interested in Useful when a group drops the user as member and this user should be notified so that it will remove the reference to the group from its internal collections (the user is no longer member of the group)
 void processGateEvent(GateEvent e)
          huh?
 void registerObjectModificationListener(ObjectModificationListener l, int eventType)
          registers an object fore receiving ObjectModificationEvent-s send by this object the only types of events sent by a user object are OBJECT_DELETED and OBJECT_MODIFIED, so any attempt for registering for other events is invalid
(package private)  void setGroups(Vector groupIDs)
           
 void setName(String newName, Session s)
          changes user name Only members of the ADMIN group have sufficient privileges.
 void setPassword(String newPass, Session s)
          changes user password Only members of the ADMIN group and the user himself have sufficient privileges
 void unregisterObjectModificationListener(ObjectModificationListener l, int eventType)
          unregisters an object fore receiving ObjectModificationEvent-s send by this object the only types of events sent by a user object are OBJECT_DELETED and OBJECT_MODIFIED, so any attempt for unregistering for other events is invalid
 
Methods inherited from class java.lang.Object
, clone, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

id

private Long id
user ID (must be unique)

name

private String name
user name (must be unique)

groups

private List groups
list of groups the user belongs to

conn

private Connection conn
Connection to the data store used for updates

dbType

private int dbType
---

ac

private AccessControllerImpl ac
reference to the security factory

omModificationListeners

private Vector omModificationListeners
list of objects that should be modified when the state of this object is changed

omCreationListeners

private Vector omCreationListeners
list of objects that should be modified when this object is created

omDeletionListeners

private Vector omDeletionListeners
list of objects that should be modified when this object is deleted
Constructor Detail

UserImpl

public UserImpl(Long id,
                String name,
                List groups,
                AccessControllerImpl ac,
                Connection conn)
---
Method Detail

getID

public Long getID()
returns the ID of the user user IDs are uniques in the same data store
Specified by:
getID in interface User

getName

public String getName()
returns the name of the user user names are unique in the same data store
Specified by:
getName in interface User

getGroups

public List getGroups()
returns a list with the groups that the user is member of
Specified by:
getGroups in interface User

setName

public void setName(String newName,
                    Session s)
             throws PersistenceException,
                    SecurityException
changes user name Only members of the ADMIN group have sufficient privileges. fires ObjectModificationEvent
Specified by:
setName in interface User
See Also:
gate.events.ObjectModificationEvent

setPassword

public void setPassword(String newPass,
                        Session s)
                 throws PersistenceException,
                        SecurityException
changes user password Only members of the ADMIN group and the user himself have sufficient privileges
Specified by:
setPassword in interface User

equals

public boolean equals(Object obj)
this one is necessary for the contains() operations in Lists It is possible that two users have two different UserImpl that refer to the very same user in the DB, because they got it fromt he security factory at different times. So we assume that two instances refer the same GATE user if ID1==ID2 && NAME1==NAME2
Overrides:
equals in class Object

registerObjectModificationListener

public void registerObjectModificationListener(ObjectModificationListener l,
                                               int eventType)
registers an object fore receiving ObjectModificationEvent-s send by this object the only types of events sent by a user object are OBJECT_DELETED and OBJECT_MODIFIED, so any attempt for registering for other events is invalid

unregisterObjectModificationListener

public void unregisterObjectModificationListener(ObjectModificationListener l,
                                                 int eventType)
unregisters an object fore receiving ObjectModificationEvent-s send by this object the only types of events sent by a user object are OBJECT_DELETED and OBJECT_MODIFIED, so any attempt for unregistering for other events is invalid

fireObjectModifiedEvent

private void fireObjectModifiedEvent(ObjectModificationEvent e)
sends ObjectModificationEvent of type OBJECT_MODIFIED to all who have already registered

objectCreated

public void objectCreated(ObjectModificationEvent e)
callback that is invoked from objects that were created and this user object is interested in NOTE that this events are just ignored
Specified by:
objectCreated in interface ObjectModificationListener

objectModified

public void objectModified(ObjectModificationEvent e)
callback that is invoked from objects that were modified and this user object is interested in Useful when a group drops the user as member and this user should be notified so that it will remove the reference to the group from its internal collections (the user is no longer member of the group)
Specified by:
objectModified in interface ObjectModificationListener

objectDeleted

public void objectDeleted(ObjectModificationEvent e)
callback that is invoked from objects that were deleted and this user object is interested in Useful when a group is deleted from the security factory and this user should be notified so that it will remove the reference to the group from its internal collections (the user is no longer member of the group)
Specified by:
objectDeleted in interface ObjectModificationListener

processGateEvent

public void processGateEvent(GateEvent e)
huh?
Specified by:
processGateEvent in interface GateListener

setGroups

void setGroups(Vector groupIDs)