Search in sources :

Example 1 with ProgramDiscoveryExploreClient

use of co.cask.cdap.explore.client.ProgramDiscoveryExploreClient in project cdap by caskdata.

the class DistributedProgramRunnableModule method getCoreModules.

private List<Module> getCoreModules(final ProgramId programId, String txClientId) {
    return new ArrayList<>(Arrays.<Module>asList(new ConfigModule(cConf, hConf), new IOModule(), new ZKClientModule(), new KafkaClientModule(), new MetricsClientRuntimeModule().getDistributedModules(), new MessagingClientModule(), new LocationRuntimeModule().getDistributedModules(), new LoggingModules().getDistributedModules(), new DiscoveryRuntimeModule().getDistributedModules(), new DataFabricModules(txClientId).getDistributedModules(), new DataSetsModules().getDistributedModules(), new ViewAdminModules().getDistributedModules(), new StreamAdminModules().getDistributedModules(), new NotificationFeedClientModule(), new AuditModule().getDistributedModules(), new NamespaceClientRuntimeModule().getDistributedModules(), new AuthorizationEnforcementModule().getDistributedModules(), new SecureStoreModules().getDistributedModules(), new AbstractModule() {

        @Override
        protected void configure() {
            // For Binding queue stuff
            bind(QueueReaderFactory.class).in(Scopes.SINGLETON);
            // For binding DataSet transaction stuff
            install(new DataFabricFacadeModule());
            bind(ProgramStateWriter.class).to(MessagingProgramStateWriter.class);
            bind(RuntimeStore.class).to(RemoteRuntimeStore.class);
            // For binding StreamWriter
            install(createStreamFactoryModule());
            // don't need to perform any impersonation from within user programs
            bind(UGIProvider.class).to(CurrentUGIProvider.class).in(Scopes.SINGLETON);
            // bind PrivilegesManager to a remote implementation, so it does not need to instantiate the authorizer
            bind(PrivilegesManager.class).to(RemotePrivilegesManager.class);
            bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
            // 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(programId);
            // bind explore client to ProgramDiscoveryExploreClient which is aware of the programId
            bind(ExploreClient.class).to(ProgramDiscoveryExploreClient.class).in(Scopes.SINGLETON);
            // Bind the ArtifactManager implementation
            install(new FactoryModuleBuilder().implement(ArtifactManager.class, RemoteArtifactManager.class).build(ArtifactManagerFactory.class));
            // Bind the PluginFinder implementation
            bind(PluginFinder.class).to(RemotePluginFinder.class);
        }
    }));
}
Also used : IOModule(co.cask.cdap.common.guice.IOModule) MessagingClientModule(co.cask.cdap.messaging.guice.MessagingClientModule) NamespaceClientRuntimeModule(co.cask.cdap.common.namespace.guice.NamespaceClientRuntimeModule) ProgramDiscoveryExploreClient(co.cask.cdap.explore.client.ProgramDiscoveryExploreClient) ConfigModule(co.cask.cdap.common.guice.ConfigModule) FactoryModuleBuilder(com.google.inject.assistedinject.FactoryModuleBuilder) ArtifactManagerFactory(co.cask.cdap.internal.app.runtime.artifact.ArtifactManagerFactory) ArrayList(java.util.ArrayList) RuntimeStore(co.cask.cdap.app.store.RuntimeStore) RemoteRuntimeStore(co.cask.cdap.internal.app.store.remote.RemoteRuntimeStore) MetricsClientRuntimeModule(co.cask.cdap.metrics.guice.MetricsClientRuntimeModule) ViewAdminModules(co.cask.cdap.data.view.ViewAdminModules) ZKClientModule(co.cask.cdap.common.guice.ZKClientModule) MessagingProgramStateWriter(co.cask.cdap.internal.app.program.MessagingProgramStateWriter) ProgramStateWriter(co.cask.cdap.app.runtime.ProgramStateWriter) KafkaClientModule(co.cask.cdap.common.guice.KafkaClientModule) RemotePluginFinder(co.cask.cdap.internal.app.runtime.artifact.RemotePluginFinder) PluginFinder(co.cask.cdap.internal.app.runtime.artifact.PluginFinder) CurrentUGIProvider(co.cask.cdap.security.impersonation.CurrentUGIProvider) DiscoveryRuntimeModule(co.cask.cdap.common.guice.DiscoveryRuntimeModule) DataSetsModules(co.cask.cdap.data.runtime.DataSetsModules) SecureStoreModules(co.cask.cdap.security.guice.SecureStoreModules) DefaultOwnerAdmin(co.cask.cdap.security.impersonation.DefaultOwnerAdmin) OwnerAdmin(co.cask.cdap.security.impersonation.OwnerAdmin) LocationRuntimeModule(co.cask.cdap.common.guice.LocationRuntimeModule) PrivilegesManager(co.cask.cdap.security.spi.authorization.PrivilegesManager) RemotePrivilegesManager(co.cask.cdap.security.authorization.RemotePrivilegesManager) ProgramId(co.cask.cdap.proto.id.ProgramId) LoggingModules(co.cask.cdap.logging.guice.LoggingModules) AbstractModule(com.google.inject.AbstractModule) StreamAdminModules(co.cask.cdap.data.stream.StreamAdminModules) NotificationFeedClientModule(co.cask.cdap.notifications.feeds.client.NotificationFeedClientModule) QueueReaderFactory(co.cask.cdap.internal.app.queue.QueueReaderFactory) AuditModule(co.cask.cdap.data2.audit.AuditModule) DataFabricModules(co.cask.cdap.data.runtime.DataFabricModules) AuthorizationEnforcementModule(co.cask.cdap.security.authorization.AuthorizationEnforcementModule)

Aggregations

ProgramStateWriter (co.cask.cdap.app.runtime.ProgramStateWriter)1 RuntimeStore (co.cask.cdap.app.store.RuntimeStore)1 ConfigModule (co.cask.cdap.common.guice.ConfigModule)1 DiscoveryRuntimeModule (co.cask.cdap.common.guice.DiscoveryRuntimeModule)1 IOModule (co.cask.cdap.common.guice.IOModule)1 KafkaClientModule (co.cask.cdap.common.guice.KafkaClientModule)1 LocationRuntimeModule (co.cask.cdap.common.guice.LocationRuntimeModule)1 ZKClientModule (co.cask.cdap.common.guice.ZKClientModule)1 NamespaceClientRuntimeModule (co.cask.cdap.common.namespace.guice.NamespaceClientRuntimeModule)1 DataFabricModules (co.cask.cdap.data.runtime.DataFabricModules)1 DataSetsModules (co.cask.cdap.data.runtime.DataSetsModules)1 StreamAdminModules (co.cask.cdap.data.stream.StreamAdminModules)1 ViewAdminModules (co.cask.cdap.data.view.ViewAdminModules)1 AuditModule (co.cask.cdap.data2.audit.AuditModule)1 ProgramDiscoveryExploreClient (co.cask.cdap.explore.client.ProgramDiscoveryExploreClient)1 MessagingProgramStateWriter (co.cask.cdap.internal.app.program.MessagingProgramStateWriter)1 QueueReaderFactory (co.cask.cdap.internal.app.queue.QueueReaderFactory)1 ArtifactManagerFactory (co.cask.cdap.internal.app.runtime.artifact.ArtifactManagerFactory)1 PluginFinder (co.cask.cdap.internal.app.runtime.artifact.PluginFinder)1 RemotePluginFinder (co.cask.cdap.internal.app.runtime.artifact.RemotePluginFinder)1