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