Search in sources :

Example 1 with DaybookPostsImporter

use of org.datatransferproject.transfer.daybook.social.DaybookPostsImporter in project data-transfer-project by google.

the class DaybookTransferExtension method initialize.

@Override
public void initialize(ExtensionContext context) {
    Monitor monitor = context.getMonitor();
    if (initialized) {
        monitor.severe(() -> "DaybookTransferExtension is already initialized");
        return;
    }
    ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    OkHttpClient client = context.getService(OkHttpClient.class);
    TemporaryPerJobDataStore jobStore = context.getService(TemporaryPerJobDataStore.class);
    ImmutableMap.Builder<String, Importer> importerBuilder = ImmutableMap.builder();
    importerBuilder.put("PHOTOS", new DaybookPhotosImporter(monitor, client, mapper, jobStore, BASE_URL));
    importerBuilder.put("SOCIAL-POSTS", new DaybookPostsImporter(monitor, client, mapper, BASE_URL));
    importerMap = importerBuilder.build();
    initialized = true;
}
Also used : TemporaryPerJobDataStore(org.datatransferproject.spi.cloud.storage.TemporaryPerJobDataStore) Monitor(org.datatransferproject.api.launcher.Monitor) OkHttpClient(okhttp3.OkHttpClient) DaybookPostsImporter(org.datatransferproject.transfer.daybook.social.DaybookPostsImporter) DaybookPhotosImporter(org.datatransferproject.transfer.daybook.photos.DaybookPhotosImporter) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) ImmutableMap(com.google.common.collect.ImmutableMap) DaybookPostsImporter(org.datatransferproject.transfer.daybook.social.DaybookPostsImporter) DaybookPhotosImporter(org.datatransferproject.transfer.daybook.photos.DaybookPhotosImporter) Importer(org.datatransferproject.spi.transfer.provider.Importer)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 OkHttpClient (okhttp3.OkHttpClient)1 Monitor (org.datatransferproject.api.launcher.Monitor)1 TemporaryPerJobDataStore (org.datatransferproject.spi.cloud.storage.TemporaryPerJobDataStore)1 Importer (org.datatransferproject.spi.transfer.provider.Importer)1 DaybookPhotosImporter (org.datatransferproject.transfer.daybook.photos.DaybookPhotosImporter)1 DaybookPostsImporter (org.datatransferproject.transfer.daybook.social.DaybookPostsImporter)1