Search in sources :

Example 11 with AuditModule

use of io.cdap.cdap.data2.audit.AuditModule in project cdap by cdapio.

the class StandaloneMain method createPersistentModules.

private static List<Module> createPersistentModules(CConfiguration cConf, Configuration hConf) {
    cConf.setInt(Constants.Master.MAX_INSTANCES, 1);
    cConf.setIfUnset(Constants.CFG_DATA_LEVELDB_DIR, Constants.DEFAULT_DATA_LEVELDB_DIR);
    cConf.set(Constants.CFG_DATA_INMEMORY_PERSISTENCE, Constants.InMemoryPersistenceType.LEVELDB.name());
    // configure all services except for router and auth to bind to 127.0.0.1
    String localhost = InetAddress.getLoopbackAddress().getHostAddress();
    cConf.set(Constants.Service.MASTER_SERVICES_BIND_ADDRESS, localhost);
    cConf.set(Constants.MessagingSystem.HTTP_SERVER_BIND_ADDRESS, localhost);
    cConf.set(Constants.Transaction.Container.ADDRESS, localhost);
    cConf.set(Constants.Dataset.Executor.ADDRESS, localhost);
    cConf.set(Constants.Metrics.ADDRESS, localhost);
    cConf.set(Constants.MetricsProcessor.BIND_ADDRESS, localhost);
    cConf.set(Constants.LogSaver.ADDRESS, localhost);
    cConf.set(Constants.LogQuery.ADDRESS, localhost);
    cConf.set(Constants.Explore.SERVER_ADDRESS, localhost);
    cConf.set(Constants.Metadata.SERVICE_BIND_ADDRESS, localhost);
    cConf.set(Constants.Preview.ADDRESS, localhost);
    cConf.set(Constants.SupportBundle.SERVICE_BIND_ADDRESS, localhost);
    return ImmutableList.of(new ConfigModule(cConf, hConf), RemoteAuthenticatorModules.getDefaultModule(), new IOModule(), new ZKClientModule(), new KafkaClientModule(), new MetricsHandlerModule(), new LogQueryRuntimeModule().getStandaloneModules(), new InMemoryDiscoveryModule(), new LocalLocationModule(), new ProgramRunnerRuntimeModule().getStandaloneModules(), new DataFabricModules(StandaloneMain.class.getName()).getStandaloneModules(), new DataSetsModules().getStandaloneModules(), new DataSetServiceModules().getStandaloneModules(), new MetricsClientRuntimeModule().getStandaloneModules(), new LocalLogAppenderModule(), new LogReaderRuntimeModules().getStandaloneModules(), new RouterModules().getStandaloneModules(), new CoreSecurityRuntimeModule().getStandaloneModules(), new ExternalAuthenticationModule(), new SecureStoreServerModule(), new ExploreRuntimeModule().getStandaloneModules(), new ExploreClientModule(), new MetadataServiceModule(), new MetadataReaderWriterModules().getStandaloneModules(), new AuditModule(), new AuthenticationContextModules().getMasterModule(), new AuthorizationModule(), new AuthorizationEnforcementModule().getStandaloneModules(), new PreviewConfigModule(cConf, new Configuration(), SConfiguration.create()), new PreviewManagerModule(false), new PreviewRunnerManagerModule().getStandaloneModules(), new MessagingServerRuntimeModule().getStandaloneModules(), new AppFabricServiceRuntimeModule(cConf).getStandaloneModules(), new MonitorHandlerModule(false), new RuntimeServerModule(), new OperationalStatsModule(), new MetricsWriterModule(), new SupportBundleServiceModule(), new AbstractModule() {

        @Override
        protected void configure() {
            // Needed by MonitorHandlerModuler
            bind(TwillRunner.class).to(NoopTwillRunnerService.class);
            bind(HealthCheckService.class).in(Scopes.SINGLETON);
        }
    });
}
Also used : IOModule(io.cdap.cdap.common.guice.IOModule) InMemoryDiscoveryModule(io.cdap.cdap.common.guice.InMemoryDiscoveryModule) DataSetServiceModules(io.cdap.cdap.data.runtime.DataSetServiceModules) MetricsWriterModule(io.cdap.cdap.metrics.process.loader.MetricsWriterModule) PreviewManagerModule(io.cdap.cdap.app.preview.PreviewManagerModule) Configuration(org.apache.hadoop.conf.Configuration) SConfiguration(io.cdap.cdap.common.conf.SConfiguration) CConfiguration(io.cdap.cdap.common.conf.CConfiguration) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) PreviewConfigModule(io.cdap.cdap.app.preview.PreviewConfigModule) MessagingServerRuntimeModule(io.cdap.cdap.messaging.guice.MessagingServerRuntimeModule) MetricsClientRuntimeModule(io.cdap.cdap.metrics.guice.MetricsClientRuntimeModule) MonitorHandlerModule(io.cdap.cdap.app.guice.MonitorHandlerModule) ZKClientModule(io.cdap.cdap.common.guice.ZKClientModule) PreviewConfigModule(io.cdap.cdap.app.preview.PreviewConfigModule) LocalLocationModule(io.cdap.cdap.common.guice.LocalLocationModule) CoreSecurityRuntimeModule(io.cdap.cdap.security.guice.CoreSecurityRuntimeModule) KafkaClientModule(io.cdap.cdap.common.guice.KafkaClientModule) SupportBundleServiceModule(io.cdap.cdap.support.app.guice.SupportBundleServiceModule) PreviewRunnerManagerModule(io.cdap.cdap.app.preview.PreviewRunnerManagerModule) AuthorizationModule(io.cdap.cdap.app.guice.AuthorizationModule) OperationalStatsModule(io.cdap.cdap.operations.guice.OperationalStatsModule) ExternalAuthenticationModule(io.cdap.cdap.security.guice.ExternalAuthenticationModule) LogReaderRuntimeModules(io.cdap.cdap.logging.guice.LogReaderRuntimeModules) AuthenticationContextModules(io.cdap.cdap.security.auth.context.AuthenticationContextModules) DataSetsModules(io.cdap.cdap.data.runtime.DataSetsModules) MetadataServiceModule(io.cdap.cdap.metadata.MetadataServiceModule) ExploreRuntimeModule(io.cdap.cdap.explore.guice.ExploreRuntimeModule) RouterModules(io.cdap.cdap.gateway.router.RouterModules) LogQueryRuntimeModule(io.cdap.cdap.logging.guice.LogQueryRuntimeModule) AbstractModule(com.google.inject.AbstractModule) MetadataReaderWriterModules(io.cdap.cdap.metadata.MetadataReaderWriterModules) NoopTwillRunnerService(io.cdap.cdap.common.twill.NoopTwillRunnerService) MetricsHandlerModule(io.cdap.cdap.metrics.guice.MetricsHandlerModule) ProgramRunnerRuntimeModule(io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule) RuntimeServerModule(io.cdap.cdap.app.guice.RuntimeServerModule) LocalLogAppenderModule(io.cdap.cdap.logging.guice.LocalLogAppenderModule) ExploreClientModule(io.cdap.cdap.explore.guice.ExploreClientModule) AuditModule(io.cdap.cdap.data2.audit.AuditModule) DataFabricModules(io.cdap.cdap.data.runtime.DataFabricModules) SecureStoreServerModule(io.cdap.cdap.security.guice.SecureStoreServerModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) AppFabricServiceRuntimeModule(io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule)

