Class SelfTestSubsystem

  • All Implemented Interfaces:
    ISubsystem, com.netscape.certsrv.selftests.ISelfTestSubsystem

    public class SelfTestSubsystem
    extends java.lang.Object
    implements com.netscape.certsrv.selftests.ISelfTestSubsystem
    This class implements a container for self tests.

    Version:
    $Revision$, $Date$
    Author:
    mharmsen, thomask
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.slf4j.Logger logger  
      java.util.Vector<SelfTestOrderedInstance> mOnDemandOrder  
      java.util.Hashtable<java.lang.String,​com.netscape.certsrv.selftests.ISelfTest> mSelfTestInstances  
      java.util.Vector<SelfTestOrderedInstance> mStartupOrder  
      • Fields inherited from interface com.netscape.certsrv.selftests.ISelfTestSubsystem

        ID, PROP_CONTAINER, PROP_INSTANCE, PROP_LOGGER, PROP_LOGGER_CLASS, PROP_ON_DEMAND, PROP_ORDER, PROP_STARTUP
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void audit​(com.netscape.certsrv.logging.LogEvent event)  
      void deregisterSelfTestAtStartup​(java.lang.String instanceName)
      Deregister an individual self test on the instances list AND on the "startup" list (note that the specified self test will be removed from each list).
      void deregisterSelfTestOnDemand​(java.lang.String instanceName)
      Deregister an individual self test on the instances list AND on the "on demand" list (note that the specified self test will be removed from each list).
      void disableSelfTestAtStartup​(java.lang.String instanceName)
      Disable the specified self test at server startup.
      void disableSelfTestOnDemand​(java.lang.String instanceName)
      Disable the specified self test from being able to be executed on demand.
      void enableSelfTestAtStartup​(java.lang.String instanceName, boolean isCritical)
      Enable the specified self test at server startup.
      void enableSelfTestOnDemand​(java.lang.String instanceName, boolean isCritical)
      Enable the specified self test to be executed on demand.
      IConfigStore getConfigStore()
      Returns the root configuration storage of this subsystem.
      java.lang.String getId()
      This method retrieves the name of this subsystem.
      com.netscape.certsrv.selftests.ISelfTest getSelfTest​(java.lang.String instanceName)
      Retrieve an individual self test from the instances list given its instance name.
      com.netscape.certsrv.logging.ILogEventListener getSelfTestLogger()
      Returns the ILogEventListener of this subsystem.
      java.util.Collection<java.lang.String> getSelfTestNames()  
      void init​(IConfigStore config)
      This method initializes this subsystem.
      boolean isSelfTestCriticalAtStartup​(java.lang.String instanceName)
      Determine if failure of the specified self test is fatal to server startup.
      boolean isSelfTestCriticalOnDemand​(java.lang.String instanceName)
      Determine if failure of the specified self test is fatal when it is executed on demand.
      boolean isSelfTestEnabledAtStartup​(java.lang.String instanceName)
      Determine if the specified self test is executed automatically at server startup.
      boolean isSelfTestEnabledOnDemand​(java.lang.String instanceName)
      Determine if the specified self test is enabled to be executed on demand.
      java.lang.String[] listSelfTestsEnabledAtStartup()
      List the instance names of all the self tests enabled to run at server startup (in execution order); may return null.
      java.lang.String[] listSelfTestsEnabledOnDemand()
      List the instance names of all the self tests enabled to run on demand (in execution order); may return null.
      void log​(int level, java.lang.String msg)  
      void log​(com.netscape.certsrv.logging.ILogEventListener logger, java.lang.String msg)
      This method represents the log interface for the self test subsystem.
      void registerSelfTestAtStartup​(java.lang.String instanceName, boolean isCritical, com.netscape.certsrv.selftests.ISelfTest instance)
      Register an individual self test on the instances list AND on the "startup" list (note that the specified self test will be appended to the end of each list).
      void registerSelfTestOnDemand​(java.lang.String instanceName, boolean isCritical, com.netscape.certsrv.selftests.ISelfTest instance)
      Register an individual self test on the instances list AND on the "on demand" list (note that the specified self test will be appended to the end of each list).
      void runSelfTest​(java.lang.String instanceName)
      Execute a self test.
      void runSelfTestsAtStartup()
      Execute all self tests specified to be run at server startup.
      void runSelfTestsOnDemand()
      Execute all self tests specified to be run on demand.
      void setId​(java.lang.String id)
      This method sets information specific to this subsystem.
      void shutdown()
      Stops this subsystem.
      void startup()
      Notifies this subsystem if owner is in running mode.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • logger

        public static org.slf4j.Logger logger
      • mSelfTestInstances

        public java.util.Hashtable<java.lang.String,​com.netscape.certsrv.selftests.ISelfTest> mSelfTestInstances
    • Constructor Detail

      • SelfTestSubsystem

        public SelfTestSubsystem()
    • Method Detail

      • audit

        protected void audit​(com.netscape.certsrv.logging.LogEvent event)
      • getSelfTestNames

        public java.util.Collection<java.lang.String> getSelfTestNames()
        Specified by:
        getSelfTestNames in interface com.netscape.certsrv.selftests.ISelfTestSubsystem
      • listSelfTestsEnabledOnDemand

        public java.lang.String[] listSelfTestsEnabledOnDemand()
        List the instance names of all the self tests enabled to run on demand (in execution order); may return null.

        Specified by:
        listSelfTestsEnabledOnDemand in interface com.netscape.certsrv.selftests.ISelfTestSubsystem
        Returns:
        list of self test instance names run on demand
      • enableSelfTestOnDemand

        public void enableSelfTestOnDemand​(java.lang.String instanceName,
                                           boolean isCritical)
                                    throws com.netscape.certsrv.selftests.EInvalidSelfTestException,
                                           com.netscape.certsrv.selftests.EMissingSelfTestException
        Enable the specified self test to be executed on demand.

        Parameters:
        instanceName - instance name of self test
        isCritical - isCritical is either a critical failure (true) or a non-critical failure (false)
        Throws:
        com.netscape.certsrv.selftests.EInvalidSelfTestException - subsystem has invalid name/value
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name/value
      • disableSelfTestOnDemand

        public void disableSelfTestOnDemand​(java.lang.String instanceName)
                                     throws com.netscape.certsrv.selftests.EMissingSelfTestException
        Disable the specified self test from being able to be executed on demand.

        Parameters:
        instanceName - instance name of self test
        Throws:
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name
      • isSelfTestEnabledOnDemand

        public boolean isSelfTestEnabledOnDemand​(java.lang.String instanceName)
                                          throws com.netscape.certsrv.selftests.EMissingSelfTestException
        Determine if the specified self test is enabled to be executed on demand.

        Specified by:
        isSelfTestEnabledOnDemand in interface com.netscape.certsrv.selftests.ISelfTestSubsystem
        Parameters:
        instanceName - instance name of self test
        Returns:
        true if the specified self test is enabled on demand
        Throws:
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name
      • isSelfTestCriticalOnDemand

        public boolean isSelfTestCriticalOnDemand​(java.lang.String instanceName)
                                           throws com.netscape.certsrv.selftests.EMissingSelfTestException
        Determine if failure of the specified self test is fatal when it is executed on demand.

        Specified by:
        isSelfTestCriticalOnDemand in interface com.netscape.certsrv.selftests.ISelfTestSubsystem
        Parameters:
        instanceName - instance name of self test
        Returns:
        true if failure of the specified self test is fatal when it is executed on demand
        Throws:
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name
      • runSelfTestsOnDemand

        public void runSelfTestsOnDemand()
                                  throws com.netscape.certsrv.selftests.EMissingSelfTestException,
                                         com.netscape.certsrv.selftests.ESelfTestException
        Execute all self tests specified to be run on demand.

        Specified by:
        runSelfTestsOnDemand in interface com.netscape.certsrv.selftests.ISelfTestSubsystem
        Throws:
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name
        com.netscape.certsrv.selftests.ESelfTestException - self test exception
      • runSelfTest

        public void runSelfTest​(java.lang.String instanceName)
                         throws java.lang.Exception
        Description copied from interface: com.netscape.certsrv.selftests.ISelfTestSubsystem
        Execute a self test.
        Specified by:
        runSelfTest in interface com.netscape.certsrv.selftests.ISelfTestSubsystem
        Throws:
        java.lang.Exception - self test exception
      • listSelfTestsEnabledAtStartup

        public java.lang.String[] listSelfTestsEnabledAtStartup()
        List the instance names of all the self tests enabled to run at server startup (in execution order); may return null.

        Specified by:
        listSelfTestsEnabledAtStartup in interface com.netscape.certsrv.selftests.ISelfTestSubsystem
        Returns:
        list of self test instance names run at server startup
      • enableSelfTestAtStartup

        public void enableSelfTestAtStartup​(java.lang.String instanceName,
                                            boolean isCritical)
                                     throws com.netscape.certsrv.selftests.EInvalidSelfTestException,
                                            com.netscape.certsrv.selftests.EMissingSelfTestException
        Enable the specified self test at server startup.

        Parameters:
        instanceName - instance name of self test
        isCritical - isCritical is either a critical failure (true) or a non-critical failure (false)
        Throws:
        com.netscape.certsrv.selftests.EInvalidSelfTestException - subsystem has invalid name/value
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name/value
      • disableSelfTestAtStartup

        public void disableSelfTestAtStartup​(java.lang.String instanceName)
                                      throws com.netscape.certsrv.selftests.EMissingSelfTestException
        Disable the specified self test at server startup.

        Parameters:
        instanceName - instance name of self test
        Throws:
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name
      • isSelfTestEnabledAtStartup

        public boolean isSelfTestEnabledAtStartup​(java.lang.String instanceName)
                                           throws com.netscape.certsrv.selftests.EMissingSelfTestException
        Determine if the specified self test is executed automatically at server startup.

        Specified by:
        isSelfTestEnabledAtStartup in interface com.netscape.certsrv.selftests.ISelfTestSubsystem
        Parameters:
        instanceName - instance name of self test
        Returns:
        true if the specified self test is executed at server startup
        Throws:
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name
      • isSelfTestCriticalAtStartup

        public boolean isSelfTestCriticalAtStartup​(java.lang.String instanceName)
                                            throws com.netscape.certsrv.selftests.EMissingSelfTestException
        Determine if failure of the specified self test is fatal to server startup.

        Specified by:
        isSelfTestCriticalAtStartup in interface com.netscape.certsrv.selftests.ISelfTestSubsystem
        Parameters:
        instanceName - instance name of self test
        Returns:
        true if failure of the specified self test is fatal to server startup
        Throws:
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name
      • runSelfTestsAtStartup

        public void runSelfTestsAtStartup()
                                   throws java.lang.Exception
        Execute all self tests specified to be run at server startup.

        • signed.audit LOGGING_SIGNED_AUDIT_SELFTESTS_EXECUTION used when self tests are run at server startup
        Specified by:
        runSelfTestsAtStartup in interface com.netscape.certsrv.selftests.ISelfTestSubsystem
        Throws:
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name
        java.lang.Exception - self test exception
      • log

        public void log​(int level,
                        java.lang.String msg)
      • getSelfTest

        public com.netscape.certsrv.selftests.ISelfTest getSelfTest​(java.lang.String instanceName)
        Retrieve an individual self test from the instances list given its instance name. This method may return null.

        Specified by:
        getSelfTest in interface com.netscape.certsrv.selftests.ISelfTestSubsystem
        Parameters:
        instanceName - instance name of self test
        Returns:
        individual self test
      • getSelfTestLogger

        public com.netscape.certsrv.logging.ILogEventListener getSelfTestLogger()
        Returns the ILogEventListener of this subsystem. This method may return null.

        Specified by:
        getSelfTestLogger in interface com.netscape.certsrv.selftests.ISelfTestSubsystem
        Returns:
        ILogEventListener of this subsystem
      • log

        public void log​(com.netscape.certsrv.logging.ILogEventListener logger,
                        java.lang.String msg)
        This method represents the log interface for the self test subsystem.

        Specified by:
        log in interface com.netscape.certsrv.selftests.ISelfTestSubsystem
        Parameters:
        logger - log event listener
        msg - self test log message
      • registerSelfTestOnDemand

        public void registerSelfTestOnDemand​(java.lang.String instanceName,
                                             boolean isCritical,
                                             com.netscape.certsrv.selftests.ISelfTest instance)
                                      throws com.netscape.certsrv.selftests.EDuplicateSelfTestException,
                                             com.netscape.certsrv.selftests.EInvalidSelfTestException,
                                             com.netscape.certsrv.selftests.EMissingSelfTestException
        Register an individual self test on the instances list AND on the "on demand" list (note that the specified self test will be appended to the end of each list).

        Parameters:
        instanceName - instance name of self test
        isCritical - isCritical is either a critical failure (true) or a non-critical failure (false)
        instance - individual self test
        Throws:
        com.netscape.certsrv.selftests.EDuplicateSelfTestException - subsystem has duplicate name
        com.netscape.certsrv.selftests.EInvalidSelfTestException - subsystem has invalid name/value
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name/value
      • deregisterSelfTestOnDemand

        public void deregisterSelfTestOnDemand​(java.lang.String instanceName)
                                        throws com.netscape.certsrv.selftests.EMissingSelfTestException
        Deregister an individual self test on the instances list AND on the "on demand" list (note that the specified self test will be removed from each list).

        Parameters:
        instanceName - instance name of self test
        Throws:
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name
      • registerSelfTestAtStartup

        public void registerSelfTestAtStartup​(java.lang.String instanceName,
                                              boolean isCritical,
                                              com.netscape.certsrv.selftests.ISelfTest instance)
                                       throws com.netscape.certsrv.selftests.EDuplicateSelfTestException,
                                              com.netscape.certsrv.selftests.EInvalidSelfTestException,
                                              com.netscape.certsrv.selftests.EMissingSelfTestException
        Register an individual self test on the instances list AND on the "startup" list (note that the specified self test will be appended to the end of each list).

        Parameters:
        instanceName - instance name of self test
        isCritical - isCritical is either a critical failure (true) or a non-critical failure (false)
        instance - individual self test
        Throws:
        com.netscape.certsrv.selftests.EDuplicateSelfTestException - subsystem has duplicate name
        com.netscape.certsrv.selftests.EInvalidSelfTestException - subsystem has invalid name/value
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name/value
      • deregisterSelfTestAtStartup

        public void deregisterSelfTestAtStartup​(java.lang.String instanceName)
                                         throws com.netscape.certsrv.selftests.EMissingSelfTestException
        Deregister an individual self test on the instances list AND on the "startup" list (note that the specified self test will be removed from each list).

        Parameters:
        instanceName - instance name of self test
        Throws:
        com.netscape.certsrv.selftests.EMissingSelfTestException - subsystem has missing name
      • getId

        public java.lang.String getId()
        This method retrieves the name of this subsystem. This method may return null.

        Specified by:
        getId in interface ISubsystem
        Returns:
        identification of this subsystem
      • setId

        public void setId​(java.lang.String id)
                   throws EBaseException
        This method sets information specific to this subsystem.

        Specified by:
        setId in interface ISubsystem
        Parameters:
        id - identification of this subsystem
        Throws:
        EBaseException - base CMS exception
      • shutdown

        public void shutdown()
        Stops this subsystem. The owner may call shutdown anytime after initialization.

        Specified by:
        shutdown in interface ISubsystem
      • getConfigStore

        public IConfigStore getConfigStore()
        Returns the root configuration storage of this subsystem. This method may return null.

        Specified by:
        getConfigStore in interface ISubsystem
        Returns:
        configuration store of this subsystem