Class ValidationEngine
- java.lang.Object
-
- org.eclipse.viatra.addon.validation.core.ValidationEngine
-
- All Implemented Interfaces:
IValidationEngine
public class ValidationEngine extends java.lang.Object implements IValidationEngine
This class uses anViatraQueryEnginefor tracking violations ofConstraintSpecifications. Use thebuilder()method for setting up a new instance through theValidationEngineBuilder.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedValidationEngine(ViatraQueryEngine engine, org.apache.log4j.Logger logger)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IConstraintaddConstraintSpecification(IConstraintSpecification constraintSpecification)Adds the given constraint specification to the validation engine and returns the created constraint.booleanaddListener(ValidationEngineListener listener)Adds the given listener to the list of listeners to be notified on specific events regarding the validation engine.protected booleanaddRuleSpecificationToExecutionSchema(Constraint constraint)static ValidationEngineBuilderbuilder()voiddispose()Disposes the validation engine.java.util.Set<IConstraint>getConstraints()Returns the constraints to the registered constraint specifications.protected ExecutionSchemagetExecutionSchema()java.util.Set<ValidationEngineListener>getListeners()Returns the listeners registered for the validation engine.protected ViatraQueryEnginegetQueryEngine()voidinitialize()Initializes the validation engine.protected voidnotifyListenersConstraintDeregistered(Constraint constraint)protected voidnotifyListenersConstraintRegistered(Constraint constraint)IConstraintremoveConstraintSpecification(IConstraintSpecification constraintSpecification)Removes the given constraint specification from the validation engine and returns the corresponding constraint.booleanremoveListener(ValidationEngineListener listener)Removes the given listener from the list of listeners to be notified on specific events regarding the validation engine.protected booleanremoveRuleSpecificationFromExecutionSchema(Constraint constraint)
-
-
-
Constructor Detail
-
ValidationEngine
protected ValidationEngine(ViatraQueryEngine engine, org.apache.log4j.Logger logger)
-
-
Method Detail
-
getQueryEngine
protected ViatraQueryEngine getQueryEngine()
-
getExecutionSchema
protected ExecutionSchema getExecutionSchema()
-
builder
public static ValidationEngineBuilder builder()
-
initialize
public void initialize()
Description copied from interface:IValidationEngineInitializes the validation engine.- Specified by:
initializein interfaceIValidationEngine
-
dispose
public void dispose()
Description copied from interface:IValidationEngineDisposes the validation engine.- Specified by:
disposein interfaceIValidationEngine
-
getConstraints
public java.util.Set<IConstraint> getConstraints()
Description copied from interface:IValidationEngineReturns the constraints to the registered constraint specifications.- Specified by:
getConstraintsin interfaceIValidationEngine- Returns:
- The Collection of constraints in the validation engine.
-
addConstraintSpecification
public IConstraint addConstraintSpecification(IConstraintSpecification constraintSpecification)
Description copied from interface:IValidationEngineAdds the given constraint specification to the validation engine and returns the created constraint.- Specified by:
addConstraintSpecificationin interfaceIValidationEngine- Parameters:
constraintSpecification- The constraint specification instance to be registered.- Returns:
- The created corresponding constraint instance.
-
removeConstraintSpecification
public IConstraint removeConstraintSpecification(IConstraintSpecification constraintSpecification)
Description copied from interface:IValidationEngineRemoves the given constraint specification from the validation engine and returns the corresponding constraint.- Specified by:
removeConstraintSpecificationin interfaceIValidationEngine- Parameters:
constraintSpecification- The constraint specification to be deregistered.- Returns:
- The removed corresponding constraint instance.
-
addRuleSpecificationToExecutionSchema
protected boolean addRuleSpecificationToExecutionSchema(Constraint constraint)
-
removeRuleSpecificationFromExecutionSchema
protected boolean removeRuleSpecificationFromExecutionSchema(Constraint constraint)
-
getListeners
public java.util.Set<ValidationEngineListener> getListeners()
Description copied from interface:IValidationEngineReturns the listeners registered for the validation engine.- Specified by:
getListenersin interfaceIValidationEngine- Returns:
- The Collection of listeners registered for the validation engine.
-
addListener
public boolean addListener(ValidationEngineListener listener)
Description copied from interface:IValidationEngineAdds the given listener to the list of listeners to be notified on specific events regarding the validation engine.- Specified by:
addListenerin interfaceIValidationEngine- Parameters:
listener- The listener to be registered.- Returns:
trueif the listener was not registered before.
-
removeListener
public boolean removeListener(ValidationEngineListener listener)
Description copied from interface:IValidationEngineRemoves the given listener from the list of listeners to be notified on specific events regarding the validation engine.- Specified by:
removeListenerin interfaceIValidationEngine- Parameters:
listener- The listener to be deregistered.- Returns:
trueif the listener was in fact registered.
-
notifyListenersConstraintRegistered
protected void notifyListenersConstraintRegistered(Constraint constraint)
-
notifyListenersConstraintDeregistered
protected void notifyListenersConstraintDeregistered(Constraint constraint)
-
-