Felix Meschberger wrote:
Hi Alexander,

Alexander Shutyaev schrieb:
Thanks for your help! I checked on your example. It looks like this is
the thing.

Glad to hear ;-)

But I'm a little bit of newbie in OSGi, so I'm not confident
in two things:
1) How should I declare that component in a xml-file in that case.
2) How should I construct new Configuration objects in that case.
If you could you give me the svn-links that clarify these two questions
for Apache's 'RequestLoggerService' it would be very great.

In Apache Felix we have a Maven 2 plugin, which constructs the
Declarative Services declaration from the @scr.* tags in the Java source
file. You might want to check that out. Otherwise you might want to
check out the Sling Engine bundle from [1], which encloses an
OSGI-INF/serviceComponents.xml file, which contains the declaration for
the RequestLoggerService.

As for the generation of configuration objects: You can manually create
those, by getting the Configuration Admin Service and call
createFactoryConfiguration on it:

   ConfigurationAdmin ca = getConfigurationAdmin();
   Configuration config =
        ca.createFactoryConfiguration("the.factory.pid");

   Properties props = new Properties();
   // prepare configuration properties

   config.update(props);

Hope this helps.

Regards
Felix

[1]
http://people.apache.org/repo/m2-incubating-repository/org/apache/sling/org.apache.sling.engine/2.0.2-incubator/org.apache.sling.engine-2.0.2-incubator.jar
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev


Hello again!

I'm very sorry that I actually flooded you with messages, but you know, the development process goes very strange sometimes ;) You know it's a pity that e-mail messages once sent can not be canceled. =)

I solved my problem and guess what... found another one. You once wrote in org.apache.felix.dev I quote:

"your component does not have to care about getting the configuration from the Configuration Admin. It is provided by the Declarative Services implementation in the ComponentContext given to the activate method"

That was what I actually wanted and that is how Apache Felix behaves. I however use Equinox and when I switched the SCR (or DS) package back to equinox it just stopped working the way it did (and the way I want). I inspected the source code of Felix and Equinox and found out one big difference: Felix registers some of it's classes as a ManagedServiceFactory (thus catching my configurations from ConfigurationAdmin) while Equinox does not.

As this was your work I guess you'll say something like "Don't use that baaad Equinox, use our good Felix" =) That's not quite alright with me but still I'm using scr bundle from Felix. The question is who is right in this case: Felix or Equinox? I'm not an English native speaker, so it's very hard for me to argue about specifications aspects and so I ask you as a man who studied this problem. Maybe the specification itself isn't clear enough?

So anyway there's a bug somewhere: either Felix, or Equinox or the OSGi specification. I think we should find out where and post some kind of bug report.

Thanks for cooperation ;)
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to