org.yawlfoundation.yawl.schema
Class YDataValidator

java.lang.Object
  extended by org.yawlfoundation.yawl.schema.YDataValidator

public class YDataValidator
extends Object

This class serves as a validation mechanism for the specification specific schema and the instance data from either the net or a task. This is performed by taking the data available at the various validation points and converting it into conventional XML which is then validated using a SchemaHandler.

Author:
Mike Fowler Date: 05-Jul-2006

Constructor Summary
YDataValidator(String schema)
          Constructs a new validator and handler.
 
Method Summary
 Vector<String> getMessages()
           
 String getSchema()
           
 void validate(Collection vars, org.jdom.Element data, String source)
          Validates a collection of variables against the schema.
 void validate(YVariable variable, org.jdom.Element data, String source)
          Validates a single data variable
 boolean validateSchema()
          Compiles and determines the validity of the current schema
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YDataValidator

public YDataValidator(String schema)
Constructs a new validator and handler. The handler is not ready for use until validateSchema has been called.

Parameters:
schema - W3C XML Schema
Method Detail

validateSchema

public boolean validateSchema()
Compiles and determines the validity of the current schema

Returns:
true if the schema compiled without error.

validate

public void validate(YVariable variable,
                     org.jdom.Element data,
                     String source)
              throws YDataValidationException
Validates a single data variable

Parameters:
variable - to be validated
data - XML representation of variable to be validated
source -
Throws:
YDataValidationException - if the data is not valid

validate

public void validate(Collection vars,
                     org.jdom.Element data,
                     String source)
              throws YDataValidationException
Validates a collection of variables against the schema. This is achieved by temporarily adding a schema element declaration for the data. This avoids attempting to create a new schema containing only the relevant data types.

Parameters:
vars - variables to be validated
data - XML representation fo the variables to be validated
source -
Throws:
YDataValidationException - if the data is not valid

getSchema

public String getSchema()
Returns:
String representation of the schema

getMessages

public Vector<String> getMessages()
Returns:
All error/warning messages relating to the last validation/compilation


Copyright © 2004-2012 The YAWL Foundation.