Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » loading a uml-profile
loading a uml-profile [message #752664] Wed, 26 October 2011 09:24 Go to next message
st oehm is currently offline st oehm
Messages: 79
Registered: October 2009
Member
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 116 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
Tatiana Fesenko is currently offline Tatiana Fesenko
Messages: 60
Registered: July 2009
Member
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
st oehm is currently offline st oehm
Messages: 79
Registered: October 2009
Member
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: Tue Jul 29 13:11:19 EDT 2014

Powered by FUDForum. Page generated in 0.04925 seconds