Skip to main content



      Home
Home » Modeling » EMF » [Teneo] Adding EPackages Dynamically to DataStore
[Teneo] Adding EPackages Dynamically to DataStore [message #938743] Wed, 10 October 2012 01:39 Go to next message
Eclipse UserFriend
Hi Everyone,

Is there anyway I can dynamically include EPackages in to datastore during runtime ?

My Code:

//Initializing with a simple EPackage
EPackage[] epacks = new EPackage[]{EcoreFactory.eINSTANCE.createEPackage()};
hbds.setEPackages(epacks);
hbds.initialize();

.....


Later updating Registry with actual EPackages.

 EPackage.Registry.INSTANCE.put( epack.getNsURI(), epack );


Will Teneo automatically pick from global EPackage.Registry the packages at runtime?

Teneo gives me below error:

java.lang.IllegalArgumentException: No annotated model element present for: type EClass has its epackage been registered with Teneo?


Thanks and Regards,
Appasamy





Re: [Teneo] Adding EPackages Dynamically to DataStore [message #938802 is a reply to message #938743] Wed, 10 October 2012 02:59 Go to previous messageGo to next message
Eclipse UserFriend
Hi Appasamy,
I am afraid that this won't work like this. The datastore should be initialized with the actual epackage instance. So if
you have new epackages then you need to initialize the datastore again with those.

gr. Martin

On 10/10/2012 07:39 AM, Appasamy Thirugnana wrote:
> Hi Everyone,
>
> Is there anyway I can dynamically include EPackages in to datastore during runtime ?
>
> My Code:
>
> //Initializing with a simple EPackage
> EPackage[] epacks = new EPackage[]{EcoreFactory.eINSTANCE.createEPackage()};
> hbds.setEPackages(epacks);
> hbds.initialize();
>
> .....
>
>
> Later updating Registry with actual EPackages.
>
> EPackage.Registry.INSTANCE.put( epack.getNsURI(), epack );
>
> Will Teneo automatically pick from global EPackage.Registry the packages at runtime?
>
> Teneo gives me below error:
>
> java.lang.IllegalArgumentException: No annotated model element present for: type EClass has its epackage been registered
> with Teneo?
>
>
> Thanks and Regards,
> Appasamy
>
>
>
>
>
>


--

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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Teneo] Adding EPackages Dynamically to DataStore [message #938818 is a reply to message #938802] Wed, 10 October 2012 03:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi Martin,

Thanks for the input.

Ok I understood that I have to reinitialize the data store and I am following

http://wiki.eclipse.org/Teneo/Hibernate/Dynamic_EMF_Tutorial#Create_and_persist_Dynamic_EObject


Here will there be a problem if 5 concurrent users trying to persist instances using the datastore and one of the user triggers for reinitialization of datastore.

Will teneo manage to hold the reinitialization till all the transactions get complete and execute re-initialization later.


We have a spring web application with Sessionfactory implemented as per below configuration.
sebthom.de/152-configuring-emf-teneo-hibernate-dbcp-spring-transactions-opensessioninviewfilter/


Thanks ,

Appasamy









Re: [Teneo] Adding EPackages Dynamically to DataStore [message #938823 is a reply to message #938802] Wed, 10 October 2012 03:27 Go to previous messageGo to next message
Eclipse UserFriend
Hi Martin,

Thanks for the input.

Ok I understood that I have to reinitialize the data store and I am following

http://wiki.eclipse.org/Teneo/Hibernate/Dynamic_EMF_Tutorial#Create_and_persist_Dynamic_EObject


Here will there be a problem if 5 concurrent users trying to persist instances using the datastore and one of the user triggers for reinitialization of datastore.

Will teneo manage to hold the reinitialization till all the transactions get complete and execute re-initialization later.


We have a spring web application with Sessionfactory implemented as per below configuration.
sebthom.de/152-configuring-emf-teneo-hibernate-dbcp-spring-transactions-opensessioninviewfilter/


Thanks ,

Appasamy
Re: [Teneo] Adding EPackages Dynamically to DataStore [message #938859 is a reply to message #938823] Wed, 10 October 2012 04:10 Go to previous messageGo to next message
Eclipse UserFriend
Hi Appasamy,
Re-initializing the datastore is the same as re-initializing the sessionfactory. In most application the
sessionfactory/datastore is setup/initialized when the application starts not during normal operation.

If you have a dynamic model, then the best way is to create a new datastore with the new epackages and then after
initializing the new datastore switch the old and new one in a thread-safe way. This is quite doable.

gr. Martin


On 10/10/2012 09:27 AM, Appasamy Thirugnana wrote:
> Hi Martin,
>
> Thanks for the input.
> Ok I understood that I have to reinitialize the data store and I am following
>
> http://wiki.eclipse.org/Teneo/Hibernate/Dynamic_EMF_Tutorial#Create_and_persist_Dynamic_EObject
>
>
> Here will there be a problem if 5 concurrent users trying to persist instances using the datastore and one of the user
> triggers for reinitialization of datastore.
>
> Will teneo manage to hold the reinitialization till all the transactions get complete and execute re-initialization later.
>
>
> We have a spring web application with Sessionfactory implemented as per below configuration.
> sebthom.de/152-configuring-emf-teneo-hibernate-dbcp-spring-transactions-opensessioninviewfilter/
>
>
> Thanks ,
>
> Appasamy
>


--

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@xxxxxxxx - mtaal@xxxxxxxx
Web: www.springsite.com - www.elver.org
Re: [Teneo] Adding EPackages Dynamically to DataStore [message #938865 is a reply to message #938859] Wed, 10 October 2012 04:19 Go to previous message
Eclipse UserFriend
Hi Martin,

Thanks for the information. I understood now. Thanks for the support provided.

Thanks,
Appasamy
Previous Topic:BinaryResource lost unsettable empty values
Next Topic:Why to use a Map when EKeys are possible?
Goto Forum:
  


Current Time: Mon Oct 27 16:53:16 EDT 2025

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

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

Back to the top