this.slingId = this.settingsService.getSlingId();
this.initialContentLoader = new Loader(this);
componentContext.getBundleContext().addBundleListener(this);
Session session = null;
try {
session = this.getSession();
this.createRepositoryPath(session, ContentLoaderService.BUNDLE_CONTENT_NODE);
log.debug(
"Activated - attempting to load content from all "
+ "bundles which are neither INSTALLED nor UNINSTALLED");
int ignored = 0;
Bundle[] bundles = componentContext.getBundleContext().getBundles();
for (Bundle bundle : bundles) {
if ((bundle.getState() & (Bundle.INSTALLED | Bundle.UNINSTALLED)) == 0) {
// load content for bundles which are neither INSTALLED nor
// UNINSTALLED
try {
initialContentLoader.registerBundle(session, bundle, false);
} catch (Throwable t) {
log.error(
"Problem loading initial content of bundle "
+ bundle.getSymbolicName() + " ("
+ bundle.getBundleId() + ")", t);
} finally {
if ( session.hasPendingChanges() ) {
session.refresh(false);
}
}
} else {
ignored++;
}