Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Multiple instances of an application
Multiple instances of an application [message #488419] Mon, 28 September 2009 15:23 Go to next message
Janred  is currently offline Janred Friend
Messages: 20
Registered: August 2009
Junior Member
Hello all,

I am using TENEO to persist my model(based on GMF,EMF).I have so far
associated a ResourceSet to an Eclipse project. Is it possible to have
more instances of such a setting?

I mean multiple Eclipse projects, with each project having its own
Resource. Will it work in the context of a Database persistence?

Currently I am initializing the factory and my underlying model like this :

HibernateXMLResourceFactory resourceSet
= new HibernateXMLResourceFactory();
final Resource resource = resourceSet
..createResource(DATABASE_URI_MODEL_AND_DIAGRAM);
resource.load(Collections.EMPTY_MAP);


thx
Jan Red
Re: Multiple instances of an application [message #488445 is a reply to message #488419] Mon, 28 September 2009 17:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Jan,

I'm not really sure how you associate a ResourceSet with an Eclipse
project. You can create any number of separate resource sets, so I
imagine the answer is yes, you can and yes it will work.


Jan Red wrote:
> Hello all,
>
> I am using TENEO to persist my model(based on GMF,EMF).I have so far
> associated a ResourceSet to an Eclipse project. Is it possible to have
> more instances of such a setting?
>
> I mean multiple Eclipse projects, with each project having its own
> Resource. Will it work in the context of a Database persistence?
>
> Currently I am initializing the factory and my underlying model like
> this :
>
> HibernateXMLResourceFactory resourceSet
> = new HibernateXMLResourceFactory();
> final Resource resource = resourceSet
> .createResource(DATABASE_URI_MODEL_AND_DIAGRAM);
> resource.load(Collections.EMPTY_MAP);
>
>
> thx
> Jan Red


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Multiple instances of an application [message #488547 is a reply to message #488445] Tue, 29 September 2009 08:29 Go to previous messageGo to next message
Janred  is currently offline Janred Friend
Messages: 20
Registered: August 2009
Junior Member
Ed,

Currently my setting works for only a single Eclipse project.

I store my model in the DB using TENEO.I have extended the Navigator
generated by EMF/GMF (XXNavigatorContentProvider) so that I could view
my model from the DB. This "fake resource" is added to the existing
Eclipse project.

So , in the getChildren() method of the XXNavigatorContentProvider,
I use the following code

HibernateXMLResourceFactory resourceSet = new HibernateXMLResourceFactory();
final Resource resource =
resourceSet.createResource(DATABASE_URI_MODEL_AND_DIAGRAM);
resource.load(Collections.EMPTY_MAP);

My question was if I could store multiple models in the same DB?

thx
Jan


Ed Merks schrieb:
> Jan,
>
> I'm not really sure how you associate a ResourceSet with an Eclipse
> project. You can create any number of separate resource sets, so I
> imagine the answer is yes, you can and yes it will work.
>
>
> Jan Red wrote:
>> Hello all,
>>
>> I am using TENEO to persist my model(based on GMF,EMF).I have so far
>> associated a ResourceSet to an Eclipse project. Is it possible to have
>> more instances of such a setting?
>>
>> I mean multiple Eclipse projects, with each project having its own
>> Resource. Will it work in the context of a Database persistence?
>>
>> Currently I am initializing the factory and my underlying model like
>> this :
>>
>> HibernateXMLResourceFactory resourceSet
>> = new HibernateXMLResourceFactory();
>> final Resource resource = resourceSet
>> .createResource(DATABASE_URI_MODEL_AND_DIAGRAM);
>> resource.load(Collections.EMPTY_MAP);
>>
>>
>> thx
>> Jan Red
Re: Multiple instances of an application [message #488561 is a reply to message #488547] Tue, 29 September 2009 09:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Jan,

What's the actual value of DATABASE_URI_MODEL_AND_DIAGRAM; that seems to
be the key to answering your question. You'll need different URIs to
access different things. Note that a ResourceFactory is not a ResourceSet.


Jan Red wrote:
> Ed,
>
> Currently my setting works for only a single Eclipse project.
>
> I store my model in the DB using TENEO.I have extended the Navigator
> generated by EMF/GMF (XXNavigatorContentProvider) so that I could view
> my model from the DB. This "fake resource" is added to the existing
> Eclipse project.
>
> So , in the getChildren() method of the XXNavigatorContentProvider,
> I use the following code
>
> HibernateXMLResourceFactory resourceSet = new
> HibernateXMLResourceFactory();
> final Resource resource =
> resourceSet.createResource(DATABASE_URI_MODEL_AND_DIAGRAM);
> resource.load(Collections.EMPTY_MAP);
>
> My question was if I could store multiple models in the same DB?
>
> thx
> Jan
>
>
> Ed Merks schrieb:
>> Jan,
>>
>> I'm not really sure how you associate a ResourceSet with an Eclipse
>> project. You can create any number of separate resource sets, so I
>> imagine the answer is yes, you can and yes it will work.
>>
>>
>> Jan Red wrote:
>>> Hello all,
>>>
>>> I am using TENEO to persist my model(based on GMF,EMF).I have so far
>>> associated a ResourceSet to an Eclipse project. Is it possible to
>>> have more instances of such a setting?
>>>
>>> I mean multiple Eclipse projects, with each project having its own
>>> Resource. Will it work in the context of a Database persistence?
>>>
>>> Currently I am initializing the factory and my underlying model like
>>> this :
>>>
>>> HibernateXMLResourceFactory resourceSet
>>> = new HibernateXMLResourceFactory();
>>> final Resource resource = resourceSet
>>> .createResource(DATABASE_URI_MODEL_AND_DIAGRAM);
>>> resource.load(Collections.EMPTY_MAP);
>>>
>>>
>>> thx
>>> Jan Red


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Multiple instances of an application [message #488569 is a reply to message #488561] Tue, 29 September 2009 09:24 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Jan,
You can put different models in one DB. With Teneo the object-resource relation is not stored in the database. This
means that you can load objects freely in resources (using queries) or you can let Teneo do it for you. In the last case
Teneo detects which types represent the root of the containment hierarchy and will load the instances of these types in
a resource.
But as Ed says, to control different load behavior you need different URI's or you can extend the hibernate resource and
implement your own load behavior.

btw, I don't read all EMF posts all the time, but if you prefix the subject with [Teneo] then I am sure to check and answer.

gr. Martin

Ed Merks wrote:
> Jan,
>
> What's the actual value of DATABASE_URI_MODEL_AND_DIAGRAM; that seems to
> be the key to answering your question. You'll need different URIs to
> access different things. Note that a ResourceFactory is not a ResourceSet.
>
>
> Jan Red wrote:
>> Ed,
>>
>> Currently my setting works for only a single Eclipse project.
>>
>> I store my model in the DB using TENEO.I have extended the Navigator
>> generated by EMF/GMF (XXNavigatorContentProvider) so that I could view
>> my model from the DB. This "fake resource" is added to the existing
>> Eclipse project.
>>
>> So , in the getChildren() method of the XXNavigatorContentProvider,
>> I use the following code
>>
>> HibernateXMLResourceFactory resourceSet = new
>> HibernateXMLResourceFactory();
>> final Resource resource =
>> resourceSet.createResource(DATABASE_URI_MODEL_AND_DIAGRAM);
>> resource.load(Collections.EMPTY_MAP);
>>
>> My question was if I could store multiple models in the same DB?
>>
>> thx
>> Jan
>>
>>
>> Ed Merks schrieb:
>>> Jan,
>>>
>>> I'm not really sure how you associate a ResourceSet with an Eclipse
>>> project. You can create any number of separate resource sets, so I
>>> imagine the answer is yes, you can and yes it will work.
>>>
>>>
>>> Jan Red wrote:
>>>> Hello all,
>>>>
>>>> I am using TENEO to persist my model(based on GMF,EMF).I have so far
>>>> associated a ResourceSet to an Eclipse project. Is it possible to
>>>> have more instances of such a setting?
>>>>
>>>> I mean multiple Eclipse projects, with each project having its own
>>>> Resource. Will it work in the context of a Database persistence?
>>>>
>>>> Currently I am initializing the factory and my underlying model like
>>>> this :
>>>>
>>>> HibernateXMLResourceFactory resourceSet
>>>> = new HibernateXMLResourceFactory();
>>>> final Resource resource = resourceSet
>>>> .createResource(DATABASE_URI_MODEL_AND_DIAGRAM);
>>>> resource.load(Collections.EMPTY_MAP);
>>>>
>>>>
>>>> thx
>>>> Jan Red


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
[TENEO]Re: Multiple instances of an application [message #488592 is a reply to message #488569] Tue, 29 September 2009 11:35 Go to previous messageGo to next message
Janred  is currently offline Janred Friend
Messages: 20
Registered: August 2009
Junior Member
Hello,

This is my DATABASE_URI_MODEL_AND_DIAGRAM :
hbxml://?dsname="+DATASTORE_NAME&query1=from Application&&query2=from
Diagram
where Application represents the root of the containment hierarchy.

According to Martin I understand that it is possible to do what I
need(multiple models). So how do I initialize another model?

thank you
Jan Red


Martin Taal schrieb:
> Hi Jan,
> You can put different models in one DB. With Teneo the object-resource
> relation is not stored in the database. This means that you can load
> objects freely in resources (using queries) or you can let Teneo do it
> for you. In the last case Teneo detects which types represent the root
> of the containment hierarchy and will load the instances of these types
> in a resource.
> But as Ed says, to control different load behavior you need different
> URI's or you can extend the hibernate resource and implement your own
> load behavior.
>
> btw, I don't read all EMF posts all the time, but if you prefix the
> subject with [Teneo] then I am sure to check and answer.
>
> gr. Martin
>
> Ed Merks wrote:
>> Jan,
>>
>> What's the actual value of DATABASE_URI_MODEL_AND_DIAGRAM; that seems
>> to be the key to answering your question. You'll need different URIs
>> to access different things. Note that a ResourceFactory is not a
>> ResourceSet.
>>
>>
Re: [TENEO]Re: Multiple instances of an application [message #488628 is a reply to message #488592] Tue, 29 September 2009 14:01 Go to previous messageGo to next message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Jan,
If you mean multiple epackages then you need to create a new Datastore with these epackages and use the datastore name
in the dsname parameter.

I am not sure though if I am answering your question...

gr. Martin

Jan Red wrote:
> Hello,
>
> This is my DATABASE_URI_MODEL_AND_DIAGRAM :
> hbxml://?dsname="+DATASTORE_NAME&query1=from Application&&query2=from
> Diagram
> where Application represents the root of the containment hierarchy.
>
> According to Martin I understand that it is possible to do what I
> need(multiple models). So how do I initialize another model?
>
> thank you
> Jan Red
>
>
> Martin Taal schrieb:
>> Hi Jan,
>> You can put different models in one DB. With Teneo the object-resource
>> relation is not stored in the database. This means that you can load
>> objects freely in resources (using queries) or you can let Teneo do it
>> for you. In the last case Teneo detects which types represent the root
>> of the containment hierarchy and will load the instances of these
>> types in a resource.
>> But as Ed says, to control different load behavior you need different
>> URI's or you can extend the hibernate resource and implement your own
>> load behavior.
>>
>> btw, I don't read all EMF posts all the time, but if you prefix the
>> subject with [Teneo] then I am sure to check and answer.
>>
>> gr. Martin
>>
>> Ed Merks wrote:
>>> Jan,
>>>
>>> What's the actual value of DATABASE_URI_MODEL_AND_DIAGRAM; that seems
>>> to be the key to answering your question. You'll need different URIs
>>> to access different things. Note that a ResourceFactory is not a
>>> ResourceSet.
>>>
>>>
>
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [TENEO]Re: Multiple instances of an application [message #488641 is a reply to message #488628] Tue, 29 September 2009 14:45 Go to previous messageGo to next message
Janred  is currently offline Janred Friend
Messages: 20
Registered: August 2009
Junior Member
Hi Martin,

Maybe I am not expressing myself clearly. I have an application based on
an Ecore meta-model. This application is designed with the help of a few
editors. The editors are generated using GMF.

Since I did not want to use a file-system(default with GMF), I persisted
the model using TENEO. I followed the GMF Editor tutorials in Elver.org.
Since I wanted to show the model(in the database) to the user as a tree
I extended the default Navigator generated by GMF. So everytime the user
opens a project(Navigator) or clicks on DB Editor I initialize a
HibernateXMLResourceFactory and loads the resources as a tree.

As you have advised, I will try to use another Datastore for multiple
models.

thank you
Jan Red


Martin Taal schrieb:
> Hi Jan,
> If you mean multiple epackages then you need to create a new Datastore
> with these epackages and use the datastore name in the dsname parameter.
>
> I am not sure though if I am answering your question...
>
> gr. Martin
>
> Jan Red wrote:
>> Hello,
>>
>> This is my DATABASE_URI_MODEL_AND_DIAGRAM :
>> hbxml://?dsname="+DATASTORE_NAME&query1=from Application&&query2=from
>> Diagram
>> where Application represents the root of the containment hierarchy.
>>
>> According to Martin I understand that it is possible to do what I
>> need(multiple models). So how do I initialize another model?
>>
>> thank you
>> Jan Red
>>
>>
>> Martin Taal schrieb:
>>> Hi Jan,
>>> You can put different models in one DB. With Teneo the
>>> object-resource relation is not stored in the database. This means
>>> that you can load objects freely in resources (using queries) or you
>>> can let Teneo do it for you. In the last case Teneo detects which
>>> types represent the root of the containment hierarchy and will load
>>> the instances of these types in a resource.
>>> But as Ed says, to control different load behavior you need different
>>> URI's or you can extend the hibernate resource and implement your own
>>> load behavior.
>>>
>>> btw, I don't read all EMF posts all the time, but if you prefix the
>>> subject with [Teneo] then I am sure to check and answer.
>>>
>>> gr. Martin
>>>
>>> Ed Merks wrote:
>>>> Jan,
>>>>
>>>> What's the actual value of DATABASE_URI_MODEL_AND_DIAGRAM; that
>>>> seems to be the key to answering your question. You'll need
>>>> different URIs to access different things. Note that a
>>>> ResourceFactory is not a ResourceSet.
>>>>
>>>>
>>
>>
>
>
Re: [TENEO]Re: Multiple instances of an application [message #488647 is a reply to message #488641] Tue, 29 September 2009 15:16 Go to previous message
Martin Taal is currently offline Martin TaalFriend
Messages: 5468
Registered: July 2009
Senior Member
Hi Jan,
To add, I ment that you need another datastore if you add epackages at runtime. If you know all the epackages when your
application starts then you can put them all in one datastore.

gr. Martin

Jan Red wrote:
> Hi Martin,
>
> Maybe I am not expressing myself clearly. I have an application based on
> an Ecore meta-model. This application is designed with the help of a few
> editors. The editors are generated using GMF.
>
> Since I did not want to use a file-system(default with GMF), I persisted
> the model using TENEO. I followed the GMF Editor tutorials in Elver.org.
> Since I wanted to show the model(in the database) to the user as a tree
> I extended the default Navigator generated by GMF. So everytime the user
> opens a project(Navigator) or clicks on DB Editor I initialize a
> HibernateXMLResourceFactory and loads the resources as a tree.
>
> As you have advised, I will try to use another Datastore for multiple
> models.
>
> thank you
> Jan Red
>
>
> Martin Taal schrieb:
>> Hi Jan,
>> If you mean multiple epackages then you need to create a new Datastore
>> with these epackages and use the datastore name in the dsname parameter.
>>
>> I am not sure though if I am answering your question...
>>
>> gr. Martin
>>
>> Jan Red wrote:
>>> Hello,
>>>
>>> This is my DATABASE_URI_MODEL_AND_DIAGRAM :
>>> hbxml://?dsname="+DATASTORE_NAME&query1=from Application&&query2=from
>>> Diagram
>>> where Application represents the root of the containment hierarchy.
>>>
>>> According to Martin I understand that it is possible to do what I
>>> need(multiple models). So how do I initialize another model?
>>>
>>> thank you
>>> Jan Red
>>>
>>>
>>> Martin Taal schrieb:
>>>> Hi Jan,
>>>> You can put different models in one DB. With Teneo the
>>>> object-resource relation is not stored in the database. This means
>>>> that you can load objects freely in resources (using queries) or you
>>>> can let Teneo do it for you. In the last case Teneo detects which
>>>> types represent the root of the containment hierarchy and will load
>>>> the instances of these types in a resource.
>>>> But as Ed says, to control different load behavior you need
>>>> different URI's or you can extend the hibernate resource and
>>>> implement your own load behavior.
>>>>
>>>> btw, I don't read all EMF posts all the time, but if you prefix the
>>>> subject with [Teneo] then I am sure to check and answer.
>>>>
>>>> gr. Martin
>>>>
>>>> Ed Merks wrote:
>>>>> Jan,
>>>>>
>>>>> What's the actual value of DATABASE_URI_MODEL_AND_DIAGRAM; that
>>>>> seems to be the key to answering your question. You'll need
>>>>> different URIs to access different things. Note that a
>>>>> ResourceFactory is not a ResourceSet.
>>>>>
>>>>>
>>>
>>>
>>
>>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Previous Topic:implementing factory override
Next Topic:Get real Instance of DynamicEObjectImpl
Goto Forum:
  


Current Time: Thu Apr 25 16:23:21 GMT 2024

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

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

Back to the top