use of org.dataportabilityproject.spi.cloud.storage.JobStore in project data-transfer-project by google.
the class WorkerMain method initialize.
public void initialize() {
SettingsExtension settingsExtension = getSettingsExtension();
settingsExtension.initialize(null);
WorkerExtensionContext extensionContext = new WorkerExtensionContext(settingsExtension);
// TODO this should be moved into a service extension
extensionContext.registerService(HttpTransport.class, new NetHttpTransport());
ServiceLoader.load(ServiceExtension.class).iterator().forEachRemaining(serviceExtension -> serviceExtension.initialize(extensionContext));
// TODO: verify that this is the cloud extension that is specified in the configuration
CloudExtension cloudExtension = getCloudExtension();
cloudExtension.initialize(extensionContext);
logger.info("Using CloudExtension: {} ", cloudExtension.getClass().getName());
JobStore jobStore = cloudExtension.getJobStore();
extensionContext.registerService(JobStore.class, jobStore);
AppCredentialStore appCredentialStore = cloudExtension.getAppCredentialStore();
extensionContext.registerService(AppCredentialStore.class, appCredentialStore);
List<TransferExtension> transferExtensions = getTransferExtensions();
// TODO: make configurable
SymmetricKeyGenerator symmetricKeyGenerator = new AesSymmetricKeyGenerator();
AsymmetricKeyGenerator asymmetricKeyGenerator = new RsaSymmetricKeyGenerator();
Injector injector = Guice.createInjector(new WorkerModule(extensionContext, cloudExtension, transferExtensions, symmetricKeyGenerator, asymmetricKeyGenerator));
worker = injector.getInstance(Worker.class);
}
use of org.dataportabilityproject.spi.cloud.storage.JobStore in project data-transfer-project by google.
the class LocalCloudFactory method getJobStore.
@Override
public JobStore getJobStore() {
JobStore store = jobStoreSupplier.get();
logger.info("Returning local datastore-based key value store, {}", store.getClass().getName());
return store;
}
use of org.dataportabilityproject.spi.cloud.storage.JobStore in project data-transfer-project by google.
the class FlickrTransferExtension method initialize.
@Override
public void initialize(ExtensionContext context) {
if (initialized)
return;
jobStore = context.getService(JobStore.class);
try {
appCredentials = context.getService(AppCredentialStore.class).getAppCredentials(FLICKR_KEY, FLICKER_SECRET);
} catch (Exception e) {
logger.warn("Problem getting AppCredentials: {}", e);
initialized = false;
return;
}
importer = new FlickrPhotosImporter(appCredentials, jobStore);
exporter = new FlickrPhotosExporter(appCredentials);
initialized = true;
}
use of org.dataportabilityproject.spi.cloud.storage.JobStore in project data-transfer-project by google.
the class GoogleTransferExtension method initialize.
@Override
public void initialize(ExtensionContext context) {
// times.
if (initialized)
return;
jobStore = context.getService(JobStore.class);
ImmutableMap.Builder<String, Importer> importerBuilder = ImmutableMap.builder();
importerBuilder.put("contacts", new GoogleContactsImporter());
importerBuilder.put("calendar", new GoogleCalendarImporter(jobStore));
importerBuilder.put("tasks", new GoogleTasksImporter(jobStore));
importerMap = importerBuilder.build();
ImmutableMap.Builder<String, Exporter> exporterBuilder = ImmutableMap.builder();
exporterBuilder.put("contacts", new GoogleContactsExporter());
exporterBuilder.put("calendar", new GoogleCalendarExporter());
exporterBuilder.put("tasks", new GoogleTasksExporter());
exporterMap = exporterBuilder.build();
initialized = true;
}
Aggregations