Thanks Marcel; I didn't know that ! lol, never considered NOT setting an interface...

dennis

On 17 apr 2009, at 22:49, Marcel Offermans wrote:

Hello Brendan, Dennis,

On Apr 17, 2009, at 21:50 , Dennis Geurts wrote:

one little pointer: Since you are using the dependency manager;

you do not necessarily need to call 'manager.add(svc)' to instigate
the dependency injection,

it suffices to call svc.start(), thus, your ui components are NOT
registered as services, but DO get injected
with the dependencies you define...

This is not entirely correct, Dennis. You should add services to the
manager, and not start them yourselves. If a service does not define
an interface, ie there is no .setInterface() call, then no service
will be published.

I am currently migrating our application to use the OSGI framework
on both
the client and server programs.  The server portion of the program
was
relatively straightforward, however, I am having some difficulties
adapting
OSGI to the client architecture.  Basically, I've refactored every
client
package to expose its own service.  However, there are so many GUI
classes
and components that have dependencies to other services that I
don't really
know what to do.  I don't want to make every UI component its own
service
because I know there has to be a better way.  Is there a way to
specify that
a component is a dependency and needs the service injection into
one of its
fields, but it isn't a service itself?

Yes, there is a way to inject depencencies into a whole collection of
objects, if that collection itself remains unchanged.

Check out this page:

http://felix.apache.org/site/dependency-manager-usage.html

specifically, look at the "Using compositions" part. Say you have a
UI, which is basically build out of a big tree of components, then you
can inject dependencies into all those components by having that
getInstance() call return all of them.

Greetings, Marcel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org




Violence is the last refuge of the incompetent.
-------------------------------------------------
Dennis Geurts
luminis
iQ Products B.V.
K.v.k Centraal Gelderland: 09 16 28 93
-------------------------------------------------
+31 6 12078236
dennis.geu...@luminis.nl
www.luminis.nl
-------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to