Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2014-09-11 11:17:22 -0400
committerAnsgar Radermacher2014-09-15 04:17:22 -0400
commit252f1b316da367e70ed6312385b6006330012ea5 (patch)
tree582f8ac250a547f6e2faef5aae225f1cdaf1dc3e /extraplugins
parent6ace73dd3a914645d70f9746856018ae5bd028ed (diff)
downloadorg.eclipse.papyrus-252f1b316da367e70ed6312385b6006330012ea5.tar.gz
org.eclipse.papyrus-252f1b316da367e70ed6312385b6006330012ea5.tar.xz
org.eclipse.papyrus-252f1b316da367e70ed6312385b6006330012ea5.zip
436296 - [Validation] DSML plugin generation is broken
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/generate.emtl52
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/generate.mtl2
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.wizard/src/org/eclipse/papyrus/dsml/validation/wizard/ValidationPluginGenerator.java4
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/META-INF/MANIFEST.MF9
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/plugin.xml8
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/src/org/eclipse/papyrus/dsml/validation/StereotypeUtil.java63
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/src/org/eclipse/papyrus/dsml/validation/oclpivot/AbstractOCLModelConstraint.java204
-rw-r--r--extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/src/org/eclipse/papyrus/dsml/validation/oclpivot/OCLConstraintParser.java62
8 files changed, 31 insertions, 373 deletions
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/generate.emtl b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/generate.emtl
index 50df88e318b..a26cc4ff465 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/generate.emtl
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/generate.emtl
@@ -409,7 +409,7 @@
<eType xsi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Stereotype"/>
</argument>
</body>
- <body xsi:type="ocl.ecore:StringLiteralExp" stringSymbol=".selectors;&#xA;&#xA;import org.eclipse.emf.validation.model.IClientSelector;&#xA;import org.eclipse.papyrus.dsml.validation.StereotypeUtil;&#xA;&#xA;/**&#xA; * This class filters (selects) passed stereotype applications. It returns true, if the&#xA; * associated stereotype (or one of its super-stereotypes) has the name '"/>
+ <body xsi:type="ocl.ecore:StringLiteralExp" stringSymbol=".selectors;&#xA;&#xA;import org.eclipse.emf.validation.model.IClientSelector;&#xA;import org.eclipse.papyrus.uml.service.validation.StereotypeUtil;&#xA;&#xA;/**&#xA; * This class filters (selects) passed stereotype applications. It returns true, if the&#xA; * associated stereotype (or one of its super-stereotypes) has the name '"/>
<body xsi:type="ocl.ecore:PropertyCallExp">
<eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/>
<source xsi:type="ocl.ecore:VariableExp" name="stereotype" referredVariable="/0/generateValidationContext/stereotype">
@@ -417,7 +417,7 @@
</source>
<referredProperty xsi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement/name"/>
</body>
- <body xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="'. &#xA; * @generated&#xA; */&#xA;public class "/>
+ <body xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="'.&#xA; *&#xA; * @generated&#xA; */&#xA;public class "/>
<body xsi:type="ocl.ecore:PropertyCallExp">
<eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/>
<source xsi:type="ocl.ecore:VariableExp" name="stereotype" referredVariable="/0/generateValidationContext/stereotype">
@@ -433,7 +433,7 @@
</source>
<referredProperty xsi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement/name"/>
</body>
- <body xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="&quot;); //$NON-NLS-1$&#xA;&#x9;}&#xA;}&#xA;&#xA;"/>
+ <body xsi:type="ocl.ecore:StringLiteralExp" stringSymbol="&quot;); //$NON-NLS-1$&#xA;&#x9;}&#xA;}&#xA;"/>
<fileUrl xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/String_Class/+">
<eType xsi:type="ocl.ecore:PrimitiveType" href="http://www.eclipse.org/ocl/1.1.0/oclstdlib.ecore#/0/String"/>
<source xsi:type="ocl.ecore:OperationCallExp" referredOperation="/1/String_Class/+">
@@ -1525,12 +1525,12 @@
</eAnnotations>
<eAnnotations source="positions.144" references="/0/generateValidationContext">
<details key="start" value="3583"/>
- <details key="end" value="4478"/>
+ <details key="end" value="4485"/>
<details key="line" value="86"/>
</eAnnotations>
<eAnnotations source="positions.145" references="/0/generateValidationContext/%">
<details key="start" value="3652"/>
- <details key="end" value="4466"/>
+ <details key="end" value="4473"/>
<details key="line" value="87"/>
</eAnnotations>
<eAnnotations source="positions.146" references="/0/generateValidationContext/%/%">
@@ -1550,53 +1550,53 @@
</eAnnotations>
<eAnnotations source="positions.149" references="/0/generateValidationContext/%/%.2">
<details key="start" value="3880"/>
- <details key="end" value="4175"/>
+ <details key="end" value="4182"/>
<details key="line" value="93"/>
</eAnnotations>
<eAnnotations source="positions.150" references="/0/generateValidationContext/%/%.3">
- <details key="start" value="4176"/>
- <details key="end" value="4191"/>
+ <details key="start" value="4183"/>
+ <details key="end" value="4198"/>
<details key="line" value="0"/>
</eAnnotations>
<eAnnotations source="positions.151" references="/0/generateValidationContext/%/%.3/stereotype">
- <details key="start" value="4176"/>
- <details key="end" value="4186"/>
+ <details key="start" value="4183"/>
+ <details key="end" value="4193"/>
<details key="line" value="0"/>
</eAnnotations>
<eAnnotations source="positions.152" references="/0/generateValidationContext/%/%.4">
- <details key="start" value="4193"/>
- <details key="end" value="4229"/>
+ <details key="start" value="4200"/>
+ <details key="end" value="4237"/>
<details key="line" value="100"/>
</eAnnotations>
<eAnnotations source="positions.153" references="/0/generateValidationContext/%/%.5">
- <details key="start" value="4230"/>
- <details key="end" value="4245"/>
+ <details key="start" value="4238"/>
+ <details key="end" value="4253"/>
<details key="line" value="0"/>
</eAnnotations>
<eAnnotations source="positions.154" references="/0/generateValidationContext/%/%.5/stereotype">
- <details key="start" value="4230"/>
- <details key="end" value="4240"/>
+ <details key="start" value="4238"/>
+ <details key="end" value="4248"/>
<details key="line" value="0"/>
</eAnnotations>
<eAnnotations source="positions.155" references="/0/generateValidationContext/%/%.6">
- <details key="start" value="4247"/>
- <details key="end" value="4417"/>
- <details key="line" value="103"/>
+ <details key="start" value="4255"/>
+ <details key="end" value="4425"/>
+ <details key="line" value="104"/>
</eAnnotations>
<eAnnotations source="positions.156" references="/0/generateValidationContext/%/%.7">
- <details key="start" value="4418"/>
- <details key="end" value="4433"/>
+ <details key="start" value="4426"/>
+ <details key="end" value="4441"/>
<details key="line" value="0"/>
</eAnnotations>
<eAnnotations source="positions.157" references="/0/generateValidationContext/%/%.7/stereotype">
- <details key="start" value="4418"/>
- <details key="end" value="4428"/>
+ <details key="start" value="4426"/>
+ <details key="end" value="4436"/>
<details key="line" value="0"/>
</eAnnotations>
<eAnnotations source="positions.158" references="/0/generateValidationContext/%/%.8">
- <details key="start" value="4435"/>
- <details key="end" value="4459"/>
- <details key="line" value="106"/>
+ <details key="start" value="4443"/>
+ <details key="end" value="4466"/>
+ <details key="line" value="107"/>
</eAnnotations>
<eAnnotations source="positions.159" references="/0/generateValidationContext/%/%.9">
<details key="start" value="3659"/>
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/generate.mtl b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/generate.mtl
index b1b81d4f886..de4e6bb9cbb 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/generate.mtl
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.generator/src/org/eclipse/papyrus/dsml/validation/generator/main/generate.mtl
@@ -93,7 +93,7 @@ public class [constraint.name.toUpperFirst() + 'Constraint'/] extends AbstractMo
package [getPluginID(stereotype)/].selectors;
import org.eclipse.emf.validation.model.IClientSelector;
-import org.eclipse.papyrus.dsml.validation.StereotypeUtil;
+import org.eclipse.papyrus.uml.service.validation.StereotypeUtil;
/**
* This class filters (selects) passed stereotype applications. It returns true, if the
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.wizard/src/org/eclipse/papyrus/dsml/validation/wizard/ValidationPluginGenerator.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.wizard/src/org/eclipse/papyrus/dsml/validation/wizard/ValidationPluginGenerator.java
index 153db773d9f..e3416e856fe 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.wizard/src/org/eclipse/papyrus/dsml/validation/wizard/ValidationPluginGenerator.java
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation.wizard/src/org/eclipse/papyrus/dsml/validation/wizard/ValidationPluginGenerator.java
@@ -89,7 +89,7 @@ public class ValidationPluginGenerator {
private static final String EMF_VALIDATION_PLUGIN = "org.eclipse.emf.validation"; //$NON-NLS-1$
- private static final String DSML_VALIDATION_PLUGIN = "org.eclipse.papyrus.dsml.validation"; //$NON-NLS-1$
+ private static final String UML_VALIDATION_PLUGIN = "org.eclipse.papyrus.uml.service.validation"; //$NON-NLS-1$
private static final String UML_URL = "http://www.eclipse.org/uml2/5.0.0/UML"; //$NON-NLS-1$
@@ -139,7 +139,7 @@ public class ValidationPluginGenerator {
editor.addNatures(natures);
editor.getManifestEditor().addDependency(EMF_VALIDATION_PLUGIN);
- editor.getManifestEditor().addDependency(DSML_VALIDATION_PLUGIN);
+ editor.getManifestEditor().addDependency(UML_VALIDATION_PLUGIN);
editor.getManifestEditor().addDependency(UML_PLUGIN);
Element constraintProviderExtension =
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/META-INF/MANIFEST.MF b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/META-INF/MANIFEST.MF
index 6b3e8124bdd..2a3446ca5d9 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/META-INF/MANIFEST.MF
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/META-INF/MANIFEST.MF
@@ -2,19 +2,14 @@ Manifest-Version: 1.0
Export-Package: org.eclipse.papyrus.dsml.validation,
org.eclipse.papyrus.dsml.validation.PapyrusDSMLValidationRule,
org.eclipse.papyrus.dsml.validation.PapyrusDSMLValidationRule.impl,
- org.eclipse.papyrus.dsml.validation.PapyrusDSMLValidationRule.util,
- org.eclipse.papyrus.dsml.validation.oclpivot
+ org.eclipse.papyrus.dsml.validation.PapyrusDSMLValidationRule.util
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.emf.ecore;visibility:=reexport,
org.eclipse.emf.ecore.xmi;visibility:=reexport,
org.eclipse.uml2.types;visibility:=reexport,
org.eclipse.uml2.uml;bundle-version="5.0.0",
- org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.0.1",
- org.eclipse.emf.validation;bundle-version="1.8.0",
- org.eclipse.ocl.examples.pivot;bundle-version="3.4.0",
- org.eclipse.ocl;bundle-version="3.4.0",
- org.eclipse.ocl.ecore;bundle-version="3.3.100"
+ org.eclipse.papyrus.uml.extensionpoints;bundle-version="1.0.1"
Bundle-Vendor: %pluginProvider
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/plugin.xml b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/plugin.xml
index e25eaf08f44..4e36d434130 100644
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/plugin.xml
+++ b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/plugin.xml
@@ -32,12 +32,4 @@
provider="Eclipse Modeling Project">
</profile>
</extension>
-
- <extension
- point="org.eclipse.emf.validation.constraintParsers">
- <constraintParser
- class="org.eclipse.papyrus.dsml.validation.oclpivot.OCLConstraintParser"
- lang="OCLpivot">
- </constraintParser>
- </extension>
</plugin>
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/src/org/eclipse/papyrus/dsml/validation/StereotypeUtil.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/src/org/eclipse/papyrus/dsml/validation/StereotypeUtil.java
deleted file mode 100644
index a5c9a9c2edd..00000000000
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/src/org/eclipse/papyrus/dsml/validation/StereotypeUtil.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST.
- *
- *
- * 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
- *
- * Contributors:
- * Ansgar Radermacher (CEA LIST) - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.dsml.validation;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.uml2.uml.Class;
-import org.eclipse.uml2.uml.Element;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-/**
- * Provide the possibility to check whether a stereotype application corresponds
- * to a stereotype provided as string. It takes sub-stereotypes into account.
- * The objective is to filter the execution of validation rules within the plugin.xml, i.e.
- * only schedule their execution, if a suitable context object is selected.
- *
- * Limitation: constraint context must be a stereotype (passed objects are stereotype applications)
- */
-public class StereotypeUtil {
-
- public static boolean checkStereoApplication(Object stereotypeApplicationObj, String stereoName) {
- if(!(stereotypeApplicationObj instanceof EObject)) {
- return false;
- }
-
- if(stereotypeApplicationObj instanceof Element) {
- return false;
- }
-
- EObject stereotypeApplication = ((EObject)stereotypeApplicationObj);
- Stereotype stereotype = UMLUtil.getStereotype(stereotypeApplication);
- if(stereotype == null) {
- return false;
- }
- return checkStereotype(stereotype, stereoName);
- }
-
- public static boolean checkStereotype(Stereotype stereotype, String stereoName) {
- if(stereoName.equals(stereotype.getName())) {
- return true;
- }
- for (Class superStereo : stereotype.getSuperClasses()) {
- if (superStereo instanceof Stereotype) {
- if (checkStereotype((Stereotype) superStereo, stereoName)) {
- return true;
- }
- }
- }
- return false;
- }
-}
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/src/org/eclipse/papyrus/dsml/validation/oclpivot/AbstractOCLModelConstraint.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/src/org/eclipse/papyrus/dsml/validation/oclpivot/AbstractOCLModelConstraint.java
deleted file mode 100644
index ef8a4c68535..00000000000
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/src/org/eclipse/papyrus/dsml/validation/oclpivot/AbstractOCLModelConstraint.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2003, 2007 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
- *
- * Contributors:
- * IBM - Initial API and implementation
- * Radek Dvorak (Borland) - Bugzilla 165458
- * Ansgar Radermacher (CEA) - created variant for evaluation with OCL pivot element
- *
- * </copyright>
- */
-
-package org.eclipse.papyrus.dsml.validation.oclpivot;
-
-import java.lang.ref.Reference;
-import java.lang.ref.WeakReference;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.common.util.WrappedException;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.validation.IValidationContext;
-import org.eclipse.emf.validation.model.ConstraintStatus;
-import org.eclipse.emf.validation.model.IModelConstraint;
-import org.eclipse.emf.validation.service.IConstraintDescriptor;
-import org.eclipse.ocl.EnvironmentFactory;
-import org.eclipse.ocl.Query;
-import org.eclipse.ocl.examples.pivot.ExpressionInOCL;
-import org.eclipse.ocl.examples.pivot.NamedElement;
-import org.eclipse.ocl.examples.pivot.OCL;
-import org.eclipse.ocl.examples.pivot.ParserException;
-import org.eclipse.ocl.examples.pivot.Type;
-import org.eclipse.ocl.examples.pivot.helper.OCLHelper;
-import org.eclipse.ocl.examples.pivot.manager.MetaModelManager;
-import org.eclipse.ocl.examples.pivot.utilities.PivotEnvironmentFactory;
-import org.eclipse.uml2.uml.Stereotype;
-import org.eclipse.uml2.uml.util.UMLUtil;
-
-/**
- * <p>
- * An OCL-language implementation of the {@link org.eclipse.emf.validation.model.IModelConstraint} interface. This class considers the OCL constraint text as a context-free expression, possibly targeting multiple model types (because the validation framework
- * permits declaration of any number of targets). A separate OCL {@link Query} is created and cached for each of these target types as required.
- * </p>
- * <p>
- * Any problems in parsing or executing the OCL will result in the constraint being disabled at run-time.
- * </p>
- * <p>
- * This class is intended to be used by clients of the validation framework that need to customize the OCL parsing environment for their constraints.
- * </p>
- * <p>
- * The generic type parameters declared by this class correspond to the like-named parameters of the {@link EnvironmentFactory} interface.
- * </p>
- *
- * @author Christian W. Damus (cdamus)
- */
-public abstract class AbstractOCLModelConstraint implements IModelConstraint {
-
- private final IConstraintDescriptor descriptor;
-
- /**
- * A separate query is maintained for each EClass of model object that this
- * constraint handles. Maintain the values in weak references also, because
- * the queries reference the EClasses that are the keys!
- */
- private final java.util.Map<Stereotype, Reference<?>> queries = new java.util.WeakHashMap<Stereotype, Reference<?>>();
-
- private QueryManager queryManager;
-
- protected static OCL oclInstance = null;
-
- /**
- * Initializes me with the <code>descriptor</code> which contains my OCL
- * body.
- *
- * @param descriptor
- * the descriptor, which must contain an OCL expression in its
- * body
- */
- public AbstractOCLModelConstraint(IConstraintDescriptor descriptor) {
- this.descriptor = descriptor;
- }
-
- /**
- * Obtains the cached OCL query/constraint that implements me for the
- * specified element's metaclass.
- *
- * @param target
- * a model element
- * @return the corresponding OCL query
- */
- public ExpressionInOCL getConstraintCondition(EObject target) {
- ExpressionInOCL result = null;
-
- Stereotype umlStereotype = UMLUtil.getStereotype(target);
-
- if (umlStereotype == null) {
- return null;
- }
-
- @SuppressWarnings("unchecked")
- Reference<ExpressionInOCL> reference = (Reference<ExpressionInOCL>) queries.get(umlStereotype);
- if (reference != null) {
- result = reference.get();
- }
-
- if (result == null) {
- // lazily initialize the condition.
- if (oclInstance == null) {
- OCL.initialize(null);
- PivotEnvironmentFactory pef = new PivotEnvironmentFactory(null,
- new MetaModelManager());
- oclInstance = OCL.newInstance(pef);
- }
-
- OCLHelper oclHelper = oclInstance.createOCLHelper();
-
- try {
- NamedElement context =
- oclInstance.getMetaModelManager().getPivotOf(NamedElement.class, umlStereotype);
-
- oclHelper.setContext((Type) context);
-
- String expression = getDescriptor().getBody();
- result = oclHelper.createQuery(expression);
- } catch (ParserException parserException) {
- throw new WrappedException(parserException);
- }
-
- queries.put(umlStereotype, new WeakReference<ExpressionInOCL>(
- result));
- }
-
- return result;
- }
-
- // implements the inherited method
- public IStatus validate(IValidationContext ctx) {
- EObject target = ctx.getTarget();
-
- try {
- if (getQueryManager().check(target)) {
- return ctx.createSuccessStatus();
- } else {
- // OCL constraints only support the target object as an extraction
- // variable and result locus, as OCL has no way to provide
- // additional extractions. Also, there is no way for the OCL
- // to access the context object
- return ctx.createFailureStatus(target);
- }
-
- } catch (Exception e) {
- // do not raise an exception, but create a failure status. This is consistent with
- // the behavior of the "in-profile" OCL pivot validation.
- String message = String.format("The '%s' constraint is invalid - %s", getDescriptor().getName(), e.getMessage());
- return new ConstraintStatus(this, target, IStatus.ERROR, -1,
- message, null);
- }
- }
-
- private QueryManager getQueryManager() {
- if (queryManager == null) {
- queryManager = new QueryManager();
- }
-
- return queryManager;
- }
-
- /*
- * (non-Javadoc) Implements the interface method.
- */
- public IConstraintDescriptor getDescriptor() {
- return descriptor;
- }
-
- /**
- * An object that knows how to obtain and evaluate the query implementation
- * appropriate to the constraint's environment factory, accounting for
- * whether it is using the OCL 1.0 or later API.
- *
- * @author Christian W. Damus (cdamus)
- */
- private final class QueryManager {
-
- QueryManager() {
- }
-
- /**
- * Obtains and checks the appropriate parsed constraint for the
- * specified target element.
- *
- * @param target
- * an element to be validated
- * @return whether it passed the constraint
- */
- boolean check(EObject target) {
- ExpressionInOCL query = getConstraintCondition(target);
- return (Boolean) oclInstance.evaluate(target, query);
- }
- }
-}
diff --git a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/src/org/eclipse/papyrus/dsml/validation/oclpivot/OCLConstraintParser.java b/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/src/org/eclipse/papyrus/dsml/validation/oclpivot/OCLConstraintParser.java
deleted file mode 100644
index b260cdf7cc9..00000000000
--- a/extraplugins/dsml.validation/org.eclipse.papyrus.dsml.validation/src/org/eclipse/papyrus/dsml/validation/oclpivot/OCLConstraintParser.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * <copyright>
- *
- * Copyright (c) 2003, 2007 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
- *
- * Contributors:
- * IBM - Initial API and implementation
- * Radek Dvorak (Borland) - Bugzilla 165458
- *
- * </copyright>
- *
- * $Id: OCLConstraintParser.java,v 1.5 2007/06/06 22:28:11 cdamus Exp $
- */
-
-package org.eclipse.papyrus.dsml.validation.oclpivot;
-
-import org.eclipse.emf.validation.model.IModelConstraint;
-import org.eclipse.emf.validation.service.IConstraintDescriptor;
-import org.eclipse.emf.validation.service.IParameterizedConstraintDescriptor;
-import org.eclipse.emf.validation.service.IParameterizedConstraintParser;
-
-/**
- * <p>
- * Simple constraint parser for creation of OCL-language constraints from the XML.
- * </p>
- * <p>
- * This class is not intended to be used by clients of the validation framework.
- * </p>
- *
- * @author Christian W. Damus (cdamus)
- */
-public class OCLConstraintParser implements IParameterizedConstraintParser {
-
- /**
- * Initializes me.
- */
- public OCLConstraintParser() {
- super();
- }
-
- // implements the inherited method
- public IModelConstraint parseConstraint(
- IParameterizedConstraintDescriptor desc) {
- return new EcoreOCLConstraint(desc);
- }
-
- /**
- * A concrete implementation of OCL constraints for the Ecore metamodel.
- *
- * @author Christian W. Damus (cdamus)
- */
- private static class EcoreOCLConstraint extends AbstractOCLModelConstraint {
-
- EcoreOCLConstraint(IConstraintDescriptor descriptor) {
- super(descriptor);
- }
- }
-}

Back to the top