Search in sources :

Example 1 with MetadataServiceClient

use of io.cdap.cdap.data2.metadata.writer.MetadataServiceClient in project cdap by caskdata.

the class DefaultArtifactRepository method writeSystemMetadata.

private void writeSystemMetadata(io.cdap.cdap.proto.id.ArtifactId artifactId, ArtifactInfo artifactInfo) {
    // add system metadata for artifacts
    ArtifactSystemMetadataWriter writer = new ArtifactSystemMetadataWriter(metadataServiceClient, artifactId, artifactInfo);
    writer.write();
}
Also used : ArtifactSystemMetadataWriter(io.cdap.cdap.data2.metadata.system.ArtifactSystemMetadataWriter)

Example 2 with MetadataServiceClient

use of io.cdap.cdap.data2.metadata.writer.MetadataServiceClient in project cdap by caskdata.

the class SystemMetadataWriterStageTest method setup.

@BeforeClass
public static void setup() {
    Injector injector = AppFabricTestHelper.getInjector();
    metadataStorage = injector.getInstance(MetadataStorage.class);
    metadataServiceClient = injector.getInstance(MetadataServiceClient.class);
    metadataSubscriber = injector.getInstance(MetadataSubscriberService.class);
    metadataSubscriber.startAndWait();
}
Also used : MetadataServiceClient(io.cdap.cdap.data2.metadata.writer.MetadataServiceClient) Injector(com.google.inject.Injector) MetadataSubscriberService(io.cdap.cdap.metadata.MetadataSubscriberService) MetadataStorage(io.cdap.cdap.spi.metadata.MetadataStorage) BeforeClass(org.junit.BeforeClass)

Example 3 with MetadataServiceClient

use of io.cdap.cdap.data2.metadata.writer.MetadataServiceClient in project cdap by caskdata.

the class DatasetInstanceService method publishMetadata.

private void publishMetadata(DatasetId dataset, SystemMetadata metadata) {
    if (metadata != null && !metadata.isEmpty()) {
        SystemMetadataWriter metadataWriter = new DelegateSystemMetadataWriter(metadataServiceClient, dataset, metadata);
        metadataWriter.write();
    }
}
Also used : DelegateSystemMetadataWriter(io.cdap.cdap.data2.metadata.system.DelegateSystemMetadataWriter) SystemMetadataWriter(io.cdap.cdap.data2.metadata.system.SystemMetadataWriter) DelegateSystemMetadataWriter(io.cdap.cdap.data2.metadata.system.DelegateSystemMetadataWriter)

Example 4 with MetadataServiceClient

use of io.cdap.cdap.data2.metadata.writer.MetadataServiceClient in project cdap by caskdata.

the class AppFabricTestBase method initializeAndStartServices.

