in jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/Deployer.java [198:244]
public void init() throws Exception {
// Init storage
SimpleStorage s = new SimpleStorage(bundleContext.getDataFile("storage.properties"));
try {
s.load();
} catch (IOException e) {
logger.warn("Error loading JBI artifacts state", e);
}
this.storage = s;
// Track bundles
bundleContext.addBundleListener(this);
for (Bundle bundle : bundleContext.getBundles()) {
if (bundle.getState() == Bundle.ACTIVE) {
bundleChanged(new BundleEvent(BundleEvent.STARTED, bundle));
}
}
// Track deployed components
deployedComponentsTracker = new ServiceTracker(bundleContext, javax.jbi.component.Component.class.getName(), null) {
public Object addingService(ServiceReference serviceReference) {
Object o = super.addingService(serviceReference);
registerDeployedComponent(serviceReference, (javax.jbi.component.Component) o);
return o;
}
public void removedService(ServiceReference serviceReference, Object o) {
unregisterDeployedComponent(serviceReference, (javax.jbi.component.Component) o);
super.removedService(serviceReference, o);
}
};
deployedComponentsTracker.open();
// Track deployed service assemblies
deployedAssembliesTracker = new ServiceTracker(bundleContext, DeployedAssembly.class.getName(), null) {
public Object addingService(ServiceReference serviceReference) {
Object o = super.addingService(serviceReference);
registerDeployedServiceAssembly(serviceReference, (DeployedAssembly) o);
return o;
}
public void removedService(ServiceReference serviceReference, Object o) {
unregisterDeployedServiceAssembly(serviceReference, (DeployedAssembly) o);
super.removedService(serviceReference, o);
}
};
deployedAssembliesTracker.open();
}