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 anViatraQueryEngine
for tracking violations ofConstraintSpecification
s. Use thebuilder()
method for setting up a new instance through theValidationEngineBuilder
.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ValidationEngine(ViatraQueryEngine engine, org.apache.log4j.Logger logger)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IConstraint
addConstraintSpecification(IConstraintSpecification constraintSpecification)
Adds the given constraint specification to the validation engine and returns the created constraint.boolean
addListener(ValidationEngineListener listener)
Adds the given listener to the list of listeners to be notified on specific events regarding the validation engine.protected boolean
addRuleSpecificationToExecutionSchema(Constraint constraint)
static ValidationEngineBuilder
builder()
void
dispose()
Disposes the validation engine.java.util.Set<IConstraint>
getConstraints()
Returns the constraints to the registered constraint specifications.protected ExecutionSchema
getExecutionSchema()
java.util.Set<ValidationEngineListener>
getListeners()
Returns the listeners registered for the validation engine.protected ViatraQueryEngine
getQueryEngine()
void
initialize()
Initializes the validation engine.protected void
notifyListenersConstraintDeregistered(Constraint constraint)
protected void
notifyListenersConstraintRegistered(Constraint constraint)
IConstraint
removeConstraintSpecification(IConstraintSpecification constraintSpecification)
Removes the given constraint specification from the validation engine and returns the corresponding constraint.boolean
removeListener(ValidationEngineListener listener)
Removes the given listener from the list of listeners to be notified on specific events regarding the validation engine.protected boolean
removeRuleSpecificationFromExecutionSchema(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:IValidationEngine
Initializes the validation engine.- Specified by:
initialize
in interfaceIValidationEngine
-
dispose
public void dispose()
Description copied from interface:IValidationEngine
Disposes the validation engine.- Specified by:
dispose
in interfaceIValidationEngine
-
getConstraints
public java.util.Set<IConstraint> getConstraints()
Description copied from interface:IValidationEngine
Returns the constraints to the registered constraint specifications.- Specified by:
getConstraints
in interfaceIValidationEngine
- Returns:
- The Collection of constraints in the validation engine.
-
addConstraintSpecification
public IConstraint addConstraintSpecification(IConstraintSpecification constraintSpecification)
Description copied from interface:IValidationEngine
Adds the given constraint specification to the validation engine and returns the created constraint.- Specified by:
addConstraintSpecification
in 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:IValidationEngine
Removes the given constraint specification from the validation engine and returns the corresponding constraint.- Specified by:
removeConstraintSpecification
in 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:IValidationEngine
Returns the listeners registered for the validation engine.- Specified by:
getListeners
in interfaceIValidationEngine
- Returns:
- The Collection of listeners registered for the validation engine.
-
addListener
public boolean addListener(ValidationEngineListener listener)
Description copied from interface:IValidationEngine
Adds the given listener to the list of listeners to be notified on specific events regarding the validation engine.- Specified by:
addListener
in interfaceIValidationEngine
- Parameters:
listener
- The listener to be registered.- Returns:
true
if the listener was not registered before.
-
removeListener
public boolean removeListener(ValidationEngineListener listener)
Description copied from interface:IValidationEngine
Removes the given listener from the list of listeners to be notified on specific events regarding the validation engine.- Specified by:
removeListener
in interfaceIValidationEngine
- Parameters:
listener
- The listener to be deregistered.- Returns:
true
if the listener was in fact registered.
-
notifyListenersConstraintRegistered
protected void notifyListenersConstraintRegistered(Constraint constraint)
-
notifyListenersConstraintDeregistered
protected void notifyListenersConstraintDeregistered(Constraint constraint)
-
-