Example 12 with AuditModule

use of io.cdap.cdap.data2.audit.AuditModule 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;
}
Also used : MessagingClientModule(io.cdap.cdap.messaging.guice.MessagingClientModule) UnsupportedExploreClient(io.cdap.cdap.app.guice.UnsupportedExploreClient) ExploreClient(io.cdap.cdap.explore.client.ExploreClient) DataSetServiceModules(io.cdap.cdap.data.runtime.DataSetServiceModules) MetricsStoreModule(io.cdap.cdap.metrics.guice.MetricsStoreModule) PreviewManagerModule(io.cdap.cdap.app.preview.PreviewManagerModule) SecureStoreClientModule(io.cdap.cdap.security.guice.SecureStoreClientModule) DataSetsModules(io.cdap.cdap.data.runtime.DataSetsModules) TwillRunner(org.apache.twill.api.TwillRunner) ArrayList(java.util.ArrayList) MetadataServiceModule(io.cdap.cdap.metadata.MetadataServiceModule) AbstractModule(com.google.inject.AbstractModule) MetadataReaderWriterModules(io.cdap.cdap.metadata.MetadataReaderWriterModules) DFSLocationModule(io.cdap.cdap.common.guice.DFSLocationModule) ProgramRunnerRuntimeModule(io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule) AuditModule(io.cdap.cdap.data2.audit.AuditModule) SupplierProviderBridge(io.cdap.cdap.common.guice.SupplierProviderBridge) PreviewRunnerManagerModule(io.cdap.cdap.app.preview.PreviewRunnerManagerModule) Module(com.google.inject.Module) SecureStoreClientModule(io.cdap.cdap.security.guice.SecureStoreClientModule) PreviewManagerModule(io.cdap.cdap.app.preview.PreviewManagerModule) MetricsStoreModule(io.cdap.cdap.metrics.guice.MetricsStoreModule) AuthorizationModule(io.cdap.cdap.app.guice.AuthorizationModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) AppFabricServiceRuntimeModule(io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule) DFSLocationModule(io.cdap.cdap.common.guice.DFSLocationModule) AuditModule(io.cdap.cdap.data2.audit.AuditModule) ProgramRunnerRuntimeModule(io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule) MessagingClientModule(io.cdap.cdap.messaging.guice.MessagingClientModule) MetadataServiceModule(io.cdap.cdap.metadata.MetadataServiceModule) AbstractModule(com.google.inject.AbstractModule) PreviewRunnerManagerModule(io.cdap.cdap.app.preview.PreviewRunnerManagerModule) AuthorizationModule(io.cdap.cdap.app.guice.AuthorizationModule) AppFabricServiceRuntimeModule(io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule)

