Search in sources :

Example 6 with KafkaLogAppenderModule

use of io.cdap.cdap.logging.guice.KafkaLogAppenderModule 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);
        }
    });
}
Also used : MessagingClientModule(io.cdap.cdap.messaging.guice.MessagingClientModule) IOModule(io.cdap.cdap.common.guice.IOModule) NoOpMetricsSystemClient(io.cdap.cdap.common.metrics.NoOpMetricsSystemClient) ZKDiscoveryModule(io.cdap.cdap.common.guice.ZKDiscoveryModule) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) NoOpMetricsCollectionService(io.cdap.cdap.common.metrics.NoOpMetricsCollectionService) DatasetFramework(io.cdap.cdap.data2.dataset2.DatasetFramework) InMemoryDatasetFramework(io.cdap.cdap.data2.dataset2.InMemoryDatasetFramework) ZKClientModule(io.cdap.cdap.common.guice.ZKClientModule) KafkaClientModule(io.cdap.cdap.common.guice.KafkaClientModule) DefaultDatasetDefinitionRegistryFactory(io.cdap.cdap.data2.dataset2.DefaultDatasetDefinitionRegistryFactory) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) AuthorizationModule(io.cdap.cdap.app.guice.AuthorizationModule) InMemoryDatasetFramework(io.cdap.cdap.data2.dataset2.InMemoryDatasetFramework) Named(com.google.inject.name.Named) TwillModule(io.cdap.cdap.app.guice.TwillModule) DatasetInstanceManager(io.cdap.cdap.data2.datafabric.dataset.instance.DatasetInstanceManager) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) DataSetsModules(io.cdap.cdap.data.runtime.DataSetsModules) Provides(com.google.inject.Provides) AbstractModule(com.google.inject.AbstractModule) KafkaLogAppenderModule(io.cdap.cdap.logging.guice.KafkaLogAppenderModule) DFSLocationModule(io.cdap.cdap.common.guice.DFSLocationModule) ProgramRunnerRuntimeModule(io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule) FieldLineageWriter(io.cdap.cdap.data2.metadata.writer.FieldLineageWriter) LineageWriter(io.cdap.cdap.data2.metadata.writer.LineageWriter) NoOpLineageWriter(io.cdap.cdap.data2.metadata.writer.NoOpLineageWriter) ExploreClientModule(io.cdap.cdap.explore.guice.ExploreClientModule) Singleton(com.google.inject.Singleton) TransactionRunner(io.cdap.cdap.spi.data.transaction.TransactionRunner) NoOpMetadataServiceClient(io.cdap.cdap.data2.metadata.writer.NoOpMetadataServiceClient) DataFabricModules(io.cdap.cdap.data.runtime.DataFabricModules) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) SecureStoreServerModule(io.cdap.cdap.security.guice.SecureStoreServerModule) AppFabricServiceRuntimeModule(io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule) FieldLineageWriter(io.cdap.cdap.data2.metadata.writer.FieldLineageWriter) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 7 with KafkaLogAppenderModule

use of io.cdap.cdap.logging.guice.KafkaLogAppenderModule in project cdap by cdapio.

the class SystemWorkerTwillRunnable method createInjector.

