FileDocCategorySizeDatePackage
UserMgmtEventListenerImpl.javaAPI DocGlassfish v2 API4720Fri May 04 22:35:28 BST 2007com.sun.enterprise.security.auth.realm

UserMgmtEventListenerImpl

public class UserMgmtEventListenerImpl extends Object implements com.sun.enterprise.admin.event.UserMgmtEventListener
Implements interface UserMgmtEventListener. So that users can be dynamically created/updated/deleted.
author
Shing Wai Chan

Fields Summary
Constructors Summary
Methods Summary
private voidreloadRealm(com.sun.enterprise.admin.event.UserMgmtEvent event)
In this moment, user management is supported only in FileRealm. The FileRealm will be refreshed in this case. Other realms will throw Exception. Administrative API may be factored out during JSR 196 implementation.

param
event the UserMgmtEvent
exception
AdminEventListenerException

        try {
            String realmName = event.getAuthRealmName();
            Realm realm = Realm.getInstance(realmName);

            // should always true in this moment
            if (realm instanceof FileRealm) {
                SecuritySupport secSupp = SecurityUtil.getSecuritySupport();
                secSupp.synchronizeKeyFile(event.getConfigContext(), realmName);
            }

            realm.refresh();
        } catch(Exception ex) {
            throw new AdminEventListenerException(ex);
        }
    
public voiduserAdded(com.sun.enterprise.admin.event.UserMgmtEvent event)
user added. It is called whenever a UserMgmtEvent with action of UserMgmtEvent.ACTION_USERADD is received.

throws
AdminEventListenerException when the listener is unable to process the event.

        reloadRealm(event);
    
public voiduserRemoved(com.sun.enterprise.admin.event.UserMgmtEvent event)
user deleted. It is called whenever a UserMgmtEvent with action of UserMgmtEvent.ACTION_USERREMOVE is received.

throws
AdminEventListenerException when the listener is unable to process the event.

        reloadRealm(event);
    
public voiduserUpdated(com.sun.enterprise.admin.event.UserMgmtEvent event)
user updated (attributes change). It is called whenever a UserMgmtEvent with action of UserMgmtEvent.ACTION_USERUPDATE is received.

throws
AdminEventListenerException when the listener is unable to process the event.

        reloadRealm(event);