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;
}
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);
}
Aggregations