@VisibleForTesting
static Injector createInjector(CConfiguration cConf, Configuration hConf) {
    List<Module> modules = new ArrayList<>();
    CoreSecurityModule coreSecurityModule = CoreSecurityRuntimeModule.getDistributedModule(cConf);
    modules.add(new ConfigModule(cConf, hConf));
    modules.add(new LocalLocationModule());
    modules.add(new IOModule());
    modules.add(new AuthenticationContextModules().getMasterWorkerModule());
    modules.add(coreSecurityModule);
    modules.add(new MessagingClientModule());
    modules.add(new SystemAppModule());
    modules.add(new MetricsClientRuntimeModule().getDistributedModules());
    // If MasterEnvironment is not available, assuming it is the old hadoop stack with ZK, Kafka
    MasterEnvironment masterEnv = MasterEnvironments.getMasterEnvironment();
    if (masterEnv == null) {
        modules.add(new ZKClientModule());
        modules.add(new ZKDiscoveryModule());
        modules.add(new KafkaClientModule());
        modules.add(new KafkaLogAppenderModule());
    } else {
        modules.add(new AbstractModule() {

            @Override
            protected void configure() {
                bind(DiscoveryService.class).toProvider(new SupplierProviderBridge<>(masterEnv.getDiscoveryServiceSupplier()));
                bind(DiscoveryServiceClient.class).toProvider(new SupplierProviderBridge<>(masterEnv.getDiscoveryServiceClientSupplier()));
            }
        });
        modules.add(new RemoteLogAppenderModule());
        if (coreSecurityModule.requiresZKClient()) {
            modules.add(new ZKClientModule());
        }
    }
    return Guice.createInjector(modules);
}
Also used : IOModule(io.cdap.cdap.common.guice.IOModule) MessagingClientModule(io.cdap.cdap.messaging.guice.MessagingClientModule) ZKDiscoveryModule(io.cdap.cdap.common.guice.ZKDiscoveryModule) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) RemoteLogAppenderModule(io.cdap.cdap.logging.guice.RemoteLogAppenderModule) ArrayList(java.util.ArrayList) MetricsClientRuntimeModule(io.cdap.cdap.metrics.guice.MetricsClientRuntimeModule) KafkaLogAppenderModule(io.cdap.cdap.logging.guice.KafkaLogAppenderModule) AbstractModule(com.google.inject.AbstractModule) ZKClientModule(io.cdap.cdap.common.guice.ZKClientModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) CoreSecurityModule(io.cdap.cdap.security.guice.CoreSecurityModule) MasterEnvironment(io.cdap.cdap.master.spi.environment.MasterEnvironment) KafkaClientModule(io.cdap.cdap.common.guice.KafkaClientModule) SupplierProviderBridge(io.cdap.cdap.common.guice.SupplierProviderBridge) Module(com.google.inject.Module) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) CoreSecurityModule(io.cdap.cdap.security.guice.CoreSecurityModule) SystemAppModule(io.cdap.cdap.internal.app.worker.SystemAppModule) KafkaLogAppenderModule(io.cdap.cdap.logging.guice.KafkaLogAppenderModule) MessagingClientModule(io.cdap.cdap.messaging.guice.MessagingClientModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) RemoteLogAppenderModule(io.cdap.cdap.logging.guice.RemoteLogAppenderModule) CoreSecurityRuntimeModule(io.cdap.cdap.security.guice.CoreSecurityRuntimeModule) KafkaClientModule(io.cdap.cdap.common.guice.KafkaClientModule) ZKClientModule(io.cdap.cdap.common.guice.ZKClientModule) IOModule(io.cdap.cdap.common.guice.IOModule) ZKDiscoveryModule(io.cdap.cdap.common.guice.ZKDiscoveryModule) MetricsClientRuntimeModule(io.cdap.cdap.metrics.guice.MetricsClientRuntimeModule) AbstractModule(com.google.inject.AbstractModule) SystemAppModule(io.cdap.cdap.internal.app.worker.SystemAppModule) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 8 with KafkaLogAppenderModule

use of io.cdap.cdap.logging.guice.KafkaLogAppenderModule in project cdap by cdapio.

the class DistributedProgramContainerModule method addOnPremiseModules.

private void addOnPremiseModules(List<Module> modules) {
    CoreSecurityModule coreSecurityModule = CoreSecurityRuntimeModule.getDistributedModule(cConf);
    modules.add(new AuthenticationContextModules().getMasterModule());
    modules.add(coreSecurityModule);
    // If MasterEnvironment is not available, assuming it is the old hadoop stack with ZK, Kafka
    MasterEnvironment masterEnv = MasterEnvironments.getMasterEnvironment();
    if (masterEnv == null) {
        modules.add(new ZKClientModule());
        modules.add(new ZKDiscoveryModule());
        modules.add(new KafkaClientModule());
        modules.add(new KafkaLogAppenderModule());
        return;
    }
    if (coreSecurityModule.requiresZKClient()) {
        modules.add(new ZKClientModule());
    }
    modules.add(new AbstractModule() {

        @Override
        protected void configure() {
            bind(DiscoveryService.class).toProvider(new SupplierProviderBridge<>(masterEnv.getDiscoveryServiceSupplier()));
            bind(DiscoveryServiceClient.class).toProvider(new SupplierProviderBridge<>(masterEnv.getDiscoveryServiceClientSupplier()));
            bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
        }
    });
    modules.add(new RemoteLogAppenderModule());
}
Also used : ZKClientModule(io.cdap.cdap.common.guice.ZKClientModule) CoreSecurityModule(io.cdap.cdap.security.guice.CoreSecurityModule) MasterEnvironment(io.cdap.cdap.master.spi.environment.MasterEnvironment) ZKDiscoveryModule(io.cdap.cdap.common.guice.ZKDiscoveryModule) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) KafkaClientModule(io.cdap.cdap.common.guice.KafkaClientModule) RemoteLogAppenderModule(io.cdap.cdap.logging.guice.RemoteLogAppenderModule) SupplierProviderBridge(io.cdap.cdap.common.guice.SupplierProviderBridge) DefaultOwnerAdmin(io.cdap.cdap.security.impersonation.DefaultOwnerAdmin) KafkaLogAppenderModule(io.cdap.cdap.logging.guice.KafkaLogAppenderModule) AbstractModule(com.google.inject.AbstractModule)

Example 9 with KafkaLogAppenderModule

