use of org.datatransferproject.api.launcher.Monitor in project data-transfer-project by google.
the class FacebookTransferExtension method initialize.
@Override
public void initialize(ExtensionContext context) {
if (initialized)
return;
AppCredentials appCredentials;
final Monitor monitor = context.getMonitor();
try {
appCredentials = context.getService(AppCredentialStore.class).getAppCredentials("FACEBOOK_KEY", "FACEBOOK_SECRET");
} catch (IOException e) {
monitor.info(() -> "Unable to retrieve Facebook AppCredentials. Did you set FACEBOOK_KEY and FACEBOOK_SECRET?", e);
return;
}
ImmutableMap.Builder<String, Importer> importerBuilder = ImmutableMap.builder();
importerBuilder.put("VIDEOS", new FacebookVideosImporter(appCredentials));
importerMap = importerBuilder.build();
ImmutableMap.Builder<String, Exporter> exporterBuilder = ImmutableMap.builder();
exporterBuilder.put("PHOTOS", new FacebookPhotosExporter(appCredentials, monitor, context.getService(TemporaryPerJobDataStore.class)));
exporterBuilder.put("VIDEOS", new FacebookVideosExporter(appCredentials, monitor));
exporterMap = exporterBuilder.build();
initialized = true;
}
use of org.datatransferproject.api.launcher.Monitor in project data-transfer-project by google.
the class DeezerTransferExtension method initialize.
@Override
public void initialize(ExtensionContext context) {
if (initialized) {
Monitor monitor = context.getMonitor();
monitor.severe(() -> "DeezerTransferExtension already initialized");
return;
}
Monitor monitor = context.getMonitor();
HttpTransport httpTransport = context.getService(HttpTransport.class);
TransferServiceConfig transferServiceConfig = context.getService(TransferServiceConfig.class);
exporter = new DeezerPlaylistExporter(monitor, httpTransport, transferServiceConfig);
importer = new DeezerPlaylistImporter(monitor, httpTransport, transferServiceConfig);
initialized = true;
}
Aggregations