Search in sources :

Example 1 with Importer

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

Example 2 with Importer

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

the class LocalImportTestRunner method main.

@SuppressWarnings("unchecked")
public static void main(String... args) throws Exception {
    AuthTestDriver authTestDriver = new AuthTestDriver();
    MicrosoftTransferExtension serviceProvider = new MicrosoftTransferExtension();
    TokenAuthData token = authTestDriver.getOAuthTokenCode();
    Importer<TokenAuthData, ContactsModelWrapper> contacts = (Importer<TokenAuthData, ContactsModelWrapper>) serviceProvider.getImporter("contacts");
    ContactsModelWrapper wrapper = new ContactsModelWrapper(createCards());
    ImportResult result = contacts.importItem(UUID.randomUUID(), token, wrapper);
}
Also used : ImportResult(org.dataportabilityproject.spi.transfer.provider.ImportResult) 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) Importer(org.dataportabilityproject.spi.transfer.provider.Importer)

Aggregations

Importer (org.dataportabilityproject.spi.transfer.provider.Importer)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 Exporter (org.dataportabilityproject.spi.transfer.provider.Exporter)1 ImportResult (org.dataportabilityproject.spi.transfer.provider.ImportResult)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