use of org.datatransferproject.api.launcher.Monitor 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;
}
use of org.datatransferproject.api.launcher.Monitor in project data-transfer-project by google.
the class BackblazeTransferExtension method initialize.
@Override
public void initialize(ExtensionContext context) {
Monitor monitor = context.getMonitor();
monitor.debug(() -> "Starting Backblaze initialization");
if (initialized) {
monitor.severe(() -> "BackblazeTransferExtension already initialized.");
return;
}
TemporaryPerJobDataStore jobStore = context.getService(TemporaryPerJobDataStore.class);
ImmutableMap.Builder<String, Importer> importerBuilder = ImmutableMap.builder();
BackblazeDataTransferClientFactory backblazeDataTransferClientFactory = new BackblazeDataTransferClientFactory(monitor);
ImageStreamProvider isProvider = new ImageStreamProvider();
importerBuilder.put("PHOTOS", new BackblazePhotosImporter(monitor, jobStore, isProvider, backblazeDataTransferClientFactory));
importerBuilder.put("VIDEOS", new BackblazeVideosImporter(monitor, jobStore, isProvider, backblazeDataTransferClientFactory));
importerMap = importerBuilder.build();
initialized = true;
}
use of org.datatransferproject.api.launcher.Monitor in project data-transfer-project by google.
the class JettyRestExtension method initialize.
@Override
public void initialize(ExtensionContext context) {
Monitor monitor = context.getMonitor();
JettyMonitor.setDelegate(monitor);
KeyStore keyStore = context.getService(KeyStore.class);
boolean useHttps = context.getSetting("useHttps", true);
transport = new JettyTransport(keyStore, useHttps, monitor);
binder = new JerseyTransportBinder(transport);
context.registerService(TransportBinder.class, binder);
}
use of org.datatransferproject.api.launcher.Monitor in project data-transfer-project by google.
the class TwitterTransferExtension method initialize.
@Override
public void initialize(ExtensionContext context) {
Monitor monitor = context.getMonitor();
monitor.debug(() -> "Starting Twitter initialization");
if (initialized) {
monitor.severe(() -> "TwitterTransferExtension already initialized.");
return;
}
AppCredentials appCredentials;
try {
appCredentials = context.getService(AppCredentialStore.class).getAppCredentials(TWITTER_KEY, TWITTER_SECRET);
} catch (IOException e) {
monitor.info(() -> format("Unable to retrieve Twitter AppCredentials. Did you set %s and %s?", TWITTER_KEY, TWITTER_SECRET), e);
return;
}
exporter = new TwitterPhotosExporter(appCredentials, monitor);
importer = new TwitterPhotosImporter(appCredentials, monitor);
initialized = true;
}
use of org.datatransferproject.api.launcher.Monitor in project data-transfer-project by google.
the class ApiMain method main.
/**
* Starts the api server, currently the reference implementation.
*/
public static void main(String[] args) {
Monitor monitor = loadMonitor();
monitor.info(() -> "Starting API Server.");
Thread.setDefaultUncaughtExceptionHandler((thread, t) -> monitor.severe(() -> "Uncaught exception in thread: " + thread.getName(), t));
ApiMain apiMain = new ApiMain(monitor);
apiMain.initializeHttp();
apiMain.start();
}
Aggregations