Change in ovirt-engine[master]: restapi: Constraint parser

juan.hernandez at redhat.com juan.hernandez at redhat.com
Tue Dec 15 16:41:26 UTC 2015


Juan Hernandez has submitted this change and it was merged.

Change subject: restapi: Constraint parser
......................................................................


restapi: Constraint parser

This patch improves adds a parser for constraint expressions, so that
constraints can be added to the model using Java code in default
methods. For example the constraint that says that when adding a virtual
machine the name is mandatory can be now expressed adding a method like
this to the "Add" method of the "VmService":

  interface Add {
    /**
     * Creates a new VM ...
     */
    @In @Out Vm vm();

    /**
     * This defines a new constraint that says that the input
     * of the `Add` operation should contain a name.
     */
    @Required @In
    default void nameIsMandatory() {
      assert vm().name() != null;
    }
  }

Later patches will move the specification of constraints from the
"rsdl_metadata.yaml" file to the metamodel.

Change-Id: Iea6d2e535f89a7c166eb17e0f951bf06699ccd8e
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M backend/manager/modules/restapi/metamodel/analyzer/exclude-filters.xml
M backend/manager/modules/restapi/metamodel/analyzer/pom.xml
A backend/manager/modules/restapi/metamodel/analyzer/src/main/antlr4/org/ovirt/api/metamodel/analyzer/Expression.g4
A backend/manager/modules/restapi/metamodel/analyzer/src/main/java/org/ovirt/api/metamodel/analyzer/ConstraintAnalyzer.java
A backend/manager/modules/restapi/metamodel/analyzer/src/main/java/org/ovirt/api/metamodel/analyzer/ExpressionAnalyzer.java
A backend/manager/modules/restapi/metamodel/analyzer/src/main/java/org/ovirt/api/metamodel/analyzer/FieldExpression.java
A backend/manager/modules/restapi/metamodel/analyzer/src/main/java/org/ovirt/api/metamodel/analyzer/MethodExpression.java
M backend/manager/modules/restapi/metamodel/analyzer/src/main/java/org/ovirt/api/metamodel/analyzer/ModelAnalyzer.java
M backend/manager/modules/restapi/metamodel/analyzer/src/main/java/org/ovirt/api/metamodel/analyzer/ModelAnnotations.java
A backend/manager/modules/restapi/metamodel/analyzer/src/test/java/org/ovirt/api/metamodel/analyzer/ExpressionAnalyzerTest.java
A backend/manager/modules/restapi/metamodel/annotations/src/main/java/org/ovirt/api/metamodel/annotations/Allowed.java
A backend/manager/modules/restapi/metamodel/annotations/src/main/java/org/ovirt/api/metamodel/annotations/Required.java
A backend/manager/modules/restapi/metamodel/concepts/src/main/java/org/ovirt/api/metamodel/concepts/ArrayExpression.java
A backend/manager/modules/restapi/metamodel/concepts/src/main/java/org/ovirt/api/metamodel/concepts/AttributeExpression.java
A backend/manager/modules/restapi/metamodel/concepts/src/main/java/org/ovirt/api/metamodel/concepts/BinaryExpression.java
M backend/manager/modules/restapi/metamodel/concepts/src/main/java/org/ovirt/api/metamodel/concepts/Constraint.java
A backend/manager/modules/restapi/metamodel/concepts/src/main/java/org/ovirt/api/metamodel/concepts/ConstraintKind.java
M backend/manager/modules/restapi/metamodel/concepts/src/main/java/org/ovirt/api/metamodel/concepts/Expression.java
A backend/manager/modules/restapi/metamodel/concepts/src/main/java/org/ovirt/api/metamodel/concepts/LinkExpression.java
A backend/manager/modules/restapi/metamodel/concepts/src/main/java/org/ovirt/api/metamodel/concepts/LiteralExpression.java
M backend/manager/modules/restapi/metamodel/concepts/src/main/java/org/ovirt/api/metamodel/concepts/Method.java
A backend/manager/modules/restapi/metamodel/concepts/src/main/java/org/ovirt/api/metamodel/concepts/Operator.java
A backend/manager/modules/restapi/metamodel/concepts/src/main/java/org/ovirt/api/metamodel/concepts/ParameterExpression.java
M backend/manager/modules/restapi/metamodel/concepts/src/main/java/org/ovirt/api/metamodel/concepts/StructType.java
A backend/manager/modules/restapi/metamodel/concepts/src/main/java/org/ovirt/api/metamodel/concepts/UnaryExpression.java
25 files changed, 2,292 insertions(+), 20 deletions(-)

Approvals:
  Juan Hernandez: Verified; Looks good to me, approved
  Jenkins CI: Passed CI tests



-- 
To view, visit https://gerrit.ovirt.org/49169
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iea6d2e535f89a7c166eb17e0f951bf06699ccd8e
Gerrit-PatchSet: 6
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Ori Liel <oliel at redhat.com>
Gerrit-Reviewer: Oved Ourfali <oourfali at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>



More information about the Engine-commits mailing list