Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Loading UML_21.ecore model from a standalone java app
Loading UML_21.ecore model from a standalone java app [message #504820] Tue, 22 December 2009 19:55 Go to next message
Dameer Joog is currently offline Dameer JoogFriend
Messages: 17
Registered: July 2009
Junior Member
Hi All

I asked a question on the emf group that got redirected here.
Can anyone please help ?

http://www.eclipse.org/forums/index.php?t=msg&th=159731& amp;start=0&
Re: Loading UML_21.ecore model from a standalone java app [message #504935 is a reply to message #504820] Wed, 23 December 2009 10:52 Go to previous messageGo to next message
Tim Myer is currently offline Tim MyerFriend
Messages: 81
Registered: July 2009
Member
Hi Dameer,

Have you looked here?

http://wiki.eclipse.org/MDT/UML2/FAQ#What.27s_required_to_lo ad_a_UML_.28.uml.29_resource_from_a_standalone_application.3 F

You will also need to register the UML 212 namespace:

resourceSet.getPackageRegistry().put(UML212UMLResource.UML_M ETAMODEL_NS_URI,
UMLPackage.eINSTANCE);

Hope that helps,
---Tim---


Dameer Joog wrote:
> Hi All
>
> I asked a question on the emf group that got redirected here.
> Can anyone please help ?
>
> http://www.eclipse.org/forums/index.php?t=msg&th=159731& amp;start=0&
>
Re: Loading UML_21.ecore model from a standalone java app [message #504938 is a reply to message #504935] Wed, 23 December 2009 11:13 Go to previous messageGo to next message
Dameer Joog is currently offline Dameer JoogFriend
Messages: 17
Registered: July 2009
Junior Member
Sorry to ask this newbie question but i am not loading a .uml file. I am trying to load the uml2 ecore metamodel which is UML_21.ecore.

Also it looks like i have to put some jar files in the class path for my application to run now. Can you say which ones i need ?

maybe org.eclipse.uml2.uml.resources_<version>.jar but what else since its not mentioned in the faq ?

Thanks a lot.
Re: Loading UML_21.ecore model from a standalone java app [message #505359 is a reply to message #504820] Tue, 29 December 2009 18:03 Go to previous message
Dameer Joog is currently offline Dameer JoogFriend
Messages: 17
Registered: July 2009
Junior Member
I tried to follow uml2 standlone faq but i am still getting the getEPackage() as null on one class only (EmodelElement).

EmodelElement is a superclass of the ELement class.

EPackage currPackage = superType.getEClassifier().getEPackage();

this always returns null for the Element class superclass EmodelElement as i expalined in the emf group.

I am starting to think that this maybe has nothing to do with uml.



output----------------------
[java] Loading metamodel ... uml
[java] class Comment {
[java] }
[java] class Element {
[java] eClass proxy:false
[java] superType proxy:false
[java] classifier proxy:true

parser-----------------
//EGenericType superType=null;
System.out.println(" class " + eClass.getName() +" {");
for (EGenericType superType : eClass.getEGenericSuperTypes()) {

//String typeName = getTypeName(superType, eClass);

EPackage currPackage = superType.getEClassifier().getEPackage();
if(currPackage==null){
System.out.println("eClass proxy:"+eClass.eIsProxy());
System.out.println("superType proxy:"+superType.eIsProxy());
System.out.println("classifier proxy:"+superType.getEClassifier().eIsProxy());
}else {
}

}


uml2------------

protected void loadUml2MetaModel(ResourceSet resourceSet) {

EPackage.Registry reg1;
reg1 = resourceSet.getPackageRegistry();

reg1.put(UMLPackage.eNS_URI, UMLPackage.eINSTANCE);
reg1.put(UML212UMLResource.UML_METAMODEL_NS_URI, UMLPackage.eINSTANCE);

Factory.Registry reg2;
reg2 = resourceSet.getResourceFactoryRegistry();
reg2.getExtensionToFactoryMap().put(UMLResource.FILE_EXTENSI ON,
UMLResource.Factory.INSTANCE);

Map<URI, URI> uriMap = resourceSet.getURIConverter().getURIMap();

URI uri = URI
.createURI(" jar:file:./lib/ecore/org.eclipse.uml2.uml.resources_3.0.0.v2 00906011111.jar!/ ");

uriMap.put(URI.createURI(UMLResource.LIBRARIES_PATHMAP), uri
.appendSegment("libraries").appendSegment(""));

uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP), uri
.appendSegment("metamodels").appendSegment(""));

uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri
.appendSegment("profiles").appendSegment(""));

}


Previous Topic:Extend Infrastructure.uml
Next Topic:Loading UML_21.ecore model from a standalone java app
Goto Forum:
  


Current Time: Fri Dec 19 00:46:34 GMT 2014

Powered by FUDForum. Page generated in 0.01620 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software