I was wondering if it is somehow possible to create a fallback from one activation method to another? Let's say i have a bundle that is activated via Declarative Services, but SCR is not installed on the application server in question. Is it possible to have a bundle with both Declarative Services and Blueprint activators, and decide the load order? For example: Can i make a bundle and specify that it should be loaded by SCR if available, and Blueprints if SCR is not installed?
Asked
Active
Viewed 58 times
0
-
And then what if Blueprint is not installed? – Neil Bartlett Apr 12 '16 at 07:25
-
Either look for an activator or give up? :) – Martin Nielsen Apr 12 '16 at 08:14
-
2So if you are that concerned about installing one more bundle (SCR) then just write a `BundleActivator`. But it's an odd concern to have. – Neil Bartlett Apr 12 '16 at 09:37
-
Actually, the reason is that i am writing a set of bundles that needs to be installed on several app servers, which i don't control. I like Declarative services, and the flexibility and ease of use they bring, but they are not available to me everywhere i need to install, and i cant just install it. So i was looking for a middle way of doing things, which arguably is never a good idea:) – Martin Nielsen Apr 13 '16 at 06:39
2 Answers
4
If you want to use SCR functionality and your bundle is installed in an app server that doesn't have SCR then the easiest answer is to install SCR. It's a single, small bundle, and it is a dependency of your bundle just as much as the packages etc that you depend on.
If you really cannot install SCR or rely on SCR already being available, then you need to write a BundleActivator
. This is normally only necessary for very low-level "plumbing"-type bundles, or when running on extremely resource-constrained devices.

Neil Bartlett
- 23,743
- 4
- 44
- 77
-
Ok, so in my case, where i can't just install that extra bundle, i will need to look for the lowest common denominator? Allright that is what i will do then. Thanks:) – Martin Nielsen Apr 13 '16 at 06:41
1
This is not possible. I think the best practice is to decide for one of the two. If you are concerned about additional dependencies you introduce then DS is the better choice as it only needs one bundle to work.

Christian Schneider
- 19,420
- 2
- 39
- 64