Revision 61308
Added by Andreas Czerniak almost 3 years ago
modules/dnet-modular-collector-service/trunk/src/main/java/eu/dnetlib/data/collector/plugins/oai/OaiIterator.java | ||
---|---|---|
4 | 4 |
import java.io.UnsupportedEncodingException; |
5 | 5 |
import java.net.URLEncoder; |
6 | 6 |
import java.util.Iterator; |
7 |
import java.util.Map; |
|
7 | 8 |
import java.util.Queue; |
8 | 9 |
import java.util.concurrent.PriorityBlockingQueue; |
9 | 10 |
|
11 |
import com.google.common.collect.Maps; |
|
12 |
|
|
10 | 13 |
import org.apache.commons.lang3.StringUtils; |
11 | 14 |
import org.apache.commons.logging.Log; |
12 | 15 |
import org.apache.commons.logging.LogFactory; |
... | ... | |
35 | 38 |
private String token; |
36 | 39 |
private boolean started; |
37 | 40 |
private HttpConnector httpConnector; |
41 |
private Map<String, String> requestHeader; |
|
38 | 42 |
|
39 | 43 |
public OaiIterator(final String baseUrl, final String mdFormat, final String set, final String fromDate, final String untilDate, final HttpConnector httpConnector) { |
40 | 44 |
this.baseUrl = baseUrl; |
... | ... | |
44 | 48 |
this.untilDate = untilDate; |
45 | 49 |
this.started = false; |
46 | 50 |
this.httpConnector = httpConnector; |
51 |
this.requestHeader = requestHeader != null ? requestHeader : Maps.newHashMap(); |
|
47 | 52 |
} |
48 | 53 |
|
49 | 54 |
private void verifyStarted() { |
... | ... | |
90 | 95 |
if ((set != null) && !set.isEmpty()) { |
91 | 96 |
url += "&set=" + URLEncoder.encode(set,"UTF-8"); |
92 | 97 |
} |
93 |
// http://www.openarchives.org/OAI/openarchivesprotocol.html#Dates , eg. 1957-03-20T20:30:00Z |
|
98 |
// ISO8601 , http://www.openarchives.org/OAI/openarchivesprotocol.html#Dates , eg. 1957-03-20T20:30:00Z
|
|
94 | 99 |
if ((fromDate != null) && (fromDate.matches("\\d{4}-\\d{2}-\\d{2}") || fromDate.matches("\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z")) ) { |
95 | 100 |
url += "&from=" + URLEncoder.encode(fromDate,"UTF-8"); |
96 | 101 |
} |
Also available in: Unified diff
adding from/until dates aligned with OAI v2, ISO8601 (refs #6839)