Package com.netscape.cmscore.selftests
Class SelfTestSubsystem
- java.lang.Object
-
- com.netscape.cmscore.selftests.SelfTestSubsystem
-
- All Implemented Interfaces:
ISubsystem,ISelfTestSubsystem
public class SelfTestSubsystem extends java.lang.Object implements 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.Loggerloggerjava.util.Vector<SelfTestOrderedInstance>mOnDemandOrderjava.util.Hashtable<java.lang.String,ISelfTest>mSelfTestInstancesjava.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
-
-
Constructor Summary
Constructors Constructor Description SelfTestSubsystem()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaudit(LogEvent event)voidderegisterSelfTestAtStartup(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).voidderegisterSelfTestOnDemand(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).voiddisableSelfTestAtStartup(java.lang.String instanceName)Disable the specified self test at server startup.voiddisableSelfTestOnDemand(java.lang.String instanceName)Disable the specified self test from being able to be executed on demand.voidenableSelfTestAtStartup(java.lang.String instanceName, boolean isCritical)Enable the specified self test at server startup.voidenableSelfTestOnDemand(java.lang.String instanceName, boolean isCritical)Enable the specified self test to be executed on demand.IConfigStoregetConfigStore()Returns the root configuration storage of this subsystem.java.lang.StringgetId()This method retrieves the name of this subsystem.ISelfTestgetSelfTest(java.lang.String instanceName)Retrieve an individual self test from the instances list given its instance name.ILogEventListenergetSelfTestLogger()Returns the ILogEventListener of this subsystem.java.util.Collection<java.lang.String>getSelfTestNames()voidinit(IConfigStore config)This method initializes this subsystem.booleanisSelfTestCriticalAtStartup(java.lang.String instanceName)Determine if failure of the specified self test is fatal to server startup.booleanisSelfTestCriticalOnDemand(java.lang.String instanceName)Determine if failure of the specified self test is fatal when it is executed on demand.booleanisSelfTestEnabledAtStartup(java.lang.String instanceName)Determine if the specified self test is executed automatically at server startup.booleanisSelfTestEnabledOnDemand(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.voidlog(int level, java.lang.String msg)voidlog(ILogEventListener logger, java.lang.String msg)This method represents the log interface for the self test subsystem.voidregisterSelfTestAtStartup(java.lang.String instanceName, boolean isCritical, 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).voidregisterSelfTestOnDemand(java.lang.String instanceName, boolean isCritical, 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).voidrunSelfTest(java.lang.String instanceName)Execute a self test.voidrunSelfTestsAtStartup()Execute all self tests specified to be run at server startup.voidrunSelfTestsOnDemand()Execute all self tests specified to be run on demand.voidsetId(java.lang.String id)This method sets information specific to this subsystem.voidshutdown()Stops this subsystem.voidstartup()Notifies this subsystem if owner is in running mode.
-
-
-
Field Detail
-
logger
public static org.slf4j.Logger logger
-
mSelfTestInstances
public java.util.Hashtable<java.lang.String,ISelfTest> mSelfTestInstances
-
mOnDemandOrder
public java.util.Vector<SelfTestOrderedInstance> mOnDemandOrder
-
mStartupOrder
public java.util.Vector<SelfTestOrderedInstance> mStartupOrder
-
-
Method Detail
-
audit
protected void audit(LogEvent event)
-
getSelfTestNames
public java.util.Collection<java.lang.String> getSelfTestNames()
- Specified by:
getSelfTestNamesin interfaceISelfTestSubsystem
-
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:
listSelfTestsEnabledOnDemandin interfaceISelfTestSubsystem- Returns:
- list of self test instance names run on demand
-
enableSelfTestOnDemand
public void enableSelfTestOnDemand(java.lang.String instanceName, boolean isCritical) throws EInvalidSelfTestException, EMissingSelfTestExceptionEnable the specified self test to be executed on demand.- Parameters:
instanceName- instance name of self testisCritical- isCritical is either a critical failure (true) or a non-critical failure (false)- Throws:
EInvalidSelfTestException- subsystem has invalid name/valueEMissingSelfTestException- subsystem has missing name/value
-
disableSelfTestOnDemand
public void disableSelfTestOnDemand(java.lang.String instanceName) throws EMissingSelfTestExceptionDisable the specified self test from being able to be executed on demand.- Parameters:
instanceName- instance name of self test- Throws:
EMissingSelfTestException- subsystem has missing name
-
isSelfTestEnabledOnDemand
public boolean isSelfTestEnabledOnDemand(java.lang.String instanceName) throws EMissingSelfTestExceptionDetermine if the specified self test is enabled to be executed on demand.- Specified by:
isSelfTestEnabledOnDemandin interfaceISelfTestSubsystem- Parameters:
instanceName- instance name of self test- Returns:
- true if the specified self test is enabled on demand
- Throws:
EMissingSelfTestException- subsystem has missing name
-
isSelfTestCriticalOnDemand
public boolean isSelfTestCriticalOnDemand(java.lang.String instanceName) throws EMissingSelfTestExceptionDetermine if failure of the specified self test is fatal when it is executed on demand.- Specified by:
isSelfTestCriticalOnDemandin interfaceISelfTestSubsystem- 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:
EMissingSelfTestException- subsystem has missing name
-
runSelfTestsOnDemand
public void runSelfTestsOnDemand() throws EMissingSelfTestException, ESelfTestExceptionExecute all self tests specified to be run on demand.- Specified by:
runSelfTestsOnDemandin interfaceISelfTestSubsystem- Throws:
EMissingSelfTestException- subsystem has missing nameESelfTestException- self test exception
-
runSelfTest
public void runSelfTest(java.lang.String instanceName) throws java.lang.ExceptionDescription copied from interface:ISelfTestSubsystemExecute a self test.- Specified by:
runSelfTestin interfaceISelfTestSubsystem- 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:
listSelfTestsEnabledAtStartupin interfaceISelfTestSubsystem- Returns:
- list of self test instance names run at server startup
-
enableSelfTestAtStartup
public void enableSelfTestAtStartup(java.lang.String instanceName, boolean isCritical) throws EInvalidSelfTestException, EMissingSelfTestExceptionEnable the specified self test at server startup.- Parameters:
instanceName- instance name of self testisCritical- isCritical is either a critical failure (true) or a non-critical failure (false)- Throws:
EInvalidSelfTestException- subsystem has invalid name/valueEMissingSelfTestException- subsystem has missing name/value
-
disableSelfTestAtStartup
public void disableSelfTestAtStartup(java.lang.String instanceName) throws EMissingSelfTestExceptionDisable the specified self test at server startup.- Parameters:
instanceName- instance name of self test- Throws:
EMissingSelfTestException- subsystem has missing name
-
isSelfTestEnabledAtStartup
public boolean isSelfTestEnabledAtStartup(java.lang.String instanceName) throws EMissingSelfTestExceptionDetermine if the specified self test is executed automatically at server startup.- Specified by:
isSelfTestEnabledAtStartupin interfaceISelfTestSubsystem- Parameters:
instanceName- instance name of self test- Returns:
- true if the specified self test is executed at server startup
- Throws:
EMissingSelfTestException- subsystem has missing name
-
isSelfTestCriticalAtStartup
public boolean isSelfTestCriticalAtStartup(java.lang.String instanceName) throws EMissingSelfTestExceptionDetermine if failure of the specified self test is fatal to server startup.- Specified by:
isSelfTestCriticalAtStartupin interfaceISelfTestSubsystem- Parameters:
instanceName- instance name of self test- Returns:
- true if failure of the specified self test is fatal to server startup
- Throws:
EMissingSelfTestException- subsystem has missing name
-
runSelfTestsAtStartup
public void runSelfTestsAtStartup() throws java.lang.ExceptionExecute 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:
runSelfTestsAtStartupin interfaceISelfTestSubsystem- Throws:
EMissingSelfTestException- subsystem has missing namejava.lang.Exception- self test exception
-
log
public void log(int level, java.lang.String msg)
-
getSelfTest
public 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:
getSelfTestin interfaceISelfTestSubsystem- Parameters:
instanceName- instance name of self test- Returns:
- individual self test
-
getSelfTestLogger
public ILogEventListener getSelfTestLogger()
Returns the ILogEventListener of this subsystem. This method may return null.- Specified by:
getSelfTestLoggerin interfaceISelfTestSubsystem- Returns:
- ILogEventListener of this subsystem
-
log
public void log(ILogEventListener logger, java.lang.String msg)
This method represents the log interface for the self test subsystem.- Specified by:
login interfaceISelfTestSubsystem- Parameters:
logger- log event listenermsg- self test log message
-
registerSelfTestOnDemand
public void registerSelfTestOnDemand(java.lang.String instanceName, boolean isCritical, ISelfTest instance) throws EDuplicateSelfTestException, EInvalidSelfTestException, EMissingSelfTestExceptionRegister 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 testisCritical- isCritical is either a critical failure (true) or a non-critical failure (false)instance- individual self test- Throws:
EDuplicateSelfTestException- subsystem has duplicate nameEInvalidSelfTestException- subsystem has invalid name/valueEMissingSelfTestException- subsystem has missing name/value
-
deregisterSelfTestOnDemand
public void deregisterSelfTestOnDemand(java.lang.String instanceName) throws EMissingSelfTestExceptionDeregister 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:
EMissingSelfTestException- subsystem has missing name
-
registerSelfTestAtStartup
public void registerSelfTestAtStartup(java.lang.String instanceName, boolean isCritical, ISelfTest instance) throws EDuplicateSelfTestException, EInvalidSelfTestException, EMissingSelfTestExceptionRegister 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 testisCritical- isCritical is either a critical failure (true) or a non-critical failure (false)instance- individual self test- Throws:
EDuplicateSelfTestException- subsystem has duplicate nameEInvalidSelfTestException- subsystem has invalid name/valueEMissingSelfTestException- subsystem has missing name/value
-
deregisterSelfTestAtStartup
public void deregisterSelfTestAtStartup(java.lang.String instanceName) throws EMissingSelfTestExceptionDeregister 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:
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:
getIdin interfaceISubsystem- Returns:
- identification of this subsystem
-
setId
public void setId(java.lang.String id) throws EBaseExceptionThis method sets information specific to this subsystem.- Specified by:
setIdin interfaceISubsystem- Parameters:
id- identification of this subsystem- Throws:
EBaseException- base CMS exception
-
init
public void init(IConfigStore config) throws EBaseException
This method initializes this subsystem.- Specified by:
initin interfaceISubsystem- Parameters:
config- configuration store- Throws:
EBaseException- base CMS exception
-
startup
public void startup() throws EBaseExceptionNotifies this subsystem if owner is in running mode.- Specified by:
startupin interfaceISubsystem- Throws:
EBaseException- base CMS exception
-
shutdown
public void shutdown()
Stops this subsystem. The owner may call shutdown anytime after initialization.- Specified by:
shutdownin interfaceISubsystem
-
getConfigStore
public IConfigStore getConfigStore()
Returns the root configuration storage of this subsystem. This method may return null.- Specified by:
getConfigStorein interfaceISubsystem- Returns:
- configuration store of this subsystem
-
-