protected static void initializeAndStartServices(CConfiguration cConf, Module overrides) throws Exception {
    injector = Guice.createInjector(Modules.override(new AppFabricTestModule(cConf, null)).with(overrides));
    int connectionTimeout = cConf.getInt(Constants.HTTP_CLIENT_CONNECTION_TIMEOUT_MS);
    int readTimeout = cConf.getInt(Constants.HTTP_CLIENT_READ_TIMEOUT_MS);
    httpRequestConfig = new HttpRequestConfig(connectionTimeout, readTimeout, false);
    messagingService = injector.getInstance(MessagingService.class);
    if (messagingService instanceof Service) {
        ((Service) messagingService).startAndWait();
    }
    txManager = injector.getInstance(TransactionManager.class);
    txManager.startAndWait();
    // Define all StructuredTable before starting any services that need StructuredTable
    StoreDefinition.createAllTables(injector.getInstance(StructuredTableAdmin.class));
    metadataStorage = injector.getInstance(MetadataStorage.class);
    metadataStorage.createIndex();
    dsOpService = injector.getInstance(DatasetOpExecutorService.class);
    dsOpService.startAndWait();
    datasetService = injector.getInstance(DatasetService.class);
    datasetService.startAndWait();
    appFabricServer = injector.getInstance(AppFabricServer.class);
    appFabricServer.startAndWait();
    DiscoveryServiceClient discoveryClient = injector.getInstance(DiscoveryServiceClient.class);
    appFabricEndpointStrategy = new RandomEndpointStrategy(() -> discoveryClient.discover(Constants.Service.APP_FABRIC_HTTP));
    txClient = injector.getInstance(TransactionSystemClient.class);
    metricsCollectionService = injector.getInstance(MetricsCollectionService.class);
    metricsCollectionService.startAndWait();
    serviceStore = injector.getInstance(ServiceStore.class);
    serviceStore.startAndWait();
    metadataService = injector.getInstance(MetadataService.class);
    metadataService.startAndWait();
    metadataSubscriberService = injector.getInstance(MetadataSubscriberService.class);
    metadataSubscriberService.startAndWait();
    logQueryService = injector.getInstance(LogQueryService.class);
    logQueryService.startAndWait();
    locationFactory = getInjector().getInstance(LocationFactory.class);
    datasetClient = new DatasetClient(getClientConfig(discoveryClient, Constants.Service.DATASET_MANAGER));
    remoteClientFactory = new RemoteClientFactory(discoveryClient, new DefaultInternalAuthenticator(new AuthenticationTestContext()));
    metadataClient = new MetadataClient(getClientConfig(discoveryClient, Constants.Service.METADATA_SERVICE));
    metadataServiceClient = new DefaultMetadataServiceClient(remoteClientFactory);
    metricStore = injector.getInstance(MetricStore.class);
    Scheduler programScheduler = injector.getInstance(Scheduler.class);
    // Wait for the scheduler to be functional.
    if (programScheduler instanceof CoreSchedulerService) {
        try {
            ((CoreSchedulerService) programScheduler).waitUntilFunctional(10, TimeUnit.SECONDS);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
    createNamespaces();
}
Also used : MetricStore(io.cdap.cdap.api.metrics.MetricStore) RemoteClientFactory(io.cdap.cdap.common.internal.remote.RemoteClientFactory) DiscoveryServiceClient(org.apache.twill.discovery.DiscoveryServiceClient) StructuredTableAdmin(io.cdap.cdap.spi.data.StructuredTableAdmin) Scheduler(io.cdap.cdap.scheduler.Scheduler) AppFabricServer(io.cdap.cdap.internal.app.services.AppFabricServer) DatasetService(io.cdap.cdap.data2.datafabric.dataset.service.DatasetService) MetadataService(io.cdap.cdap.metadata.MetadataService) LogQueryService(io.cdap.cdap.logging.service.LogQueryService) TransactionSystemClient(org.apache.tephra.TransactionSystemClient) MetadataClient(io.cdap.cdap.client.MetadataClient) DefaultMetadataServiceClient(io.cdap.cdap.data2.metadata.writer.DefaultMetadataServiceClient) ServiceStore(io.cdap.cdap.app.store.ServiceStore) CoreSchedulerService(io.cdap.cdap.scheduler.CoreSchedulerService) MetricsCollectionService(io.cdap.cdap.api.metrics.MetricsCollectionService) AuthenticationTestContext(io.cdap.cdap.security.auth.context.AuthenticationTestContext) MetadataSubscriberService(io.cdap.cdap.metadata.MetadataSubscriberService) DatasetOpExecutorService(io.cdap.cdap.data2.datafabric.dataset.service.executor.DatasetOpExecutorService) Service(com.google.common.util.concurrent.Service) MetadataService(io.cdap.cdap.metadata.MetadataService) MessagingService(io.cdap.cdap.messaging.MessagingService) DatasetService(io.cdap.cdap.data2.datafabric.dataset.service.DatasetService) LogQueryService(io.cdap.cdap.logging.service.LogQueryService) CoreSchedulerService(io.cdap.cdap.scheduler.CoreSchedulerService) MetricsCollectionService(io.cdap.cdap.api.metrics.MetricsCollectionService) HttpRequestConfig(io.cdap.common.http.HttpRequestConfig) Constraint(io.cdap.cdap.internal.schedule.constraint.Constraint) UnauthorizedException(io.cdap.cdap.security.spi.authorization.UnauthorizedException) IOException(java.io.IOException) NotFoundException(io.cdap.cdap.common.NotFoundException) UnauthenticatedException(io.cdap.cdap.security.spi.authentication.UnauthenticatedException) MessagingService(io.cdap.cdap.messaging.MessagingService) LocationFactory(org.apache.twill.filesystem.LocationFactory) DatasetClient(io.cdap.cdap.client.DatasetClient) DefaultInternalAuthenticator(io.cdap.cdap.common.internal.remote.DefaultInternalAuthenticator) TransactionManager(org.apache.tephra.TransactionManager) DatasetOpExecutorService(io.cdap.cdap.data2.datafabric.dataset.service.executor.DatasetOpExecutorService) MetadataSubscriberService(io.cdap.cdap.metadata.MetadataSubscriberService) MetadataStorage(io.cdap.cdap.spi.metadata.MetadataStorage) AppFabricTestModule(io.cdap.cdap.internal.guice.AppFabricTestModule) RandomEndpointStrategy(io.cdap.cdap.common.discovery.RandomEndpointStrategy)

Example 5 with MetadataServiceClient

use of io.cdap.cdap.data2.metadata.writer.MetadataServiceClient in project cdap by caskdata.

the class MetadataWriterStage method collectProgramSystemMetadata.

private void collectProgramSystemMetadata(ApplicationId appId, ProgramType programType, Iterable<? extends ProgramSpecification> specs, List<MetadataMutation> mutations) {
    for (ProgramSpecification spec : specs) {
        ProgramId programId = appId.program(programType, spec.getName());
        mutations.add(new ProgramSystemMetadataWriter(metadataServiceClient, programId, spec, creationTime).getMetadataMutation());
    }
}
Also used : ProgramSpecification(io.cdap.cdap.api.ProgramSpecification) ProgramId(io.cdap.cdap.proto.id.ProgramId) ProgramSystemMetadataWriter(io.cdap.cdap.data2.metadata.system.ProgramSystemMetadataWriter)

Aggregations

MetadataSubscriberService (io.cdap.cdap.metadata.MetadataSubscriberService)2 MetadataStorage (io.cdap.cdap.spi.metadata.MetadataStorage)2 Service (com.google.common.util.concurrent.Service)1 Injector (com.google.inject.Injector)1 ProgramSpecification (io.cdap.cdap.api.ProgramSpecification)1 ApplicationSpecification (io.cdap.cdap.api.app.ApplicationSpecification)1 Metadata (io.cdap.cdap.api.metadata.Metadata)1 MetricStore (io.cdap.cdap.api.metrics.MetricStore)1 MetricsCollectionService (io.cdap.cdap.api.metrics.MetricsCollectionService)1 ServiceStore (io.cdap.cdap.app.store.ServiceStore)1 DatasetClient (io.cdap.cdap.client.DatasetClient)1 MetadataClient (io.cdap.cdap.client.MetadataClient)1 NotFoundException (io.cdap.cdap.common.NotFoundException)1 RandomEndpointStrategy (io.cdap.cdap.common.discovery.RandomEndpointStrategy)1 DefaultInternalAuthenticator (io.cdap.cdap.common.internal.remote.DefaultInternalAuthenticator)1 RemoteClientFactory (io.cdap.cdap.common.internal.remote.RemoteClientFactory)1 DatasetService (io.cdap.cdap.data2.datafabric.dataset.service.DatasetService)1 DatasetOpExecutorService (io.cdap.cdap.data2.datafabric.dataset.service.executor.DatasetOpExecutorService)1 AppSystemMetadataWriter (io.cdap.cdap.data2.metadata.system.AppSystemMetadataWriter)1 ArtifactSystemMetadataWriter (io.cdap.cdap.data2.metadata.system.ArtifactSystemMetadataWriter)1