Example 13 with AuditModule

use of io.cdap.cdap.data2.audit.AuditModule in project cdap by cdapio.

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;
}
Also used : IOModule(io.cdap.cdap.common.guice.IOModule) MessagingClientModule(io.cdap.cdap.messaging.guice.MessagingClientModule) NamespaceQueryAdminModule(io.cdap.cdap.common.namespace.guice.NamespaceQueryAdminModule) SecureStoreClientModule(io.cdap.cdap.security.guice.SecureStoreClientModule) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) DataSetsModules(io.cdap.cdap.data.runtime.DataSetsModules) UGIProvider(io.cdap.cdap.security.impersonation.UGIProvider) CurrentUGIProvider(io.cdap.cdap.security.impersonation.CurrentUGIProvider) Arguments(io.cdap.cdap.app.runtime.Arguments) SystemArguments(io.cdap.cdap.internal.app.runtime.SystemArguments) ArrayList(java.util.ArrayList) MetricsClientRuntimeModule(io.cdap.cdap.metrics.guice.MetricsClientRuntimeModule) MessagingProgramStateWriter(io.cdap.cdap.internal.app.program.MessagingProgramStateWriter) AbstractModule(com.google.inject.AbstractModule) MetadataReaderWriterModules(io.cdap.cdap.metadata.MetadataReaderWriterModules) DFSLocationModule(io.cdap.cdap.common.guice.DFSLocationModule) MessagingWorkflowStateWriter(io.cdap.cdap.internal.app.runtime.workflow.MessagingWorkflowStateWriter) PreferencesFetcher(io.cdap.cdap.metadata.PreferencesFetcher) AuditModule(io.cdap.cdap.data2.audit.AuditModule) Module(com.google.inject.Module) SecureStoreClientModule(io.cdap.cdap.security.guice.SecureStoreClientModule) ConfigModule(io.cdap.cdap.common.guice.ConfigModule) NamespaceQueryAdminModule(io.cdap.cdap.common.namespace.guice.NamespaceQueryAdminModule) SystemDatasetRuntimeModule(io.cdap.cdap.data.runtime.SystemDatasetRuntimeModule) CoreSecurityModule(io.cdap.cdap.security.guice.CoreSecurityModule) DFSLocationModule(io.cdap.cdap.common.guice.DFSLocationModule) KafkaLogAppenderModule(io.cdap.cdap.logging.guice.KafkaLogAppenderModule) MessagingClientModule(io.cdap.cdap.messaging.guice.MessagingClientModule) RemoteLogAppenderModule(io.cdap.cdap.logging.guice.RemoteLogAppenderModule) CoreSecurityRuntimeModule(io.cdap.cdap.security.guice.CoreSecurityRuntimeModule) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule) KafkaClientModule(io.cdap.cdap.common.guice.KafkaClientModule) ZKClientModule(io.cdap.cdap.common.guice.ZKClientModule) TMSLogAppenderModule(io.cdap.cdap.logging.guice.TMSLogAppenderModule) AuditModule(io.cdap.cdap.data2.audit.AuditModule) 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) AuthorizationEnforcementModule(io.cdap.cdap.security.authorization.AuthorizationEnforcementModule)

Example 14 with AuditModule

use of io.cdap.cdap.data2.audit.AuditModule in project cdap by caskdata.

the class MetadataStoreTest method setup.

