use of com.google.inject.PrivateModule in project cdap by caskdata.
the class DataSetServiceModules method getInMemoryModules.
@Override
public Module getInMemoryModules() {
return new AbstractModule() {
@Override
protected void configure() {
// Add the system dataset runtime module as public binding so that adding bindings could be added
install(new SystemDatasetRuntimeModule().getInMemoryModules());
install(new PrivateModule() {
@Override
protected void configure() {
install(new FactoryModuleBuilder().implement(DatasetDefinitionRegistry.class, DefaultDatasetDefinitionRegistry.class).build(DatasetDefinitionRegistryFactory.class));
bind(DatasetFramework.class).annotatedWith(Names.named("datasetMDS")).toProvider(DatasetMdsProvider.class).in(Singleton.class);
expose(DatasetFramework.class).annotatedWith(Names.named("datasetMDS"));
bind(DatasetService.class);
expose(DatasetService.class);
Named datasetUserName = Names.named(Constants.Service.DATASET_EXECUTOR);
Multibinder<HttpHandler> handlerBinder = Multibinder.newSetBinder(binder(), HttpHandler.class, datasetUserName);
CommonHandlers.add(handlerBinder);
handlerBinder.addBinding().to(DatasetAdminOpHTTPHandler.class);
Multibinder.newSetBinder(binder(), DatasetMetricsReporter.class);
bind(DatasetOpExecutorService.class).in(Scopes.SINGLETON);
expose(DatasetOpExecutorService.class);
bind(DatasetOpExecutor.class).to(LocalDatasetOpExecutor.class);
expose(DatasetOpExecutor.class);
}
});
}
};
}
use of com.google.inject.PrivateModule in project cdap by caskdata.
the class DataSetsModules method getModule.
private Module getModule() {
return new PrivateModule() {
@Override
protected void configure() {
install(new FactoryModuleBuilder().implement(DatasetDefinitionRegistry.class, DefaultDatasetDefinitionRegistry.class).build(DatasetDefinitionRegistryFactory.class));
bind(MetadataStore.class).to(DefaultMetadataStore.class);
expose(MetadataStore.class);
bind(DatasetFramework.class).annotatedWith(Names.named(BASE_DATASET_FRAMEWORK)).to(RemoteDatasetFramework.class);
bind(LineageStoreReader.class).to(LineageStore.class);
bind(LineageStoreWriter.class).to(LineageStore.class);
// Need to expose LineageStoreReader as it's being used by the LineageHandler (through LineageAdmin)
expose(LineageStoreReader.class);
bind(LineageWriter.class).to(BasicLineageWriter.class);
expose(LineageWriter.class);
bind(UsageRegistry.class).to(DefaultUsageRegistry.class).in(Scopes.SINGLETON);
expose(UsageRegistry.class);
bind(RuntimeUsageRegistry.class).to(DefaultUsageRegistry.class).in(Scopes.SINGLETON);
expose(RuntimeUsageRegistry.class);
bind(DefaultUsageRegistry.class).in(Scopes.SINGLETON);
bind(DatasetFramework.class).to(LineageWriterDatasetFramework.class);
expose(DatasetFramework.class);
bind(DefaultOwnerStore.class).in(Scopes.SINGLETON);
bind(OwnerStore.class).to(DefaultOwnerStore.class);
expose(OwnerStore.class);
}
};
}
use of com.google.inject.PrivateModule in project cdap by caskdata.
the class PreviewDataModules method getDataSetsModule.
public Module getDataSetsModule(final DatasetFramework remoteDatasetFramework) {
return new PrivateModule() {
@Override
protected void configure() {
install(new FactoryModuleBuilder().implement(DatasetDefinitionRegistry.class, DefaultDatasetDefinitionRegistry.class).build(DatasetDefinitionRegistryFactory.class));
bind(MetadataStore.class).to(DefaultMetadataStore.class);
expose(MetadataStore.class);
bind(DatasetFramework.class).annotatedWith(Names.named("localDatasetFramework")).to(RemoteDatasetFramework.class);
bind(DatasetFramework.class).annotatedWith(Names.named("actualDatasetFramework")).toInstance(remoteDatasetFramework);
bind(DatasetFramework.class).annotatedWith(Names.named(BASE_DATASET_FRAMEWORK)).toProvider(PreviewDatasetFrameworkProvider.class).in(Scopes.SINGLETON);
bind(DatasetFramework.class).toProvider(PreviewDatasetFrameworkProvider.class).in(Scopes.SINGLETON);
expose(DatasetFramework.class);
bind(LineageStoreReader.class).to(LineageStore.class);
bind(LineageStoreWriter.class).to(LineageStore.class);
// Need to expose LineageStoreReader as it's being used by the LineageHandler (through LineageAdmin)
expose(LineageStoreReader.class);
bind(LineageWriter.class).to(BasicLineageWriter.class);
expose(LineageWriter.class);
bind(RuntimeUsageRegistry.class).to(NoOpUsageRegistry.class).in(Scopes.SINGLETON);
expose(RuntimeUsageRegistry.class);
bind(UsageRegistry.class).to(NoOpUsageRegistry.class).in(Scopes.SINGLETON);
expose(UsageRegistry.class);
}
};
}
use of com.google.inject.PrivateModule in project cdap by caskdata.
the class DatasetFrameworkTestUtil method before.
@Override
protected void before() throws Throwable {
this.tmpFolder = new TemporaryFolder();
tmpFolder.create();
File localDataDir = tmpFolder.newFolder();
cConf = CConfiguration.create();
cConf.set(Constants.CFG_LOCAL_DATA_DIR, localDataDir.getAbsolutePath());
injector = Guice.createInjector(new ConfigModule(cConf), new NonCustomLocationUnitTestModule().getModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new TransactionModules().getInMemoryModules(), new TransactionExecutorModule(), new PrivateModule() {
@Override
protected void configure() {
install(new FactoryModuleBuilder().implement(DatasetDefinitionRegistry.class, DefaultDatasetDefinitionRegistry.class).build(DatasetDefinitionRegistryFactory.class));
bind(DatasetFramework.class).to(InMemoryDatasetFramework.class);
expose(DatasetFramework.class);
}
});
txManager = injector.getInstance(TransactionManager.class);
txManager.startAndWait();
framework = injector.getInstance(DatasetFramework.class);
}
use of com.google.inject.PrivateModule in project cdap by caskdata.
the class AppFabricTestModule method configure.
@Override
protected void configure() {
install(new DataFabricModules().getInMemoryModules());
install(new DataSetsModules().getStandaloneModules());
install(new TransactionExecutorModule());
install(new DataSetServiceModules().getInMemoryModules());
install(new ConfigModule(cConf, hConf, sConf));
install(new IOModule());
install(new DiscoveryRuntimeModule().getInMemoryModules());
install(new AppFabricServiceRuntimeModule().getInMemoryModules());
install(new ServiceStoreModules().getInMemoryModules());
install(new PrivateModule() {
@Override
protected void configure() {
bind(Scheduler.class).annotatedWith(Assisted.class).toInstance(createNoopScheduler());
}
});
install(new ProgramRunnerRuntimeModule().getInMemoryModules());
install(new NonCustomLocationUnitTestModule().getModule());
install(new LoggingModules().getInMemoryModules());
install(new LogReaderRuntimeModules().getInMemoryModules());
install(new MetricsHandlerModule());
install(new MetricsClientRuntimeModule().getInMemoryModules());
install(new ExploreClientModule());
install(new NotificationFeedServiceRuntimeModule().getInMemoryModules());
install(new NotificationServiceRuntimeModule().getInMemoryModules());
install(new ConfigStoreModule().getInMemoryModule());
install(new ViewAdminModules().getInMemoryModules());
install(new StreamAdminModules().getInMemoryModules());
install(new StreamServiceRuntimeModule().getInMemoryModules());
install(new NamespaceStoreModule().getStandaloneModules());
install(new MetadataServiceModule());
install(new RemoteSystemOperationsServiceModule());
install(new AuthorizationModule());
install(new AuthorizationEnforcementModule().getStandaloneModules());
install(new SecureStoreModules().getInMemoryModules());
install(new MessagingServerRuntimeModule().getInMemoryModules());
}
Aggregations