Search in sources :

Example 1 with SmugMugPhotosImporter

use of org.datatransferproject.transfer.smugmug.photos.SmugMugPhotosImporter in project data-transfer-project by google.

the class SmugMugTransferExtension method initialize.

@Override
public void initialize(ExtensionContext context) {
    Monitor monitor = context.getMonitor();
    if (initialized) {
        monitor.severe(() -> "SmugMugTransferExtension already initailized.");
        return;
    }
    TemporaryPerJobDataStore jobStore = context.getService(TemporaryPerJobDataStore.class);
    AppCredentials appCredentials;
    try {
        appCredentials = context.getService(AppCredentialStore.class).getAppCredentials(SMUGMUG_KEY, SMUGMUG_SECRET);
    } catch (IOException e) {
        monitor.info(() -> format("Unable to retrieve SmugMug AppCredentials. Did you set %s and %s?", SMUGMUG_KEY, SMUGMUG_SECRET), e);
        return;
    }
    ObjectMapper mapper = context.getService(TypeManager.class).getMapper();
    exporter = new SmugMugPhotosExporter(appCredentials, mapper, jobStore, monitor);
    importer = new SmugMugPhotosImporter(jobStore, appCredentials, mapper, monitor);
    initialized = true;
}
Also used : TemporaryPerJobDataStore(org.datatransferproject.spi.cloud.storage.TemporaryPerJobDataStore) Monitor(org.datatransferproject.api.launcher.Monitor) AppCredentials(org.datatransferproject.types.transfer.auth.AppCredentials) TypeManager(org.datatransferproject.api.launcher.TypeManager) SmugMugPhotosImporter(org.datatransferproject.transfer.smugmug.photos.SmugMugPhotosImporter) SmugMugPhotosExporter(org.datatransferproject.transfer.smugmug.photos.SmugMugPhotosExporter) IOException(java.io.IOException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IOException (java.io.IOException)1 Monitor (org.datatransferproject.api.launcher.Monitor)1 TypeManager (org.datatransferproject.api.launcher.TypeManager)1 TemporaryPerJobDataStore (org.datatransferproject.spi.cloud.storage.TemporaryPerJobDataStore)1 SmugMugPhotosExporter (org.datatransferproject.transfer.smugmug.photos.SmugMugPhotosExporter)1 SmugMugPhotosImporter (org.datatransferproject.transfer.smugmug.photos.SmugMugPhotosImporter)1 AppCredentials (org.datatransferproject.types.transfer.auth.AppCredentials)1