Hi all,

 

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?  Right now, I am creating my service
dependencies as follows:

 

public class UserBundleActivator extends DependencyActivatorBase {

 

    public void init(BundleContext context, DependencyManager manager)
throws Exception {

      Service svc;

      

      // Service implementations

            

      svc = createService().setInterface(UserService.class.getName(),
null).setImplementation(UserServiceImpl.class);

 
svc.add(createServiceDependency().setService(CoreService.class).setRequired(
true));

 
svc.add(createServiceDependency().setService(ExtensionService.class).setRequ
ired(true));

      manager.add(svc);

        

      // Non-service dependencies

 

      // UI component dependencies here?

}

 

Please help because I know there has to be a better way.

 

Thank you!

 

Brendan Haverlock

 

Reply via email to