use of io.cdap.cdap.logging.guice.KafkaLogAppenderModule in project cdap by caskdata.

the class SystemWorkerTwillRunnable method createInjector.

@VisibleForTesting
static Injector createInjector(CConfiguration cConf, Configuration hConf) {
    List<Module> modules = new ArrayList<>();
    CoreSecurityModule coreSecurityModule = CoreSecurityRuntimeModule.getDistributedModule(cConf);
    modules.add(new ConfigModule(cConf, hConf));
    modules.add(new LocalLocationModule());
    modules.add(new IOModule());
    modules.add(new AuthenticationContextModules().getMasterWorkerModule());
    modules.add(coreSecurityModule);
    modules.add(new MessagingClientModule());
    modules.add(new SystemAppModule());
    modules.add(new MetricsClientRuntimeModule().getDistributedModules());
    // If MasterEnvironment is not available, assuming it is the old hadoop stack with ZK, Kafka
    MasterEnvironment masterEnv = MasterEnvironments.getMasterEnvironment();
    if (masterEnv == null) {
        modules.add(new ZKClientModule());
        modules.add(new ZKDiscoveryModule());
        modules.add(new KafkaClientModule());
        modules.add(new KafkaLogAppenderModule());
    } else {
        modules.add(new AbstractModule() {

            @Override
            protected void configure() {
                bind(DiscoveryService.class).toProvider(new SupplierProviderBridge<>(masterEnv.getDiscoveryServiceSupplier()));
                bind(DiscoveryServiceClient.class).toProvider(new SupplierProviderBridge<>(masterEnv.getDiscoveryServiceClientSupplier()));
            }
        });
        modules.add(new RemoteLogAppenderModule());
        if (coreSecurityModule.requiresZKClient()) {
            modules.add(new ZKClientModule());
        }
    }
    return Guice.createInjector(modules);
}
Also used : IOModule(io.cdap.cdap.common.guice.IOModule) MessagingClientModule(io.cdap.cdap.messaging.guice.MessagingClientModule) ZKDiscoveryModule(io.cdap.cdap.common.guice.ZKDiscoveryModule) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) RemoteLogAppenderModule(io.cdap.cdap.logging.guice.RemoteLogAppenderModule) ArrayList(java.util.ArrayList) MetricsClientRuntimeModule(io.cdap.cdap.metrics.guice.MetricsClientRuntimeModule) KafkaLogAppenderModule(io.cdap.cdap.logging.guice.KafkaLogAppenderModule) AbstractModule(com.google.inject.AbstractModule) ZKClientModule(io.cdap.cdap.common.guice.ZKClientModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) CoreSecurityModule(io.cdap.cdap.security.guice.CoreSecurityModule) MasterEnvironment(io.cdap.cdap.master.spi.environment.MasterEnvironment) KafkaClientModule(io.cdap.cdap.common.guice.KafkaClientModule) SupplierProviderBridge(io.cdap.cdap.common.guice.SupplierProviderBridge) Module(com.google.inject.Module) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) CoreSecurityModule(io.cdap.cdap.security.guice.CoreSecurityModule) SystemAppModule(io.cdap.cdap.internal.app.worker.SystemAppModule) KafkaLogAppenderModule(io.cdap.cdap.logging.guice.KafkaLogAppenderModule) MessagingClientModule(io.cdap.cdap.messaging.guice.MessagingClientModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) RemoteLogAppenderModule(io.cdap.cdap.logging.guice.RemoteLogAppenderModule) CoreSecurityRuntimeModule(io.cdap.cdap.security.guice.CoreSecurityRuntimeModule) KafkaClientModule(io.cdap.cdap.common.guice.KafkaClientModule) ZKClientModule(io.cdap.cdap.common.guice.ZKClientModule) IOModule(io.cdap.cdap.common.guice.IOModule) ZKDiscoveryModule(io.cdap.cdap.common.guice.ZKDiscoveryModule) MetricsClientRuntimeModule(io.cdap.cdap.metrics.guice.MetricsClientRuntimeModule) AbstractModule(com.google.inject.AbstractModule) SystemAppModule(io.cdap.cdap.internal.app.worker.SystemAppModule) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Example 10 with KafkaLogAppenderModule

use of io.cdap.cdap.logging.guice.KafkaLogAppenderModule in project cdap by caskdata.

the class ArtifactLocalizerTwillRunnable method createInjector.