@BeforeClass
public static void setup() throws IOException {
    Injector injector = Guice.createInjector(new ConfigModule(), Modules.override(new DataSetsModules().getInMemoryModules()).with(new AbstractModule() {

        @Override
        protected void configure() {
            // Need the distributed metadata store.
            bind(MetadataStore.class).to(DefaultMetadataStore.class);
        }
    }), new LocationRuntimeModule().getInMemoryModules(), new TransactionInMemoryModule(), new SystemDatasetRuntimeModule().getInMemoryModules(), new NamespaceClientRuntimeModule().getInMemoryModules(), new AuthorizationTestModule(), new AuthorizationEnforcementModule().getInMemoryModules(), new AuthenticationContextModules().getMasterModule(), new AuditModule().getInMemoryModules());
    cConf = injector.getInstance(CConfiguration.class);
    txManager = injector.getInstance(TransactionManager.class);
    txManager.startAndWait();
    store = injector.getInstance(MetadataStore.class);
    auditPublisher = injector.getInstance(InMemoryAuditPublisher.class);
}
Also used : NamespaceClientRuntimeModule(co.cask.cdap.common.namespace.guice.NamespaceClientRuntimeModule) TransactionInMemoryModule(org.apache.tephra.runtime.TransactionInMemoryModule) ConfigModule(co.cask.cdap.common.guice.ConfigModule) AuthenticationContextModules(co.cask.cdap.security.auth.context.AuthenticationContextModules) DataSetsModules(co.cask.cdap.data.runtime.DataSetsModules) LocationRuntimeModule(co.cask.cdap.common.guice.LocationRuntimeModule) AuthorizationTestModule(co.cask.cdap.security.authorization.AuthorizationTestModule) CConfiguration(co.cask.cdap.common.conf.CConfiguration) AbstractModule(com.google.inject.AbstractModule) InMemoryAuditPublisher(co.cask.cdap.data2.audit.InMemoryAuditPublisher) Injector(com.google.inject.Injector) TransactionManager(org.apache.tephra.TransactionManager) SystemDatasetRuntimeModule(co.cask.cdap.data.runtime.SystemDatasetRuntimeModule) AuditModule(co.cask.cdap.data2.audit.AuditModule) AuthorizationEnforcementModule(co.cask.cdap.security.authorization.AuthorizationEnforcementModule) BeforeClass(org.junit.BeforeClass)

Example 15 with AuditModule

use of io.cdap.cdap.data2.audit.AuditModule in project cdap by caskdata.

the class AuditPublishTest method init.

@BeforeClass
public static void init() throws Exception {
    cConf = CConfiguration.create();
    cConf.set(Constants.CFG_LOCAL_DATA_DIR, TEMP_FOLDER.newFolder().getAbsolutePath());
    Injector injector = AppFabricTestHelper.getInjector(cConf, new AuditModule().getDistributedModules());
    messagingService = injector.getInstance(MessagingService.class);
    if (messagingService instanceof Service) {
        ((Service) messagingService).startAndWait();
    }
    auditTopic = NamespaceId.SYSTEM.topic(cConf.get(Constants.Audit.TOPIC));
}
Also used : Injector(com.google.inject.Injector) MessagingService(co.cask.cdap.messaging.MessagingService) Service(com.google.common.util.concurrent.Service) AuditModule(co.cask.cdap.data2.audit.AuditModule) MessagingService(co.cask.cdap.messaging.MessagingService) BeforeClass(org.junit.BeforeClass)

Aggregations

AbstractModule (com.google.inject.AbstractModule)14 AuditModule (io.cdap.cdap.data2.audit.AuditModule)10 AuditModule (co.cask.cdap.data2.audit.AuditModule)8 Injector (com.google.inject.Injector)8 DataSetsModules (io.cdap.cdap.data.runtime.DataSetsModules)8 MetadataReaderWriterModules (io.cdap.cdap.metadata.MetadataReaderWriterModules)8 AuthorizationEnforcementModule (io.cdap.cdap.security.authorization.AuthorizationEnforcementModule)8 BeforeClass (org.junit.BeforeClass)8 ArrayList (java.util.ArrayList)7 ConfigModule (co.cask.cdap.common.guice.ConfigModule)6 Module (com.google.inject.Module)6 AppFabricServiceRuntimeModule (io.cdap.cdap.app.guice.AppFabricServiceRuntimeModule)6 AuthorizationModule (io.cdap.cdap.app.guice.AuthorizationModule)6 ProgramRunnerRuntimeModule (io.cdap.cdap.app.guice.ProgramRunnerRuntimeModule)6 PreviewRunnerManagerModule (io.cdap.cdap.app.preview.PreviewRunnerManagerModule)6 ConfigModule (io.cdap.cdap.common.guice.ConfigModule)6 DFSLocationModule (io.cdap.cdap.common.guice.DFSLocationModule)6 IOModule (io.cdap.cdap.common.guice.IOModule)6 KafkaClientModule (io.cdap.cdap.common.guice.KafkaClientModule)6 ZKClientModule (io.cdap.cdap.common.guice.ZKClientModule)6