예제 #1
0
  /**
   * Initialises the RODA client services.
   *
   * @throws PluginException if an error occurred during initialisation
   */
  private void initClientServices() throws PluginException {

    final String rodaClientServiceUrl =
        getParameterValues().get(AbstractPlugin.PARAMETER_RODA_CORE_URL().getName());
    final String rodaClientUsername =
        getParameterValues().get(AbstractPlugin.PARAMETER_RODA_CORE_USERNAME().getName());
    final String rodaClientPassword =
        getParameterValues().get(AbstractPlugin.PARAMETER_RODA_CORE_PASSWORD().getName());

    try {

      rodaClient =
          new RODAClient(new URL(rodaClientServiceUrl), rodaClientUsername, rodaClientPassword);
      rodaUploader =
          new Uploader(new URL(rodaClientServiceUrl), rodaClientUsername, rodaClientPassword);
      rodaDownloader = rodaClient.getDownloader();

    } catch (RODAClientException e) {
      logger.debug("Exception creating RODA Client - " + e.getMessage(), e);
      throw new PluginException("Exception creating RODA Client - " + e.getMessage(), e);
    } catch (LoginException e) {
      logger.debug("Exception creating RODA Client - " + e.getMessage(), e);
      throw new PluginException("Exception creating RODA Client - " + e.getMessage(), e);
    } catch (MalformedURLException e) {
      logger.debug("Exception creating service URL - " + e.getMessage(), e);
      throw new PluginException("Exception creating service URL - " + e.getMessage(), e);
    } catch (DownloaderException e) {
      logger.debug("Exception creating RODA downloader - " + e.getMessage(), e);
      throw new PluginException("Exception creating service URL - " + e.getMessage(), e);
    }
  }
  private void initClientServices() throws PluginException {
    try {

      this.rodaClient =
          new RODAClient(
              getParameterRodaServicesURL(),
              getParameterRodaServicesUsername(),
              getParameterRodaServicesPassword());
      this.rodaUploader =
          new Uploader(
              getParameterRodaServicesURL(),
              getParameterRodaServicesUsername(),
              getParameterRodaServicesPassword());
      this.rodaDownloader =
          new Downloader(
              getParameterRodaServicesURL(),
              getParameterRodaServicesUsername(),
              getParameterRodaServicesPassword());

    } catch (RODAClientException e) {
      logger.debug("Error creating RODA client - " + e.getMessage(), e);
      throw new PluginException("Error creating RODA client - " + e.getMessage(), e);
    } catch (LoginException e) {
      logger.debug("Error creating RODA client - " + e.getMessage(), e);
      throw new PluginException("Error creating RODA client - " + e.getMessage(), e);
    } catch (MalformedURLException e) {
      logger.debug("Error creating RODA client - " + e.getMessage(), e);
      throw new PluginException("Error creating RODA client - " + e.getMessage(), e);
    } catch (DownloaderException e) {
      logger.debug("Error creating RODA downloader - " + e.getMessage(), e);
      throw new PluginException("Error creating RODA downloader - " + e.getMessage(), e);
    }

    try {

      this.browserService = this.rodaClient.getBrowserService();

    } catch (RODAClientException e) {
      logger.debug("Error accessing Browser service - " + e.getMessage(), e);
      throw new PluginException("Error accessing Browser service - " + e.getMessage(), e);
    }

    try {

      this.ingestService = this.rodaClient.getIngestService();

    } catch (RODAClientException e) {
      logger.debug("Error accessing Ingest service - " + e.getMessage(), e);
      throw new PluginException("Error accessing Ingest service - " + e.getMessage(), e);
    }

    this.migratorClient = new MigratorClient();
  }