use of org.icij.datashare.extension.PipelineRegistry in project datashare by ICIJ.
the class CommonMode method configure.
@Override
protected void configure() {
bind(PropertiesProvider.class).toInstance(propertiesProvider);
bind(LanguageGuesser.class).to(OptimaizeLanguageGuesser.class);
String batchQueueType = propertiesProvider.get("batchQueueType").orElse("org.icij.datashare.extract.MemoryBlockingQueue");
bind(new TypeLiteral<BlockingQueue<String>>() {
}).toInstance(getBlockingQueue(propertiesProvider, batchQueueType, "ds:batchsearch:queue"));
bind(new TypeLiteral<BlockingQueue<BatchDownload>>() {
}).toInstance(getBlockingQueue(propertiesProvider, batchQueueType, "ds:batchdownload:queue"));
RestHighLevelClient esClient = createESClient(propertiesProvider);
bind(RestHighLevelClient.class).toInstance(esClient);
bind(Indexer.class).to(ElasticsearchIndexer.class).asEagerSingleton();
bind(TaskManagerMemory.class).toInstance(new TaskManagerMemory(propertiesProvider));
install(new FactoryModuleBuilder().build(TaskFactory.class));
if ("memory".equals(propertiesProvider.getProperties().get("queueType"))) {
bind(DocumentCollectionFactory.class).to(MemoryDocumentCollectionFactory.class).asEagerSingleton();
} else {
install(new FactoryModuleBuilder().implement(DocumentQueue.class, RedisUserDocumentQueue.class).implement(ReportMap.class, RedisUserReportMap.class).build(DocumentCollectionFactory.class));
}
DataBus dataBus;
if ("memory".equals(propertiesProvider.getProperties().get("busType"))) {
dataBus = new MemoryDataBus();
} else {
dataBus = new RedisDataBus(propertiesProvider);
}
bind(DataBus.class).toInstance(dataBus);
bind(Publisher.class).toInstance(dataBus);
PipelineRegistry pipelineRegistry = new PipelineRegistry(propertiesProvider);
pipelineRegistry.register(EmailPipeline.class);
pipelineRegistry.register(Pipeline.Type.CORENLP);
try {
pipelineRegistry.load();
} catch (FileNotFoundException e) {
LoggerFactory.getLogger(getClass()).info("extensions dir not found " + e.getMessage());
}
bind(PipelineRegistry.class).toInstance(pipelineRegistry);
}
use of org.icij.datashare.extension.PipelineRegistry in project datashare by ICIJ.
the class TaskResourceTest method setUp.
@Before
public void setUp() {
PipelineRegistry pipelineRegistry = new PipelineRegistry(new PropertiesProvider());
pipelineRegistry.register(EmailPipeline.class);
configure(new CommonMode(new Properties()) {
@Override
protected void configure() {
bind(TaskFactory.class).toInstance(taskFactory);
bind(Indexer.class).toInstance(mock(Indexer.class));
bind(TaskManager.class).toInstance(taskManager);
bind(PipelineRegistry.class).toInstance(pipelineRegistry);
bind(Filter.class).to(LocalUserFilter.class).asEagerSingleton();
bind(PropertiesProvider.class).toInstance(new PropertiesProvider(getDefaultProperties()));
}
@Override
protected Routes addModeConfiguration(Routes routes) {
return routes.add(TaskResource.class).filter(LocalUserFilter.class);
}
}.createWebConfiguration());
init(taskFactory);
}
Aggregations