diff --git a/pom.xml b/pom.xml
index 6db7112..543137e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -144,18 +144,6 @@
commons-pool2
-
-
- eu.dnetlib
- cnr-rmi-api
- ${cnr-rmi-api.version}
-
-
- org.apache.cxf
- cxf-rt-transports-http
- 3.1.5
-
-
eu.dnetlib.dhp
diff --git a/src/main/java/eu/dnetlib/app/directindex/DirectIndexApplication.java b/src/main/java/eu/dnetlib/app/directindex/DirectIndexApplication.java
index 2dc3b62..cd131a0 100644
--- a/src/main/java/eu/dnetlib/app/directindex/DirectIndexApplication.java
+++ b/src/main/java/eu/dnetlib/app/directindex/DirectIndexApplication.java
@@ -7,11 +7,6 @@ import java.util.Arrays;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
-import org.apache.cxf.endpoint.Client;
-import org.apache.cxf.frontend.ClientProxy;
-import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
-import org.apache.cxf.transport.http.HTTPConduit;
-import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
@@ -26,7 +21,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.core.io.ClassPathResource;
import org.springframework.scheduling.annotation.EnableScheduling;
-import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
import io.micrometer.core.instrument.ImmutableTag;
import io.micrometer.core.instrument.Metrics;
import io.swagger.v3.oas.models.OpenAPI;
@@ -123,28 +117,4 @@ public class DirectIndexApplication {
.build();
}
- @Bean
- public ISLookUpService lookupServiceStub() {
-
- log.info(String.format("creating stub for ISLookUpService from %s", isLookupUrl));
-
- final JaxWsProxyFactoryBean jaxWsProxyFactory = new JaxWsProxyFactoryBean();
- jaxWsProxyFactory.setServiceClass(ISLookUpService.class);
- jaxWsProxyFactory.setAddress(isLookupUrl);
- final ISLookUpService service = (ISLookUpService) jaxWsProxyFactory.create();
-
- final Client client = ClientProxy.getClient(service);
- if (client != null) {
- final HTTPConduit conduit = (HTTPConduit) client.getConduit();
- final HTTPClientPolicy policy = new HTTPClientPolicy();
-
- policy.setConnectionTimeout(isLookupConnectTimeout);
- policy.setReceiveTimeout(isLookupRequestTimeout);
-
- conduit.setClient(policy);
- }
-
- return service;
- }
-
}
diff --git a/src/main/java/eu/dnetlib/app/directindex/clients/CommunityClient.java b/src/main/java/eu/dnetlib/app/directindex/clients/CommunityClient.java
index 89520e4..defeca3 100644
--- a/src/main/java/eu/dnetlib/app/directindex/clients/CommunityClient.java
+++ b/src/main/java/eu/dnetlib/app/directindex/clients/CommunityClient.java
@@ -1,8 +1,10 @@
package eu.dnetlib.app.directindex.clients;
+import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
+import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -14,7 +16,6 @@ import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import eu.dnetlib.app.directindex.errors.DirectIndexApiException;
-import eu.dnetlib.app.directindex.input.ZenodoContextList;
@Component
public class CommunityClient {
@@ -23,23 +24,53 @@ public class CommunityClient {
private static final Log log = LogFactory.getLog(CommunityClient.class);
- @Value("${dnet.directindex.community.url")
+ @Value("${dnet.directindex.community.url}")
private String communityApiUrl;
@Cacheable("communities")
public Collection translateZenodoCommunity(final String community) throws DirectIndexApiException {
if (!community.contains(ZENODO_COMMUNITY)) { return Arrays.asList(community); }
+
final String context = community.substring(community.lastIndexOf("/") + 1);
final RestTemplate rt = new RestTemplate();
+
+ final String url = communityApiUrl + "/" + context + "/openairecommunities";
try {
- return new HashSet<>(rt.getForObject(communityApiUrl + context + "/openairecommunities", ZenodoContextList.class)
- .getOpenAirecommunitylist());
+ return new HashSet<>(rt.getForObject(url, ZenodoContextList.class).getOpenAirecommunitylist());
} catch (final RestClientException e) {
- log.error("Unable to get object for " + communityApiUrl + context + "/openairecommunities", e);
- throw new DirectIndexApiException("Unable to get object for " + communityApiUrl + context + "/openairecommunities", e);
+ log.error("Unable to get object for url: " + url, e);
+ throw new DirectIndexApiException("Unable to get object for url: " + url, e);
}
}
@CacheEvict(value = "communities", allEntries = true)
public void clearCache() {}
+
+ public class ZenodoContextList implements Serializable {
+
+ private static final long serialVersionUID = -8575901008472098218L;
+
+ private String zenodoid;
+
+ private List openAirecommunitylist;
+
+ public List getOpenAirecommunitylist() {
+ return openAirecommunitylist;
+ }
+
+ public void setOpenAirecommunitylist(final List openAirecommunitylist) {
+ this.openAirecommunitylist = openAirecommunitylist;
+
+ }
+
+ public String getZenodoid() {
+ return zenodoid;
+ }
+
+ public void setZenodoid(final String zenodoid) {
+ this.zenodoid = zenodoid;
+
+ }
+
+ }
}
diff --git a/src/main/java/eu/dnetlib/app/directindex/clients/DatasourceManagerClient.java b/src/main/java/eu/dnetlib/app/directindex/clients/DatasourceManagerClient.java
index 3ece72d..48c22ec 100644
--- a/src/main/java/eu/dnetlib/app/directindex/clients/DatasourceManagerClient.java
+++ b/src/main/java/eu/dnetlib/app/directindex/clients/DatasourceManagerClient.java
@@ -19,7 +19,7 @@ import eu.dnetlib.app.directindex.input.DatasourceEntry;
@Component
public class DatasourceManagerClient {
- @Value("${dnet.directindex.dsm.url")
+ @Value("${dnet.directindex.dsm.url}")
private String dsmApiUrl;
private static final Log log = LogFactory.getLog(DatasourceManagerClient.class);
@@ -40,7 +40,7 @@ public class DatasourceManagerClient {
.orElse(DatasourceEntry.UNKNOWN_DATASOURCE);
} catch (final RestClientException rce) {
- log.warn("Unable to obtainn datasource: " + dsId, rce);
+ log.warn("Unable to obtain datasource: " + dsId, rce);
throw new DirectIndexApiException("Unable to obtainn datasource: " + dsId, rce);
}
}
diff --git a/src/main/java/eu/dnetlib/app/directindex/clients/VocabularyClient.java b/src/main/java/eu/dnetlib/app/directindex/clients/VocabularyClient.java
index 23fb82e..4c562a3 100644
--- a/src/main/java/eu/dnetlib/app/directindex/clients/VocabularyClient.java
+++ b/src/main/java/eu/dnetlib/app/directindex/clients/VocabularyClient.java
@@ -1,52 +1,149 @@
package eu.dnetlib.app.directindex.clients;
+import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestClientException;
+import org.springframework.web.client.RestTemplate;
import eu.dnetlib.app.directindex.errors.DirectIndexApiException;
-import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException;
-import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService;
@Component
public class VocabularyClient {
private static final Log log = LogFactory.getLog(VocabularyClient.class);
- @Autowired
- private ISLookUpService lookupService;
+ @Value("${dnet.directindex.vocabulary.url}")
+ private String vocApiUrl;
@Cacheable("vocabularies")
public Map findVocabulary(final String voc) throws DirectIndexApiException {
- final String query = "collection('/db/DRIVER/VocabularyDSResources/VocabularyDSResourceType')[.//VOCABULARY_NAME/@code='" + voc
- + "']//TERM/concat(@code, ' @@@ ', @english_name)";
+ final String url = vocApiUrl + "/" + voc + ".json";
- final Map map = new HashMap<>();
- for (final String s : find(query)) {
- final String[] arr = s.split("@@@");
- map.put(arr[0].trim(), arr[1].trim());
+ final RestTemplate rt = new RestTemplate();
+ try {
+ final Map map = new HashMap<>();
+ for (final VocTerm term : rt.getForObject(url, Vocabulary.class).getTerms()) {
+ map.put(term.getCode(), term.getEnglishName());
+ }
+ return map;
+ } catch (final RestClientException e) {
+ log.error("Unable to get vocabulary, url: " + url, e);
+ throw new DirectIndexApiException("Unable to get vocabulary, url: " + url, e);
}
-
- return map;
}
@CacheEvict(value = "vocabularies", allEntries = true)
public void clearCache() {}
- private List find(final String query) throws DirectIndexApiException {
- try {
- return lookupService.quickSearchProfile(query);
- } catch (final ISLookUpException e) {
- log.error("Error executing xquery: " + query, e);
- throw new DirectIndexApiException("Error executing xquery: " + query, e);
+ public class Vocabulary implements Serializable {
+
+ private static final long serialVersionUID = -865664758603896385L;
+
+ private String id;
+ private String name;
+ private String description;
+ private String code;
+ private List terms;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(final String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(final String description) {
+ this.description = description;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(final String code) {
+ this.code = code;
+ }
+
+ public List getTerms() {
+ return terms;
+ }
+
+ public void setTerms(final List terms) {
+ this.terms = terms;
+ }
+ }
+
+ public class VocTerm implements Serializable {
+
+ private static final long serialVersionUID = 1618105318956602387L;
+
+ private String englishName;
+ private String nativeName;
+ private String encoding;
+ private String code;
+ private List> synonyms;
+
+ public String getEnglishName() {
+ return englishName;
+ }
+
+ public void setEnglishName(final String englishName) {
+ this.englishName = englishName;
+ }
+
+ public String getNativeName() {
+ return nativeName;
+ }
+
+ public void setNativeName(final String nativeName) {
+ this.nativeName = nativeName;
+ }
+
+ public String getEncoding() {
+ return encoding;
+ }
+
+ public void setEncoding(final String encoding) {
+ this.encoding = encoding;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public void setCode(final String code) {
+ this.code = code;
+ }
+
+ public List> getSynonyms() {
+ return synonyms;
+ }
+
+ public void setSynonyms(final List> synonyms) {
+ this.synonyms = synonyms;
}
}
diff --git a/src/main/java/eu/dnetlib/app/directindex/input/ResultEntry.java b/src/main/java/eu/dnetlib/app/directindex/input/ResultEntry.java
index d3b6170..fcb4be4 100644
--- a/src/main/java/eu/dnetlib/app/directindex/input/ResultEntry.java
+++ b/src/main/java/eu/dnetlib/app/directindex/input/ResultEntry.java
@@ -31,18 +31,14 @@ public class ResultEntry implements Serializable {
private String language;
private List pids = new ArrayList<>();
- @Schema(requiredMode = RequiredMode.REQUIRED, allowableValues = {
- "OPEN", "CLOSED", "RESTRICTED", "EMBARGO", "UNKNOWN", "OTHER", "OPEN SOURCE"
- })
+ @Schema(requiredMode = RequiredMode.REQUIRED, allowableValues = { "OPEN", "CLOSED", "RESTRICTED", "EMBARGO", "UNKNOWN", "OTHER", "OPEN SOURCE" })
private String accessRightCode;
private String embargoEndDate;
/**
* One of publication, dataset, software, other. Default value is publication.
*/
- @Schema(allowableValues = {
- "publication", "dataset", "software", "other"
- })
+ @Schema(allowableValues = { "publication", "dataset", "software", "other" })
private String type = "publication";
@Schema(requiredMode = RequiredMode.REQUIRED, description = "Use 001 for articles, 021 for datasets, 0029 for software. See: http://api.openaire.eu/vocabularies/dnet:publication_resource for all the available resource types.")
@@ -133,11 +129,6 @@ public class ResultEntry implements Serializable {
this.pids = pids;
}
- /**
- * Set required = true when the deprecated licenseCode is not used anymore by our client and it is removed
- *
- * @return access rights code
- */
public String getAccessRightCode() {
return accessRightCode;
}
diff --git a/src/main/java/eu/dnetlib/app/directindex/input/ZenodoContextList.java b/src/main/java/eu/dnetlib/app/directindex/input/ZenodoContextList.java
deleted file mode 100644
index 270e764..0000000
--- a/src/main/java/eu/dnetlib/app/directindex/input/ZenodoContextList.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package eu.dnetlib.app.directindex.input;
-
-import java.io.Serializable;
-import java.util.List;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class ZenodoContextList implements Serializable {
-
- private static final long serialVersionUID = -8575901008472098218L;
-
- private String zenodoid;
-
- private List openAirecommunitylist;
-
- public List getOpenAirecommunitylist() {
- return openAirecommunitylist;
- }
-
- public void setOpenAirecommunitylist(final List openAirecommunitylist) {
- this.openAirecommunitylist = openAirecommunitylist;
-
- }
-
- public String getZenodoid() {
- return zenodoid;
- }
-
- public void setZenodoid(final String zenodoid) {
- this.zenodoid = zenodoid;
-
- }
-
-}
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index d3f28cc..2cdf209 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,21 +1,19 @@
server.port=8080
-dnet.directindex.baseurl = http://localhost:8280
-
-dnet.directindex.scheduling.enabled}")
-
+dnet.directindex.baseurl = http://localhost:8080
dnet.directindex.title = D-Net Direct Index Service
dnet.directindex.description = Service that permits the indexing according to the SWORD v.3 protocol
+
dnet.directindex.scheduling.enabled = false
-dnet.directindex.legacy.enabled=true
-dnet.directindex.sword.enabled=false
+dnet.directindex.legacy.enabled = true
+dnet.directindex.sword.enabled = false
-dnet.directindex.solr.collection =
dnet.directindex.solr.url =
-dnet.directindex.community.url =
-dnet.directindex.dsm.url =
-
+dnet.directindex.solr.collection =
+dnet.directindex.community.url = https://services.openaire.eu/openaire/community
+dnet.directindex.dsm.url = https://services.openaire.eu/openaire/ds
+dnet.directindex.vocabulary.url = https://services.openaire.eu/provision/mvc/vocabularies
spring.profiles.active=dev