Revision 39411
Added by Claudio Atzori over 8 years ago
modules/dnet-download-service/trunk/src/main/java/eu/dnetlib/data/download/DownloadServiceImpl.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.data.download; |
2 | 2 |
|
3 |
import java.security.KeyManagementException; |
|
4 |
import java.security.NoSuchAlgorithmException; |
|
5 |
import java.security.cert.CertificateException; |
|
6 |
import java.util.ArrayList; |
|
7 |
import java.util.List; |
|
8 |
|
|
9 |
import javax.annotation.Resource; |
|
10 |
import javax.net.ssl.HostnameVerifier; |
|
11 |
import javax.net.ssl.HttpsURLConnection; |
|
12 |
import javax.net.ssl.SSLContext; |
|
13 |
import javax.net.ssl.SSLSession; |
|
14 |
import javax.net.ssl.TrustManager; |
|
15 |
import javax.net.ssl.X509TrustManager; |
|
16 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
|
17 |
|
|
18 |
import org.apache.commons.logging.Log; |
|
19 |
import org.apache.commons.logging.LogFactory; |
|
20 |
import org.springframework.beans.factory.annotation.Required; |
|
21 |
import org.springframework.beans.factory.annotation.Value; |
|
22 |
|
|
23 | 3 |
import eu.dnetlib.data.download.rmi.DownloadItem; |
24 | 4 |
import eu.dnetlib.data.download.rmi.DownloadService; |
25 | 5 |
import eu.dnetlib.data.download.rmi.DownloadServiceException; |
... | ... | |
27 | 7 |
import eu.dnetlib.data.objectstore.rmi.ObjectStoreServiceException; |
28 | 8 |
import eu.dnetlib.enabling.tools.AbstractBaseService; |
29 | 9 |
import eu.dnetlib.enabling.tools.blackboard.NotificationHandler; |
10 |
import org.apache.commons.logging.Log; |
|
11 |
import org.apache.commons.logging.LogFactory; |
|
12 |
import org.springframework.beans.factory.annotation.Required; |
|
13 |
import org.springframework.beans.factory.annotation.Value; |
|
30 | 14 |
|
15 |
import javax.annotation.Resource; |
|
16 |
import javax.net.ssl.*; |
|
17 |
import javax.xml.ws.wsaddressing.W3CEndpointReference; |
|
18 |
import java.security.KeyManagementException; |
|
19 |
import java.security.NoSuchAlgorithmException; |
|
20 |
import java.security.cert.CertificateException; |
|
21 |
import java.util.ArrayList; |
|
22 |
import java.util.List; |
|
23 |
|
|
31 | 24 |
/** |
32 | 25 |
* The Class DownloadServiceImpl. |
33 | 26 |
*/ |
34 | 27 |
public class DownloadServiceImpl extends AbstractBaseService implements DownloadService { |
35 | 28 |
|
36 |
/** The Constant log. */ |
|
37 |
private static final Log log = LogFactory.getLog(DownloadServiceImpl.class); |
|
38 |
|
|
39 |
/** The Constant END_QUEUE. */ |
|
29 |
/** |
|
30 |
* The Constant END_QUEUE. |
|
31 |
*/ |
|
40 | 32 |
public static final DownloadItem END_QUEUE = new DownloadItem(); |
41 | 33 |
|
42 | 34 |
public static final String END_QUEUE_STRING = "END_DOWNLOAD"; |
43 | 35 |
|
44 |
@Resource |
|
45 |
private DownloadServiceFeeder downloadfeeder; |
|
36 |
/** |
|
37 |
* The Constant log. |
|
38 |
*/ |
|
39 |
private static final Log log = LogFactory.getLog(DownloadServiceImpl.class); |
|
46 | 40 |
|
47 |
/** The download plugin enumerator. */ |
|
41 |
/** |
|
42 |
* The download plugin enumerator. |
|
43 |
*/ |
|
48 | 44 |
@Resource |
49 | 45 |
DownloadPluginEnumeratorImpl downloadPluginEnumerator; |
50 | 46 |
|
51 |
/** The notification handler. */ |
|
47 |
@Resource |
|
48 |
private DownloadServiceFeeder downloadfeeder; |
|
49 |
|
|
50 |
/** |
|
51 |
* The notification handler. |
|
52 |
*/ |
|
52 | 53 |
private NotificationHandler notificationHandler; |
53 | 54 |
|
54 | 55 |
@Value("${services.download.http.sslcheck}") |
... | ... | |
67 | 68 |
final String protocol, |
68 | 69 |
final String mimeType) throws DownloadServiceException { |
69 | 70 |
|
70 |
log.info(String.format("Try to download using plugin '%s' , protocol '%s' into ObjectStore '%s'", plugin, protocol, objectStoreID));
|
|
71 |
log.info(String.format("download using plugin '%s' , protocol '%s' into ObjectStore '%s'", plugin, protocol, objectStoreID)); |
|
71 | 72 |
try { |
72 | 73 |
downloadfeeder.download(resultSet.toString(), plugin, objectStoreID, protocol, mimeType, 5, null, null); |
73 | 74 |
} catch (ObjectStoreServiceException e) { |
... | ... | |
153 | 154 |
} |
154 | 155 |
|
155 | 156 |
/** |
156 |
* @param downloadfeeder |
|
157 |
* the downloadfeeder to set |
|
157 |
* @param downloadfeeder the downloadfeeder to set |
|
158 | 158 |
*/ |
159 | 159 |
public void setDownloadfeeder(final DownloadServiceFeeder downloadfeeder) { |
160 | 160 |
this.downloadfeeder = downloadfeeder; |
... | ... | |
168 | 168 |
} |
169 | 169 |
|
170 | 170 |
/** |
171 |
* @param notificationHandler |
|
172 |
* the notificationHandler to set |
|
171 |
* @param notificationHandler the notificationHandler to set |
|
173 | 172 |
*/ |
174 | 173 |
@Required |
175 | 174 |
public void setNotificationHandler(final NotificationHandler notificationHandler) { |
Also available in: Unified diff
logs