|
Re: loading a uml-profile [message #752874 is a reply to message #752664] |
Wed, 26 October 2011 14:52   |
Tatiana Fesenko Messages: 62 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.02136 seconds