Skip to main content



      Home
Home » Modeling » UML2 » loading a uml-profile
loading a uml-profile [message #752664] Wed, 26 October 2011 09:24 Go to next message
Eclipse UserFriend
hi

i'am writing a codegen for uml to java using uml-profiles.
to recognize the stereotypes in my templates i have to lad them at runtime and here is the problem. the uml-file i want to transform has the form like in the picture in the appendix: one platform:/resource... file and some pathmap...files
the profile i need is in a pathmap file and so i cannot access them, because the workflow expect a platform...file.
so i put the profile.uml-file in my workspace and tried to load it extra, but this does not work.
so i need a way to load the profile from the pathmap, has anybody an idea

greetings stoehm
  • Attachment: stereo.PNG
    (Size: 7.51KB, Downloaded 368 times)
Re: loading a uml-profile [message #752874 is a reply to message #752664] Wed, 26 October 2011 10:52 Go to previous messageGo to next message
Eclipse UserFriend
Hi Stoehm!

> ...
> the profile i need is in a pathmap file and so i cannot access them,
because the workflow expect a platform...file.

Is there any error or warning message?

> so i put the profile.uml-file in my workspace and tried to load it
extra, but this does not work.
> so i need a way to load the profile from the pathmap, has anybody an idea

I think the problem is that the pathmaps are defined in an extension
point, since you'are colling this code programmatically EMF doesn't know
about the them. So you have to register the pathmaps programmatically.
The code like this should help:

void setupUML(ResourceSet resourceSet) {
....
URI uri = getUMLResourcesURI();

//Put pathmap paths to the registry
Map<URI, URI> uriMap = URIConverter.URI_MAP;
uriMap.put(URI.createURI(UMLResource.METAMODELS_PATHMAP),
uri.appendSegment("metamodels").appendSegment(""));
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP),
uri.appendSegment("profiles").appendSegment(""));

// load the resources
resourceSet.getResource(URI.createURI(UMLResource.UML_METAMODEL_URI), true);
resourceSet.getResource(URI.createURI(UMLResource.ECORE_PROFILE_URI), true);
resourceSet.getResource(URI.createURI(UMLResource.STANDARD_PROFILE_URI),
true);
}

protected URI getUMLResourcesURI() {
final String umlProfile = "metamodels/UML.metamodel.uml";
final URL url = MyClass.class.getClassLoader().getResource(
umlProfile);
String baseUrl = url.toString();
URI uri = URI.createURI(baseUrl.substring(0, baseUrl.length()
- umlProfile.length()));
return uri;
}

Best wishes,
--
Tatiana Fesenko
ModelSolv, Inc.
Model-Oriented Solutions for Service Integration
Re: loading a uml-profile [message #753426 is a reply to message #752874] Thu, 27 October 2011 04:27 Go to previous message
Eclipse UserFriend
hi tatiana
thanks for your reply.

i think that can help me, but i have just two questions:

>final String umlProfile = "metamodels/UML.metamodel.uml";
this uml is the profile? because you write metamodel in it?

>final URL url = MyClass.class.getClassLoader().getResource(umlProfile);
i am not sure which class i have to choose here, can you give me a hint, please?

regards
stoehm
Previous Topic:how can i access the stereotype of an element
Next Topic:Iterative export of ecore to UML2
Goto Forum:
  


Current Time: Fri May 16 18:24:03 EDT 2025

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

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

Back to the top