@VisibleForTesting
static Injector createInjector(CConfiguration cConf, Configuration hConf) {
    List<Module> modules = new ArrayList<>();
    CoreSecurityModule coreSecurityModule = CoreSecurityRuntimeModule.getDistributedModule(cConf);
    modules.add(new ConfigModule(cConf, hConf));
    modules.add(new IOModule());
    modules.add(RemoteAuthenticatorModules.getDefaultModule());
    modules.add(new AuthenticationContextModules().getMasterModule());
    modules.add(coreSecurityModule);
    // If MasterEnvironment is not available, assuming it is the old hadoop stack with ZK, Kafka
    MasterEnvironment masterEnv = MasterEnvironments.getMasterEnvironment();
    if (masterEnv == null) {
        modules.add(new ZKClientModule());
        modules.add(new ZKDiscoveryModule());
        modules.add(new KafkaClientModule());
        modules.add(new KafkaLogAppenderModule());
    } else {
        modules.add(new AbstractModule() {

            @Override
            protected void configure() {
                bind(DiscoveryService.class).toProvider(new SupplierProviderBridge<>(masterEnv.getDiscoveryServiceSupplier()));
                bind(DiscoveryServiceClient.class).toProvider(new SupplierProviderBridge<>(masterEnv.getDiscoveryServiceClientSupplier()));
            }
        });
        modules.add(new RemoteLogAppenderModule());
        modules.add(new LocalLocationModule());
        if (coreSecurityModule.requiresZKClient()) {
            modules.add(new ZKClientModule());
        }
    }
    modules.add(new DistributedArtifactManagerModule());
    return Guice.createInjector(modules);
}
Also used : IOModule(io.cdap.cdap.common.guice.IOModule) ZKDiscoveryModule(io.cdap.cdap.common.guice.ZKDiscoveryModule) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) RemoteLogAppenderModule(io.cdap.cdap.logging.guice.RemoteLogAppenderModule) ArrayList(java.util.ArrayList) KafkaLogAppenderModule(io.cdap.cdap.logging.guice.KafkaLogAppenderModule) AbstractModule(com.google.inject.AbstractModule) ZKClientModule(io.cdap.cdap.common.guice.ZKClientModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) CoreSecurityModule(io.cdap.cdap.security.guice.CoreSecurityModule) MasterEnvironment(io.cdap.cdap.master.spi.environment.MasterEnvironment) KafkaClientModule(io.cdap.cdap.common.guice.KafkaClientModule) DistributedArtifactManagerModule(io.cdap.cdap.app.guice.DistributedArtifactManagerModule) SupplierProviderBridge(io.cdap.cdap.common.guice.SupplierProviderBridge) Module(com.google.inject.Module) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) RemoteLogAppenderModule(io.cdap.cdap.logging.guice.RemoteLogAppenderModule) CoreSecurityRuntimeModule(io.cdap.cdap.security.guice.CoreSecurityRuntimeModule) KafkaClientModule(io.cdap.cdap.common.guice.KafkaClientModule) ZKClientModule(io.cdap.cdap.common.guice.ZKClientModule) CoreSecurityModule(io.cdap.cdap.security.guice.CoreSecurityModule) IOModule(io.cdap.cdap.common.guice.IOModule) KafkaLogAppenderModule(io.cdap.cdap.logging.guice.KafkaLogAppenderModule) DistributedArtifactManagerModule(io.cdap.cdap.app.guice.DistributedArtifactManagerModule) ZKDiscoveryModule(io.cdap.cdap.common.guice.ZKDiscoveryModule) AbstractModule(com.google.inject.AbstractModule) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

AbstractModule (com.google.inject.AbstractModule)14 KafkaClientModule (io.cdap.cdap.common.guice.KafkaClientModule)14 ZKClientModule (io.cdap.cdap.common.guice.ZKClientModule)14 ZKDiscoveryModule (io.cdap.cdap.common.guice.ZKDiscoveryModule)14 KafkaLogAppenderModule (io.cdap.cdap.logging.guice.KafkaLogAppenderModule)14 AuthenticationContextModules (io.cdap.cdap.security.auth.context.AuthenticationContextModules)14 ConfigModule (io.cdap.cdap.common.guice.ConfigModule)12 IOModule (io.cdap.cdap.common.guice.IOModule)12 VisibleForTesting (com.google.common.annotations.VisibleForTesting)10 SupplierProviderBridge (io.cdap.cdap.common.guice.SupplierProviderBridge)10 RemoteLogAppenderModule (io.cdap.cdap.logging.guice.RemoteLogAppenderModule)10 MasterEnvironment (io.cdap.cdap.master.spi.environment.MasterEnvironment)10 MessagingClientModule (io.cdap.cdap.messaging.guice.MessagingClientModule)10 Module (com.google.inject.Module)8 MetricsClientRuntimeModule (io.cdap.cdap.metrics.guice.MetricsClientRuntimeModule)8 CoreSecurityModule (io.cdap.cdap.security.guice.CoreSecurityModule)8 CoreSecurityRuntimeModule (io.cdap.cdap.security.guice.CoreSecurityRuntimeModule)8 ArrayList (java.util.ArrayList)8 AppFabricServiceRuntimeModule (io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule)6 AuthorizationModule (io.cdap.cdap.app.guice.AuthorizationModule)6