Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345431 - Make it possible to preregister epackages
Summary: Make it possible to preregister epackages
Status: CLOSED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: cdo.core (show other bugs)
Version: 4.3   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Eike Stepper CLA
QA Contact: Eike Stepper CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-11 10:36 EDT by Martin Taal CLA
Modified: 2020-12-11 10:40 EST (History)
5 users (show)

See Also:


Attachments
Patch for non-first start pre-registration (3.58 KB, patch)
2011-05-18 06:53 EDT, Eike Stepper CLA
no flags Details | Diff
Patch for non-first start packages changed to apply to HEAD (4.87 KB, patch)
2013-04-27 18:22 EDT, András Péteri CLA
no flags Details | Diff
Test case for non-system package registration (3.33 KB, patch)
2013-04-27 18:26 EDT, András Péteri CLA
no flags Details | Diff
Updated test case (3.46 KB, patch)
2013-04-27 18:47 EDT, András Péteri CLA
no flags Details | Diff
Updated patch (4.38 KB, patch)
2013-04-27 18:54 EDT, András Péteri CLA
no flags Details | Diff
Updated patch (2) (4.88 KB, patch)
2013-04-27 19:06 EDT, András Péteri CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Taal CLA 2011-05-11 10:36:22 EDT
There are use cases in which the epackages are known upfront before the application starts. In some CDO stores registration of an epackage is also quite a heavy activity as the database schema needs to be updated. So for these stores it makes sense to preregister epackages before users actually start using the system.

This bugzilla is a feature request to define an internal api which can be used by a store to preregister epackages or another way (through properties) to define the epackages which can be preregistered when the application starts.
Comment 1 Saulius Tvarijonas CLA 2011-05-12 06:50:07 EDT
We facing similar problem also and thinking about creating tables upfront.
Comment 2 Eike Stepper CLA 2011-05-14 05:39:08 EDT
Committed revision 7712:
- trunk/features/org.eclipse.emf.cdo.server.product-feature
- trunk/plugins/org.eclipse.emf.cdo.server
Comment 3 Eike Stepper CLA 2011-05-14 05:39:49 EDT
I've added this new API:

	IRepository.setInitialPackages(EPackage...)
	
cdo-server.xml supports the following new syntax:

  <repository name="repo1">
    	<initialPackage nsURI="http://www.eclipse.org/emf/CDO/examples/company/1.0.0"/>
    	<initialPackage nsURI="http://xyz"/>
    	...
Comment 4 Martin Taal CLA 2011-05-15 05:13:23 EDT
Thanks Eike, I tested this and it works great! My tables now get created when the app starts for the first time.

gr. Martin
Comment 5 Saulius Tvarijonas CLA 2011-05-18 05:24:57 EDT
Hi Eike,

It would be helpful to have API to register packages after activation also. We have few packages which takes about 10 minutes to create tables. Packages are optional and we could invoke registration after repository activation.
Is it possible to adjust API?
Comment 6 Eike Stepper CLA 2011-05-18 05:34:49 EDT
It's not so much an API question. The problem with not-first-start-registrations is that there's no "system" commit like the commit of the root resource during first time repo activation.
Comment 7 Eike Stepper CLA 2011-05-18 06:52:43 EDT
Reopening for the attempt to allow pre-registration on non-first repository starts, as well...
Comment 8 Eike Stepper CLA 2011-05-18 06:53:24 EDT
Created attachment 195947 [details]
Patch for non-first start pre-registration

Egidijus, can you please test this?
Comment 9 Eike Stepper CLA 2011-06-23 03:58:37 EDT
Moving all open enhancement requests to 4.1
Comment 10 Eike Stepper CLA 2011-07-16 11:42:05 EDT
I thought this fix had already been committed. Seesms that not.

Egidijus, I'm not sure why I asked you to test this. Do you know it? Have you tested it?
Comment 11 Egidijus Vaisnora CLA 2011-07-18 02:28:52 EDT
No, I have not tested it yet... Will try to check this asap
Comment 12 Eike Stepper CLA 2012-08-14 22:57:10 EDT
Moving all open issues to 4.2. Open bugs can be ported to 4.1 maintenance after they've been fixed in master.
Comment 13 András Péteri CLA 2013-04-27 18:22:49 EDT
Created attachment 230217 [details]
Patch for non-first start packages changed to apply to HEAD
Comment 14 András Péteri CLA 2013-04-27 18:26:59 EDT
Created attachment 230218 [details]
Test case for non-system package registration
Comment 15 András Péteri CLA 2013-04-27 18:47:02 EDT
Created attachment 230219 [details]
Updated test case
Comment 16 András Péteri CLA 2013-04-27 18:54:50 EDT
Created attachment 230220 [details]
Updated patch

I have switched the order of readPackageUnits() and initSystemPackages(false) calls to populate the package registry first before attempting to write to it; this prevents potential primary key violations when registering initial packages which are already present in the repository.
Comment 17 András Péteri CLA 2013-04-27 19:06:20 EDT
Created attachment 230221 [details]
Updated patch (2)
Comment 18 Eike Stepper CLA 2013-05-20 07:02:15 EDT
Hi Andras,

Unfortunately your change of the initSystemPackages() method breaks the 4.x API and we can't accept that for 4.2 ;-(

You must find a different solution...
Comment 19 Eike Stepper CLA 2013-06-27 04:08:00 EDT
Moving all outstanding enhancements to 4.3
Comment 20 Eike Stepper CLA 2014-03-08 05:58:15 EST
It took me more than an hour to apply this patch against the old base commit to avoid conflicts. Thank you EGit!

commit 47e034b851573650dc67602f4902a9f5ef978edf
Comment 21 Eike Stepper CLA 2014-03-08 06:04:35 EST
Sorry, I had to rewrite that commit because you're not a registered Gerrit author ;-(

commit ccd53285217afb0f3cfdbfea336b82e9ffc1daae
Comment 22 Eike Stepper CLA 2020-12-11 10:26:19 EST
Closing.
Comment 23 Eike Stepper CLA 2020-12-11 10:40:55 EST
Closing.