Search in sources :

Example 1 with PlatformStatusManagerImpl

use of org.motechproject.server.osgi.status.PlatformStatusManagerImpl in project motech by motech.

the class PlatformActivator method registerStatusManager.

private void registerStatusManager() {
    List<Bundle> bundles = new ArrayList<>();
    if (bundlesByType.containsKey(BundleType.MOTECH_MODULE)) {
        bundles.addAll(bundlesByType.get(BundleType.MOTECH_MODULE));
    }
    if (bundlesByType.containsKey(BundleType.MDS_BUNDLE)) {
        bundles.addAll(bundlesByType.get(BundleType.MDS_BUNDLE));
    }
    if (bundlesByType.containsKey(BundleType.PLATFORM_BUNDLE_PRE_MDS)) {
        bundles.addAll(bundlesByType.get(BundleType.PLATFORM_BUNDLE_PRE_MDS));
    }
    if (bundlesByType.containsKey(BundleType.PLATFORM_BUNDLE_PRE_WS)) {
        bundles.addAll(bundlesByType.get(BundleType.PLATFORM_BUNDLE_PRE_WS));
    }
    if (bundlesByType.containsKey(BundleType.WS_BUNDLE)) {
        bundles.addAll(bundlesByType.get(BundleType.WS_BUNDLE));
    }
    if (bundlesByType.containsKey(BundleType.PLATFORM_BUNDLE_POST_WS)) {
        bundles.addAll(bundlesByType.get(BundleType.PLATFORM_BUNDLE_POST_WS));
    }
    List<Bundle> osgiBundles = new ArrayList<>();
    List<Bundle> blueprintBundles = new ArrayList<>();
    ConfigurationScanner configurationScanner = new DefaultConfigurationScanner();
    for (Bundle bundle : bundles) {
        String[] config = configurationScanner.getConfigurations(bundle);
        if (config.length > 0) {
            blueprintBundles.add(bundle);
        } else {
            osgiBundles.add(bundle);
        }
    }
    platformStatusManager = new PlatformStatusManagerImpl(osgiBundles, blueprintBundles);
    bundleContext.addBundleListener(platformStatusManager);
    bundleContext.registerService(OsgiBundleApplicationContextListener.class, platformStatusManager, null);
    bundleContext.registerService(PlatformStatusManager.class, platformStatusManager, null);
}
Also used : DefaultConfigurationScanner(org.eclipse.gemini.blueprint.extender.support.scanning.DefaultConfigurationScanner) Bundle(org.osgi.framework.Bundle) ArrayList(java.util.ArrayList) DefaultConfigurationScanner(org.eclipse.gemini.blueprint.extender.support.scanning.DefaultConfigurationScanner) ConfigurationScanner(org.eclipse.gemini.blueprint.extender.support.scanning.ConfigurationScanner) PlatformStatusManagerImpl(org.motechproject.server.osgi.status.PlatformStatusManagerImpl)

Aggregations

ArrayList (java.util.ArrayList)1 ConfigurationScanner (org.eclipse.gemini.blueprint.extender.support.scanning.ConfigurationScanner)1 DefaultConfigurationScanner (org.eclipse.gemini.blueprint.extender.support.scanning.DefaultConfigurationScanner)1 PlatformStatusManagerImpl (org.motechproject.server.osgi.status.PlatformStatusManagerImpl)1 Bundle (org.osgi.framework.Bundle)1