org.schmant.task.xml.validation
Class SchemaFactoryTask

java.lang.Object
  extended by org.schmant.support.AbstractArgumentChecker
      extended by org.schmant.task.stub.AbstractTask<T>
          extended by org.schmant.task.stub.AbstractActionTask<T>
              extended by org.schmant.task.template.xml.AbstractParseXmlTask<SchemaFactoryTask>
                  extended by org.schmant.task.xml.validation.SchemaFactoryTask
All Implemented Interfaces:
Producer<Schema>, TaskDependency, ActionTaskConfigurable<SchemaFactoryTask>, ActionTaskSpec<SchemaFactoryTask>, LoggingConfigurable<SchemaFactoryTask>, SourceConfigurable<SchemaFactoryTask>, SourceConfigured, Task, TaskRunnable, TaskSpecification<SchemaFactoryTask>

public final class SchemaFactoryTask
extends AbstractParseXmlTask<SchemaFactoryTask>
implements Producer<Schema>

See SchemaFactoryTF

Since:
0.5
Author:
Karl Gustafsson
Task_package:
org.schmant.task.base

Method Summary
 void copyProperties(SchemaFactoryTask spec)
          Override the implementation from AbstractTask to copy the source properties.
 Schema get()
          Returns the produced object, or null if nothing is produced yet.
 Schema getSchema()
          Get the parsed Schema.
 Schema getSchemaOrNull()
          Get the parsed schema, returning null if it is not parsed.
protected  boolean isSourcesMandatory()
          Must the sources property be set? This method returns true.
protected  void runInternal(Report r)
          Subclasses implement this.
 String toString()
          Default implementation for tasks.
protected  Collection<String> validate(Report r)
          Override the method inherited from AbstractTask to give a validation error if no source is set (and AbstractActionTask.isSourcesMandatory() is true).
 
Methods inherited from class org.schmant.task.template.xml.AbstractParseXmlTask
getErrorHandler, getFeatures
 
Methods inherited from class org.schmant.task.stub.AbstractActionTask
addSource, addSources, clearSources, getRelativeToBase, getSource, getSources, isMoreThanOneSourceAllowed, setRelativeToBase, setSource, setSources
 
Methods inherited from class org.schmant.task.stub.AbstractTask
cancel, createTask, getDefaultLogFooter, getDefaultLogHeader, getDependencyForTasksScheduledByThisTask, getDependencyObservable, getFailureCause, getLogFooter, getLogHeader, getSatisfiedStateLock, getThis, isCancelled, isDone, isInterrupted, isRunning, isSatisfied, isSuccessful, run, setLogFooter, setLogHeader, setReportLevel, setTraceLogging
 
Methods inherited from class org.schmant.support.AbstractArgumentChecker
check, check, check, check
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.schmant.task.TaskSpecification
createTask
 
Methods inherited from interface org.schmant.task.confable.LoggingConfigurable
setLogFooter, setLogHeader, setReportLevel, setTraceLogging
 

Method Detail

getSchema

public Schema getSchema()
                 throws TaskFailedException
Get the parsed Schema. This can only be called after the task has been run.

Returns:
The parsed schema.
Throws:
TaskFailedException - If the schema is not parsed.
See Also:
getSchemaOrNull()

getSchemaOrNull

public Schema getSchemaOrNull()
Get the parsed schema, returning null if it is not parsed.

Returns:
The schema, or null if it is not parsed.

get

public Schema get()
Description copied from interface: Producer
Returns the produced object, or null if nothing is produced yet.

This method should be implemented thread-safe.

Specified by:
get in interface Producer<Schema>
Returns:
The produced object.

isSourcesMandatory

protected boolean isSourcesMandatory()
Description copied from class: AbstractActionTask
Must the sources property be set? This method returns true. Subclasses may override this method to return false if the sources property is not mandatory.

Overrides:
isSourcesMandatory in class AbstractActionTask<SchemaFactoryTask>
Returns:
true, always.

validate

protected Collection<String> validate(Report r)
Description copied from class: AbstractActionTask
Override the method inherited from AbstractTask to give a validation error if no source is set (and AbstractActionTask.isSourcesMandatory() is true).

Subclasses may override this to add their own validations.

Overrides:
validate in class AbstractActionTask<SchemaFactoryTask>
Parameters:
r - A report to log warning and debug messages to. Validation errors should not be logged, though. They are logged later.
Returns:
A collection of error messages.

runInternal

protected void runInternal(Report r)
                    throws SAXException
Description copied from class: AbstractTask
Subclasses implement this. The task is AbstractTask.validate(Report):d before this method is called, see AbstractTask.run().

Specified by:
runInternal in class AbstractTask<SchemaFactoryTask>
Parameters:
r - The current thread's Report.
Throws:
SAXException

copyProperties

public void copyProperties(SchemaFactoryTask spec)
Description copied from class: AbstractActionTask
Override the implementation from AbstractTask to copy the source properties. Subclasses must override this to copy their own properties.

Specified by:
copyProperties in interface TaskSpecification<SchemaFactoryTask>
Overrides:
copyProperties in class AbstractParseXmlTask<SchemaFactoryTask>
Parameters:
spec - The specification to copy properties to.

toString

public String toString()
Description copied from class: AbstractTask
Default implementation for tasks. Task implementations may override this. It is used in the default log header that is written (level INFO) before a task is run.

This implementation just returns the class name.

Overrides:
toString in class AbstractActionTask<SchemaFactoryTask>