use of io.cdap.cdap.common.namespace.guice.NamespaceQueryAdminModule in project cdap by caskdata.
the class DistributedProgramContainerModule method getCoreModules.
private List<Module> getCoreModules() {
Arguments systemArgs = programOpts.getArguments();
ClusterMode clusterMode = systemArgs.hasOption(ProgramOptionConstants.CLUSTER_MODE) ? ClusterMode.valueOf(systemArgs.getOption(ProgramOptionConstants.CLUSTER_MODE)) : ClusterMode.ON_PREMISE;
List<Module> modules = new ArrayList<>();
modules.add(new ConfigModule(cConf, hConf));
modules.add(new IOModule());
modules.add(new DFSLocationModule());
modules.add(new MetricsClientRuntimeModule().getDistributedModules());
modules.add(new MessagingClientModule());
modules.add(new AuditModule());
modules.add(new AuthorizationEnforcementModule().getDistributedModules());
modules.add(new SecureStoreClientModule());
modules.add(new MetadataReaderWriterModules().getDistributedModules());
modules.add(new NamespaceQueryAdminModule());
modules.add(new DataSetsModules().getDistributedModules());
modules.add(new AbstractModule() {
@Override
protected void configure() {
bind(ProgramStateWriter.class).to(MessagingProgramStateWriter.class);
bind(WorkflowStateWriter.class).to(MessagingWorkflowStateWriter.class);
// don't need to perform any impersonation from within user programs
bind(UGIProvider.class).to(CurrentUGIProvider.class).in(Scopes.SINGLETON);
// Bind ProgramId to the passed in instance programId so that we can retrieve it back later when needed.
// For example see ProgramDiscoveryExploreClient.
// Also binding to instance is fine here as the programId is guaranteed to not change throughout the
// lifecycle of this program runnable
bind(ProgramId.class).toInstance(programRunId.getParent());
bind(ProgramRunId.class).toInstance(programRunId);
if (serviceAnnouncer != null) {
bind(ServiceAnnouncer.class).toInstance(serviceAnnouncer);
}
bind(PreferencesFetcher.class).to(RemotePreferencesFetcherInternal.class).in(Scopes.SINGLETON);
}
});
addDataFabricModules(modules);
switch(clusterMode) {
case ON_PREMISE:
addOnPremiseModules(modules);
break;
case ISOLATED:
addIsolatedModules(modules);
break;
default:
}
return modules;
}
Aggregations