Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » load correctly an UML profile
load correctly an UML profile [message #642946] Fri, 03 December 2010 13:27 Go to next message
charfi asma is currently offline charfi asmaFriend
Messages: 17
Registered: July 2009
Junior Member
Hello everybody,
I tried to load an UML profile manually (in a java class):

public void registerPackages(ResourceSet resourceSet) {
super.registerPackages(resourceSet);
resourceSet.getPackageRegistry().put(UMLPackage.eINSTANCE.ge tNsURI(), UMLPackage.eINSTANCE);
// TODO If you need additional package registrations, do them here. The following line is an example for UML.

resourceSet.getPackageRegistry().put(HLAMPackage.eINSTANCE.g etNsURI(), HLAMPackage.eINSTANCE);

/* resourceSet.getPackageRegistry().put(EcorePackage.eINSTANCE. getNsURI(), EcorePackage.eINSTANCE);*/

Map uriMap = resourceSet.getURIConverter().getURIMap();

URI uri = URI.createURI(" jar:file:/export/home/charfi/Bureau/Logiciel/eclipse/plugins /org.eclipse.papyrus.marte.static.profile_0.7.1.201011231845 .jar!/ ");

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


/*URI uri = URI.createURI(" jar:file:/export/home/charfi/Bureau/Logiciel/eclipse/plugins /org.eclipse.uml2.uml.resources_3.1.1.v201008191505.jar!/ ");
uriMap.put(URI.createURI(UMLResource.PROFILES_PATHMAP), uri.appendSegment("profiles").appendSegment(""));*/

}

public void registerResourceFactories(ResourceSet resourceSet) {
super.registerResourceFactories(resourceSet);
// TODO If you need additional resource factories registrations, do them here
resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION, UMLResource.Factory.INSTANCE);

resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.PROFILE_FILE_EXTENSION, HLAMFactory.eINSTANCE);

}

for the Ecore profile, this works very well, I can print the profile name, the used stereotype name etc.
when I try to load the HLAƙ profile (sub profile of the MARTE profile), and print the profile name I get this:
org.eclipse.uml2.uml.internal.impl.ProfileImpl@121fd61 (eProxyURI: pathmap://Papyrus_PROFILES/MARTE.profile.uml#_yNSZIAPMEdyuUt -4qHuVvQ)

instead of :
org.eclipse.uml2.uml.internal.impl.ProfileImpl@1df7735 (name: HLAM, visibility: <unset>)

the MARTE.profile.uml is located in the resources folder of je jar file: jar:file:/export/home/charfi/Bureau/Logiciel/eclipse/plugins /org.eclipse.papyrus.marte.static.profile_0.7.1.201011231845 .jar

just like the Ecore.profile.uml which is located in the folder profiles of the jar file jar:file:/export/home/charfi/Bureau/Logiciel/eclipse/plugins /org.eclipse.uml2.uml.resources_3.1.1.v201008191505.jar

did I miss something to load corectly the profile, cause the (eProxyURI: pathmap://Papyrus_PROFILES/MARTE.profile.uml#_yNSZIAPMEdyuUt -4qHuVvQ) means that the EMF did not recognize my profile although the refernce is the rignt reference of the HLAM profile.

thank you very much

Asma.
Re: load correctly an UML profile [message #642983 is a reply to message #642946] Fri, 03 December 2010 15:13 Go to previous message
charfi asma is currently offline charfi asmaFriend
Messages: 17
Registered: July 2009
Junior Member
Hello,
I modified the factory register by specifying UMLResource.FILE_EXTENSION instead of UMLResource.PROFILE_FILE_EXTENSION and it works now for the profile name

resourceSet.getResourceFactoryRegistry().getExtensionToFacto ryMap().put(UMLResource.FILE_EXTENSION, HLAMFactory.eINSTANCE.createRtUnit());

--> the c.getModel().getAllAppliedProfiles() retruns: (c is a UML class )
org.eclipse.uml2.uml.internal.impl.ProfileImpl@959fa1 (name: HLAM, visibility: <unset>)

but the list of applied stereotypes is still empty ( c.getAppliedStereotypes() didi not return anything)

any idea ?

Asma
Previous Topic:Galileo/Helios UML profile conflict.
Next Topic:Unable to create 'ResourceSetImpl' instance in Eclipse 3.4.1
Goto Forum:
  


Current Time: Fri Dec 19 20:31:23 GMT 2014

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

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