Skip to content

Alf support

Ákos Horváth edited this page May 4, 2015 · 6 revisions

All description here relies on the Alf integration from Papyrus 1.1.0 M6+ #High level overview and installation ##Requirements

##Executing the Alf parser tests Two set of tests are included:

  • Generator Test parses Alf files and generates C++ snippets from Alf expressions. Each test definition includes a name, an input and the expected output of the snippet generator.
  • Scalability Test provides various sizes of test cases where the scalability of the parser can be evaluated.

Furthermore, a [launch configuration](../../blob/master/com.incquerylabs.emdw.alf.tests/AlfGeneratorTest (plug-in).launch) is also provided that executes all test cases automatically. It can be executed as a JUnit Plug-in test.

#Technical details

Dependencies and initialization

In the background, OCL and QVT are used for validation and AlfMapper (basically resolution)

###Dependencies

  • org.eclipse.papyrus.uml.alf;bundle-version="1.1.0",
  • com.google.inject, -- for Xtext API
  • org.eclipse.emf.ecore,
  • org.eclipse.ocl.pivot;bundle-version="1.0.0",
  • org.eclipse.ocl.uml;bundle-version="5.0.100",
  • org.eclipse.uml2.uml.resources;bundle-version="5.1.0",
  • org.eclipse.uml2;bundle-version="5.0.0",
  • org.eclipse.ocl.xtext.essentialocl;bundle-version="1.0.0",
  • org.eclipse.ocl.pivot.uml;bundle-version="1.0.0", -- required for AlfMapper_ (if missing runtime exceptions are thrown)
  • org.eclipse.papyrus.uml.alf.to.fuml;bundle-version="1.1.0" -- required for AlfMapper (if missing runtime exceptions are thrown)

###Initial registrations In Eclipse environment, everything should be registered if org.eclipse.papyrus.uml.alf.ui project is loaded. Otherwise, the following registrations are required:

//Once in the application
injector = new AlfStandaloneSetup().createInjectorAndDoEMFRegistration()
EssentialOCLStandaloneSetup.doSetup
OCLstdlib.install()
//Once per resourceset
OCL.initialize(resourceSet)
OCLDelegateDomain.initialize(resourceSet)

Parsing standalone Alf files

var Resource resource = this.resourceSet.createResource(URI.createURI("temp.alf"))
resource.load(new StringInputStream(input), #{})
//Running resolution
val AlfMapper mapper = new AlfMapper()
mapper.map(resource.contents)

Parsing in-UML Alf files

To be researched

Clone this wiki locally