Search in sources :

Example 1 with DelegatingExtensionContext

use of org.datatransferproject.api.launcher.DelegatingExtensionContext in project data-transfer-project by google.

the class WorkerModule method getExporter.

@Provides
@Singleton
Exporter getExporter(ImmutableList<TransferExtension> transferExtensions) {
    TransferExtension extension = findTransferExtension(transferExtensions, JobMetadata.getExportService());
    DelegatingExtensionContext serviceSpecificContext = new DelegatingExtensionContext(context);
    serviceSpecificContext.registerOverrideService(MetricRecorder.class, new ServiceAwareMetricRecorder(extension.getServiceId(), context.getService(DtpInternalMetricRecorder.class)));
    serviceSpecificContext.registerOverrideService(TransferServiceConfig.class, getTransferServiceConfig(extension));
    extension.initialize(serviceSpecificContext);
    return extension.getExporter(JobMetadata.getDataType());
}
Also used : TransferExtension(org.datatransferproject.spi.transfer.extension.TransferExtension) ServiceAwareMetricRecorder(org.datatransferproject.launcher.metrics.ServiceAwareMetricRecorder) DelegatingExtensionContext(org.datatransferproject.api.launcher.DelegatingExtensionContext) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Example 2 with DelegatingExtensionContext

use of org.datatransferproject.api.launcher.DelegatingExtensionContext in project data-transfer-project by google.

the class WorkerModule method getImporter.

@Provides
@Singleton
Importer getImporter(ImmutableList<TransferExtension> transferExtensions) {
    TransferExtension extension = findTransferExtension(transferExtensions, JobMetadata.getImportService());
    DelegatingExtensionContext serviceSpecificContext = new DelegatingExtensionContext(context);
    serviceSpecificContext.registerOverrideService(MetricRecorder.class, new ServiceAwareMetricRecorder(extension.getServiceId(), context.getService(DtpInternalMetricRecorder.class)));
    serviceSpecificContext.registerOverrideService(TransferServiceConfig.class, getTransferServiceConfig(extension));
    extension.initialize(serviceSpecificContext);
    return extension.getImporter(JobMetadata.getDataType());
}
Also used : TransferExtension(org.datatransferproject.spi.transfer.extension.TransferExtension) ServiceAwareMetricRecorder(org.datatransferproject.launcher.metrics.ServiceAwareMetricRecorder) DelegatingExtensionContext(org.datatransferproject.api.launcher.DelegatingExtensionContext) Singleton(com.google.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

Provides (com.google.inject.Provides)2 Singleton (com.google.inject.Singleton)2 DelegatingExtensionContext (org.datatransferproject.api.launcher.DelegatingExtensionContext)2 ServiceAwareMetricRecorder (org.datatransferproject.launcher.metrics.ServiceAwareMetricRecorder)2 TransferExtension (org.datatransferproject.spi.transfer.extension.TransferExtension)2