Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Extending models at runtime(Working with multiple hierachical model instances)
Extending models at runtime [message #1386052] Fri, 13 June 2014 08:38 Go to next message
Victor Kirk is currently offline Victor KirkFriend
Messages: 1
Registered: June 2014
Junior Member
Hi

I'm looking at creating a model that can be enhanced with additional plugins. The core model would only introduce some fairly fundamental types. For example an asset management system could define a basic model in plugin A that would define assets, suppliers etc. An additional plugin B would add a number of specializations for computer equipment and another plugin C would bring in specializations for something else. This is akin to a uml profile.

I'd like my application to have a single model, with plugin B and C creating their specialized instances and adding them to the model residing in plugin A. Is this possible, all the documentation I can find seems concerned with extending a model but creating an instance of that, not mixing and matching. If it matters, objects would only be created in the plugin that defines that type.

I do however need concrete types for developing buisness logic against.

Is this achievable with EMF? I had thought that if it is not possible to do this directly that I could possibly achieve the required result by chaining the model objects by having them implementing IAdpatable and changing the factory methods to create instances in the parent model and add the specialised instance as an adapter, but having a single model seems better.

Additionally I'd like other plugins to enrich the data model, e.g. a fault management plugin D could add data to the objects to hold fault status. Again I could do this with adapters if there is nothing in EMF.

Regards, Vic


Re: Extending models at runtime [message #1386140 is a reply to message #1386052] Fri, 13 June 2014 15:10 Go to previous messageGo to next message
Per Sterner is currently offline Per SternerFriend
Messages: 91
Registered: October 2011
Member
>I'm looking at creating a model that can be enhanced with additional plugins. The core model would only introduce some fairly fundamental types. For example an asset management system could define a basic model in plugin A that would define assets, suppliers etc. An additional plugin B would add a number of specializations for computer equipment and another plugin C would bring in specializations for something else. This is akin to a uml profile.

- Do you mean enhancing the original model f.e. with attributes in already defined EClass's? -> ''Model weaving''

>I'd like my application to have a single model, with plugin B and C creating their specialized instances and adding them to the model residing in plugin A. Is this possible, all the documentation I can find seems concerned with extending a model but creating an instance of that, not mixing and matching. If it matters, objects would only be created in the plugin that defines that type.

>I do however need concrete types for developing buisness logic against.

Must they be in one plugin? You could have one master model which requires and reexports all your models. Then the Javacode would be available automatically. The EMF-Registry also has all runtime EPackackes.

>Is this achievable with EMF? I had thought that if it is not possible to do this directly that I could possibly achieve the required result by chaining the model objects by having them implementing IAdpatable and changing the factory methods to create instances in the parent model and add the specialised instance as an adapter, but having a single model seems better.

>Additionally I'd like other plugins to enrich the data model, e.g. a fault management plugin D could add data to the objects to hold fault status. Again I could do this with adapters if there is nothing in EMF.

I can't tell you anything except ''Xcore'' could perhaps help (or modifying the Java-Generator-Templates, perhaps not so good Smile ).

>Regards, Vic

[Updated on: Fri, 13 June 2014 15:12]

Report message to a moderator

Re: Extending models at runtime [message #1386174 is a reply to message #1386052] Sat, 14 June 2014 05:44 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30351
Registered: July 2009
Senior Member
Victor,

Comments below.

On 13/06/2014 3:04 PM, Victor Kirk wrote:
> Hi
>
> I'm looking at creating a model that can be enhanced with additional
> plugins. The core model would only introduce some fairly fundamental
> types. For example an asset management system could define a basic
> model in plugin A that would define assets, suppliers etc. An
> additional plugin B would add a number of specializations for computer
> equipment and another plugin C would bring in specializations for
> something else. This is akin to a uml profile.
>
> I'd like my application to have a single model, with plugin B and C
> creating their specialized instances and adding them to the model
> residing in plugin A.
I'm not sure when you say a "single model" if you're taking about one
Ecore model (no you can't split a single Ecore model across plugins) or
a "single instance" (yes you can create an instances of many Ecore
models and compose them the same was as if they came from a single Ecore
model).
> Is this possible, all the documentation I can find seems concerned
> with extending a model but creating an instance of that, not mixing
> and matching. If it matters, objects would only be created in the
> plugin that defines that type.
Maybe
http://ed-merks.blogspot.de/2008/01/creating-children-you-didnt-know.html helps...
>
> I do however need concrete types for developing buisness logic against.
>
> Is this achievable with EMF?
I expect so.
> I had thought that if it is not possible to do this directly that I
> could possibly achieve the required result by chaining the model
> objects by having them implementing IAdpatable and changing the
> factory methods to create instances in the parent model and add the
> specialised instance as an adapter, but having a single model seems
> better.
Each model will have its own factory.
>
> Additionally I'd like other plugins to enrich the data model, e.g. a
> fault management plugin D could add data to the objects to hold fault
> status. Again I could do this with adapters if there is nothing in EMF.
That's all possible, given a suitably extensible base model.
>
> Regards, Vic
>
>
>
Previous Topic:CDO Transaction becomes not active the second time I open it
Next Topic:Acceleo generator in standalone mode
Goto Forum:
  


Current Time: Sun Aug 18 11:46:09 GMT 2019

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

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

Back to the top