FileDocCategorySizeDatePackage
SecurityServiceEventListenerImpl.javaAPI DocGlassfish v2 API4610Fri May 04 22:35:24 BST 2007com.sun.enterprise.security.audit

SecurityServiceEventListenerImpl

public class SecurityServiceEventListenerImpl extends Object implements com.sun.enterprise.admin.event.SecurityServiceEventListener
Listener interface to handle security service events. In this moment, only audit-enabled flag can be updated dynamically.
author
Shing Wai Chan

Fields Summary
Constructors Summary
Methods Summary
public voidsecurityServiceCreated(com.sun.enterprise.admin.event.SecurityServiceEvent event)
New security service element created. It is called whenever a SecurityServiceEvent with action of SecurityServiceEvent.ACTION_CREATE is received.

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

    
public voidsecurityServiceDeleted(com.sun.enterprise.admin.event.SecurityServiceEvent event)
security service deleted. It is called whenever a SecurityServiceEvent with action of SecurityServiceEvent.ACTION_DELETE is received.

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

    
public voidsecurityServiceUpdated(com.sun.enterprise.admin.event.SecurityServiceEvent event)
security service element updated (attributes change). It is called whenever a SecurityServiceEvent with action of SecurityServiceEvent.ACTION_UPDATE is received.

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

        try {
            SecurityService securityBean =
                ServerBeansFactory.getSecurityServiceBean(
                event.getConfigContext());
            boolean auditFlag = securityBean.isAuditEnabled();

            SecurityService oldSecurityBean =
                ServerBeansFactory.getSecurityServiceBean(
                event.getOldConfigContext());

            boolean oldAuditFlag = oldSecurityBean.isAuditEnabled();

            if (auditFlag != oldAuditFlag) {
                AuditManagerFactory.getInstance().getAuditManagerInstance().setAuditOn(auditFlag);
            }
        } catch(Exception ex) {
            throw new AdminEventListenerException(ex);
        }