use of org.eclipse.gemini.blueprint.extender.support.scanning.ConfigurationScanner 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);
}
use of org.eclipse.gemini.blueprint.extender.support.scanning.ConfigurationScanner in project motech by motech.
the class MotechOsgiApplicationContextCreatorTest method shouldReturnApplicationOfTypeWebApplicationContext.
@Test
public void shouldReturnApplicationOfTypeWebApplicationContext() throws Exception {
MockBundle bundle = new MockBundle();
MockBundleContext bundleContext = new MockBundleContext(bundle);
ConfigurationScanner configurationScanner = mock(ConfigurationScanner.class);
when(configurationScanner.getConfigurations(bundle)).thenReturn(new String[] { "resource.xml" });
MotechOsgiApplicationContextCreator contextCreator = new MotechOsgiApplicationContextCreator();
contextCreator.setConfigurationScanner(configurationScanner);
MotechOsgiConfigurableApplicationContext applicationContext = (MotechOsgiConfigurableApplicationContext) contextCreator.createApplicationContext(bundleContext);
assertThat(applicationContext, notNullValue());
}
Aggregations