use of io.cdap.cdap.messaging.guice.MessagingClientModule in project cdap by caskdata.
the class UpgradeTool method createInjector.
@VisibleForTesting
Injector createInjector() {
return Guice.createInjector(new ConfigModule(cConf, hConf), RemoteAuthenticatorModules.getDefaultModule(), new DFSLocationModule(), new ZKClientModule(), new ZKDiscoveryModule(), new MessagingClientModule(), Modules.override(new DataSetsModules().getDistributedModules()).with(new AbstractModule() {
@Override
protected void configure() {
bind(DatasetFramework.class).to(InMemoryDatasetFramework.class).in(Scopes.SINGLETON);
// the DataSetsModules().getDistributedModules() binds to RemoteDatasetFramework so override that to
// the same InMemoryDatasetFramework
bind(DatasetFramework.class).annotatedWith(Names.named(DataSetsModules.BASE_DATASET_FRAMEWORK)).to(DatasetFramework.class);
bind(DatasetDefinitionRegistryFactory.class).to(DefaultDatasetDefinitionRegistryFactory.class).in(Scopes.SINGLETON);
// CDAP-5954 Upgrade tool does not need to record lineage and metadata changes for now.
bind(LineageWriter.class).to(NoOpLineageWriter.class);
bind(FieldLineageWriter.class).to(NoOpLineageWriter.class);
}
}), new TwillModule(), new ExploreClientModule(), new ProgramRunnerRuntimeModule().getDistributedModules(), new SystemDatasetRuntimeModule().getDistributedModules(), new KafkaClientModule(), new IOModule(), CoreSecurityRuntimeModule.getDistributedModule(cConf), new AuthenticationContextModules().getMasterModule(), new AuthorizationModule(), new AuthorizationEnforcementModule().getMasterModule(), new SecureStoreServerModule(), new DataFabricModules(UpgradeTool.class.getName()).getDistributedModules(), new AppFabricServiceRuntimeModule(cConf).getDistributedModules(), new KafkaLogAppenderModule(), // the DataFabricDistributedModule needs MetricsCollectionService binding
new AbstractModule() {
@Override
protected void configure() {
// Since Upgrade tool does not do anything with Metrics we just bind it to no-op implementations
bind(MetricsCollectionService.class).toInstance(new NoOpMetricsCollectionService());
bind(MetricsSystemClient.class).toInstance(new NoOpMetricsSystemClient());
}
@Provides
@Singleton
@Named("datasetInstanceManager")
@SuppressWarnings("unused")
public DatasetInstanceManager getDatasetInstanceManager(TransactionRunner transactionRunner) {
return new DatasetInstanceManager(transactionRunner);
}
// This is needed because the LocalApplicationManager
// expects a dsframework injection named datasetMDS
@Provides
@Singleton
@Named("datasetMDS")
@SuppressWarnings("unused")
public DatasetFramework getInDsFramework(DatasetFramework dsFramework) {
return dsFramework;
}
}, new AbstractModule() {
@Override
protected void configure() {
// TODO (CDAP-14677): find a better way to inject metadata publisher
bind(MetadataServiceClient.class).to(NoOpMetadataServiceClient.class);
}
});
}
use of io.cdap.cdap.messaging.guice.MessagingClientModule in project cdap by caskdata.
the class RouterServiceMain method getServiceModules.
@Override
protected List<Module> getServiceModules(MasterEnvironment masterEnv, EnvironmentOptions options, CConfiguration cConf) {
List<Module> modules = new ArrayList<>();
modules.add(new MessagingClientModule());
modules.add(new RouterModules().getDistributedModules());
modules.add(new DFSLocationModule());
modules.add(new ExternalAuthenticationModule());
return modules;
}
use of io.cdap.cdap.messaging.guice.MessagingClientModule in project cdap by cdapio.
the class UpgradeTool method createInjector.
@VisibleForTesting
Injector createInjector() {
return Guice.createInjector(new ConfigModule(cConf, hConf), RemoteAuthenticatorModules.getDefaultModule(), new DFSLocationModule(), new ZKClientModule(), new ZKDiscoveryModule(), new MessagingClientModule(), Modules.override(new DataSetsModules().getDistributedModules()).with(new AbstractModule() {
@Override
protected void configure() {
bind(DatasetFramework.class).to(InMemoryDatasetFramework.class).in(Scopes.SINGLETON);
// the DataSetsModules().getDistributedModules() binds to RemoteDatasetFramework so override that to
// the same InMemoryDatasetFramework
bind(DatasetFramework.class).annotatedWith(Names.named(DataSetsModules.BASE_DATASET_FRAMEWORK)).to(DatasetFramework.class);
bind(DatasetDefinitionRegistryFactory.class).to(DefaultDatasetDefinitionRegistryFactory.class).in(Scopes.SINGLETON);
// CDAP-5954 Upgrade tool does not need to record lineage and metadata changes for now.
bind(LineageWriter.class).to(NoOpLineageWriter.class);
bind(FieldLineageWriter.class).to(NoOpLineageWriter.class);
}
}), new TwillModule(), new ExploreClientModule(), new ProgramRunnerRuntimeModule().getDistributedModules(), new SystemDatasetRuntimeModule().getDistributedModules(), new KafkaClientModule(), new IOModule(), CoreSecurityRuntimeModule.getDistributedModule(cConf), new AuthenticationContextModules().getMasterModule(), new AuthorizationModule(), new AuthorizationEnforcementModule().getMasterModule(), new SecureStoreServerModule(), new DataFabricModules(UpgradeTool.class.getName()).getDistributedModules(), new AppFabricServiceRuntimeModule(cConf).getDistributedModules(), new KafkaLogAppenderModule(), // the DataFabricDistributedModule needs MetricsCollectionService binding
new AbstractModule() {
@Override
protected void configure() {
// Since Upgrade tool does not do anything with Metrics we just bind it to no-op implementations
bind(MetricsCollectionService.class).toInstance(new NoOpMetricsCollectionService());
bind(MetricsSystemClient.class).toInstance(new NoOpMetricsSystemClient());
}
@Provides
@Singleton
@Named("datasetInstanceManager")
@SuppressWarnings("unused")
public DatasetInstanceManager getDatasetInstanceManager(TransactionRunner transactionRunner) {
return new DatasetInstanceManager(transactionRunner);
}
// This is needed because the LocalApplicationManager
// expects a dsframework injection named datasetMDS
@Provides
@Singleton
@Named("datasetMDS")
@SuppressWarnings("unused")
public DatasetFramework getInDsFramework(DatasetFramework dsFramework) {
return dsFramework;
}
}, new AbstractModule() {
@Override
protected void configure() {
// TODO (CDAP-14677): find a better way to inject metadata publisher
bind(MetadataServiceClient.class).to(NoOpMetadataServiceClient.class);
}
});
}
use of io.cdap.cdap.messaging.guice.MessagingClientModule in project cdap by cdapio.
the class AuthenticationServiceMain method getServiceModules.
@Override
protected List<Module> getServiceModules(MasterEnvironment masterEnv, EnvironmentOptions options, CConfiguration cConf) {
if (!SecurityUtil.isManagedSecurity(cConf)) {
throw new RuntimeException("Security is not enabled. Authentication service shouldn't be used");
}
List<Module> modules = new ArrayList<>();
modules.add(new MessagingClientModule());
modules.add(new ExternalAuthenticationModule());
return modules;
}
use of io.cdap.cdap.messaging.guice.MessagingClientModule in project cdap by cdapio.
the class PreviewServiceMain method getServiceModules.
@Override
protected List<Module> getServiceModules(MasterEnvironment masterEnv, EnvironmentOptions options, CConfiguration cConf) {
List<Module> modules = new ArrayList<>(Arrays.asList(new DataSetServiceModules().getStandaloneModules(), new DataSetsModules().getStandaloneModules(), new AppFabricServiceRuntimeModule(cConf).getStandaloneModules(), new ProgramRunnerRuntimeModule().getStandaloneModules(), new MetricsStoreModule(), new MessagingClientModule(), new AuditModule(), new SecureStoreClientModule(), new MetadataReaderWriterModules().getStandaloneModules(), getDataFabricModule(), new DFSLocationModule(), new MetadataServiceModule(), new AuthorizationModule(), new AuthorizationEnforcementModule().getDistributedModules(), new AbstractModule() {
@Override
protected void configure() {
bind(TwillRunnerService.class).toProvider(new SupplierProviderBridge<>(masterEnv.getTwillRunnerSupplier())).in(Scopes.SINGLETON);
bind(TwillRunner.class).to(TwillRunnerService.class);
bind(ExploreClient.class).to(UnsupportedExploreClient.class);
}
}));
if (cConf.getInt(Constants.Preview.CONTAINER_COUNT) > 0) {
modules.add(new PreviewManagerModule(true));
} else {
modules.add(new PreviewManagerModule(false));
modules.add(new PreviewRunnerManagerModule().getStandaloneModules());
}
return modules;
}
Aggregations