[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.technology.gmt] Re: Error running the aw4.demo.emf.uml2.generator example project in 4.1 alpha

Hi
I managed to get this example working I had to make additional modifications 
to the
Setup class in UML2.adapter. Th eproblem was that the instances of the 
meodel elemnts being created was of the generic type (AnyTypeImpl) not the 
generated
UML2 model types. Therefore the type name known to oaw was Object, and it 
could not find a template which matched.
These changes solve the problem
In particular adding the following statement in the constructor

addEPackageClass(Ecore2XMLPackage.eINSTANCE.getClass().getName());

and the following statements in the method setStandardUML2Setup

// This sets up the resource factory impementation to use

addExtensionMap(new 
Mapping("uml","org.eclipse.uml2.uml.resource.UML22UMLResource"));

// Note that this is only required if you have legacy Eclipse UML 1.1 models 
, with
Eclipse UML 2.0 the extension is uml
addExtensionMap(new 
Mapping("uml2","org.eclipse.uml2.uml.resource.UML22UMLResource"));


// This is required by the resource factory above
uri = EcoreUtil2.getURI("model/UML2_2_UML.ecore2xml");
if (uri != null) {
String path = uri.toString();
if (path.indexOf(".jar!")!=-1) {
if (!path.startsWith("jar:")) path = "jar:"+path;
}
addUriMap(new 
Mapping("platform:/plugin/org.eclipse.uml2.uml/model/UML2_2_UML.ecore2xml",path));
}

these changes are neccessary to support UML2 version2 . Other statements may 
be needed to support reading uml2 models that take advantage of elements 
that are in
UML 2.1 .

There is thread on this in the eclipse.tools.uml2 newsgroup with the subject 
Re: Standalone parsing (redux)

I also had to make changes to the dependent plugins in adapter.uml, I added
org.eclipse.emf.mapping.ecore2xml_2.2.0vXXXXX asa dependent plugin

If anyone requires I will forward the complete source

Please note that when I export the adapter.uml plugin and run I get a class 
not found error for a class CacheAdapter which apparently is in UML2 1.1 for 
now I run
this as workspace project or a jar

Thanks
Solomon
"Solomon Obi" <solomono@xxxxxxx> wrote in message 
news:e652us$m20$1@xxxxxxxxxxxxxxxxxxxx
> Hi,
> I am attempting to run the oaw4.demo.emf.uml2.generator (the Alpha2 
> release for the Eclipse download )
> The first problem was that the Setup class in the uml2.adapter project was 
> not ported to UML2 2.0 Please see the corrections I made (changed 
> reference to new namespaces/packages)
>
> package org.openarchitectureware.uml2;
>
> import org.eclipse.emf.common.util.URI;
> import org.eclipse.uml2.uml.UMLPackage;
> import org.openarchitectureware.emf.EcoreUtil2;
> import org.openarchitectureware.emf.Mapping;
>
> public class Setup extends org.openarchitectureware.emf.Setup {
>
>   public Setup() {
>      addEPackageClass(UMLPackage.eINSTANCE.getClass().getName());
>   }
>
>   public void setStandardUML2Setup(boolean b) {
>      if (b) {
>         addExtensionMap(new 
> Mapping("ecore","org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl"));
>         addExtensionMap(new
>                       _____________________________________
> Mapping("uml2","org.eclipse.uml2.uml.resource.UMLResource"));
>                       ________________________________________
>                                               ____________________________
>         URI uri = EcoreUtil2.getURI("metamodels/UML.metamodel.uml");
> 
> ______________________________
>         if (uri!=null) {
>            String path = uri.toString();
>            path = path.substring(0,path.lastIndexOf("/metamodels"));
>            if (path.indexOf(".jar!")!=-1) {
>             if (!path.startsWith("jar:")) path = "jar:"+path;
>            }
>            addUriMap(new 
> Mapping("pathmap://UML2_PROFILES/",path+"/profiles/"));
>            addUriMap(new 
> Mapping("pathmap://UML2_METAMODELS/",path+"/metamodels/"));
>            addUriMap(new 
> Mapping("pathmap://UML2_LIBRARIES/",path+"/libraries/"));
>         }
>      }
>   }
>
>
> }
>
> The XMIReader now sucessfully reads in the input model, I now obtain the 
> following
>
> error
>
>
>
> 0 
> INFO  - ----------------------------------------------------------------------------------
> 0    INFO  - openArchitectureWare v4 -- (c) 2005, 2006 
> openarchitectureware.org and contributors
> 0 
> INFO  - ----------------------------------------------------------------------------------
> 0    INFO  - running workflow: 
> C:/tools/oaw/oaw-sample-emf-4.1.0/eclipse-projects/oaw4.demo.emf.uml2.generator/src/workflow.oaw
> 0    INFO  -
> 3594 INFO  - Starting: org.openarchitectureware.emf.XmiReader
> 3891 INFO  - Starting: generator 
> [org.openarchitectureware.xpand2.Generator]
> 4063 ERROR - No Definition 'templates::Root::Root for Object' found!:in 
> workflow-description on line 1 'EXPAND templates::Root::Root FOR 
> model.get(0)'
> org.openarchitectureware.expression.EvaluationException: No Definition 
> 'templates::Root::Root for Object' found!:in workflow-description on line 
> 1 'EXPAND templates::Root::Root FOR model.get(0)'
> at 
> org.openarchitectureware.xpand2.ast.ExpandStatement.invokeDefinition(ExpandStatement.java:166)
> at 
> org.openarchitectureware.xpand2.ast.ExpandStatement.evaluateInternal(ExpandStatement.java:157)
> at 
> org.openarchitectureware.xpand2.ast.Statement.evaluate(Statement.java:27)
> at 
> org.openarchitectureware.xpand2.Generator.invokeInternal(Generator.java:180)
> at 
> org.openarchitectureware.workflow.lib.AbstractWorkflowComponent2.invoke(AbstractWorkflowComponent2.java:28)
> at 
> org.openarchitectureware.workflow.container.CompositeComponent.internalInvoke(CompositeComponent.java:74)
> at 
> org.openarchitectureware.workflow.container.CompositeComponent.invoke(CompositeComponent.java:64)
> at 
> org.openarchitectureware.workflow.WorkflowRunner.executeWorkflow(WorkflowRunner.java:227)
> at 
> org.openarchitectureware.workflow.WorkflowRunner.run(WorkflowRunner.java:166)
> at 
> org.openarchitectureware.workflow.WorkflowRunner.main(WorkflowRunner.java:119)
>
> Apparently the line
> <expand value="templates::Root::Root FOR model.get(0)"/> in the workflow
> is evaulated  to type Object as opposed to uml:Model
>
> What change is neccessary
>
> Solomon
>