Dynamics are not optional, evert application is dynamic at start up. The optionally part is reacting to real world events and cleaning up when you stop.

You create a lot of software for a function that is handled fully invisible by DS, iPOJO, Spring, dep. manager etc. You're fighting OSGi, you do not leverage it ... OSGi allows you to work with well defined dependencies, following the flow it does not cost any user code. What you're attempting to do is fighting the flow. The dynamic behavior that OSGi allows is not a primary requirement, it was a logical consequence of the strong modularity and the service model.

Kind regards,

        Peter Kriens






On 30 apr 2009, at 09:46, Eugen Reiswich wrote:

Hi OSGi-devs,

I have the following problem with osgi services. We develop basically applications where dynamic is not an issue. So what I would like to make sure in my application is that all services are registred properly at start up - if not, the application will be shut down. In addition to that I want to reuse my bundles in RCP applications so any concept must also be applicable for RCP applications.

Say I have two bundles:
1. org.mycompany.service (contains a service interface)
2. org.mycompany.serviceimpl (contains the service implementation and registers withing his activator an osgi-service)

What we do within the service bundle is this:
                
public void start(BundleContext context) throws Exception {

        Bundle[] bundles = context.getBundles();
        // find the implementation for the service bundle
        for (Bundle bundle : bundles) {
                if 
("org.mycompany.serviceimpl".equals(bundle.getSymbolicName())) {
                        // service impl found
                        if (bundle.getState() != Bundle.ACTIVE) {
                                bundle.start();
                        }
                }
        }

        // check if servicimpl has registred service properly
        ServiceReference serviceReference = context
                        .getServiceReference(IMyService.class.getName());
        
        if (serviceReference == null) {
                // shut down application

        }
        ...


From my point of view this is pretty error prone and difficult to maintain. Is there a best practice approach how I can make sure that all services are registered properly at start up of my application? How can I start my serviceimpl bundles in RCP application as no one depends on this bundle which is why the are never started?

We have spend now a lot of time to find solutions for this problem but they all seem to be improvable.

Regards,
Eugen_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

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

Reply via email to