[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.technology.equinox] how to check if DS is running?

Hi!

I am currently trying to get an ECF(-REST) service running whether DS is running or not. My current approach marks org.eclipse.equinox.ds as optional dependency and supplies DS-configurations. I then try to check programmatically if DS's running. If it isn't, I register and track services programmatically. I looks throught the ds-activator and thought to understand, that the main DS-service is registered as ConfigurationListener.

org.eclipse.equinox.ds:
Activator#initSCR():

// add the configuration listener - we to receive CM events to restart
// components
cmTrackerReg = bc.registerService(ConfigurationListener.class.getName(),
scrManager, null);

My current code that checks if DS is running looks as follows:

private boolean isDSRunning(BundleContext context) {
        ServiceReference[] serviceReferences = null;
        try {
                serviceReferences =
                        context.getServiceReferences(
                        ConfigurationListener.class.getName(), null);
        } catch (InvalidSyntaxException e) {
                // ignore
        }
        return serviceReferences != null
                && serviceReferences.length > 0;
}

Could I ask you guys to give me your hints on this? I'd be more than happy to get confirmed/corrected!

Cheers + thanks in advance
André