Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348062 - [cm] Pull mechanism in Config Admin
Summary: [cm] Pull mechanism in Config Admin
Status: RESOLVED WONTFIX
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Compendium (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows Vista
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: equinox.compendium-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 329688 348391 349191
Blocks:
  Show dependency tree
 
Reported: 2011-06-02 07:35 EDT by Lazar Kirchev CLA
Modified: 2014-04-16 15:25 EDT (History)
2 users (show)

See Also:


Attachments
equinox configuration manager patch allowing to replace file storage by custom implementation. (19.73 KB, patch)
2011-06-06 08:32 EDT, Arnaud MERGEY CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Lazar Kirchev CLA 2011-06-02 07:35:53 EDT
Currently the Config Admin implements push mechanism to update targets with new configurations. A pull mechanism in addition to this is desirable. This pull mechanism should allow the call to getConfiguration to end in a custom component, which will return the configuration from custom storage, based on the calling context. Any caching of these configurations in the ConfigAdmin service is undesired.
Comment 1 Arnaud MERGEY CLA 2011-06-06 08:32:24 EDT
Created attachment 197389 [details]
equinox configuration manager patch allowing to replace file storage by custom implementation.
Comment 2 Arnaud MERGEY CLA 2011-06-06 08:32:49 EDT
I also recently needed to replace default configuration persistent storage mechanism of equinox (replacing file by db storage). 

In order to avoid to write the whole thing I patched org.eclipse.equinox.cm.
I just did a small code refactoring, extracting ina an interface, the code responsible for configuration saving/loading, and providing the existing file mechanism as default implementation.
With the update I made on the code I can provide a custom persistence storage implementation, by packaging it in a fragment of org.eclipse.equinox.cm bundle, and giving the implementation to use, with an osgi.ini property or a System property

I can share my patch here , if you think it can be useful
Comment 3 John Ross CLA 2011-06-06 09:48:52 EDT
(In reply to comment #0)
> Currently the Config Admin implements push mechanism to update targets with new
> configurations. A pull mechanism in addition to this is desirable. This pull
> mechanism should allow the call to getConfiguration to end in a custom
> component, which will return the configuration from custom storage, based on
> the calling context. Any caching of these configurations in the ConfigAdmin
> service is undesired.

Are you asking for anything more than the ability to configure a custom persistence mechanism?
Comment 4 Lazar Kirchev CLA 2011-06-07 11:42:59 EDT
(In reply to comment #3)
> (In reply to comment #0)
> > Currently the Config Admin implements push mechanism to update targets with new
> > configurations. A pull mechanism in addition to this is desirable. This pull
> > mechanism should allow the call to getConfiguration to end in a custom
> > component, which will return the configuration from custom storage, based on
> > the calling context. Any caching of these configurations in the ConfigAdmin
> > service is undesired.
> 
> Are you asking for anything more than the ability to configure a custom
> persistence mechanism?

The use case is to be able to get different configurations from a custom storage, based on call context information. 
Such logic for differentiating and getting different configuration could not be incorporated in the Configuration admin itself. 
That is why we need to be able to plug a custom component, which could take this decision, and to get the configuration from the custom storage - the call to getConfiguration() should be forwarded to the plugged component, and then the returned configuration should not be cached in the internal store of the Configuration admin. 

So probably this is more than providing custom store.
Comment 5 Lazar Kirchev CLA 2011-06-07 11:45:50 EDT
(In reply to comment #2)
> I also recently needed to replace default configuration persistent storage
> mechanism of equinox (replacing file by db storage). 
> 
> In order to avoid to write the whole thing I patched org.eclipse.equinox.cm.
> I just did a small code refactoring, extracting ina an interface, the code
> responsible for configuration saving/loading, and providing the existing file
> mechanism as default implementation.
> With the update I made on the code I can provide a custom persistence storage
> implementation, by packaging it in a fragment of org.eclipse.equinox.cm bundle,
> and giving the implementation to use, with an osgi.ini property or a System
> property
> 
> I can share my patch here , if you think it can be useful

The problem was that we wanted to use the standard Configuration admin as much as possible, without forking the code and developing on our own. That is why we opened this enhancement request.
Comment 6 Arnaud MERGEY CLA 2011-06-07 12:36:04 EDT
(In reply to comment #5)

> The problem was that we wanted to use the standard Configuration admin as much
> as possible, without forking the code and developing on our own. That is why we
> opened this enhancement request.

Same for me, but as it seems there is no way currently to customize configuration persistence, I had no choice. 
I hope there will be some mechanism provided later, in order to return back to the official code.

While I was looking for opening an enhancement request, I found yours, that is quite related, even if it asks for more, so I decided to jump here
Comment 7 John Ross CLA 2011-06-07 14:15:47 EDT
(In reply to comment #4)
> The use case is to be able to get different configurations from a custom
> storage, based on call context information. 

Do you need more contextual information than is already provided by the calls to the getConfiguration method (i.e. pid and location)?
Comment 8 Lazar Kirchev CLA 2011-06-08 11:23:31 EDT
(In reply to comment #7)
> (In reply to comment #4)
> > The use case is to be able to get different configurations from a custom
> > storage, based on call context information. 
> 
> Do you need more contextual information than is already provided by the calls
> to the getConfiguration method (i.e. pid and location)?

With contextual information I mean information in the thread locale of the call, on which bases to determine exactly which configuration should be returned. 

This should be exactly a pull mechanism, which gets a configuration (no updates, just get) depending on information from the thread locale. And the configuration should be stored in a custom storage. This decision logic may be in a custom component, which could be plugged in the Configuration Admin.
Comment 9 John Ross CLA 2011-06-13 09:59:07 EDT
Targeting this for review in 3.8.

Would like to resolve Bug 348391 first.

Bug 349191 and Bug 329688 may also affect the timing of this.
Comment 10 Thomas Watson CLA 2011-06-13 10:23:55 EDT
We are using June targets for next release.
Comment 11 Thomas Watson CLA 2012-04-25 11:19:10 EDT
Not happening for Juno.
Comment 12 Thomas Watson CLA 2014-04-16 15:25:26 EDT
I must say I don't fully understand the proposal for the pull mechanism here.  I would need some more concrete proposal and likely a working patch that demostrates the desired behavior.  I'm guessing the clients of the pull mechanism never use any of the traditional "push" ManagedService mechanisms to get configurations since there would be no context for such a push.   For now I am closing as wontfix

(In reply to Arnaud MERGEY from comment #1)
> Created attachment 197389 [details]
> equinox configuration manager patch allowing to replace file storage by
> custom implementation.

Arnaud, if you are still interested in this enhancement for custom storage I suggest you open a separate bug.