Search in sources :

Example 1 with TransferServiceConfig

use of org.datatransferproject.types.transfer.serviceconfig.TransferServiceConfig in project data-transfer-project by google.

the class FlickrTransferExtension method initialize.

@Override
public void initialize(ExtensionContext context) {
    if (initialized)
        return;
    jobStore = context.getService(TemporaryPerJobDataStore.class);
    Monitor monitor = context.getMonitor();
    try {
        appCredentials = context.getService(AppCredentialStore.class).getAppCredentials(FLICKR_KEY, FLICKR_SECRET);
    } catch (Exception e) {
        monitor.info(() -> format("Unable to retrieve Flickr AppCredentials. Did you set %s and %s?", FLICKR_KEY, FLICKR_SECRET), e);
        initialized = false;
        return;
    }
    TransferServiceConfig serviceConfig = context.getService(TransferServiceConfig.class);
    importer = new FlickrPhotosImporter(appCredentials, jobStore, monitor, serviceConfig);
    exporter = new FlickrPhotosExporter(appCredentials, serviceConfig);
    initialized = true;
}
Also used : FlickrPhotosImporter(org.datatransferproject.datatransfer.flickr.photos.FlickrPhotosImporter) TemporaryPerJobDataStore(org.datatransferproject.spi.cloud.storage.TemporaryPerJobDataStore) Monitor(org.datatransferproject.api.launcher.Monitor) FlickrPhotosExporter(org.datatransferproject.datatransfer.flickr.photos.FlickrPhotosExporter) TransferServiceConfig(org.datatransferproject.types.transfer.serviceconfig.TransferServiceConfig)

Example 2 with TransferServiceConfig

use of org.datatransferproject.types.transfer.serviceconfig.TransferServiceConfig 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;
}
Also used : HttpTransport(com.google.api.client.http.HttpTransport) DeezerPlaylistExporter(org.datatransferproject.transfer.deezer.playlists.DeezerPlaylistExporter) Monitor(org.datatransferproject.api.launcher.Monitor) TransferServiceConfig(org.datatransferproject.types.transfer.serviceconfig.TransferServiceConfig) DeezerPlaylistImporter(org.datatransferproject.transfer.deezer.playlists.DeezerPlaylistImporter)

Aggregations

Monitor (org.datatransferproject.api.launcher.Monitor)2 TransferServiceConfig (org.datatransferproject.types.transfer.serviceconfig.TransferServiceConfig)2 HttpTransport (com.google.api.client.http.HttpTransport)1 FlickrPhotosExporter (org.datatransferproject.datatransfer.flickr.photos.FlickrPhotosExporter)1 FlickrPhotosImporter (org.datatransferproject.datatransfer.flickr.photos.FlickrPhotosImporter)1 TemporaryPerJobDataStore (org.datatransferproject.spi.cloud.storage.TemporaryPerJobDataStore)1 DeezerPlaylistExporter (org.datatransferproject.transfer.deezer.playlists.DeezerPlaylistExporter)1 DeezerPlaylistImporter (org.datatransferproject.transfer.deezer.playlists.DeezerPlaylistImporter)1