0

I'm using Declarative Services and facing the following problem. I want to register my component with properties like using

bc.registerService(MyClass.class.getName(), this, props);

However, with Declarative Services I have to provide a XML file defining these properties. Now, the problem is that I do not have string compatible values as property values (the keys are strings). The properties are not any kind of numbers or stings but rather objects returned by a "create" method. This was not a problem with

bc.registerService(MyClass.class.getName(), this, props);

because props can contain entries. But how can I manage this with Declarative Services?

BR Ewgenij

Ewgenij Sokolovski
  • 897
  • 1
  • 12
  • 31

1 Answers1

0

I also asked the question on OSGI mailing lists, it was answered here http://www.mail-archive.com/osgi-dev@mail.osgi.org/msg02898.html

BR Ewgenij

Ewgenij Sokolovski
  • 897
  • 1
  • 12
  • 31
  • It would be better if you also summarized the solution here. Even though you're answering your own question, link-only answers are discouraged on SO. – laalto Sep 09 '13 at 14:12
  • Hello! Sorry for that. The solution is that only strings, primitive data types and arrays or collections of those are allowed as properties with declarative services. Reason is support of remote OSGI and some security issues (possible class leaks otherwise). – Ewgenij Sokolovski Sep 27 '13 at 11:07