Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Split EClass definition between more than one resource
Split EClass definition between more than one resource [message #1243038] Mon, 10 February 2014 12:35 Go to next message
Paweł Doleciński is currently offline Paweł DolecińskiFriend
Messages: 44
Registered: January 2014
Member
Hi,

I've got a strange requirement in creating meta-models.

I am working only with Dynamic EMF and creating my classes in CDO directly. At runtime I need to retrieve EClass from CDO and display a reflective table based on that. So far I am not interested in instances.

Now the requirement.
Suppose I have an EClass Car with some attributes as my core module.
class Car
- attr1 : EString
- attr2 : EString

I have a GUI action looking for that class in CDO. Based on that, I will display a table with two columns: attr1 and attr2.

Now I'd like to add Module 2 which will contribute to the EClass Car by adding additional attribute.
Important thing is that I cannot extend from this class and cannot change the action in GUI. So after opening a table for EClass Car I'd like to see three columns.
What I can do is to provide information about modules to be used and a merging order.

I've seen EMF Compare EPatch solution which looked as a solution for me, but it seems to be removed from EMF Compare.

So I need to somehow merge meta-model definitions at runtime.

Does anyone ever meet with a similar requirement? Is there any already existing solution or something what could be adapted to handle it?
Or maybe I need to use annotations or introduce fragment's model and handle this logic on my own?

I would really appreciate any clue how to bite this problem.

Cheers,
Paweł.



[Updated on: Mon, 10 February 2014 12:37]

Report message to a moderator

Re: Split EClass definition between more than one resource [message #1243095 is a reply to message #1243038] Mon, 10 February 2014 14:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Paweł,

Comments below.

On 10/02/2014 1:35 PM, Paweł Doleciński wrote:
> Hi,
>
> I've got a strange requirement in creating meta-models.
>
> I am working only with Dynamic EMF and creating my classes in CDO
> directly. At runtime I need to retrieve EClass from CDO and display a
> reflective table based on that. So far I am not interested in instances.
>
> Now the requirement. Suppose I have an EClass Car with some attributes
> as my core module.
> class Car
> - attr1 : EString
> - attr2 : EString
>
> I have a GUI action looking for that class in CDO. Based on that, I
> will display a table with two columns: attr1 and attr2.
>
> Now I'd like to add Module 2 which will contribute to the EClass Car
> by adding additional attribute.
> Important thing is that I cannot extend from this class and cannot
> change the action in GUI. So after opening a table for EClass Car I'd
> like to see three columns.
Why can't you have an EClass ExtendedCar that extends Car and introduces
the additional attributes? Given that your action is looking at the
EClass, it can just look at EClass.getEAllStructuralFeatures to
determine the columns...
>
> I've seen EMF Compare EPatch solution which looked as a solution for
> me, but it seems to be removed from EMF Compare.
>
> So I need to somehow merge meta-model definitions at runtime.
Why must the be merged?
>
> Does anyone ever meet with a similar requirement? Is there any already
> existing solution or something what could be adapted to handle it?
> Or maybe I need to use annotations or introduce fragment's model and
> handle this logic on my own?
I don't see why an extended class doesn't do the trick.
>
> I would really appreciate any clue how to bite this problem.
>
> Cheers,
> Paweł.
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Split EClass definition between more than one resource [message #1243640 is a reply to message #1243095] Tue, 11 February 2014 08:32 Go to previous messageGo to next message
Paweł Doleciński is currently offline Paweł DolecińskiFriend
Messages: 44
Registered: January 2014
Member
Ed, thanks for replay.

Unfortunately it is not so easy, I guess. Let me explain my point more clearly and sorry for a long description.

I've got:
//core module

class Car
{
 String attr1;
} 

class SpecialCar extends Car
{
 String specialAttr;
}


Next, I've got few modules which you can plug in and unplug and all of them contribute to class Car.

//module 1
CarModule1 contribute to Car
{
 String moduleOneAttr;
} 

//module 2
CarModule2 contribute to Car
{
 String moduleTwoAttr;
}


Now in GUI I have an action bound to SpecialCar EClass. So I can use EClass.getEAllStructuralFeatures.
In normal case I will get two attributes: attr1 and specialAttr. But depends on which modules are on
I'd like to to get additional attributes from contributions. And I cannot change the core module.

So for me it's like module 1 and 2 contains kind of patches to apply at runtime.

I hope now it is more clear why normal inheritance doesn't do the trick.

I'll be really thankful for any idea in here.
Re: Split EClass definition between more than one resource [message #1243720 is a reply to message #1243640] Tue, 11 February 2014 10:51 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
Paweł,

Perhaps the EMF Facet project provides something that would help:
http://www.eclipse.org/facet/


On 11/02/2014 9:32 AM, Paweł Doleciński wrote:
> Ed, thanks for replay.
>
> Unfortunately it is not so easy, I guess. Let me explain my point more
> clearly and sorry for a long description.
>
> I've got:
> //core module
>
> class Car
> {
> String attr1;
> }
> class SpecialCar extends Car
> {
> String specialAttr;
> }
>
>
> Next, I've got few modules which you can plug in and unplug and all of
> them contribute to class Car.
>
>
> //module 1
> CarModule1 contribute to Car
> {
> String moduleOneAttr;
> }
> //module 2
> CarModule2 contribute to Car
> {
> String moduleTwoAttr;
> }
>
>
> Now in GUI I have an action bound to SpecialCar EClass. So I can use
> EClass.getEAllStructuralFeatures.
> In normal case I will get two attributes: attr1 and specialAttr. But
> depends on which modules are on I'd like to to get additional
> attributes from contributions. And I cannot change the core module.
>
> So for me it's like module 1 and 2 contains kind of patches to apply
> at runtime.
>
> I hope now it is more clear why normal inheritance doesn't do the trick.
>
> I'll be really thankful for any idea in here.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Split EClass definition between more than one resource [message #1243866 is a reply to message #1243640] Tue, 11 February 2014 15:03 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Complete OCL supports the ability to partition a design by concerns and
extend a class from a concern-specific document.

Regards

Ed Willink

On 11/02/2014 08:32, Paweł Doleciński wrote:
> Ed, thanks for replay.
>
> Unfortunately it is not so easy, I guess. Let me explain my point more
> clearly and sorry for a long description.
>
> I've got:
> //core module
>
> class Car
> {
> String attr1;
> }
> class SpecialCar extends Car
> {
> String specialAttr;
> }
>
>
> Next, I've got few modules which you can plug in and unplug and all of
> them contribute to class Car.
>
>
> //module 1
> CarModule1 contribute to Car
> {
> String moduleOneAttr;
> }
> //module 2
> CarModule2 contribute to Car
> {
> String moduleTwoAttr;
> }
>
>
> Now in GUI I have an action bound to SpecialCar EClass. So I can use
> EClass.getEAllStructuralFeatures.
> In normal case I will get two attributes: attr1 and specialAttr. But
> depends on which modules are on I'd like to to get additional
> attributes from contributions. And I cannot change the core module.
>
> So for me it's like module 1 and 2 contains kind of patches to apply
> at runtime.
>
> I hope now it is more clear why normal inheritance doesn't do the trick.
>
> I'll be really thankful for any idea in here.
Re: Split EClass definition between more than one resource [message #1244366 is a reply to message #1243866] Wed, 12 February 2014 08:12 Go to previous message
Paweł Doleciński is currently offline Paweł DolecińskiFriend
Messages: 44
Registered: January 2014
Member
Thank you all!

I do not know how I could overlook EMF Facet.
I am going to look deeper on it and provide you some feedback and maybe more questions.

Cheers,
Paweł.
Previous Topic:[xcore] Implement method outside of xcore model
Next Topic:[TENEO] Unable to get "merge" in hibernate list cascade using teneo properties
Goto Forum:
  


Current Time: Thu Apr 18 23:55:32 GMT 2024

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

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

Back to the top