Project

General

Profile

« Previous | Next » 

Revision 60646

Openaire API with Access Token

View differences:

GenericDoiMdstorePlugin.java
13 13

  
14 14
	private static final Log log = LogFactory.getLog(GenericDoiMdstorePlugin.class);
15 15

  
16
	private String accessToken;
17

  
16 18
	@Override
17 19
	protected final boolean updateRecord(final String recordId, final MdRecord record) {
18 20
		for (final String doi : record.getDois()) {
......
29 31

  
30 32
	private String download(final String doi) {
31 33
		try {
32
			return HttpFetcher.fetch(prepareURI(doi));
34
			return HttpFetcher.fetch(prepareURI(doi), accessToken);
33 35
		} catch (final URISyntaxException e) {
34 36
			log.error("Error resolving doi: " + doi, e);
35 37
			return null;
38
		} finally {
39
			try {
40
				Thread.sleep(1000);
41
			} catch (final InterruptedException e) {
42
				log.warn("Error during sleep", e);
43
			}
36 44
		}
37 45
	}
38 46

  
47
	public String getAccessToken() {
48
		return accessToken;
49
	}
50

  
51
	public void setAccessToken(final String accessToken) {
52
		this.accessToken = accessToken;
53
	}
54

  
39 55
}

Also available in: Unified diff