EMF Validation Constraint Bindings

Identifier:
org.eclipse.emf.validation.constraintBindings

Since:
1.0

Description:
This extension point allows clients of the EMF Validation framework to define "client contexts" that describe the objects that they are interested in validating, and to bind them to constraints that they are interested in enforcing on these objects.

Configuration Markup:

<!ELEMENT extension (clientContext* , binding*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT clientContext (enablement | selector)>

<!ATTLIST clientContext

id      CDATA #REQUIRED

default (true | false) >

Definition of a client context, representing a class of objects that a client wishes to apply a set of constraints to.

A client context can declare an <enablement> expression that matches model elements that are included in the context. Where that is not sufficient, an alternative is to define a selector class using a <selector> element.



<!ELEMENT selector EMPTY>

<!ATTLIST selector

class CDATA #REQUIRED>

A selector determines which model elements are included in a client context when an XML expression is too cumbersome or somehow not sufficient to implement the test.



<!ELEMENT binding (constraint* , category*)>

<!ATTLIST binding

context    CDATA #REQUIRED

constraint CDATA #IMPLIED

category   CDATA #IMPLIED>

Declares a binding between a client context and one or more constraints. The context can, itself, be declared by the same plug-in or by a different plug-in.

The constraints to be bound may be specified by either:



<!ELEMENT constraint EMPTY>

<!ATTLIST constraint

ref CDATA #REQUIRED>

Includes a constraint in a client context <binding>.



<!ELEMENT category EMPTY>

<!ATTLIST category

ref CDATA #REQUIRED>

Includes a constraint category in a client context <binding>. All of the referenced category's constraints and those of any sub-categories (recursively) are included.



Examples:

Example of a context which includes EObjects in *.library resources only, not in some other kind of resource that uses the EMF Library example meta-model (utilizing an hypothetical property tester):


   <extension point="org.eclipse.emf.validation.constraintBindings">
      <clientContext id="com.example.MyClient">
         <enablement>
            <with variable="resource"/>
               <test
                  property="com.example.matchURI"
                  value="*.library"/>
            </with>
         </enablement>
      </clientContext>
   </extension>

Example of a binding of a single constraint to the MyClient context:


   <extension point="org.eclipse.emf.validation.constraintBindings">
      <binding
         context="com.example.MyClient"
         constraint="org.eclipse.uml2.validation.classifiers.genCycle"/>
   </extension>

Example of binding multiple constraints and constraint categories to the MyClient context:


   <extension point="org.eclipse.emf.validation.constraintBindings">
      <binding context="com.example.MyClient"/>
         <constraint ref="org.eclipse.uml2.validation.namespace.distinctMembers"/>
         <constraint ref="org.eclipse.uml2.validation.classifiers.genCycle"/>
         <category ref="uml2/spec/classes/kernel/namespaces"/>
         <category ref="uml2/spec/classes/kernel/classifiers"/>
      </binding>
   </extension>


Copyright (c) 2005 IBM Corporation and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html