Search in sources :

Example 1 with JobStore

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);
}
Also used : AppCredentialStore(org.dataportabilityproject.spi.cloud.storage.AppCredentialStore) JobStore(org.dataportabilityproject.spi.cloud.storage.JobStore) SettingsExtension(org.dataportabilityproject.config.extension.SettingsExtension) CloudExtension(org.dataportabilityproject.spi.cloud.extension.CloudExtension) NetHttpTransport(com.google.api.client.http.javanet.NetHttpTransport) SymmetricKeyGenerator(org.dataportabilityproject.security.SymmetricKeyGenerator) RsaSymmetricKeyGenerator(org.dataportabilityproject.security.RsaSymmetricKeyGenerator) AesSymmetricKeyGenerator(org.dataportabilityproject.security.AesSymmetricKeyGenerator) Injector(com.google.inject.Injector) TransferExtension(org.dataportabilityproject.spi.transfer.extension.TransferExtension) AsymmetricKeyGenerator(org.dataportabilityproject.security.AsymmetricKeyGenerator) AesSymmetricKeyGenerator(org.dataportabilityproject.security.AesSymmetricKeyGenerator) RsaSymmetricKeyGenerator(org.dataportabilityproject.security.RsaSymmetricKeyGenerator)

Example 2 with JobStore

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;
}
Also used : JobStore(org.dataportabilityproject.spi.cloud.storage.JobStore) GoogleJobStore(org.dataportabilityproject.cloud.google.GoogleJobStore)

Example 3 with JobStore

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;
}
Also used : FlickrPhotosImporter(org.dataportabilityproject.datatransfer.flickr.photos.FlickrPhotosImporter) FlickrPhotosExporter(org.dataportabilityproject.datatransfer.flickr.photos.FlickrPhotosExporter) JobStore(org.dataportabilityproject.spi.cloud.storage.JobStore)

Example 4 with JobStore

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;
}
Also used : GoogleCalendarImporter(org.dataportabilityproject.datatransfer.google.calendar.GoogleCalendarImporter) GoogleTasksExporter(org.dataportabilityproject.datatransfer.google.tasks.GoogleTasksExporter) JobStore(org.dataportabilityproject.spi.cloud.storage.JobStore) GoogleTasksExporter(org.dataportabilityproject.datatransfer.google.tasks.GoogleTasksExporter) Exporter(org.dataportabilityproject.spi.transfer.provider.Exporter) GoogleCalendarExporter(org.dataportabilityproject.datatransfer.google.calendar.GoogleCalendarExporter) GoogleContactsExporter(org.dataportabilityproject.datatransfer.google.contacts.GoogleContactsExporter) GoogleContactsExporter(org.dataportabilityproject.datatransfer.google.contacts.GoogleContactsExporter) ImmutableMap(com.google.common.collect.ImmutableMap) GoogleCalendarExporter(org.dataportabilityproject.datatransfer.google.calendar.GoogleCalendarExporter) GoogleTasksImporter(org.dataportabilityproject.datatransfer.google.tasks.GoogleTasksImporter) GoogleContactsImporter(org.dataportabilityproject.datatransfer.google.contacts.GoogleContactsImporter) GoogleTasksImporter(org.dataportabilityproject.datatransfer.google.tasks.GoogleTasksImporter) Importer(org.dataportabilityproject.spi.transfer.provider.Importer) GoogleCalendarImporter(org.dataportabilityproject.datatransfer.google.calendar.GoogleCalendarImporter) GoogleContactsImporter(org.dataportabilityproject.datatransfer.google.contacts.GoogleContactsImporter)

Aggregations

JobStore (org.dataportabilityproject.spi.cloud.storage.JobStore)4 NetHttpTransport (com.google.api.client.http.javanet.NetHttpTransport)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 Injector (com.google.inject.Injector)1 GoogleJobStore (org.dataportabilityproject.cloud.google.GoogleJobStore)1 SettingsExtension (org.dataportabilityproject.config.extension.SettingsExtension)1 FlickrPhotosExporter (org.dataportabilityproject.datatransfer.flickr.photos.FlickrPhotosExporter)1 FlickrPhotosImporter (org.dataportabilityproject.datatransfer.flickr.photos.FlickrPhotosImporter)1 GoogleCalendarExporter (org.dataportabilityproject.datatransfer.google.calendar.GoogleCalendarExporter)1 GoogleCalendarImporter (org.dataportabilityproject.datatransfer.google.calendar.GoogleCalendarImporter)1 GoogleContactsExporter (org.dataportabilityproject.datatransfer.google.contacts.GoogleContactsExporter)1 GoogleContactsImporter (org.dataportabilityproject.datatransfer.google.contacts.GoogleContactsImporter)1 GoogleTasksExporter (org.dataportabilityproject.datatransfer.google.tasks.GoogleTasksExporter)1 GoogleTasksImporter (org.dataportabilityproject.datatransfer.google.tasks.GoogleTasksImporter)1 AesSymmetricKeyGenerator (org.dataportabilityproject.security.AesSymmetricKeyGenerator)1 AsymmetricKeyGenerator (org.dataportabilityproject.security.AsymmetricKeyGenerator)1 RsaSymmetricKeyGenerator (org.dataportabilityproject.security.RsaSymmetricKeyGenerator)1 SymmetricKeyGenerator (org.dataportabilityproject.security.SymmetricKeyGenerator)1 CloudExtension (org.dataportabilityproject.spi.cloud.extension.CloudExtension)1 AppCredentialStore (org.dataportabilityproject.spi.cloud.storage.AppCredentialStore)1