use of io.openk9.plugin.driver.manager.api.DocumentTypeFactoryCustomizer in project openk9 by smclab.
the class DocumentTypeFactoryCustomizerHandle method activate.
@Activate
public void activate(BundleContext bundleContext) {
_serviceTracker = new ServiceTracker<>(bundleContext, DocumentTypeFactoryCustomizer.class, new ServiceTrackerCustomizer<>() {
@Override
public DocumentTypeFactoryCustomizer addingService(ServiceReference<DocumentTypeFactoryCustomizer> reference) {
DocumentTypeFactoryCustomizer service = bundleContext.getService(reference);
List<Mono<Void>> collect = _documentTypeProvider.getDocumentTypeMap().entrySet().stream().map(service).collect(Collectors.toList());
Flux.concat(collect).blockLast(Duration.ofSeconds(10));
return service;
}
@Override
public void modifiedService(ServiceReference<DocumentTypeFactoryCustomizer> reference, DocumentTypeFactoryCustomizer service) {
removedService(reference, service);
addingService(reference);
}
@Override
public void removedService(ServiceReference<DocumentTypeFactoryCustomizer> reference, DocumentTypeFactoryCustomizer service) {
bundleContext.ungetService(reference);
}
});
_serviceTracker.open(true);
}
Aggregations