Revision 51852
Added by Michele Artini over 6 years ago
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/utils/HttpFetcher.java | ||
---|---|---|
1 |
package eu.dnetlib.data.utils; |
|
2 |
|
|
3 |
import java.net.URI; |
|
4 |
import java.net.URISyntaxException; |
|
5 |
import java.security.KeyManagementException; |
|
6 |
import java.security.KeyStoreException; |
|
7 |
import java.security.NoSuchAlgorithmException; |
|
8 |
import java.util.concurrent.TimeUnit; |
|
9 |
|
|
10 |
import org.apache.commons.logging.Log; |
|
11 |
import org.apache.commons.logging.LogFactory; |
|
12 |
import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
|
13 |
import org.apache.http.impl.client.HttpClientBuilder; |
|
14 |
import org.apache.http.ssl.SSLContextBuilder; |
|
15 |
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
|
16 |
import org.springframework.web.client.RestTemplate; |
|
17 |
|
|
18 |
import eu.dnetlib.data.mdstore.plugins.GenericDoiMdstorePlugin; |
|
19 |
|
|
20 |
public class HttpFetcher { |
|
21 |
|
|
22 |
private static final Log log = LogFactory.getLog(GenericDoiMdstorePlugin.class); |
|
23 |
public static final int MAX_NUMBER_OF_ATTEMPTS = 10; |
|
24 |
private static final int INTERVAL_MILLIS = 20000; |
|
25 |
|
|
26 |
private static final SSLContextBuilder sslContextBuilder = new SSLContextBuilder(); |
|
27 |
private static SSLConnectionSocketFactory sslSocketFactory; |
|
28 |
static { |
|
29 |
try { |
|
30 |
sslContextBuilder.loadTrustMaterial(null, (chain, authType) -> true); |
|
31 |
sslSocketFactory = new SSLConnectionSocketFactory(sslContextBuilder.build()); |
|
32 |
} catch (final NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { |
|
33 |
log.error(e);; |
|
34 |
} |
|
35 |
} |
|
36 |
private static final HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(HttpClientBuilder |
|
37 |
.create() |
|
38 |
.setConnectionTimeToLive(0, TimeUnit.MILLISECONDS) |
|
39 |
.setMaxConnPerRoute(1) |
|
40 |
.setMaxConnTotal(1) |
|
41 |
.disableAutomaticRetries() |
|
42 |
.disableConnectionState() |
|
43 |
.setSSLSocketFactory(sslSocketFactory) |
|
44 |
.build()); |
|
45 |
|
|
46 |
public static String fetch(final String url) throws URISyntaxException { |
|
47 |
return fetch(new URI(url), MAX_NUMBER_OF_ATTEMPTS); |
|
48 |
} |
|
49 |
|
|
50 |
public static String fetch(final URI url) { |
|
51 |
return fetch(url, MAX_NUMBER_OF_ATTEMPTS); |
|
52 |
} |
|
53 |
|
|
54 |
public static String fetch(final URI url, final int attempts) { |
|
55 |
if (attempts == 0) { throw new RuntimeException("Max number of attempts reached, downloading url: " + url); } |
|
56 |
|
|
57 |
try { |
|
58 |
return (new RestTemplate(httpRequestFactory)).getForObject(url, String.class); |
|
59 |
} catch (final Exception e) { |
|
60 |
try { |
|
61 |
log.error("Error downloading url: " + url + " - " + e.getMessage()); |
|
62 |
Thread.sleep(INTERVAL_MILLIS); |
|
63 |
return fetch(url, attempts - 1); |
|
64 |
} catch (final InterruptedException e1) { |
|
65 |
throw new RuntimeException(e1); |
|
66 |
} |
|
67 |
} |
|
68 |
} |
|
69 |
} |
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/mdstore/plugins/EnrichDatasetsPlugin.java | ||
---|---|---|
4 | 4 |
import java.net.URISyntaxException; |
5 | 5 |
import java.util.ArrayList; |
6 | 6 |
import java.util.List; |
7 |
import java.util.Map; |
|
7 | 8 |
|
8 | 9 |
import org.apache.commons.lang3.StringUtils; |
9 | 10 |
import org.springframework.beans.factory.annotation.Value; |
... | ... | |
29 | 30 |
} |
30 | 31 |
|
31 | 32 |
@Override |
32 |
protected void reconfigure() {} |
|
33 |
protected void reconfigure(final Map<String, String> params) {}
|
|
33 | 34 |
|
34 | 35 |
@Override |
35 | 36 |
protected boolean updateDocument(final MdRecord doc, final String response) { |
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/mdstore/plugins/EnrichProjectsPlugin.java | ||
---|---|---|
25 | 25 |
private Map<String, Project> mapProjects = new HashMap<>(); |
26 | 26 |
|
27 | 27 |
@Override |
28 |
protected void reconfigure() { |
|
28 |
protected void reconfigure(final Map<String, String> params) {
|
|
29 | 29 |
log.info("Cleaning projects cache"); |
30 | 30 |
mapProjects.clear(); |
31 | 31 |
} |
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/mdstore/plugins/EnrichCollectionPlugin.java | ||
---|---|---|
1 |
package eu.dnetlib.data.mdstore.plugins; |
|
2 |
|
|
3 |
import java.io.StringReader; |
|
4 |
import java.net.URISyntaxException; |
|
5 |
import java.util.ArrayList; |
|
6 |
import java.util.HashMap; |
|
7 |
import java.util.List; |
|
8 |
import java.util.Map; |
|
9 |
import java.util.Objects; |
|
10 |
import java.util.regex.Matcher; |
|
11 |
import java.util.regex.Pattern; |
|
12 |
import java.util.stream.Collectors; |
|
13 |
|
|
14 |
import org.apache.commons.logging.Log; |
|
15 |
import org.apache.commons.logging.LogFactory; |
|
16 |
import org.dom4j.Document; |
|
17 |
import org.dom4j.DocumentException; |
|
18 |
import org.dom4j.Node; |
|
19 |
import org.dom4j.io.SAXReader; |
|
20 |
import org.springframework.beans.factory.annotation.Autowired; |
|
21 |
|
|
22 |
import eu.dnetlib.data.mdstore.plugins.objects.CnrCollection; |
|
23 |
import eu.dnetlib.data.mdstore.plugins.objects.MdRecord; |
|
24 |
import eu.dnetlib.data.utils.HttpFetcher; |
|
25 |
import eu.dnetlib.enabling.locators.UniqueServiceLocator; |
|
26 |
import eu.dnetlib.rmi.enabling.ISLookUpService; |
|
27 |
|
|
28 |
public class EnrichCollectionPlugin extends MdRecordPlugin { |
|
29 |
|
|
30 |
private Map<String, CnrCollection> colls = new HashMap<>(); |
|
31 |
|
|
32 |
private static final Log log = LogFactory.getLog(EnrichCollectionPlugin.class); |
|
33 |
|
|
34 |
@Autowired |
|
35 |
private UniqueServiceLocator serviceLocator; |
|
36 |
|
|
37 |
@Override |
|
38 |
protected void reconfigure(final Map<String, String> params) { |
|
39 |
|
|
40 |
params.entrySet().forEach(e -> log.info(String.format("******************* %s -> %s", e.getKey(), e.getValue()))); |
|
41 |
|
|
42 |
try { |
|
43 |
final String profile = serviceLocator.getService(ISLookUpService.class).getResourceProfile(params.get("dsId")); |
|
44 |
final Document doc = new SAXReader().read(new StringReader(profile)); |
|
45 |
final String baseUrl = doc.valueOf("//INTERFACE[@id='" + params.get("dsInterface") + "']/BASE_URL").trim(); |
|
46 |
|
|
47 |
colls.clear(); |
|
48 |
colls.putAll(listOaiCollections(baseUrl + "?verb=ListSets").stream() |
|
49 |
.map(this::createCollection) |
|
50 |
.filter(Objects::nonNull) |
|
51 |
.collect(Collectors.toMap(CnrCollection::getCode, o -> o))); |
|
52 |
|
|
53 |
} catch (final Exception e) { |
|
54 |
log.error("Error evaluating ListSets", e); |
|
55 |
throw new RuntimeException("Error evaluating ListSets", e); |
|
56 |
} |
|
57 |
|
|
58 |
} |
|
59 |
|
|
60 |
@Override |
|
61 |
protected boolean updateRecord(final MdRecord record) { |
|
62 |
for (final CnrCollection c : record.getInCollections()) { |
|
63 |
if (colls.containsKey(c.getCode())) { |
|
64 |
c.setName(colls.get(c.getCode()).getName()); |
|
65 |
c.setAcronym(colls.get(c.getCode()).getAcronym()); |
|
66 |
} |
|
67 |
} |
|
68 |
return true; |
|
69 |
} |
|
70 |
|
|
71 |
@SuppressWarnings("unchecked") |
|
72 |
private List<Node> listOaiCollections(final String listSetsUrl) { |
|
73 |
try { |
|
74 |
final SAXReader reader = new SAXReader(); |
|
75 |
final String s = HttpFetcher.fetch(listSetsUrl); |
|
76 |
final Document doc = reader.read(new StringReader(s)); |
|
77 |
return doc.selectNodes("//*[local-name() = 'ListSets']/*[local-name() = 'set']"); |
|
78 |
} catch (final DocumentException | URISyntaxException e) { |
|
79 |
log.error("Error listing sets from url: " + listSetsUrl, e); |
|
80 |
return new ArrayList<>(); |
|
81 |
} |
|
82 |
} |
|
83 |
|
|
84 |
private CnrCollection createCollection(final Node n) { |
|
85 |
|
|
86 |
final CnrCollection c = new CnrCollection(); |
|
87 |
final String code = n.valueOf("./*[local-name() = 'setSpec']").trim(); |
|
88 |
|
|
89 |
c.setCode(n.valueOf("./*[local-name() = 'setSpec']").trim()); |
|
90 |
|
|
91 |
if (code.equalsIgnoreCase("openaire")) { |
|
92 |
c.setAcronym("openaire"); |
|
93 |
c.setName("Openaire Collection"); |
|
94 |
} else { |
|
95 |
final String desc = n.valueOf("./*[local-name() = 'setDescription']").trim(); |
|
96 |
final Matcher m = Pattern.compile("^Prodotti della ricerca di (.+) \\- (.+)$").matcher(desc); |
|
97 |
if (m.matches()) { |
|
98 |
c.setAcronym(m.group(1)); |
|
99 |
c.setName(m.group(2)); |
|
100 |
} else { |
|
101 |
c.setAcronym(desc); |
|
102 |
c.setName(desc); |
|
103 |
} |
|
104 |
} |
|
105 |
return c; |
|
106 |
} |
|
107 |
|
|
108 |
} |
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/mdstore/plugins/GenericDoiMdstorePlugin.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.net.URI; |
4 | 4 |
import java.net.URISyntaxException; |
5 |
import java.security.KeyManagementException; |
|
6 |
import java.security.KeyStoreException; |
|
7 |
import java.security.NoSuchAlgorithmException; |
|
8 |
import java.util.concurrent.TimeUnit; |
|
9 | 5 |
|
10 | 6 |
import org.apache.commons.logging.Log; |
11 | 7 |
import org.apache.commons.logging.LogFactory; |
12 |
import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
|
13 |
import org.apache.http.impl.client.HttpClientBuilder; |
|
14 |
import org.apache.http.ssl.SSLContextBuilder; |
|
15 |
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
|
16 |
import org.springframework.web.client.RestTemplate; |
|
17 | 8 |
|
18 | 9 |
import eu.dnetlib.data.mdstore.plugins.objects.MdRecord; |
10 |
import eu.dnetlib.data.utils.HttpFetcher; |
|
19 | 11 |
|
20 | 12 |
public abstract class GenericDoiMdstorePlugin extends MdRecordPlugin { |
21 | 13 |
|
22 | 14 |
private static final Log log = LogFactory.getLog(GenericDoiMdstorePlugin.class); |
23 | 15 |
|
24 |
private static final int MAX_NUMBER_OF_ATTEMPTS = 10; |
|
25 |
private static final int INTERVAL_MILLIS = 20000; |
|
26 |
|
|
27 |
private static final SSLContextBuilder sslContextBuilder = new SSLContextBuilder(); |
|
28 |
private static SSLConnectionSocketFactory sslSocketFactory; |
|
29 |
static { |
|
30 |
try { |
|
31 |
sslContextBuilder.loadTrustMaterial(null, (chain, authType) -> true); |
|
32 |
sslSocketFactory = new SSLConnectionSocketFactory(sslContextBuilder.build()); |
|
33 |
} catch (final NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { |
|
34 |
log.error(e);; |
|
35 |
} |
|
36 |
} |
|
37 |
|
|
38 |
private static final HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(HttpClientBuilder |
|
39 |
.create() |
|
40 |
.setConnectionTimeToLive(0, TimeUnit.MILLISECONDS) |
|
41 |
.setMaxConnPerRoute(1) |
|
42 |
.setMaxConnTotal(1) |
|
43 |
.disableAutomaticRetries() |
|
44 |
.disableConnectionState() |
|
45 |
.setSSLSocketFactory(sslSocketFactory) |
|
46 |
.build()); |
|
47 |
|
|
48 | 16 |
@Override |
49 | 17 |
protected final boolean updateRecord(final MdRecord record) { |
50 | 18 |
for (final String doi : record.getDois()) { |
... | ... | |
61 | 29 |
|
62 | 30 |
private String download(final String doi) { |
63 | 31 |
try { |
64 |
return fetchUrl(prepareURI(doi), MAX_NUMBER_OF_ATTEMPTS);
|
|
32 |
return HttpFetcher.fetch(prepareURI(doi));
|
|
65 | 33 |
} catch (final URISyntaxException e) { |
66 | 34 |
log.error("Error resolving doi: " + doi, e); |
67 | 35 |
return null; |
68 | 36 |
} |
69 | 37 |
} |
70 | 38 |
|
71 |
private static String fetchUrl(final URI url, final int attempts) { |
|
72 |
if (attempts == 0) { throw new RuntimeException("Max number of attempts reached, downloading url: " + url); } |
|
73 |
|
|
74 |
try { |
|
75 |
return (new RestTemplate(httpRequestFactory)).getForObject(url, String.class); |
|
76 |
} catch (final Exception e) { |
|
77 |
try { |
|
78 |
log.error("Error downloading url: " + url + " - " + e.getMessage()); |
|
79 |
Thread.sleep(INTERVAL_MILLIS); |
|
80 |
return fetchUrl(url, attempts - 1); |
|
81 |
} catch (final InterruptedException e1) { |
|
82 |
throw new RuntimeException(e1); |
|
83 |
} |
|
84 |
} |
|
85 |
} |
|
86 |
|
|
87 | 39 |
} |
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/mdstore/plugins/EnrichLabsPlugin.java | ||
---|---|---|
34 | 34 |
private Map<String, Person> affiliations = new HashMap<>(); |
35 | 35 |
|
36 | 36 |
@Override |
37 |
protected void reconfigure() { |
|
37 |
protected void reconfigure(final Map<String, String> params) {
|
|
38 | 38 |
affiliations = dao.listPersonsWithAffiliations() |
39 | 39 |
.stream() |
40 | 40 |
.collect(Collectors.toMap(Person::getId, a -> a)); |
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/mdstore/plugins/objects/MdRecord.java | ||
---|---|---|
83 | 83 |
@XmlElement(name = "citation") |
84 | 84 |
private Set<String> citations = new LinkedHashSet<>(); |
85 | 85 |
|
86 |
@XmlElementWrapper(name = "collections") |
|
87 |
@XmlElement(name = "inCollection") |
|
88 |
private Set<CnrCollection> inCollections = new LinkedHashSet<>(); |
|
89 |
|
|
86 | 90 |
public String getId() { |
87 | 91 |
return id; |
88 | 92 |
} |
... | ... | |
207 | 211 |
return cnrPersons; |
208 | 212 |
} |
209 | 213 |
|
214 |
public void setCnrPersons(final Set<CnrPerson> cnrPersons) { |
|
215 |
this.cnrPersons = cnrPersons; |
|
216 |
} |
|
217 |
|
|
210 | 218 |
public void setCnrPerson(final Set<CnrPerson> cnrPersons) { |
211 | 219 |
this.cnrPersons = cnrPersons; |
212 | 220 |
} |
... | ... | |
227 | 235 |
this.citations = citations; |
228 | 236 |
} |
229 | 237 |
|
238 |
public Set<CnrCollection> getInCollections() { |
|
239 |
return inCollections; |
|
240 |
} |
|
241 |
|
|
242 |
public void setInCollections(final Set<CnrCollection> inCollections) { |
|
243 |
this.inCollections = inCollections; |
|
244 |
} |
|
245 |
|
|
230 | 246 |
} |
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/mdstore/plugins/objects/Project.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.io.StringReader; |
4 | 4 |
import java.net.URI; |
5 |
import java.util.concurrent.TimeUnit; |
|
6 | 5 |
import java.util.regex.Matcher; |
7 | 6 |
import java.util.regex.Pattern; |
8 | 7 |
|
... | ... | |
13 | 12 |
import org.apache.commons.lang3.StringUtils; |
14 | 13 |
import org.apache.commons.logging.Log; |
15 | 14 |
import org.apache.commons.logging.LogFactory; |
16 |
import org.apache.http.impl.client.HttpClientBuilder; |
|
17 | 15 |
import org.dom4j.Document; |
18 | 16 |
import org.dom4j.DocumentException; |
19 | 17 |
import org.dom4j.io.SAXReader; |
20 |
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; |
|
21 |
import org.springframework.web.client.RestTemplate; |
|
22 | 18 |
|
19 |
import eu.dnetlib.data.utils.HttpFetcher; |
|
20 |
|
|
23 | 21 |
@XmlAccessorType(XmlAccessType.FIELD) |
24 | 22 |
public class Project { |
25 | 23 |
|
... | ... | |
42 | 40 |
|
43 | 41 |
private static final Log log = LogFactory.getLog(Project.class); |
44 | 42 |
|
45 |
private static final int MAX_NUMBER_OF_ATTEMPTS = 10; |
|
46 |
private static final int INTERVAL_MILLIS = 20000; |
|
47 | 43 |
private static final String PROJECT_REGEX = "info:eu-repo\\/grantAgreement\\/(.*)\\/(.*)\\/(.*)\\/(.*)\\/(.*)\\/(.*)"; |
48 | 44 |
|
49 |
private static final HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(HttpClientBuilder |
|
50 |
.create() |
|
51 |
.setConnectionTimeToLive(0, TimeUnit.MILLISECONDS) |
|
52 |
.setMaxConnPerRoute(1) |
|
53 |
.setMaxConnTotal(1) |
|
54 |
.disableAutomaticRetries() |
|
55 |
.disableConnectionState() |
|
56 |
.build()); |
|
57 |
|
|
58 | 45 |
public static Project newInstance(final URI url) { |
59 | 46 |
|
60 | 47 |
try { |
61 | 48 |
final SAXReader reader = new SAXReader(); |
62 |
final Document doc = reader.read(new StringReader(fetchUrl(url, MAX_NUMBER_OF_ATTEMPTS))); |
|
49 |
final String s = HttpFetcher.fetch(url); |
|
50 |
final Document doc = reader.read(new StringReader(s)); |
|
63 | 51 |
|
64 | 52 |
final String openaireId = doc.valueOf("//*[local-name()='objIdentifier']"); |
65 | 53 |
|
... | ... | |
108 | 96 |
return Project.newInstance(infoId) != null; |
109 | 97 |
} |
110 | 98 |
|
111 |
private static String fetchUrl(final URI url, final int attempts) { |
|
112 |
if (attempts == 0) { throw new RuntimeException("Max number of attempts reached, downloading url: " + url); } |
|
113 |
|
|
114 |
/* |
|
115 |
* try (CloseableHttpClient client = HttpClientBuilder.create().build()) { log.debug("Invoking url: " + url); final HttpGet request |
|
116 |
* = new HttpGet(url); request.setHeader("Connection", "close"); request.setProtocolVersion(HttpVersion.HTTP_1_0); try (final |
|
117 |
* CloseableHttpResponse response = client.execute(request)) { return EntityUtils.toString(response.getEntity()); } |
|
118 |
*/ |
|
119 |
|
|
120 |
try { |
|
121 |
final RestTemplate restTemplate = new RestTemplate(); |
|
122 |
restTemplate.setRequestFactory(httpRequestFactory); |
|
123 |
return restTemplate.getForObject(url, String.class); |
|
124 |
} catch ( |
|
125 |
|
|
126 |
final Exception e) { |
|
127 |
try { |
|
128 |
log.error("Error downloading url: " + url + " - " + e.getMessage()); |
|
129 |
Thread.sleep(INTERVAL_MILLIS); |
|
130 |
return fetchUrl(url, attempts - 1); |
|
131 |
} catch (final InterruptedException e1) { |
|
132 |
throw new RuntimeException(e1); |
|
133 |
} |
|
134 |
} |
|
135 |
} |
|
136 |
|
|
137 | 99 |
public Project() {} |
138 | 100 |
|
139 | 101 |
public Project(final String openaireId, final String code, final String name, final String acronym, final String funder, final String program, |
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/mdstore/plugins/objects/CnrCollection.java | ||
---|---|---|
1 |
package eu.dnetlib.data.mdstore.plugins.objects; |
|
2 |
|
|
3 |
import javax.xml.bind.annotation.XmlAccessType; |
|
4 |
import javax.xml.bind.annotation.XmlAccessorType; |
|
5 |
import javax.xml.bind.annotation.XmlElement; |
|
6 |
|
|
7 |
@XmlAccessorType(XmlAccessType.FIELD) |
|
8 |
public class CnrCollection { |
|
9 |
|
|
10 |
@XmlElement(name = "code") |
|
11 |
public String code; |
|
12 |
@XmlElement(name = "name") |
|
13 |
public String name; |
|
14 |
@XmlElement(name = "acronym") |
|
15 |
public String acronym; |
|
16 |
|
|
17 |
public String getCode() { |
|
18 |
return code; |
|
19 |
} |
|
20 |
|
|
21 |
public void setCode(final String code) { |
|
22 |
this.code = code; |
|
23 |
} |
|
24 |
|
|
25 |
public String getAcronym() { |
|
26 |
return acronym; |
|
27 |
} |
|
28 |
|
|
29 |
public void setAcronym(final String acronym) { |
|
30 |
this.acronym = acronym; |
|
31 |
} |
|
32 |
|
|
33 |
public String getName() { |
|
34 |
return name; |
|
35 |
} |
|
36 |
|
|
37 |
public void setName(final String name) { |
|
38 |
this.name = name; |
|
39 |
} |
|
40 |
} |
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/mdstore/plugins/EnrichOpenairePlugin.java | ||
---|---|---|
4 | 4 |
import java.net.URI; |
5 | 5 |
import java.net.URISyntaxException; |
6 | 6 |
import java.util.List; |
7 |
import java.util.Map; |
|
7 | 8 |
import java.util.Set; |
8 | 9 |
import java.util.stream.Collectors; |
9 | 10 |
|
... | ... | |
33 | 34 |
} |
34 | 35 |
|
35 | 36 |
@Override |
36 |
protected void reconfigure() {} |
|
37 |
protected void reconfigure(final Map<String, String> params) {}
|
|
37 | 38 |
|
38 | 39 |
@Override |
39 | 40 |
protected boolean updateDocument(final MdRecord doc, final String response) { |
modules/dnet-isti/trunk/src/main/java/eu/dnetlib/data/mdstore/plugins/MdRecordPlugin.java | ||
---|---|---|
34 | 34 |
|
35 | 35 |
final SAXReader reader = new SAXReader(); |
36 | 36 |
|
37 |
reconfigure(); |
|
37 |
reconfigure(params);
|
|
38 | 38 |
|
39 | 39 |
for (final DBObject obj : collPubs.find()) { |
40 | 40 |
|
... | ... | |
62 | 62 |
touch(store); |
63 | 63 |
} |
64 | 64 |
|
65 |
abstract protected void reconfigure(); |
|
65 |
abstract protected void reconfigure(Map<String, String> params);
|
|
66 | 66 |
|
67 | 67 |
abstract protected boolean updateRecord(MdRecord record); |
68 | 68 |
|
modules/dnet-isti/trunk/src/main/resources/eu/dnetlib/isti/applicationContext-isti.xml | ||
---|---|---|
19 | 19 |
<bean id="enrichDatasetsMDstorePlugin" class="eu.dnetlib.data.mdstore.plugins.EnrichDatasetsPlugin" /> |
20 | 20 |
|
21 | 21 |
<bean id="freezeMDStorePlugin" class="eu.dnetlib.data.mdstore.plugins.FreezeMDStorePlugin" /> |
22 |
|
|
23 |
<bean id="enrichCollectionsMDstorePlugin" class="eu.dnetlib.data.mdstore.plugins.EnrichCollectionPlugin" /> |
|
22 | 24 |
|
23 | 25 |
<!-- Affiliations DAO --> |
24 | 26 |
<bean id="affiliationsDao" class="eu.dnetlib.data.db.AffiliationsDao"> |
modules/dnet-isti/trunk/src/main/resources/eu/dnetlib/isti/workflows/repo-hi/pubs_aggregation_wf.xml.st | ||
---|---|---|
56 | 56 |
</PARAM> |
57 | 57 |
</PARAMETERS> |
58 | 58 |
<ARCS> |
59 |
<ARC to="enrichCollections"/> |
|
60 |
</ARCS> |
|
61 |
</NODE> |
|
62 |
|
|
63 |
<NODE name="enrichCollections" type="LaunchWorkflowTemplate"> |
|
64 |
<DESCRIPTION>Enrich with collections using OAI sets</DESCRIPTION> |
|
65 |
<PARAMETERS> |
|
66 |
<PARAM name="wfTemplateId" value="f0ffb1b2-1518-4087-aa6d-046f507a50ca_V29ya2Zsb3dUZW1wbGF0ZURTUmVzb3VyY2VzL1dvcmtmbG93VGVtcGxhdGVEU1Jlc291cmNlVHlwZQ==" /> |
|
67 |
<PARAM name="wfTemplateParams"> |
|
68 |
<MAP> |
|
69 |
<ENTRY key="mdId" ref="cleanMdstoreId" /> |
|
70 |
<ENTRY key="dsId" value="$dsId$" /> |
|
71 |
<ENTRY key="dsInterface" value="$interface$" /> |
|
72 |
</MAP> |
|
73 |
</PARAM> |
|
74 |
</PARAMETERS> |
|
75 |
<ARCS> |
|
59 | 76 |
<ARC to="enrichProjects"/> |
60 | 77 |
</ARCS> |
61 | 78 |
</NODE> |
modules/dnet-isti/trunk/src/main/resources/eu/dnetlib/bootstrap/profiles/TransformationRuleDSResources/people2dataciteTransform.xml | ||
---|---|---|
122 | 122 |
|
123 | 123 |
<citations /> |
124 | 124 |
|
125 |
<collections> |
|
126 |
<xsl:for-each select="//oai:setSpec"> |
|
127 |
<inCollection> |
|
128 |
<code><xsl:value-of select="normalize-space(.)" /></code> |
|
129 |
<name /> |
|
130 |
<acronym /> |
|
131 |
</inCollection> |
|
132 |
</xsl:for-each> |
|
133 |
</collections> |
|
134 |
|
|
125 | 135 |
</record> |
126 | 136 |
|
127 | 137 |
</oai:metadata> |
modules/dnet-isti/trunk/src/main/resources/eu/dnetlib/bootstrap/profiles/workflows/common/enrichCollections.xml | ||
---|---|---|
1 |
<RESOURCE_PROFILE> |
|
2 |
<HEADER> |
|
3 |
<RESOURCE_IDENTIFIER value="f0ffb1b2-1518-4087-aa6d-046f507a50ca_V29ya2Zsb3dUZW1wbGF0ZURTUmVzb3VyY2VzL1dvcmtmbG93VGVtcGxhdGVEU1Jlc291cmNlVHlwZQ=="/> |
|
4 |
<RESOURCE_TYPE value="WorkflowTemplateDSResourceType"/> |
|
5 |
<RESOURCE_KIND value="WorkflowTemplateDSResources"/> |
|
6 |
<RESOURCE_URI value=""/> |
|
7 |
<DATE_OF_CREATION value="2001-12-31T12:00:00"/> |
|
8 |
</HEADER> |
|
9 |
<BODY> |
|
10 |
<CONFIGURATION> |
|
11 |
<PARAMETERS> |
|
12 |
<PARAM name="mdId" description="MDStoreId" required="true" type="string"/> |
|
13 |
<PARAM name="dsId" description="DatasourceId" required="true" type="string"/> |
|
14 |
<PARAM name="dsInterface" description="DatasourceInterface" required="true" type="string"/> |
|
15 |
</PARAMETERS> |
|
16 |
<WORKFLOW> |
|
17 |
<NODE name="enrich_colls" type="RunMDStorePlugin" isStart="true"> |
|
18 |
<DESCRIPTION>Enrich with collections (OAI sets)</DESCRIPTION> |
|
19 |
<PARAMETERS> |
|
20 |
<PARAM name="pluginName" value="enrichCollectionsMDstorePlugin"/> |
|
21 |
<PARAM name="parameters"> |
|
22 |
<MAP> |
|
23 |
<ENTRY key="mdId" ref="mdId" /> |
|
24 |
<ENTRY key="dsId" ref="dsId" /> |
|
25 |
<ENTRY key="dsInterface" ref="dsInterface" /> |
|
26 |
</MAP> |
|
27 |
</PARAM> |
|
28 |
</PARAMETERS> |
|
29 |
<ARCS> |
|
30 |
<ARC to="success"/> |
|
31 |
</ARCS> |
|
32 |
</NODE> |
|
33 |
</WORKFLOW> |
|
34 |
</CONFIGURATION> |
|
35 |
</BODY> |
|
36 |
</RESOURCE_PROFILE> |
Also available in: Unified diff
Oai Sets Management