Search in sources :

Example 1 with Exporter

use of org.dataportabilityproject.spi.transfer.provider.Exporter in project data-transfer-project by google.

the class LocalExportTestRunner method main.

@SuppressWarnings("unchecked")
public static void main(String... args) throws Exception {
    AuthTestDriver authTestDriver = new AuthTestDriver();
    MicrosoftTransferExtension serviceProvider = new MicrosoftTransferExtension();
    TokenAuthData token = authTestDriver.getOAuthTokenCode();
    Exporter<TokenAuthData, ContactsModelWrapper> contacts = (Exporter<TokenAuthData, ContactsModelWrapper>) serviceProvider.getExporter("contacts");
    ExportResult<ContactsModelWrapper> wrapper = contacts.export(UUID.randomUUID(), token);
}
Also used : TokenAuthData(org.dataportabilityproject.types.transfer.auth.TokenAuthData) MicrosoftTransferExtension(org.dataportabilityproject.transfer.microsoft.MicrosoftTransferExtension) ContactsModelWrapper(org.dataportabilityproject.types.transfer.models.contacts.ContactsModelWrapper) AuthTestDriver(org.dataportabilityproject.auth.microsoft.harness.AuthTestDriver) Exporter(org.dataportabilityproject.spi.transfer.provider.Exporter)

Example 2 with Exporter

use of org.dataportabilityproject.spi.transfer.provider.Exporter 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

Exporter (org.dataportabilityproject.spi.transfer.provider.Exporter)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 AuthTestDriver (org.dataportabilityproject.auth.microsoft.harness.AuthTestDriver)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 JobStore (org.dataportabilityproject.spi.cloud.storage.JobStore)1 Importer (org.dataportabilityproject.spi.transfer.provider.Importer)1 MicrosoftTransferExtension (org.dataportabilityproject.transfer.microsoft.MicrosoftTransferExtension)1 TokenAuthData (org.dataportabilityproject.types.transfer.auth.TokenAuthData)1 ContactsModelWrapper (org.dataportabilityproject.types.transfer.models.contacts.ContactsModelWrapper)1