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 Summary
Fields Modifier and Type Field Description protected FailedOpenURLTrackerServicefailedOpenUrlTrackerService
-
Constructor Summary
Constructors Constructor Description OpenUrlServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.http.client.HttpClientgetHttpClient(org.apache.http.client.config.RequestConfig requestConfig)protected org.apache.http.client.config.RequestConfiggetHttpClientRequestConfig()protected intgetResponseCodeFromUrl(String urlStr)Returns the response code from accessing the url.voidlogfailed(Context context, String url)Log a failed url in the databasevoidprocessUrl(Context c, String urlStr)Processes the url When the contacting the url fails, the url will be logged in a db tablevoidreprocessFailedQueue(Context context)Reprocess all url trackers present in the databaseprotected voidtryReprocessFailed(Context context, OpenURLTracker tracker)Retry to send a failed url
-
-
-
Field Detail
-
failedOpenUrlTrackerService
@Autowired protected FailedOpenURLTrackerService failedOpenUrlTrackerService
-
-
Method Detail
-
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:
processUrlin interfaceOpenUrlService- Parameters:
c- - the contexturlStr- - 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.client.HttpClient 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:
reprocessFailedQueuein interfaceOpenUrlService- Parameters:
context-- Throws:
SQLException
-
logfailed
public void logfailed(Context context, String url) throws SQLException
Log a failed url in the database- Specified by:
logfailedin interfaceOpenUrlService- Parameters:
context-url-- Throws:
SQLException
-
-