Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Problem with the "registration" of an UML2 profile
Problem with the "registration" of an UML2 profile [message #840699] Tue, 10 April 2012 12:05 Go to next message
JM Gauthier is currently offline JM GauthierFriend
Messages: 25
Registered: June 2011
Junior Member
Hello,

I have made a plugin which contains a profile.uml file. I want to "register" this profile by using Eclipse extensions.

The problem is as follow :

  1. First, in order to get the profile available in an Eclipse instance, I have to add an org.eclipse.uml2.uml.dynamic_package whose uri is the NSUri of the profile (created when the profile has been defined) and the location is of the form platform:/plugin/my.plugin/folder/profile.uml. With this extension, Eclipse is able to apply my profile in my model test.sysml. So that I can apply stereotypes defined in the plugin.
  2. But, I got an error when I do an ATL on the model test.sysml :
    Error loading /Project/Models/test.sysml: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri 'myUri' not found. (file:///Project/Models/test.sysml, 693, 99).


So, I tried to add another extension : org.eclipse.emf.ecore.dynamic_package. But this time I got another error which is :
org.eclipse.uml2.uml.internal.impl.ProfileImpl cannot be cast to org.eclipse.emf.ecore.EPackage


So my question is :
What is the best way to register an UML profile by using extension of Eclipse ?

Thanks for advance! Smile

Re: Problem with the "registration" of an UML2 profile [message #840743 is a reply to message #840699] Tue, 10 April 2012 13:10 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi,

The org.eclipse.emf.ecore.dynamic_package extension point is for
registration of dynamic Ecore packages, not UML packages. If anything,
you would reference the Ecore representation or "definition" of your
UML profile, which is attached to it in an annotation, on this
extension point. I expect that this would make other systems like ATL
work, as the Ecore definition of your profile would then be available
through the usual EMF channels and would look and feel just like any
other Ecore package.

Another possibility is statically defining your profile: generating
the usual EMF-ish API from it, with a static Ecore package
registration. This has the added benefit of providing a convenient
Java API for processing and manipulation of stereotype applications.
Have you considered this option?

HTH,

Christian


On 2012-04-10 12:05:58 +0000, JM Gauthier said:

> Hello,
> I have made a plugin which contains a profile.uml file. I want to
> "register" this profile by using Eclipse extensions.
> The problem is as follow :
> First, in order to get the profile available in an Eclipse instance, I
> have to add an org.eclipse.uml2.uml.dynamic_package whose uri is the
> NSUri of the profile (created when the profile has been defined) and
> the location is of the form
> platform:/plugin/my.plugin/folder/profile.uml. With this extension,
> Eclipse is able to apply my profile in my model test.sysml. So that I
> can apply stereotypes defined in the plugin.
> But, I got an error when I do an ATL on the model test.sysml : Error
> loading /Project/Models/test.sysml:
> org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package with uri
> 'myUri' not found. (file:///Project/Models/test.sysml, 693, 99).
>
>
> So, I tried to add another extension :
> org.eclipse.emf.ecore.dynamic_package. But this time I got another
> error which is :
> org.eclipse.uml2.uml.internal.impl.ProfileImpl cannot be cast to
> org.eclipse.emf.ecore.EPackage
>
>
> So my question is : What is the best way to register an UML profile by
> using extension of Eclipse ?
> Thanks for advance! :)
Re: Problem with the "registration" of an UML2 profile [message #840788 is a reply to message #840743] Tue, 10 April 2012 14:12 Go to previous messageGo to next message
JM Gauthier is currently offline JM GauthierFriend
Messages: 25
Registered: June 2011
Junior Member
Hi Christian!

Thanks for your reply!

Quote:
you would reference the Ecore representation or "definition" of your
UML profile, which is attached to it in an annotation, on this
extension point.


Actually this is done with the extension:
<extension
         point="org.eclipse.emf.ecore.dynamic_package">
      <resource
            location="platform:/plugin/my.plugin/folder/profile.uml"
            uri="myUri">
      </resource>
</extension>


Is it right ? In this case I have the following error :
org.eclipse.uml2.uml.internal.impl.ProfileImpl cannot be cast to org.eclipse.emf.ecore.EPackage

Quote:
Another possibility is statically defining your profile: generating
the usual EMF-ish API from it, with a static Ecore package
registration. This has the added benefit of providing a convenient
Java API for processing and manipulation of stereotype applications.
Have you considered this option?


I have not considered this option yet. How can I generate the EMF-ish API from the profile ?

Thanks!
Re: Problem with the &amp;quot;registration&amp;quot; of an UML2 profile [message #841167 is a reply to message #840788] Wed, 11 April 2012 01:13 Go to previous messageGo to next message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi,

See some replies in-line, below.

HTH,

Christian

On 2012-04-10 14:12:08 +0000, JM Gauthier said:

> Hi Christian!
> Thanks for your reply!
> Quote:
>> you would reference the Ecore representation or "definition" of your
>> UML profile, which is attached to it in an annotation, on this
>> extension point.
>
>
> Actually this is done with the extension: <extension
> point="org.eclipse.emf.ecore.dynamic_package">
> <resource
> location="platform:/plugin/my.plugin/folder/profile.uml"
> uri="myUri">
> </resource>
> </extension>
>
> Is it right ? In this case I have the following error :
> org.eclipse.uml2.uml.internal.impl.ProfileImpl cannot be cast to
> org.eclipse.emf.ecore.EPackage

That's because the principal content of the profile.uml resource is a
UML Profile, not an Ecore EPackage. If this extension point doesn't
let you actually register the EPackage contained within the EAnnotation
within the Profile, then perhaps this approach won't be fruitful.


> Quote:
>> Another possibility is statically defining your profile: generating
>> the usual EMF-ish API from it, with a static Ecore package
>> registration. This has the added benefit of providing a convenient
>> Java API for processing and manipulation of stereotype applications.
>> Have you considered this option?
>
>
> I have not considered this option yet. How can I generate the EMF-ish
> API from the profile ?
> Thanks!

Create a new EMF Generator Model and select the option to import from a
UML (UML2) model. Select your profile and complete the wizard to
create your genmodel. Then, generate your model and test code just as
you would for any other model, Ecore or otherwise. The result looks
and feels just like the code generated from an Ecore model.
Re: Problem with the &amp;quot;registration&amp;quot; of an UML2 profile [message #841548 is a reply to message #841167] Wed, 11 April 2012 13:02 Go to previous messageGo to next message
JM Gauthier is currently offline JM GauthierFriend
Messages: 25
Registered: June 2011
Junior Member
Hi Christian!

Thank you again for your help!

I have found the solution by trying your tips.

Actually it is not necessary to create an EMF Generator model. It could be interesting for those who (as you said) want an API.
So the following is the solution I found, in order to be able to apply a profile in a model (the profile is in an Eclipse plugin) and to use it with ATL or other technologies :

<extension
         point="org.eclipse.emf.ecore.uri_mapping">
      <mapping
            source="pathmap://MY_PROFILE/myProfile.uml"
            target="platform:/plugin/myPlugin/folder/myProfile.uml">
      </mapping>
   </extension>
   <extension
         point="org.eclipse.uml2.uml.dynamic_package">
      <profile
            location="pathmap://MY_PROFILE/myProfile.uml"
            uri="nsURI of myProfile">
      </profile>
   </extension>


I don't know if it's a good way to do this but it's work fine!

Well, thanks again!
Re: Problem with the &amp;amp;quot;registration&amp;amp;quot; of an UML2 profile [message #841596 is a reply to message #841548] Wed, 11 April 2012 14:13 Go to previous message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

Hi, JM,

I'm glad it worked out for you. It appears that the only difference is
the introduction of a URI mapping, which I wouldn't have thought should
make any difference. I would have expected the UML dynamic-package
registration to have been sufficient.

But, whatever, it works, and that's good!

cW


On 2012-04-11 13:02:58 +0000, JM Gauthier said:

> Hi Christian!
> Thank you again for your help!
> I have found the solution by trying your tips.
> Actually it is not necessary to create an EMF Generator model. It could
> be interesting for those who (as you said) want an API.
> So the following is the solution I found, in order to be able to apply
> a profile in a model (the profile is in an Eclipse plugin) and to use
> it with ATL or other technologies :
>
> <extension
> point="org.eclipse.emf.ecore.uri_mapping">
> <mapping
> source="pathmap://MY_PROFILE/myProfile.uml"
> target="platform:/plugin/myPlugin/folder/myProfile.uml">
> </mapping>
> </extension>
> <extension
> point="org.eclipse.uml2.uml.dynamic_package">
> <profile
> location="pathmap://MY_PROFILE/myProfile.uml"
> uri="nsURI of myProfile">
> </profile>
> </extension>
>
> I don't know if it's a good way to do this but it's work fine!
> Well, thanks again!
Previous Topic:Converting UML diagrams by simple java code parsing methods
Next Topic:"Invalid method Code length 67309 in class file org/eclipse/uml2/uml/util/UMLSwitch" and o
Goto Forum:
  


Current Time: Wed Apr 24 17:03:29 GMT 2024

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

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

Back to the top