Search code examples
timeosgiperiod

OSGI bundle (or service)- how to register for a given time period?


Search did not give me a hint, how can i behave with the following situation:

I'd love to have 2 OSGI implementations of the same interface: one is regular, the other should work (be active/present/whatever) on the given time period (f.e for Christmas weeks :))

The main goal is to call the same interface without specifying any flags/properties/without manual switching of ranking. Application should somehow switch implementation for this special period, doing another/regular job before and after :)

I'm a newbie, maybe i do not completely understand OSGI concept somewhere, sorry for that of give me a hint or link, sorry for my English.

Using Felix/Equinox with Apache Aries.


Solution

  • I have yet to see an OSGI container that at a framework level supports date/time based availability of services.

    If I were you I would simply drop a proxy service in front of the two interface implementations and put the service invocation based on date logic in there.