com.philemonworks.selfdiagnose
Class SelfDiagnose

java.lang.Object
  extended by com.philemonworks.selfdiagnose.SelfDiagnose

public abstract class SelfDiagnose
extends Object

SelfDiagnose is the component that keeps a registration of DiagnosticTasks and can run them providing a simple report that is logged using Log4j. Registration is done:

Author:
Ernest M. Micklei

Field Summary
static String CONFIG
           
static String COPYRIGHT
           
static String MDC_SELFDIAGNOSE_TASK_RESULT
           
static String VERSION
          The name of the resource that holds the specification of tasks.
 
Constructor Summary
SelfDiagnose()
           
 
Method Summary
static void configure(InputStream is)
          Read the configuration from an InputStream
static void configure(String resourceName)
          Try to configure SelfDiagnose using the XML configuration file with the given resource name.
static void configure(URL configURL)
          Read the configuration from the resource by URL.
static void flush()
          Flush all registered tasks
static String getConfigFilename()
          Return the filename that is used to configure SelfDiagnose
static List<DiagnosticTask> getTasks()
          Return the modifiable collection of registered Diagnostic tasks.
static DiagnosticTask register(DiagnosticTask task)
          Add the argument to the global list of Diagnostic tasks.
static DiagnosticTask register(DiagnosticTask task, String identifier)
          Add the argument to the global list of Diagnostic tasks.
static void reloadConfiguration()
          Flush all registered tasks from the configuration and re-load the configuration.
static void run()
          Run all registered DiagnosticTasks and report to the LOG.
static DiagnoseRun runTasks()
           
static DiagnoseRun runTasks(DiagnoseRunReporter reporter)
          Basic method to run all registered tasks.
static DiagnoseRun runTasks(DiagnoseRunReporter reporter, ExecutionContext ctx)
          Basic method to run all registered tasks.
static DiagnoseRun runTasks(List<DiagnosticTask> taskList, DiagnoseRunReporter reporter, ExecutionContext ctx)
          Basic method to the tasks provided
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MDC_SELFDIAGNOSE_TASK_RESULT

public static final String MDC_SELFDIAGNOSE_TASK_RESULT
See Also:
Constant Field Values

VERSION

public static final String VERSION
The name of the resource that holds the specification of tasks.

See Also:
Constant Field Values

COPYRIGHT

public static final String COPYRIGHT
See Also:
Constant Field Values

CONFIG

public static final String CONFIG
See Also:
Constant Field Values
Constructor Detail

SelfDiagnose

public SelfDiagnose()
Method Detail

getConfigFilename

public static String getConfigFilename()
Return the filename that is used to configure SelfDiagnose

Returns:

configure

public static void configure(String resourceName)
Try to configure SelfDiagnose using the XML configuration file with the given resource name.

Parameters:
resourceName - : String

configure

public static void configure(URL configURL)
Read the configuration from the resource by URL.

Parameters:
configURL - : URL

configure

public static void configure(InputStream is)
                      throws Exception
Read the configuration from an InputStream

Parameters:
is -
Throws:
Exception

reloadConfiguration

public static void reloadConfiguration()
Flush all registered tasks from the configuration and re-load the configuration.


register

public static DiagnosticTask register(DiagnosticTask task)
Add the argument to the global list of Diagnostic tasks.

Parameters:
task - DiagnosticTask
Returns:
DiagnosticTask

register

public static DiagnosticTask register(DiagnosticTask task,
                                      String identifier)
Add the argument to the global list of Diagnostic tasks.

Parameters:
task - DiagnosticTask
identifier - String
Returns:
DiagnosticTask

runTasks

public static DiagnoseRun runTasks()

runTasks

public static DiagnoseRun runTasks(DiagnoseRunReporter reporter)
Basic method to run all registered tasks.


runTasks

public static DiagnoseRun runTasks(DiagnoseRunReporter reporter,
                                   ExecutionContext ctx)
Basic method to run all registered tasks.


runTasks

public static DiagnoseRun runTasks(List<DiagnosticTask> taskList,
                                   DiagnoseRunReporter reporter,
                                   ExecutionContext ctx)
Basic method to the tasks provided


run

public static void run()
Run all registered DiagnosticTasks and report to the LOG. After running all tasks, some simple statistics are logged.


flush

public static void flush()
Flush all registered tasks


getTasks

public static List<DiagnosticTask> getTasks()
Return the modifiable collection of registered Diagnostic tasks. Use at your own risk.



Copyright © 2012. All Rights Reserved.