com.arsdigita.packaging
Class Check

java.lang.Object
  extended bycom.arsdigita.util.parameter.AbstractParameterContext
      extended bycom.arsdigita.runtime.AbstractScript
          extended bycom.arsdigita.packaging.Check
All Implemented Interfaces:
ParameterContext, Script
Direct Known Subclasses:
com.arsdigita.core.BaseCheck

public abstract class Check
extends AbstractScript

The Check class provides a developer callback for performing validation checks during various points in the package loading and server startup process. This functionality is accessed by creating a package-key.checklist file in the src dir of the package that wishes to add checks. This must be a valid xml file that conforms to the following format:

 <checklist>
   <checks type="schema">
     <check class="com.example.Check1"/>
     <check class="com.example.Check2"/>
     ...
   </checks>
   <checks type="data">
     ...
   </checks>
   <checks type="startup">
     ...
   </checks>
 </checklist>
 
Checks of type "schema" will be run before the schema for a package is loaded. Checks of type "data" will be run before the data for a package is loaded. Checks of type "startup" will be run before the server is started. All these checks will be run by the "ccm status" command. The classes referred to from the checklist file must be concrete subclasses of the Check class. They must also provide a public noargs constructor. A check is performed by first creating an instance of the specified class using the public noargs constructor and then invoking the AbstractScript.run(ScriptContext) method. The check must report success or failure using the #status(Status) method. Checks will be invoked in the order in which they appear inside the tags. If any one of the checks fail, the remaining checks that appear within the containing tags will not be performed.

Version:
$Revision: #4 $ $Date: 2004/04/07 $
Author:
Rafael H. Schloming <rhs@mit.edu>

Nested Class Summary
static class Check.Status
           
 
Field Summary
static Check.Status FAIL
           
static Check.Status PASS
           
static String versionId
           
static Check.Status WARN
           
 
Constructor Summary
Check()
           
 
Method Summary
 Check.Status getStatus()
          Accesses the status of the previous invocation of the AbstractScript.run(ScriptContext) method.
protected  void status(Check.Status status)
          Used by subclasses to report the result of the Check.
 
Methods inherited from class com.arsdigita.runtime.AbstractScript
run
 
Methods inherited from class com.arsdigita.util.parameter.AbstractParameterContext
get, get, getParameters, load, load, loadInfo, register, save, set, validate, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.arsdigita.util.parameter.ParameterContext
get, get, getParameters, load, save, set, validate
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values

PASS

public static final Check.Status PASS

FAIL

public static final Check.Status FAIL

WARN

public static final Check.Status WARN
Constructor Detail

Check

public Check()
Method Detail

status

protected void status(Check.Status status)
Used by subclasses to report the result of the Check. This method can be called at most once by a particular instance of the Check class.

Parameters:
status - The status, one of PASS, FAIL, or WARN.

getStatus

public Check.Status getStatus()
Accesses the status of the previous invocation of the AbstractScript.run(ScriptContext) method.

Returns:
The status, one of PASS, FAIL, or WARN.


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC