Class OpenUrlServiceImpl

java.lang.Object
org.dspace.statistics.export.service.OpenUrlServiceImpl
All Implemented Interfaces:
OpenUrlService

public class OpenUrlServiceImpl extends Object implements OpenUrlService
Implementation of the OpenUrlService interface
  • Field Details

  • Constructor Details

    • OpenUrlServiceImpl

      public OpenUrlServiceImpl()
  • Method Details

    • processUrl

      public void processUrl(Context c, String urlStr) throws SQLException
      Processes the url When the contacting the url fails, the url will be logged in a db table
      Specified by:
      processUrl in interface OpenUrlService
      Parameters:
      c - - the context
      urlStr - - the url to be processed
      Throws:
      SQLException
    • getResponseCodeFromUrl

      protected int getResponseCodeFromUrl(String urlStr) throws IOException
      Returns the response code from accessing the url. Returns a http status 408 when the external service doesn't reply in 10 seconds
      Parameters:
      urlStr -
      Returns:
      response code from the url
      Throws:
      IOException
    • getHttpClient

      protected org.apache.http.impl.client.CloseableHttpClient getHttpClient(org.apache.http.client.config.RequestConfig requestConfig)
    • getHttpClientRequestConfig

      protected org.apache.http.client.config.RequestConfig getHttpClientRequestConfig()
    • tryReprocessFailed

      protected void tryReprocessFailed(Context context, OpenURLTracker tracker) throws SQLException
      Retry to send a failed url
      Parameters:
      context -
      tracker - - db object containing the failed url
      Throws:
      SQLException
    • reprocessFailedQueue

      public void reprocessFailedQueue(Context context) throws SQLException
      Reprocess all url trackers present in the database
      Specified by:
      reprocessFailedQueue in interface OpenUrlService
      Parameters:
      context -
      Throws:
      SQLException
    • logfailed

      public void logfailed(Context context, String url) throws SQLException
      Log a failed url in the database
      Specified by:
      logfailed in interface OpenUrlService
      Parameters:
      context -
      url -
      Throws:
      SQLException