| /** |
| * <copyright> |
| * |
| * Copyright (c) 2011, 2013 Willink Transformations, University of York and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v2.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * E.D.Willink - initial API and implementation |
| * Adolfo Sanchez-Barbudo Herrera - bug397429 |
| * |
| * </copyright> |
| * |
| * |
| * Run As->MWE2 Workflow to regenerate QVTo models. |
| */ |
| module GenerateQVToASModels |
| |
| import org.eclipse.ocl.examples.build.utilities.* |
| import org.eclipse.ocl.examples.build.xtend.* |
| import org.eclipse.emf.mwe.utils.* |
| import org.eclipse.emf.ecore.resource.impl.* |
| |
| /** |
| * Generate the Pivot-based QVTo Models. |
| */ |
| var platformURI = ".." |
| |
| /* |
| * OCL related configuration variables |
| */ |
| var oclProjectName = "org.eclipse.ocl.pivot" |
| var oclGenModelProjectPath = "model/Pivot.genmodel" |
| |
| /* |
| * ImperativeOCL related configuration variables |
| */ |
| var imperativeOclProjectName = "org.eclipse.qvto.examples.pivot.imperativeocl" |
| var imperativeOclGenModelProjectPath = "model/ImperativeOCL.genmodel" |
| var imperativeOclGenModelPath = "${imperativeOclProjectName}/${imperativeOclGenModelProjectPath}" |
| |
| /* |
| * QVTOperational related configuration variables |
| */ |
| var qvtOperationalProjectName = "org.eclipse.qvto.examples.pivot.qvtoperational" |
| var qvtOperationalGenModelProjectPath = "model/QVTOperational.genmodel" |
| var qvtOperationalGenModelPath = "${qvtOperationalProjectName}/${qvtOperationalGenModelProjectPath}" |
| |
| Workflow { |
| bean = ResourceSetImpl : resourceSet {} |
| // bean = ProjectMapSetup { resourceSet = resourceSet } |
| bean = StandaloneSetup { resourceSet = resourceSet |
| platformUri = platformURI // Common path from which... |
| scanClassPath = true // ... a scan finds all classes |
| |
| // In case that the build.ocl plugin only resides in the workspace |
| // as might be the case for the *.build projects |
| uriMap = Mapping { |
| from = "platform:/plugin/org.eclipse.ocl.examples.build/" |
| to = "platform:/resource/org.eclipse.ocl.examples.build/" |
| } |
| } |
| bean = EcoreGenModelSetup { resourceSet = resourceSet } |
| |
| /* |
| FIXME: We can't weave the visitor pattern into the model because OCL doesn't do it. |
| We are forced to use the OCL approach, in essence, using GenModel annotations wiht source: |
| http://www.eclipse.org/OCL/GenModel/Visitor |
| See (org.eclipse.ocl.pivot/model/Pivot.genmodel) |
| |
| component = DerivedVisitorPatternWeaver { |
| resourceSet = resourceSet |
| in = imperativeOclEcoreURI |
| in = oclEcoreURI |
| in = oclEcoreURI |
| superVisitorInterfaceName = oclVisitorName |
| superVisitorInterfaceQualifiedName = oclVisitorQualifiedName |
| derivedVisitorInterfaceName = imperativeOclVisitorName |
| derivedVisitorInterfaceQualifiedName = imperativeOclVisitorQualifiedName |
| } |
| |
| component = DerivedVisitorPatternWeaver { |
| resourceSet = resourceSet |
| in = qvtOperationalEcoreURI |
| in = imperativeOclEcoreURI |
| in = oclEcoreURI |
| rootVisitorInterfaceName = oclVisitorName |
| rootVisitorInterfaceQualifiedName = oclVisitorQualifiedName |
| superVisitorInterfaceName = imperativeOclVisitorName |
| superVisitorInterfaceQualifiedName = imperativeOclVisitorQualifiedName |
| derivedVisitorInterfaceName = qvtOperationalVisitorName |
| derivedVisitorInterfaceQualifiedName = qvtOperationalVisitorQualifiedName |
| } */ |
| |
| component = GenerateModel { resourceSet = resourceSet skipOnErrors = true |
| genModel = imperativeOclGenModelPath |
| clearResourceSet = false |
| } |
| |
| |
| component = GenerateModel { resourceSet = resourceSet skipOnErrors = true |
| genModel = qvtOperationalGenModelPath |
| clearResourceSet = false |
| } |
| |
| component = GenerateASVisitors { resourceSet = resourceSet |
| projectName = imperativeOclProjectName |
| superProjectName = oclProjectName |
| baseProjectName = oclProjectName |
| genModelFile = imperativeOclGenModelProjectPath |
| superGenModelFile = oclGenModelProjectPath |
| baseGenModelFile = oclGenModelProjectPath |
| } |
| |
| component = GenerateASVisitors { resourceSet = resourceSet |
| projectName = qvtOperationalProjectName |
| superProjectName = imperativeOclProjectName |
| baseProjectName = oclProjectName |
| genModelFile = qvtOperationalGenModelProjectPath |
| superGenModelFile = imperativeOclGenModelProjectPath |
| baseGenModelFile = oclGenModelProjectPath |
| } |
| } |