Custom Tasks

If none of the available tasks fits into your need then you have two options for extending the library. For both options, you need to create your own class by extending the class DiagnosticTask (or one of its subclasses). To make this task available to the library you can either fork the SelfDiagnose project itself or use the the custom <task> tag in the configuration (recommended).

Define Custom Task

Developers can define and use custom tasks that are run by SelfDiagnose.
public MyTask extends DiagnosticTask {
	public String getDescription() { 
			return "purpose of this task";
	}
	public void initializeFromAttributes(Attributes attributes) {
		super.initializeFromAttributes(attributes);
		// ... access your custom attributes
	}	
	public void run(ExecutionContext ctx, DiagnosticTaskResult result) 
			throws DiagnoseException {
			// perform your check
	}
}
			

Configure Custom Task

<task 
	class="mypackage.MyTask" 
	comment="my task comment"
	myAttribute="some value"
	anyOtherAttribute="some other value" />