1. Create trunk folder.

This commit is contained in:
Panagiotis Kanakakis 2017-12-07 17:57:12 +00:00
commit 5227f60ce5
68 changed files with 5297 additions and 0 deletions

230
pom.xml Normal file
View File

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>eu.dnetlib</groupId>
<artifactId>dnet45-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>eu.dnetlib</groupId>
<artifactId>uoa-repository-manager-service</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<!--<plugin>
<groupId>cz.habarta.typescript-generator</groupId>
<artifactId>typescript-generator-maven-plugin</artifactId>
<version>1.29.366</version>
<executions>
<execution>
<id>generate1</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<jsonLibrary>jackson2</jsonLibrary>
<outputFileType>implementationFile</outputFileType>
<mapClasses>asClasses</mapClasses>
<classPatterns>
<pattern>eu.dnetlib.domain.data.*</pattern>
</classPatterns>
<outputFile>target/typeScriptClasses.ts</outputFile>
<outputKind>module</outputKind>
</configuration>
</execution>
</executions>
</plugin>-->
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
<version>4.1.0.Final</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>(1.2, 1.5]</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>eu.dnetlib</groupId>
<artifactId>dnet-runtime</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0)</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-javamail_1.4_spec</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>eu.dnetlib</groupId>
<artifactId>uoa-utils</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
</dependency>
<dependency>
<groupId>eu.dnetlib</groupId>
<artifactId>uoa-domain</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>eu.dnetlib</groupId>
<artifactId>uoa-commons</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
</dependency>
<dependency>
<groupId>eu.dnetlib</groupId>
<artifactId>uoa-clients</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
</dependency>
<dependency>
<groupId>eu.dnetlib</groupId>
<artifactId>uoa-hcm</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0)</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>se.kb</groupId>
<artifactId>oai4j</artifactId>
<version>[0.6b1,)</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.5.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.5.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.19.3</version>
</dependency>
<dependency>
<groupId>org.aksw.gson</groupId>
<artifactId>gson-utils-core</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20080701</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.7.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/cz.habarta.typescript-generator/typescript-generator-maven-plugin -->
<dependency>
<groupId>cz.habarta.typescript-generator</groupId>
<artifactId>typescript-generator-maven-plugin</artifactId>
<version>1.29.366</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,55 @@
package eu.dnetlib.repo.manager.service.config;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import java.util.Properties;
/**
* CascadingPropertyLoader loads a number of property files and mergers them together, so that the last properties
* override the previous. It also supports property expansion like:
*
* <code>
* something = 1
* somethingelse = 2
* test = ${something}/${somethingelse}
* </code>
*
* <p>
* And if you override something to XX, then test will become XX/2
* </p>
*
*
* @author marko
*
*/
public class CascadingPropertyLoader extends PropertyPlaceholderConfigurer implements InitializingBean {
private Properties properties;
public void afterPropertiesSet() throws Exception {
this.properties = mergeProperties();
// Convert the merged properties, if necessary.
convertProperties(this.properties);
logger.debug("Properties: " + properties);
}
@Override
protected void processProperties(final ConfigurableListableBeanFactory beanFactoryToProcess, final Properties props) throws BeansException {
super.processProperties(beanFactoryToProcess, props);
}
public Properties getProperties() {
return properties;
}
public void setProperties(final Properties properties) {
super.setProperties(properties);
this.properties = properties;
}
}

View File

@ -0,0 +1,109 @@
package eu.dnetlib.repo.manager.service.config;
import org.apache.commons.lang.ArrayUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.web.context.ContextLoaderListener;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.XmlWebApplicationContext;
import javax.servlet.ServletContext;
import java.util.Properties;
public class RepoManagerContextLoaderListener extends ContextLoaderListener {
private static Logger logger = Logger.getLogger(RepoManagerContextLoaderListener.class);
public RepoManagerContextLoaderListener() {
super();
}
public RepoManagerContextLoaderListener(WebApplicationContext context) {
super(context);
}
@Override
protected WebApplicationContext createWebApplicationContext(
ServletContext servletContext)
throws BeansException {
logger.debug("Creating web application context");
Properties props = this.loadProperties();
String repoMode = props.getProperty("services.validator.mode.repo");
String userMode = props.getProperty("services.validator.mode.user");
Boolean standaloneMode = Boolean.parseBoolean(props.getProperty("services.validator.mode.standalone"));
logger.info("User mode: " + userMode);
logger.info("Repo mode: " + repoMode);
logger.info("Standalone mode: " + standaloneMode);
// logger.info("Dnet workflow enabled: " + repoMode);
XmlWebApplicationContext ctx = new XmlWebApplicationContext();
ctx.setServletContext(servletContext);
String userApiContext = null;
if (userMode.equalsIgnoreCase("local"))
userApiContext = "eu/dnetlib/validator/web/api/impls/users/springContext-validator-user-local.xml";
else if (userMode.equalsIgnoreCase("ldap"))
userApiContext = "eu/dnetlib/users/springContext-users-ldap.xml";
String[] springContextCore = new String[] {
"classpath:META-INF/cxf/cxf.xml",
"classpath:META-INF/cxf/cxf-extension-soap.xml",
"classpath:META-INF/cxf/cxf-extension-jaxws.xml",
"classpath:META-INF/cxf/cxf-servlet.xml",
"classpath*:/cxf.xml",
"classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml",
"classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml",
"classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml",
// "classpath*:/eu/dnetlib/validator/web/actions/springContext-validator-struts.xml",
// "classpath*:/eu/dnetlib/validator/web/actions/springContext-validator-emailer.xml",
// "classpath*:/eu/dnetlib/validator/web/config/springContext-validator.xml",
"classpath*:/eu/dnetlib/repo/manager/server/config/springContext-repo-manager-config.xml",
// "classpath*:/eu/dnetlib/validator/commons/dao/springContext-*.xml",
"classpath*:/eu/dnetlib/repos/springContext-repos-" + repoMode + ".xml",
"classpath*:/" + userApiContext
};
String[] springContextForStandalone = new String[] {
};
String[] springContextForIS = new String[] {
"classpath*:/gr/uoa/di/driver/util/springContext-locators.xml",
"classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml",
"classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml",
"classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml",
"classpath*:/gr/uoa/di/driver/app/springContext-commons.xml",
"classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"
};
if (standaloneMode) {
logger.debug("Loading contexts for standalone mode");
ctx.setConfigLocations((String[])ArrayUtils.addAll(springContextCore,springContextForStandalone));
} else {
logger.debug("Loading contexts for dnet");
ctx.setConfigLocations((String[])ArrayUtils.addAll(springContextCore,springContextForIS));
}
ctx.refresh();
logger.debug("done");
return ctx;
}
private Properties loadProperties() {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] {
"classpath*:/eu/dnetlib/repo/manager/server/config/springContext-repo-manager-config.xml"
});
CascadingPropertyLoader pLoader = (CascadingPropertyLoader) ctx.getBean("propertyLoader");
Properties props = pLoader.getProperties();
ctx.destroy();
ctx.close();
return props;
}
}

View File

@ -0,0 +1,57 @@
package eu.dnetlib.repo.manager.service.config;
import eu.dnetlib.repo.manager.service.controllers.MonitorApi;
import eu.dnetlib.repo.manager.service.controllers.PiWikApi;
import eu.dnetlib.repo.manager.service.controllers.RepositoryApi;
import eu.dnetlib.repo.manager.service.controllers.ValidatorApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.service.VendorExtension;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
/**
* Created by panagiotis on 16/11/2017.
*/
@Configuration
@EnableSwagger2
@EnableWebMvc
@ComponentScan(basePackageClasses = {
RepositoryApi.class,
MonitorApi.class,
ValidatorApi.class,
PiWikApi.class
})
public class SwaggerConfig {
@Bean
public Docket productApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.pathMapping("/")
.apiInfo(getApiInfo());
}
private ApiInfo getApiInfo() {
return new ApiInfo("Repository Manager Dashboard API Documentation",
"Repository Manager Dashboard API Documentation",
"1.0",
"urn:tos",
new Contact("", "", ""),
"Apache 2.0", "http://www.apache.org/licenses/LICENSE-2.0",
new ArrayList<VendorExtension>());
}
}

View File

@ -0,0 +1,46 @@
package eu.dnetlib.repo.manager.service.controllers;
import eu.dnetlib.repo.manager.shared.BrokerException;
import eu.dnetlib.repo.manager.shared.broker.*;
import io.swagger.annotations.*;
import org.json.JSONException;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = "/broker")
@Api(description = "Broker API", tags = {"broker"})
public interface BrokerApi {
@RequestMapping(value = "/getDatasourcesOfUser" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
DatasourcesBroker getDatasourcesOfUser(@RequestBody String params) throws BrokerException, JSONException;
@RequestMapping(value = "/getTopicsForDatasource/{datasourceName}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
List<BrowseEntry> getTopicsForDatasource(String datasourceName) throws BrokerException;
@RequestMapping(value = "/advancedShowEvents" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
EventsPage advancedShowEvents(@RequestBody String params) throws BrokerException, JSONException ,IOException;
@RequestMapping(value = "/showEvents" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
EventsPage showEvents(@RequestBody String params) throws BrokerException, JSONException;
@RequestMapping(value = "/getSubscriptionsOfUser/{userEmail}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
Map<String, List<SimpleSubscriptionDesc>> getSubscriptionsOfUser(String userEmail) throws BrokerException;
@RequestMapping(value = "/subscribe" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
Subscription subscribe(@RequestBody OpenaireSubscription obj) throws BrokerException;
@RequestMapping(value = "/unsubscribe/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
void unsubscribe(String subscriptionId) throws BrokerException;
@RequestMapping(value = "/getSubscription/{subscriptionId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
Subscription getSubscription(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException;
}

View File

@ -0,0 +1,331 @@
package eu.dnetlib.repo.manager.service.controllers;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.domain.data.Repository;
import eu.dnetlib.repo.manager.shared.BrokerException;
import eu.dnetlib.repo.manager.shared.Tuple;
import eu.dnetlib.repo.manager.shared.broker.*;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import sun.reflect.generics.reflectiveObjects.LazyReflectiveObjectGenerator;
import java.io.IOException;
import java.util.*;
@Component
public class BrokerApiImpl implements BrokerApi {
@Autowired
private RepositoryApiImpl repoAPI;
@Value("${services.broker.url}:${services.broker.port}/${services.broker.api}${services.broker.openaire}")
private String openairePath;
@Value("${services.broker.url}:${services.broker.port}/${services.broker.api}")
private String apiPath;
private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger
.getLogger(BrokerApiImpl.class);
@Override
public DatasourcesBroker getDatasourcesOfUser(String params) throws JSONException {
JSONObject json_params = new JSONObject(params);
DatasourcesBroker ret = new DatasourcesBroker();
String userEmail = json_params.getString("userEmail");
boolean includeShared = Boolean.parseBoolean( json_params.getString("includeShared") );
boolean includeByOthers = Boolean.parseBoolean( json_params.getString("includeByOthers") );
try {
ret.setDatasourcesOfUser(getDatasourcesOfUserType(getRepositoriesOfUser(userEmail)));
if (includeShared) {
//TODO whatever nikonas was saying
List<String> sharedDatasourceIds = new ArrayList<String>();
ret.setSharedDatasources(getDatasourcesOfUserType(getRepositoriesByIds(sharedDatasourceIds)));
}
if (includeByOthers) {
ret.setDatasourcesOfOthers(getDatasourcesOfUserType(getRepositoriesOfUser(userEmail)));
}
} catch (BrokerException e) {
e.printStackTrace();
}
return ret;
}
@Override
public List<BrowseEntry> getTopicsForDatasource(@PathVariable("datasourceName") String datasourceName) throws BrokerException {
final String service = "/topicsForDatasource";
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service)
.queryParam("ds", datasourceName);
RestTemplate template = new RestTemplate();
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
ResponseEntity<List<BrowseEntry>> resp;
try {
resp = template.exchange(
builder.build().encode().toUri(),
HttpMethod.GET,
null,
new ParameterizedTypeReference<List<BrowseEntry>>() {
});
} catch (RestClientException e) {
throw new BrokerException(e);
}
return resp.getBody();
}
@Override
public EventsPage advancedShowEvents(String params) throws BrokerException, JSONException ,IOException {
JSONObject json_params = new JSONObject(params);
String page = json_params.getString("page");
String pagesize = json_params.getString("pagesize");
String json_advQueryObject = json_params.getString("advQueryObject");
ObjectMapper mapper = new ObjectMapper();
AdvQueryObject advQueryObject = mapper.readValue(json_advQueryObject, AdvQueryObject.class);
final String service = "/events/{page}/{pageSize}";
Map<String, Long> uriParams = new HashMap<>();
uriParams.put("page", Long.parseLong(page));
uriParams.put("pageSize", Long.parseLong(pagesize));
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service);
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
headers.add("Content-Type", "application/json");
advQueryObject.setPage(Long.parseLong(page));
HttpEntity<AdvQueryObject> entity = new HttpEntity<>(advQueryObject, headers);
RestTemplate template = new RestTemplate();
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
ResponseEntity<EventsPage> resp;
try {
resp = template.exchange(
builder.buildAndExpand(uriParams).encode().toUri(),
HttpMethod.POST,
entity,
new ParameterizedTypeReference<EventsPage>() {
}
);
} catch (RestClientException e) {
throw new BrokerException(e);
}
return resp.getBody();
}
private List<Tuple<BrowseEntry, String>> getDatasourcesOfUserType(List<Repository> repositories) throws BrokerException {
List<Tuple<BrowseEntry, String>> entries = new ArrayList<>();
for (Repository repo : repositories) {
BrowseEntry temp = new BrowseEntry();
temp.setValue(repo.getOfficialName());
temp.setSize(new Long(0));
for (BrowseEntry e : getTopicsForDatasource(repo.getOfficialName())) {
temp.setSize(temp.getSize() + e.getSize());
}
Tuple<BrowseEntry, String> tup = new Tuple<>(temp, repo.getLogoUrl());
entries.add(tup);
}
// sort the collection by the second field of the tuple which is size
Collections.sort(entries, new Comparator<Tuple<BrowseEntry, String>>() {
@Override
public int compare(Tuple<BrowseEntry, String> e1, Tuple<BrowseEntry, String> e2) {
return (int) (e2.getFirst().getSize().longValue() - e1.getFirst().getSize().longValue());
}
});
return entries;
}
private List<Repository> getRepositoriesOfUser(String userEmail) throws JSONException {
int page = 0;
int size = 50;
List<Repository> rs ;
List<Repository> resultSet = new ArrayList<>();
while (true){
rs = repoAPI.getRepositoriesOfUser(userEmail, String.valueOf(page), String.valueOf(size));
resultSet.addAll(rs);
page+=1;
if(rs.size() == 0) break;
}
return resultSet;
}
private List<Repository> getRepositoriesByIds(List<String> sharedDatasourceIds) {
return null;
}
@Override
public EventsPage showEvents(String params) throws BrokerException, JSONException {
JSONObject json_params = new JSONObject(params);
String datasourceName = json_params.getString("datasourceName");
String topic = json_params.getString("topic");
String page = json_params.getString("page");
final String service = "/showEvents";
//build the uri params
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service)
.queryParam("ds", datasourceName)
.queryParam("topic", topic)
.queryParam("page", page);
//create new template engine
RestTemplate template = new RestTemplate();
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
ResponseEntity<EventsPage> resp;
try {
//communicate with endpoint
resp = template.exchange(
builder.build().encode().toUri(),
HttpMethod.GET,
null,
new ParameterizedTypeReference<EventsPage>() {
});
} catch (RestClientException e) {
throw new BrokerException(e);
}
return resp.getBody();
}
@Override
public Map<String, List<SimpleSubscriptionDesc>> getSubscriptionsOfUser(@PathVariable("userEmail") String userEmail) throws BrokerException {
final String service = "/subscriptions";
//build the uri params
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service)
.queryParam("email", userEmail);
//create new template engine
RestTemplate template = new RestTemplate();
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
ResponseEntity<Map<String, List<SimpleSubscriptionDesc>>> resp;
try {
//communicate with endpoint
resp = template.exchange(
builder.build().encode().toUri(),
HttpMethod.GET,
null,
new ParameterizedTypeReference<Map<String, List<SimpleSubscriptionDesc>>>() {
});
} catch (RestClientException e) {
LOGGER.debug("Error " , e);
throw new BrokerException(e);
}
return resp.getBody();
}
@Override
public Subscription subscribe(OpenaireSubscription obj) throws BrokerException {
final String service = "/subscribe";
//build the uri params
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(openairePath + service);
//Header info
MultiValueMap<String, String> headers = new LinkedMultiValueMap<>();
headers.add("Content-Type", "application/json");
HttpEntity<OpenaireSubscription> entity = new HttpEntity<>(obj, headers);
//create new template engine
RestTemplate template = new RestTemplate();
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
ResponseEntity<Subscription> resp;
try {
//communicate with endpoint
resp = template.exchange(
builder.build().encode().toUri(),
HttpMethod.POST,
entity,
new ParameterizedTypeReference<Subscription>() {
});
} catch (RestClientException e) {
throw new BrokerException(e);
}
return resp.getBody();
}
@Override
public void unsubscribe(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException {
final String service = "/subscriptions/" + subscriptionId;
//build the uri params
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(apiPath + service);
//create new template engine
RestTemplate template = new RestTemplate();
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
try {
//communicate with endpoint
template.exchange(
builder.build().encode().toUri(),
HttpMethod.DELETE,
null,
new ParameterizedTypeReference<Void>() {
});
} catch (RestClientException e) {
throw new BrokerException(e);
}
}
@Override
public Subscription getSubscription(@PathVariable("subscriptionId") String subscriptionId) throws BrokerException {
final String service = "/subscriptions/" + subscriptionId;
//build the uri params
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(apiPath + service);
//create new template engine
RestTemplate template = new RestTemplate();
template.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
ResponseEntity<Subscription> resp;
try {
//communicate with endpoint
resp = template.exchange(
builder.build().encode().toUri(),
HttpMethod.GET,
null,
new ParameterizedTypeReference<Subscription>() {
});
} catch (RestClientException e) {
throw new BrokerException(e);
}
return resp.getBody();
}
}

View File

@ -0,0 +1,39 @@
package eu.dnetlib.repo.manager.service.controllers;
import eu.dnetlib.api.functionality.ValidatorServiceException;
import eu.dnetlib.domain.functionality.validator.StoredJob;
import eu.dnetlib.repo.manager.shared.JobsOfUser;
import io.swagger.annotations.Api;
import org.json.JSONException;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(value = "/monitor")
@Api(description = "Monitor API", tags = {"monitor"})
public interface MonitorApi {
@RequestMapping(value = "/getJobsOfUser" , method = RequestMethod.GET,consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
JobsOfUser getJobsOfUser(@RequestBody String user,
@RequestBody String jobType,
@RequestBody String offset,
@RequestBody String limit,
@RequestBody String dateFrom,
@RequestBody String dateTo,
@RequestBody String validationStatus,
@RequestBody String includeJobsTotal) throws JSONException, ValidatorServiceException;
@RequestMapping(value = "/getJobsOfUserPerValidationStatus" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
int getJobsOfUserPerValidationStatus(@RequestBody String user,
@RequestBody String jobType,
@RequestBody String validationStatus) throws JSONException;
@RequestMapping(value = "/getJobSummary" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
StoredJob getJobSummary(@RequestBody String jobId,
@RequestBody String groupBy) throws JSONException;
}

View File

@ -0,0 +1,89 @@
package eu.dnetlib.repo.manager.service.controllers;
import eu.dnetlib.api.functionality.ValidatorService;
import eu.dnetlib.api.functionality.ValidatorServiceException;
import eu.dnetlib.domain.functionality.validator.StoredJob;
import eu.dnetlib.repo.manager.shared.JobsOfUser;
import eu.dnetlib.repo.manager.shared.Constants;
import gr.uoa.di.driver.util.ServiceLocator;
import org.apache.log4j.Logger;
import org.json.JSONException;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
@Component
public class MonitorApiImpl implements MonitorApi {
@Resource(name = "validatorServiceLocator")
private ServiceLocator<ValidatorService> validatorServiceLocator;
private ValidatorService getValidationService() {
return this.validatorServiceLocator.getService();
}
public ServiceLocator<ValidatorService> getValidatorServiceLocator() {
return validatorServiceLocator;
}
public void setValidatorServiceLocator(ServiceLocator<ValidatorService> validatorServiceLocator) {
this.validatorServiceLocator = validatorServiceLocator;
}
private static final Logger LOGGER = Logger
.getLogger(MonitorApiImpl.class);
@Override
public JobsOfUser getJobsOfUser(String user,
String jobType,
String offset,
String limit,
String dateFrom,
String dateTo,
String validationStatus,
String includeJobsTotal) throws JSONException, ValidatorServiceException {
LOGGER.debug("Getting jobs of user : " + user);
JobsOfUser retJobs = new JobsOfUser();
retJobs.setJobs(getValidationService().getStoredJobsNew(user, jobType, Integer.parseInt(offset),
Integer.parseInt(limit), dateFrom, dateTo, validationStatus));
if (Boolean.parseBoolean(includeJobsTotal)) {
retJobs.setTotalJobs(this.getJobsTotalNumberOfUser(user, jobType, null));
retJobs.setTotalJobsSuccessful(this.getJobsTotalNumberOfUser(user, jobType, Constants.VALIDATION_JOB_STATUS_SUCCESSFUL));
retJobs.setTotalJobsFailed(this.getJobsTotalNumberOfUser(user, jobType, Constants.VALIDATION_JOB_STATUS_FAILED));
retJobs.setTotalJobsOngoing(this.getJobsTotalNumberOfUser(user, jobType,Constants.VALIDATION_JOB_STATUS_ONGOING));
}
return retJobs;
}
private int getJobsTotalNumberOfUser(String user, String jobType, String validationStatus) throws ValidatorServiceException {
return getValidationService().getStoredJobsTotalNumberNew(user, jobType, validationStatus);
}
@Override
public int getJobsOfUserPerValidationStatus(String user,
String jobType,
String validationStatus) throws JSONException {
LOGGER.debug("Getting job with validation status : " + validationStatus);
try {
return getValidationService().getStoredJobsTotalNumberNew(user, jobType, validationStatus);
} catch (ValidatorServiceException e) {
e.printStackTrace();
}
return 0;
}
@Override
public StoredJob getJobSummary(String jobId,
String groupBy) throws JSONException {
LOGGER.debug("Getting job summary with id : " + jobId);
try {
return getValidationService().getStoredJob(Integer.parseInt(jobId), groupBy);
} catch (ValidatorServiceException e) {
e.printStackTrace();
}
return null;
}
}

View File

@ -0,0 +1,34 @@
package eu.dnetlib.repo.manager.service.controllers;
import eu.dnetlib.domain.data.PiwikInfo;
import io.swagger.annotations.Api;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(value = "/piwik")
@Api(description = "Piwik API", tags = {"piwik"})
public interface PiWikApi {
@RequestMapping(value = "/getPiwikSiteForRepo/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
PiwikInfo getPiwikSiteForRepo(String repositoryId);
@RequestMapping(value = "/savePiwikInfo" , method = RequestMethod.POST,produces = MediaType.APPLICATION_JSON_VALUE)
PiwikInfo savePiwikInfo(@RequestBody PiwikInfo piwikInfo);
@RequestMapping(value = "/getPiwikSitesForRepos" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
List<PiwikInfo> getPiwikSitesForRepos();
@RequestMapping(value = "/approvePiwikSite/{repositoryId}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
void approvePiwikSite(String repositoryId);
@RequestMapping(value = "/getOpenaireId/{repositoryid}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
String getOpenaireId(String repositoryid);
}

View File

@ -0,0 +1,83 @@
package eu.dnetlib.repo.manager.service.controllers;
import eu.dnetlib.domain.data.PiwikInfo;
import eu.dnetlib.utils.md5.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import javax.annotation.PostConstruct;
import javax.sql.DataSource;
import java.security.NoSuchAlgorithmException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import java.util.List;
@Component
public class PiWikApiImpl implements PiWikApi{
@Autowired
@Qualifier("repomanager.dataSource")
private DataSource dataSource;
private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger
.getLogger(PiWikApiImpl.class);
private final static String GET_PIWIK_SITE = "select repositoryid, siteid, authenticationtoken, creationdate, requestorname, requestoremail, validated, validationdate, comment, repositoryname, country from piwik_site where repositoryid = ?;";
private final static String INSERT_PIWIK_INFO = "insert into piwik_site (repositoryid, siteid, creationdate, requestorname, requestoremail, validated, repositoryname, country, authenticationtoken) values (?, ?, now(), ?, ?, ?, ?, ?, ?)";
private final static String GET_PIWIK_SITES = "select repositoryid, siteid, authenticationtoken, creationdate, requestorname, requestoremail, validated, validationdate, comment, repositoryname, country from piwik_site order by repositoryname";
private final static String APPROVE_PIWIK_SITE = "update piwik_site set validated=true, validationdate=now() where repositoryid = ?;";
private RowMapper<PiwikInfo> piwikRowMapper = (rs, i) -> new PiwikInfo(rs.getString("repositoryid"), getOpenaireId(rs.getString("repositoryid")), rs.getString("repositoryname"), rs.getString("country"),
rs.getString("siteid"), rs.getString("authenticationtoken"), rs.getTimestamp("creationdate"), rs.getString("requestorname"), rs.getString("requestoremail"),
rs.getBoolean("validated"), rs.getTimestamp("validationdate"), rs.getString("comment"));
@Override
public PiwikInfo getPiwikSiteForRepo(@PathVariable("repositoryId") String repositoryId) {
return new JdbcTemplate(dataSource).queryForObject(GET_PIWIK_SITE, new String[]{repositoryId}, new int[]{Types.VARCHAR}, piwikRowMapper);
}
@Override
public PiwikInfo savePiwikInfo(PiwikInfo piwikInfo) {
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
jdbcTemplate.update(INSERT_PIWIK_INFO, new Object[]{piwikInfo.getRepositoryId(), piwikInfo.getSiteId(), piwikInfo.getRequestorName(),
piwikInfo.getRequestorEmail(), piwikInfo.isValidated(), piwikInfo.getRepositoryName(), piwikInfo.getCountry(), piwikInfo.getAuthenticationToken()},
new int[]{Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.BOOLEAN, Types.VARCHAR, Types.VARCHAR, Types.VARCHAR});
return piwikInfo;
}
@Override
public List<PiwikInfo> getPiwikSitesForRepos() {
LOGGER.debug("Getting piwik sites for repos! ");
return new JdbcTemplate(dataSource).query(GET_PIWIK_SITES, piwikRowMapper);
}
@Override
public void approvePiwikSite(@PathVariable("repositoryId") String repositoryId) {
new JdbcTemplate(dataSource).update(APPROVE_PIWIK_SITE, new Object[] {repositoryId}, new int[] {Types.VARCHAR});
}
@Override
public String getOpenaireId(@PathVariable("repositoryId") String repositoryid) {
try {
if (repositoryid != null && repositoryid.contains("::"))
return repositoryid.split("::")[0] + "::" + MD5.encrypt2Hex(repositoryid.split("::")[1]);
else
return null;
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return null;
}
}

View File

@ -0,0 +1,169 @@
package eu.dnetlib.repo.manager.service.controllers;
import eu.dnetlib.domain.data.Repository;
import eu.dnetlib.domain.data.RepositoryInterface;
import eu.dnetlib.repo.manager.shared.Aggregations;
import eu.dnetlib.repo.manager.shared.Country;
import eu.dnetlib.repo.manager.shared.Timezone;
import io.swagger.annotations.Api;
import org.json.JSONException;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(value = "/repository")
@Api(description = "Repository API", tags = {"repository"})
public interface RepositoryApi {
@RequestMapping(value = "/testAggregations", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
List<String> testAggregations() throws JSONException;
@RequestMapping(value = "/getCountries", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
Country[] getCountries() ;
@RequestMapping(value = "/getRepositoriesByCountry/{country}/{mode}", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
List<Repository> getRepositoriesByCountry(String country,String mode) throws JSONException;
@RequestMapping(value = "/getRepositoriesOfUser/{userEmail}/{page}/{size}",method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
List<Repository> getRepositoriesOfUser(String userEmail,
String page,
String size) throws JSONException;
@RequestMapping(value = "/getRepositoryById/{id}", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
Repository getRepositoryById(String id) throws JSONException;
@RequestMapping(value = "/getRepositoryAggregations/{id}", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
Aggregations getRepositoryAggregations(String id) throws JSONException;
@RequestMapping(value = "/getRepositoriesByName/{name}/{page}/{size}/", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
List<Repository> getRepositoriesByName(String name,
String page,
String size) throws JSONException;
@RequestMapping(value = "/getRepositoryInterface/{id}", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
List<RepositoryInterface> getRepositoryInterface(String id) throws JSONException;
@RequestMapping(value = "/addRepository", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
void addRepository( String datatype,Repository repository) throws Exception;
@RequestMapping(value = "/deleteInterface", method = RequestMethod.DELETE)
@ResponseBody
void deleteRepositoryInterface(String id);
@RequestMapping(value = "/addInterface", method = RequestMethod.POST,
consumes = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
RepositoryInterface addRepositoryInterface(String datatype,
String repoId,
RepositoryInterface iFace) throws JSONException;
@RequestMapping(value = "/getDnetCountries", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
List<String> getDnetCountries();
@RequestMapping(value = "/getTypologies", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
List<String> getTypologies();
@RequestMapping(value = "/getTimezones", method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
List<Timezone> getTimezones();
@RequestMapping(value = "/updateManagedStatus", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
String updateManagedStatus(String id, String managed);
@RequestMapping(value = "/updateEnglishName", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
String updateEnglishName(String id, String englishName);
@RequestMapping(value = "/updateLatitude", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
String updateLatitude(String id, String latitude);
@RequestMapping(value = "/updateLongitude", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
String updateLongitude(String id, String longitude);
@RequestMapping(value = "/updateOfficialName", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
String updateOfficialName(String id, String officialName);
@RequestMapping(value = "/updateTimezone", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
String updateTimezone(String id, String timezone);
@RequestMapping(value = "/updateTypology", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
String updateTypology(String id, String typology);
@RequestMapping(value = "/updateLogoUrl", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
String updateLogoUrl(String id, String logoUrl);
@RequestMapping(value = "/updatePlatform", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
String updatePlatform(String id, String platform);
@RequestMapping(value = "/getUrlsOfUserRepos/{user_email}/{page}/{size}/",method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
List<String> getUrlsOfUserRepos(String user_email,
String page,
String size) throws JSONException;
@RequestMapping(value = "/getDatasourceVocabularies/{mode}",method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
List<String> getDatasourceVocabularies(String mode);
@RequestMapping(value = "/getCompatibilityClasses/{mode}",method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
Map<String, String> getCompatibilityClasses(String mode);
@RequestMapping(value = "/getDatasourceClasses/{mode}",method = RequestMethod.GET,
produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
Map<String, String> getDatasourceClasses(String mode);
String getCountryName(String countryCode);
}

View File

@ -0,0 +1,761 @@
package eu.dnetlib.repo.manager.service.controllers;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.domain.data.Repository;
import eu.dnetlib.domain.data.RepositoryInterface;
import eu.dnetlib.domain.enabling.Vocabulary;
import eu.dnetlib.repo.manager.service.utils.Converter;
import eu.dnetlib.repo.manager.shared.Aggregations;
import eu.dnetlib.repo.manager.shared.Constants;
import eu.dnetlib.repo.manager.shared.Country;
import eu.dnetlib.repo.manager.shared.Timezone;
import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import javax.annotation.PostConstruct;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import java.io.IOException;
import java.sql.Timestamp;
import java.text.Normalizer;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
@Component
public class RepositoryApiImpl implements RepositoryApi {
@Value("${api.baseAddress}")
private String baseAddress;
private RestTemplate restTemplate = null;
private HttpHeaders httpHeaders;
private final String[] vocabularyNames = {"dnet:countries", "dnet:datasource_typologies", "dnet:compatibilityLevel"};
private static final Logger LOGGER = Logger.getLogger(RepositoryApiImpl.class);
@Autowired
private VocabularyLoader vocabularyLoader;
private Map<String, Vocabulary> vocabularyMap = new ConcurrentHashMap<String, Vocabulary>();
private Map<String, String> countriesMap = new HashMap<>();
private Map<String, String> inverseCountriesMap = new HashMap<>();
@PostConstruct
private void init() {
LOGGER.debug("Initialization method of repository api!");
restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter());
httpHeaders = new HttpHeaders();
httpHeaders.set("Content-Type", "application/json");
for (String vocName : vocabularyNames) {
vocabularyMap.put(vocName, vocabularyLoader.getVocabulary(vocName, Locale.ENGLISH, Locale.ROOT));
}
Country[] countries = getCountries();
for (Country c : countries) {
countriesMap.put(c.getName(), c.getCode());
inverseCountriesMap.put(c.getCode(), c.getName());
}
}
@Override
public List<String> testAggregations() throws JSONException {
int page = 0;
int size = 1000;
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/list/")
.path("/{page}/{size}/")
.build().expand(page, size).encode();
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
List<String> ids = new ArrayList<>();
while (!rs.equals("[]")) {
ids.addAll(getIdsWithNonEmptyAggregations(rs));
LOGGER.debug("Checked " + (page + 1) * size + " records!");
page += 1;
uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/list/")
.path("/{page}/{size}/")
.build().expand(page, size).encode();
rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
}
return ids;
}
private List<String> getIdsWithNonEmptyAggregations(String rs) throws JSONException {
JSONArray ids = new JSONArray(rs);
List<String> agg_ids = new ArrayList<>();
for (int i = 0; i < ids.length(); i++) {
String id = ids.getString(i);
Aggregations aggregations = getRepositoryAggregations(id);
if (aggregations.getAggregationHistory() != null)
agg_ids.add(id);
}
return agg_ids;
}
@Override
public Country[] getCountries() {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/countries")
.build().encode();
return restTemplate.getForObject(uriComponents.toUri(), Country[].class);
}
@Override
public List<Repository> getRepositoriesByCountry(@PathVariable("country") String country,
@PathVariable("mode") String mode) throws JSONException {
LOGGER.debug("Getting repositories by country!");
int page = 0;
int size = 100;
String countryCode = countriesMap.get(country);
String filterKey = "UNKNOWN";
if (mode.equalsIgnoreCase("opendoar")) {
filterKey = "openaire____::opendoar";
} else if (mode.equalsIgnoreCase("re3data")) {
filterKey = "openaire____::re3data";
} else if (mode.equalsIgnoreCase("jour_aggr")) {
filterKey = "infrastruct_::openaire";
}
LOGGER.debug("Country code equals : " + countryCode);
LOGGER.debug("Filter mode equals : " + filterKey);
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/search/country/")
.path("/{page}/{size}/")
.queryParam("country", countryCode)
.build().expand(page, size).encode();
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
List<Repository> resultSet = new ArrayList<>();
while (!rs.equals("[]")) {
List<Repository> rep = Converter.jsonToRepositoryList(new JSONArray(rs));
Collection<Repository> repos = this.getRepositoriesByMode(filterKey, rep);
resultSet.addAll(repos);
page += 1;
uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/search/country/")
.path("/{page}/{size}/")
.queryParam("country", countryCode)
.build().expand(page, size).encode();
rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
}
for (Repository r : resultSet){
r.setInterfaces(this.getRepositoryInterface(r.getId()));
r.setCountryName(getCountryName(r.getCountryCode()));
}
return resultSet;
}
private Collection<Repository> getRepositoriesByMode(String mode, List<Repository> rs) {
List<Repository> reps = new ArrayList<>();
for (Repository r : rs) {
if (r.getCollectedFrom().equals(mode))
reps.add(r);
}
return reps;
}
@Override
public List<Repository> getRepositoriesOfUser(@PathVariable("userEmail") String userEmail,
@PathVariable("page") String page,
@PathVariable("size") String size) throws JSONException {
LOGGER.debug("Retreiving repositories of user : " + userEmail );
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/search/registeredby/")
.path("/{page}/{size}/")
.queryParam("registeredBy", userEmail)
.build().expand(page, size).encode();
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
List<Repository> repos = Converter.jsonToRepositoryList(new JSONArray(rs));
for (Repository r : repos){
r.setInterfaces(this.getRepositoryInterface(r.getId()));
r.setCountryName(getCountryName(r.getCountryCode()));
}
return repos;
}
@Override
public Repository getRepositoryById(@PathVariable("id") String id) throws JSONException {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/get/")
.path("/{id}/")
.build().expand(id).encode();
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
Repository repo = Converter.jsonToRepositoryObject(new JSONObject(rs));
if (repo != null) {
repo.setCountryName(getCountryName(repo.getCountryCode()));
repo.setInterfaces(this.getRepositoryInterface(repo.getId()));
}
return repo;
}
@Override
public Aggregations getRepositoryAggregations(@PathVariable("id") String id) throws JSONException {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/get/")
.path("/{id}/")
.build().expand(id).encode();
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
JSONObject repository = new JSONObject(rs);
Aggregations aggregations = new Aggregations();
try {
aggregations.setAggregationHistory(Converter.getAggregationHistoryFromJson(repository));
aggregations.setLastCollection(Converter.getLastCollectionFromJson(repository));
aggregations.setLastTransformation(Converter.getLastTransformationFromJson(repository));
return aggregations;
} catch (JSONException e) {
LOGGER.debug("JSON aggregation exception ", e);
throw e;
}
}
@Override
public List<Repository> getRepositoriesByName(@PathVariable("name") String name,
@PathVariable("page") String page,
@PathVariable("size") String size) throws JSONException {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/search/name/")
.path("/{page}/{size}")
.queryParam("name", name)
.build().expand(page, size).encode();
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
List<Repository> repos = Converter.jsonToRepositoryList(new JSONArray(rs));
for (Repository r : repos){
// r.setInterfaces(this.getRepositoryInterface(r.getId()));
r.setCountryName(getCountryName(r.getCountryCode()));
}
return repos;
}
@Override
public List<RepositoryInterface> getRepositoryInterface(@PathVariable("id") String id) throws JSONException {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/api/")
.path("/{id}/")
.build().expand(id).encode();
String rs = restTemplate.getForObject(uriComponents.toUri(), String.class);
return Converter.jsonToRepositoryInterfaceList(new JSONArray(rs));
}
@Override
public void addRepository(@RequestParam("datatype") String datatype,
@RequestBody Repository repository) throws Exception {
/*JSONObject json_params = new JSONObject(params);
String datatype = json_params.getString("datatype");
String json_repository = json_params.getString("repository");
Repository repository = null;*/
ObjectMapper mapper = new ObjectMapper();
mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
try {
String json_repo = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(repository);
LOGGER.debug("repository -> " + json_repo);
// repository = mapper.readValue(json_repository, Repository.class);
} catch (Exception e) {
LOGGER.debug("Error parsing repository ", e);
throw e;
}
repository = this.setRepositoryFeatures(datatype,repository);
LOGGER.debug("storing " + datatype + " repository with id: " + repository.getId());
if (!datatype.equalsIgnoreCase("opendoar") && !datatype.equalsIgnoreCase("re3data")) {
if (datatype.equalsIgnoreCase("journal") || datatype.equalsIgnoreCase("aggregator")) {
LOGGER.debug("looking if " + datatype + " " + repository.getOfficialName() + " is already in datasources");
if (getRepositoryById(repository.getId()) != null) {
String retMessage = datatype + " '" + repository.getOfficialName() + "' is already in datasources.";
repository.getInterfaces().clear();
LOGGER.debug(retMessage);
} else {
LOGGER.debug(datatype + " " + repository.getOfficialName() + " is not in datasources. Inserting..");
this.storeRepository(repository);
}
}
} else {
this.updateRepository(repository);
}
LOGGER.debug("Inserting Interfaces");
Iterator var11 = repository.getInterfaces().iterator();
while (var11.hasNext()) {
RepositoryInterface iFace = (RepositoryInterface) var11.next();
if (!iFace.getBaseUrl().isEmpty() && !iFace.getDesiredCompatibilityLevel().isEmpty()) {
if (iFace.getId() != null && !iFace.getId().isEmpty()) {
LOGGER.debug("updating iface..");
this.updateInterface(datatype,iFace);
LOGGER.debug("updated successfully");
} else {
LOGGER.debug("adding new iface..");
this.registerRepositoryInterface(repository.getId(),iFace,datatype);
}
}
}
}
private void updateRepository(Repository repository) {
this.updateRegisteredByValue(repository.getId(),repository.getRegisteredBy());
this.updateEnglishName(repository.getId(),repository.getEnglishName());
this.updateLogoUrl(repository.getId(),repository.getLogoUrl());
this.updateTimezone(repository.getId(), String.valueOf(repository.getTimezone()));
//TODO update datasource type
}
private void updateRegisteredByValue(String id, String registeredBy) {
LOGGER.debug("Updating registered by value with : " + registeredBy );
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/registeredby/")
.queryParam("dsId",id)
.queryParam("registeredBy", registeredBy)
.build()
.encode();
restTemplate.postForObject(uriComponents.toUri(), null,String.class);
}
private Repository setRepositoryFeatures(String datatype, Repository repository) {
//TODO update map
repository.setCountryCode(countriesMap.get(repository.getCountryName()));
repository.setActivationId(UUID.randomUUID().toString());
// repo.setRegisteredBy((String) session.get(LocalVocabularies.loggedInField));
if (datatype.equals("opendoar") || datatype.equals("re3data")) {
repository.setProvenanceActionClass("sysimport:crosswalk:entityregistry");
} else if (datatype.equals("journal")) {
repository.setProvenanceActionClass("user:insert");
repository.setCollectedFrom("infrastruct_::openaire");
if (repository.getIssn() != null && repository.getIssn().length() == 0)
repository.setIssn(com.unboundid.util.Base64.encode(repository.getOfficialName()).substring(0, 8));
repository.setId("openaire____::issn" + repository.getIssn());
repository.setNamespacePrefix("issn" + repository.getIssn());
} else if (datatype.equals("aggregator")) {
repository.setProvenanceActionClass("user:insert");
repository.setCollectedFrom("infrastruct_::openaire");
repository.setId("openaire____::" + com.unboundid.util.Base64.encode(repository.getOfficialName()));
repository.setNamespacePrefix(Normalizer.normalize(repository.getOfficialName().toLowerCase().replace(" ", "_"), Normalizer.Form.NFD).replaceAll("[^a-zA-Z0-9]", ""));
if (repository.getNamespacePrefix().length() > 12) {
repository.setNamespacePrefix(repository.getNamespacePrefix().substring(0, 12));
} else {
while (repository.getNamespacePrefix().length() < 12)
repository.setNamespacePrefix(repository.getNamespacePrefix().concat("_"));
}
}
return repository;
}
private void updateInterface(String datatype,RepositoryInterface iFace) {
//TODO call update base url
//((DatasourceManagerService) this.dmService.getService()).updateBaseUrl(repo.getId(), iFace.getId(), iFace.getBaseUrl());
if (!iFace.getAccessSet().isEmpty()) {
LOGGER.debug("set not empty: " + iFace.getAccessSet());
//TODO call update method for access params
// ((DatasourceManagerService) this.dmService.getService()).updateAccessParam(repo.getId(), iFace.getId(), "set", iFace.getAccessSet(), false);
} else {
//TODO call deleteAccessParamOrExtraField
//((DatasourceManagerService) this.dmService.getService()).deleteAccessParamOrExtraField(repo.getId(), iFace.getId(), "set");
}
//TODO update content description
//((DatasourceManagerService) this.dmService.getService()).updateContentDescription(repo.getId(), iFace.getId(), "metadata");
if (datatype.equals("re3data")) {
//TODO call update access params
// ((DatasourceManagerService) this.dmService.getService()).updateAccessParam(repo.getId(), iFace.getId(), "format", "oai_datacite", false);
iFace.setAccessFormat("oai_datacite");
} else {
//TODO call update access params
//((DatasourceManagerService) this.dmService.getService()).updateAccessParam(repo.getId(), iFace.getId(), "format", "oai_dc", false);
iFace.setAccessFormat("oai_dc");
}
}
private RepositoryInterface createRepositoryInterface(Repository repo, RepositoryInterface iFace, String datatype) {
iFace.setContentDescription("metadata");
iFace.setCompliance("UNKNOWN");
if (datatype.equals("re3data")) {
iFace.setAccessFormat("oai_datacite");
} else {
iFace.setAccessFormat("oai_dc");
}
if (repo.getDatasourceClass() != null && !repo.getDatasourceClass().isEmpty()) {
iFace.setTypology(repo.getDatasourceClass());
} else if (datatype.equalsIgnoreCase("journal")) {
iFace.setTypology("pubsrepository::journal");
} else if (datatype.equalsIgnoreCase("aggregator")) {
iFace.setTypology("aggregator::pubsrepository::unknown");
} else if (datatype.equalsIgnoreCase("opendoar")) {
iFace.setTypology("pubsrepository::unknown");
} else if (datatype.equalsIgnoreCase("re3data")) {
iFace.setTypology("datarepository::unknown");
}
iFace.setRemovable(true);
iFace.setAccessProtocol("oai");
iFace.setMetadataIdentifierPath("//*[local-name()='header']/*[local-name()='identifier']");
// iFace.setId("api_________::" + repo.getId() + "::" + UUID.randomUUID().toString().substring(0, 8));
if (iFace.getAccessSet().isEmpty()) {
LOGGER.debug("set is empty: " + iFace.getAccessSet());
iFace.removeAccessSet();
}
return iFace;
}
private void storeRepository(Repository repository) throws JSONException {
Date utilDate = new Date();
Timestamp date = new Timestamp(utilDate.getTime());
repository.setDateOfCollection(date);
repository.setAggregator("OPENAIRE");
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/add/")
.build()
.encode();
String json_repository = Converter.repositoryObjectToJson(repository);
HttpEntity<String> httpEntity = new HttpEntity <String> (json_repository,httpHeaders);
restTemplate.postForObject(uriComponents.toUri(),httpEntity,String.class);
}
@Override
public void deleteRepositoryInterface(@PathVariable("id") String id){
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/api/")
.path("/{id}/")
.build().expand(id).encode();
restTemplate.delete(uriComponents.toUri());
}
@Override
public RepositoryInterface addRepositoryInterface(@RequestParam("datatype") String datatype,
@RequestParam("repoId") String repoId,
@RequestBody RepositoryInterface repositoryInterface) throws JSONException {
/* JSONObject json_params = new JSONObject(params);
// LOGGER.debug(params);
//TODO iFace parameter from gui. Object to json
String datatype = json_params.getString("datatype");
String repoId = json_params.getString("repoId");
String json_iFace = json_params.getString("iFace");
RepositoryInterface iFace = null;
ObjectMapper mapper = new ObjectMapper();
try {
iFace = mapper.readValue(json_iFace, RepositoryInterface.class);
} catch (Exception e1) {
LOGGER.debug("Error parsing repository interface ", e1);
}*/
return registerRepositoryInterface(repoId,repositoryInterface,datatype);
}
private RepositoryInterface registerRepositoryInterface(String repoId, RepositoryInterface iFace, String datatype) {
Repository e = null;
try {
e = this.getRepositoryById(repoId);
iFace = createRepositoryInterface(e,iFace,datatype);
ObjectMapper mapper = new ObjectMapper();
String json_interface = Converter.repositoryInterfaceObjectToJson(e,iFace);
LOGGER.debug("iFace equals -> " + json_interface);
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/api/add/")
.build()
.encode();
HttpEntity<String> httpEntity = new HttpEntity <String> (json_interface,httpHeaders);
restTemplate.postForObject(uriComponents.toUri(),httpEntity,String.class);
return iFace;
} catch (JSONException e1) {
LOGGER.debug("Error parsing json ",e1);
}
return null;
}
@Override
public List<String> getDnetCountries() {
LOGGER.debug("Getting dnet-countries!");
return Converter.readFile("countries.txt");
}
@Override
public List<String> getTypologies() {
return Converter.readFile("typologies.txt");
}
@Override
public List<Timezone> getTimezones() {
List<String> timezones = Converter.readFile("timezones.txt");
return Converter.toTimezones(timezones);
}
@Override
public String updateManagedStatus(@RequestParam(value = "id") String id,
@RequestParam(value = "managed") String managed) {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/manage/")
.queryParam("id",id)
.queryParam("managed",managed)
.build().encode();
return restTemplate.postForObject(uriComponents.toUri(), null,String.class);
}
@Override
public String updateEnglishName(@RequestParam(value = "id") String id,
@RequestParam(value = "englishname") String englishName) {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/englishname/")
.queryParam("dsId",id)
.queryParam("englishname",englishName)
.build().encode();
return restTemplate.postForObject(uriComponents.toUri(), null,String.class);
}
@Override
public String updateLatitude(@RequestParam(value = "id") String id,
@RequestParam(value = "managed") String latitude) {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/latitude/")
.queryParam("dsId",id)
.queryParam("latitude",latitude)
.build().encode();
return restTemplate.postForObject(uriComponents.toUri(), null,String.class);
}
@Override
public String updateLongitude(@RequestParam(value = "id") String id,
@RequestParam(value = "longitude") String longitude) {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/longitude/")
.queryParam("dsId",id)
.queryParam("longitude",longitude)
.build().encode();
return restTemplate.postForObject(uriComponents.toUri(), null,String.class);
}
@Override
public String updateOfficialName(@RequestParam(value = "id") String id,
@RequestParam(value = "officialname") String officialname) {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/officialname/")
.queryParam("dsId",id)
.queryParam("officialname",officialname)
.build().encode();
return restTemplate.postForObject(uriComponents.toUri(), null,String.class);
}
@Override
public String updateTimezone(@RequestParam(value = "id") String id,
@RequestParam(value = "timezone") String timezone) {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/timezone")
.queryParam("dsId",id)
.queryParam("timezone",timezone)
.build().encode();
return restTemplate.postForObject(uriComponents.toUri(), null,String.class);
}
@Override
public String updateTypology(@RequestParam(value = "id") String id,
@RequestParam(value = "typology") String typology) {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/typology")
.queryParam("dsId",id)
.queryParam("typology",typology)
.build().encode();
return restTemplate.postForObject(uriComponents.toUri(), null,String.class);
}
@Override
public String updateLogoUrl(@RequestParam(value = "id") String id,
@RequestParam(value = "logoUrl") String logoUrl) {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/logourl")
.queryParam("dsId",id)
.queryParam("logourl",logoUrl)
.build().encode();
return restTemplate.postForObject(uriComponents.toUri(), null,String.class);
}
@Override
public String updatePlatform(String id, String platform) {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/ds/platform")
.queryParam("dsId",id)
.queryParam("platform",platform)
.build().encode();
return restTemplate.postForObject(uriComponents.toUri(), null,String.class);
}
@Override
public List<String> getUrlsOfUserRepos(@PathVariable("user_email") String user_email,
@PathVariable("page") String page,
@PathVariable("size") String size) throws JSONException {
UriComponents uriComponents = UriComponentsBuilder
.fromHttpUrl(baseAddress + "/api/baseurl/")
.path("/{page}/{size}")
.queryParam("userEmail",user_email)
.build().expand(page,size).encode();
return Arrays.asList(restTemplate.getForObject(uriComponents.toUri(), String[].class));
}
@Override
public List<String> getDatasourceVocabularies(@PathVariable("mode") String mode) {
List<String> resultSet = new ArrayList<>();
for (Map.Entry<String, String> entry : this.getVocabulary("dnet:datasource_typologies").getAsMap().entrySet()) {
if (mode.equalsIgnoreCase("aggregator")) {
if (entry.getKey().contains("aggregator"))
resultSet.add(entry.getValue());
} else if (mode.equalsIgnoreCase("journal")) {
if (entry.getKey().contains("journal"))
resultSet.add(entry.getValue());
} else if (mode.equalsIgnoreCase("opendoar")) {
if (entry.getKey().contains("pubsrepository"))
resultSet.add(entry.getValue());
} else if (mode.equalsIgnoreCase("re3data")) {
if (entry.getKey().contains("datarepository"))
resultSet.add(entry.getValue());
}
}
return resultSet;
}
private Vocabulary getVocabulary(String vocName) {
if (!vocabularyMap.containsKey(vocName)) {
vocabularyMap.put(vocName, vocabularyLoader.getVocabulary(vocName, Locale.ENGLISH, Locale.ROOT));
}
return vocabularyMap.get(vocName);
}
@Override
public Map<String, String> getCompatibilityClasses(@PathVariable("mode") String mode) {
LOGGER.debug("Getting compatibility classes for mode: " + mode);
Map<String, String> retMap = new HashMap<String, String>();
Map<String, String> compatibilityClasses = this.getVocabulary("dnet:compatibilityLevel").getAsMap();
boolean foundData = false;
for (Map.Entry<String, String> entry : compatibilityClasses.entrySet()) {
if (mode.equalsIgnoreCase(Constants.REPOSITORY_MODE_ALL))
return compatibilityClasses;
else if (mode.equalsIgnoreCase(Constants.REPOSITORY_MODE_RE3DATA)) {
if (entry.getKey().matches("^openaire[1-9].0_data$")) {
retMap.put(entry.getKey(), entry.getValue());
foundData = true;
}
} else {
if (entry.getKey().matches("^openaire[1-9].0$") || entry.getKey().equals("driver"))
retMap.put(entry.getKey(), entry.getValue());
}
}
//TODO TO BE REMOVED WHEN VOCABULARIES ARE UPDATED
if (mode.equalsIgnoreCase(Constants.REPOSITORY_MODE_RE3DATA) && !foundData)
retMap.put("openaire2.0_data", "OpenAIRE Data (funded, referenced datasets)");
return retMap;
}
@Override
public Map<String, String> getDatasourceClasses(@PathVariable("mode") String mode) {
LOGGER.debug("Getting datasource classes for mode: " + mode);
Map<String, String> retMap = new HashMap<String, String>();
for (Map.Entry<String, String> entry : this.getVocabulary("dnet:datasource_typologies").getAsMap().entrySet()) {
if (mode.equalsIgnoreCase("aggregator")) {
if (entry.getKey().contains("aggregator"))
retMap.put(entry.getKey(), entry.getValue());
} else if (mode.equalsIgnoreCase("journal")) {
if (entry.getKey().contains("journal"))
retMap.put(entry.getKey(), entry.getValue());
} else if (mode.equalsIgnoreCase("opendoar")) {
if (entry.getKey().contains("pubsrepository"))
retMap.put(entry.getKey(), entry.getValue());
} else if (mode.equalsIgnoreCase("re3data")) {
if (entry.getKey().contains("datarepository"))
retMap.put(entry.getKey(), entry.getValue());
}
}
return retMap;
}
@Override
public String getCountryName(String countryCode) {
return inverseCountriesMap.get(countryCode);
}
}

View File

@ -0,0 +1,42 @@
package eu.dnetlib.repo.manager.service.controllers;
import eu.dnetlib.domain.functionality.validator.JobForValidation;
import eu.dnetlib.domain.functionality.validator.RuleSet;
import io.swagger.annotations.Api;
import org.json.JSONException;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping(value = "/validator")
@Api(description = "Validator API", tags = {"validator"})
public interface ValidatorApi {
@RequestMapping(value = "/submitJobForValidation",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE )
@ResponseBody
void submitJobForValidation(@RequestBody JobForValidation jobForValidation);
@RequestMapping(value = "/reSubmitJobForValidation/",method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE )
@ResponseBody
void reSubmitJobForValidation(@RequestBody String jobId) throws JSONException;
@RequestMapping(value = "/getRuleSets/{mode}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
List<RuleSet> getRuleSets(String mode);
@RequestMapping(value = "/getSetsOfRepository" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
List<String> getSetsOfRepository(@RequestBody String url);
@RequestMapping(value = "/identifyRepository/{url}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
boolean identifyRepo(String url);
@RequestMapping(value = "/getRuleSet/{acronym}" , method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
RuleSet getRuleSet(String acronym);
}

View File

@ -0,0 +1,167 @@
package eu.dnetlib.repo.manager.service.controllers;
import eu.dnetlib.api.functionality.ValidatorServiceException;
import eu.dnetlib.domain.functionality.validator.StoredJob;
import eu.dnetlib.repo.manager.service.utils.OaiTools;
import eu.dnetlib.repo.manager.shared.ValidationServiceException;
import gr.uoa.di.driver.util.ServiceLocator;
import eu.dnetlib.domain.functionality.validator.JobForValidation;
import eu.dnetlib.domain.functionality.validator.RuleSet;
import eu.dnetlib.repo.manager.shared.Constants;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import eu.dnetlib.api.functionality.ValidatorService;
import org.apache.log4j.Logger;
import org.json.JSONException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import sun.rmi.runtime.Log;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
@Component
public class ValidatorApiImpl implements ValidatorApi{
@Autowired
private MonitorApiImpl monitorApi;
@Resource(name = "validatorServiceLocator")
private ServiceLocator<ValidatorService> validatorServiceLocator;
private ValidatorService getValidationService() {
return this.validatorServiceLocator.getService();
}
public ServiceLocator<ValidatorService> getValidatorServiceLocator() {
return validatorServiceLocator;
}
public void setValidatorServiceLocator(ServiceLocator<ValidatorService> validatorServiceLocator) {
this.validatorServiceLocator = validatorServiceLocator;
}
private Map<String, List<RuleSet>> rulesetMap = new ConcurrentHashMap<String, List<RuleSet>>();
private static final Logger LOGGER = Logger
.getLogger(ValidatorApiImpl.class);
@PostConstruct
private void loadRules(){
LOGGER.debug("PostConstruct method! Load rules!");
try {
for (RuleSet ruleSet : getValidationService().getRuleSets()) {
if (ruleSet.getVisibility() != null && ruleSet.getVisibility().contains("development")) {
String key = "";
if (ruleSet.getGuidelinesAcronym().matches("^openaire[1-9].0_data$"))
key = Constants.VALIDATION_MODE_DATA;
else if (ruleSet.getGuidelinesAcronym().matches("^openaire[1-9].0$") || ruleSet.getGuidelinesAcronym().equals("driver"))
key = Constants.VALIDATION_MODE_LITERATURE;
else if (ruleSet.getGuidelinesAcronym().matches("^openaire[1-9].0_cris$"))
key = Constants.VALIDATION_MODE_CRIS;
if (rulesetMap.containsKey(key))
rulesetMap.get(key).add(ruleSet);
else {
List<RuleSet> ruleSets = new ArrayList<RuleSet>();
ruleSets.add(ruleSet);
rulesetMap.put(key, ruleSets);
}
}
}
} catch (ValidatorServiceException e) {
e.printStackTrace();
}
}
@Override
public void submitJobForValidation(JobForValidation jobForValidation) {
LOGGER.debug("Submit job for validation with id : " + jobForValidation.getDatasourceId());
try {
this.getValidationService().submitValidationJob(jobForValidation);
} catch (ValidatorServiceException e) {
e.printStackTrace();
}
}
@Override
public void reSubmitJobForValidation(String jobId) throws JSONException {
LOGGER.debug("Resubmit validation job with id : " + jobId);
StoredJob job = monitorApi.getJobSummary(jobId,"all");
Set<Integer> contentRules = new HashSet<Integer>();
Set<Integer> usageRules = new HashSet<Integer>();
RuleSet ruleSet = null;
for (List<RuleSet> ruleSets : this.rulesetMap.values()) {
for (RuleSet rSet : ruleSets)
if (rSet.getGuidelinesAcronym().equals(job.getDesiredCompatibilityLevel())) {
ruleSet = rSet;
break;
}
}
for (int ruleId : job.getRules()) {
if (ruleSet.getContentRulesIds().contains(ruleId))
contentRules.add(ruleId);
else if (ruleSet.getUsageRulesIds().contains(ruleId))
usageRules.add(ruleId);
}
if (!contentRules.isEmpty())
job.setSelectedContentRules(contentRules);
if (!usageRules.isEmpty())
job.setSelectedUsageRules(usageRules);
this.submitJobForValidation(job);
}
@Override
public List<RuleSet> getRuleSets(@PathVariable("mode") String mode) {
LOGGER.info("Getting rulesets for mode: " + mode);
return rulesetMap.get(mode);
}
@Override
public List<String> getSetsOfRepository(String url) {
LOGGER.debug("Getting sets of repository with url : " + url);
try {
return OaiTools.getSetsOfRepo(url);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@Override
public boolean identifyRepo(String url) {
LOGGER.debug("Identify repository with url : " + url);
try {
return OaiTools.identifyRepository(url);
} catch (Exception e) {
LOGGER.error("Error while identifying repository with url: " + url, e);
return false;
}
}
@Override
public RuleSet getRuleSet(String acronym) {
LOGGER.debug("Getting ruleset with acronym : " + acronym);
RuleSet ruleSet = null;
try {
for (List<RuleSet> ruleSets : this.rulesetMap.values()) {
for (RuleSet rSet : ruleSets)
if (rSet.getGuidelinesAcronym().equals(acronym)) {
ruleSet = rSet;
break;
}
}
return ruleSet;
} catch (Exception e) {
LOGGER.error("Error getting ruleset", e);
return null;
}
}
}

View File

@ -0,0 +1,351 @@
package eu.dnetlib.repo.manager.service.utils;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import eu.dnetlib.domain.data.Repository;
import eu.dnetlib.domain.data.RepositoryInterface;
import eu.dnetlib.repo.manager.service.controllers.RepositoryApi;
import eu.dnetlib.repo.manager.shared.*;
import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public class Converter {
private static final Logger LOGGER = Logger.getLogger(Converter.class);
public static Repository jsonToRepositoryObject(JSONObject repositoryObject) throws JSONException {
Repository repository = new Repository();
if( repositoryObject.get("datasource").equals(null))
return null;
JSONObject datasource = (JSONObject) repositoryObject.get("datasource");
repository.setActivationId(datasource.get("activationId").toString());
repository.setAggregator(datasource.get("aggregator").toString());
repository.setCertificates(datasource.get("certificates").toString());
repository.setCitationGuidelineUrl(datasource.get("citationguidelineurl").toString());
repository.setCollectedFrom( datasource.get("collectedfrom").toString());
repository.setContactEmail(datasource.get("contactemail").toString());
if(repository.getContactEmail().equals("null"))
repository.setContactEmail("");
repository.setDatabaseAccessRestriction(datasource.get("databaseaccessrestriction").toString());
repository.setDatabaseAccessType(datasource.get("databaseaccesstype").toString());
repository.setDataUploadRestriction(datasource.get("datauploadrestriction").toString());
repository.setDataUploadType(datasource.get("datauploadtype").toString());
repository.setDateOfCollection(convertStringToDate( datasource.get("dateofcollection").toString()));
repository.setDateOfValidation(convertStringToDate( datasource.get("dateofvalidation").toString()));
repository.setDescription(datasource.get("description").toString());
if(repository.getDescription().equals("null"))
repository.setDescription("");
repository.setEissn(datasource.get("eissn").toString());
repository.setEnglishName( datasource.get("englishname").toString());
if(repository.getEnglishName().equals("null"))
repository.setEnglishName("");
repository.setId(datasource.get("id").toString());
repository.setIssn(datasource.get("issn").toString());
repository.setOdLanguages(datasource.get("languages").toString());
repository.setLatitude( toDouble(datasource.get("latitude").toString()));
repository.setLissn(datasource.get("lissn").toString());
repository.setLogoUrl(datasource.get("logourl").toString());
if(repository.getLogoUrl().equals("null"))
repository.setLogoUrl("");
repository.setLongitude(toDouble(datasource.get("longitude").toString()));
//datasource.get("managed");
repository.setMissionStatementUrl(datasource.get("missionstatementurl").toString());
repository.setNamespacePrefix(datasource.get("namespaceprefix").toString());
repository.setOdContentTypes(datasource.get("od_contenttypes").toString());
repository.setOfficialName(datasource.get("officialname").toString());
if(repository.getOfficialName().equals("null"))
repository.setOfficialName("");
repository.setPidSystems(datasource.get("pidsystems").toString());
//datasource.get("platform");
repository.setProvenanceActionClass( datasource.get("provenanceaction").toString());
repository.setQualityManagementKind(datasource.get("qualitymanagementkind").toString());
repository.setRegisteredBy(datasource.get("registeredby").toString());
repository.setReleaseEndDate(convertStringToDate(datasource.get("releaseenddate").toString()));
repository.setReleaseStartDate(convertStringToDate(datasource.get("releasestartdate").toString()));
repository.setServiceProvider(Boolean.valueOf(datasource.get("serviceprovider").toString()));
//datasource.get("subjects");
Double timezone = toDouble(datasource.get("timezone").toString());
repository.setTimezone(timezone!=null?timezone:0.0);
repository.setTypology(datasource.get("platform").toString());
repository.setVersioning(Boolean.valueOf(datasource.get("versioning").toString()));
repository.setWebsiteUrl(datasource.get("websiteurl").toString());
repository.setDatasourceClass(datasource.get("typology").toString());
//TODO change organization to list
repository.setOrganization( ((JSONArray)datasource.get("organizations")).getJSONObject(0).get("legalname").toString());
String countryCode = ((JSONArray)datasource.get("organizations")).getJSONObject(0).get("country").toString();
repository.setCountryCode(countryCode);
String collectedFrom = datasource.get("collectedfrom").toString();
//TODO check data consistency
String type = "UNKNOWN";
if (collectedFrom.equalsIgnoreCase("openaire____::opendoar")) {
type = "opendoar";
} else if (collectedFrom.equalsIgnoreCase("openaire____::re3data")) {
type = "re3data";
} else if (collectedFrom.equalsIgnoreCase("infrastruct_::openaire")) {
type = "journal";
}
repository.setDatasourceType(type);
return repository;
}
public static Date convertStringToDate(String date){
if(Objects.equals(date, "null"))
return null;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
try {
return formatter.parse(date);
} catch (ParseException e) {
e.printStackTrace();
}
return null;
}
public static String convertDateToString(Date date){
if(Objects.equals(date, null))
return null;
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
return formatter.format(date);
}
public static Double toDouble(String number){
if(Objects.equals(number, "null"))
return 0.0;
else
return Double.valueOf(number);
}
public static List<Repository> jsonToRepositoryList(JSONArray rs) throws JSONException {
List<Repository> resultSet = new ArrayList<>();
for(int i=0;i<rs.length();i++)
resultSet.add(jsonToRepositoryObject( rs.getJSONObject(i)) );
return resultSet;
}
public static List<RepositoryInterface> jsonToRepositoryInterfaceList(JSONArray rs) throws JSONException {
List<RepositoryInterface> resultSet = new ArrayList<>();
for(int i=0;i<rs.length();i++)
resultSet.add(jsonToRepositoryInterfaceObject( rs.getJSONObject(i)) );
return resultSet;
}
public static RepositoryInterface jsonToRepositoryInterfaceObject(JSONObject repositoryInterfaceObject) throws JSONException {
RepositoryInterface repositoryInterface = new RepositoryInterface();
repositoryInterface.setBaseUrl(repositoryInterfaceObject.get("baseurl").toString());
repositoryInterface.setContentDescription(repositoryInterfaceObject.get("contentdescription").toString());
repositoryInterface.setId(repositoryInterfaceObject.get("id").toString());
repositoryInterface.setMetadataIdentifierPath(repositoryInterfaceObject.get("metadataIdentifierPath").toString());
repositoryInterface.setAccessProtocol(repositoryInterfaceObject.get("protocol").toString());
repositoryInterface.setTypology(repositoryInterfaceObject.get("typology").toString());
repositoryInterface.setDesiredCompatibilityLevel(repositoryInterfaceObject.get("compatibility").toString());
repositoryInterface.setActive(Boolean.parseBoolean(repositoryInterfaceObject.get("active").toString()));
repositoryInterface.setRemovable(Boolean.parseBoolean(repositoryInterfaceObject.get("removable").toString()));
repositoryInterface.setCompliance(repositoryInterfaceObject.get("compatibility").toString());
Map<String, String> accessParams = new HashMap<>();
Map<String, String> extraFields = new HashMap<>();
ObjectMapper mapper = new ObjectMapper();
JSONArray apiparams = repositoryInterfaceObject.getJSONArray("apiparam");
for(int i=0;i<apiparams.length();i++)
accessParams.put(apiparams.getJSONObject(i).getString("param"),apiparams.getJSONObject(i).getString("value"));
return repositoryInterface;
}
public static String repositoryObjectToJson(Repository repository) throws JSONException {
JSONObject jsonObject = new JSONObject();
jsonObject.put("activationId",repository.getActivationId());
jsonObject.put("aggregator",repository.getAggregator());
jsonObject.put("certificates",repository.getCertificates());
jsonObject.put("citationguidelineurl",repository.getCitationGuidelineUrl());
jsonObject.put("collectedfrom",repository.getCollectedFrom());
jsonObject.put("contactemail",repository.getContactEmail());
jsonObject.put("databaseaccessrestriction",repository.getDatabaseAccessRestriction());
jsonObject.put("databaseaccesstype",repository.getDatabaseAccessType());
jsonObject.put("datauploadrestriction",repository.getDataUploadRestriction());
jsonObject.put("datauploadtype",repository.getDataUploadType());
jsonObject.put("dateofcollection",convertDateToString(repository.getDateOfCollection()));
jsonObject.put("dateofvalidation",convertDateToString(repository.getDateOfValidation()));
jsonObject.put("description",repository.getDescription());
jsonObject.put("eissn",repository.getEissn());
jsonObject.put("englishname",repository.getEnglishName());
jsonObject.put("id",repository.getId());
jsonObject.put("issn",repository.getIssn());
jsonObject.put("languages",repository.getOdLanguages());
jsonObject.put("latitude",repository.getLatitude().toString());
jsonObject.put("lissn",repository.getLissn());
jsonObject.put("logourl",repository.getLogoUrl());
jsonObject.put("longitude",repository.getLongitude().toString());
jsonObject.put("missionstatementurl",repository.getMissionStatementUrl());
jsonObject.put("namespaceprefix",repository.getNamespacePrefix());
jsonObject.put("od_contenttypes",repository.getOdContentTypes());
jsonObject.put("officialname",repository.getOfficialName());
jsonObject.put("pidsystems",repository.getPidSystems());
jsonObject.put("provenanceaction",repository.getProvenanceActionClass());
jsonObject.put("qualitymanagementkind",repository.getQualityManagementKind());
jsonObject.put("registeredby",repository.getRegisteredBy());
jsonObject.put("releaseenddate",convertDateToString(repository.getReleaseEndDate()));
jsonObject.put("releasestartdate",convertDateToString(repository.getReleaseStartDate()));
jsonObject.put("serviceprovider",repository.getServiceProvider());
jsonObject.put("timezone",repository.getTimezone());
jsonObject.put("typology",repository.getTypology());
jsonObject.put("versioning",repository.getVersioning());
jsonObject.put("websiteurl",repository.getWebsiteUrl());
//datasource.get("managed");
//datasource.get("platform");
//datasource.get("subjects");
return jsonObject.toString();
}
public static String repositoryInterfaceObjectToJson(Repository repository,RepositoryInterface repositoryInterface) throws JSONException {
JSONObject jsonObject = new JSONObject();
jsonObject.put("baseurl",repositoryInterface.getBaseUrl());
jsonObject.put("contentdescription",repositoryInterface.getContentDescription());
jsonObject.put("id",repositoryInterface.getId());
jsonObject.put("metadataIdentifierPath",repositoryInterface.getMetadataIdentifierPath());
jsonObject.put("protocol",repositoryInterface.getAccessProtocol());
jsonObject.put("typology",repositoryInterface.getTypology());
jsonObject.put("compatibility",repositoryInterface.getDesiredCompatibilityLevel());
jsonObject.put("datasource",repository.getId());
jsonObject.put("metadataIdentifierPath",repositoryInterface.getMetadataIdentifierPath());
jsonObject.put("protocol",repositoryInterface.getAccessProtocol());
jsonObject.put("removable",repositoryInterface.isRemovable());
jsonObject.put("active",repositoryInterface.isActive());
JSONArray apiparams = new JSONArray();
for(String param: repositoryInterface.getAccessParams().keySet()){
JSONObject jo = new JSONObject();
jo.put("param",param);
jo.put("value",repositoryInterface.getAccessParams().get(param));
apiparams.put(jo);
}
jsonObject.put("apiparam",apiparams);
jsonObject.put("lastCollectionDate",repositoryInterface.getLastCollectionDate());
//jsonObject.put("lastCollectionMdid",repositoryInterface);
//jsonObject.put("lastCollectionTotal");
//jsonObject.put("lastDownloadDate");
// jsonObject.put("lastDownloadMdid");
// jsonObject.put("lastDownloadTotal");
// jsonObject.put("lastValidationJob");
//jsonObject.put("lastAggregationDate");
//jsonObject.put("lastAggregationMdid");
//jsonObject.put("lastAggregationTotal");
return jsonObject.toString();
}
public static ArrayList<String> readFile(String filename) {
String line;
ArrayList<String> list = new ArrayList<String>();
try {
//InputStream in = Converter.class.getResourceAsStream("resources/eu/dnetlib/repo/manager/service/utils/"+filename);
InputStream in = Converter.class.getClass().getResourceAsStream("/eu/**/" + filename);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
while((line = br.readLine()) != null) {
list.add(line.trim());
}
br.close();
} catch (IOException e) {
LOGGER.debug("Error opening file!");
e.printStackTrace();
}
return list;
}
public static List<AggregationDetails> getAggregationHistoryFromJson(JSONObject repositoryObject) throws JSONException {
if( repositoryObject.get("aggregationHistory").toString().equals("[]") ||
repositoryObject.get("aggregationHistory")!= null)
return null;
JSONArray rs = new JSONArray(repositoryObject.get("aggregationHistory").toString());
List<AggregationDetails> aggregationDetailsList = new ArrayList<>();
for(int i=0;i<rs.length();i++)
aggregationDetailsList.add(jsonToAggregationDetails(rs.getJSONObject(i)));
return aggregationDetailsList;
}
private static AggregationDetails jsonToAggregationDetails(JSONObject aggregationObject) throws JSONException {
AggregationDetails aggregationDetails = new AggregationDetails();
aggregationDetails.setAggregationStage(aggregationObject.get("aggregationStage").toString());
//aggregationDetails.setCollectionMode(aggregationObject.get("collectionMode").toString());
aggregationDetails.setDate(convertStringToDate(aggregationObject.get("date").toString()));
aggregationDetails.setNumberOfRecords(Integer.parseInt(aggregationObject.get("numberOfRecords").toString()));
return aggregationDetails;
}
public static AggregationDetails getLastCollectionFromJson(JSONObject repositoryObject) throws JSONException {
if( repositoryObject.get("lastCollection").equals(null))
return null;
return jsonToAggregationDetails(repositoryObject.getJSONObject("lastCollection"));
}
public static AggregationDetails getLastTransformationFromJson(JSONObject repositoryObject) throws JSONException {
if( repositoryObject.get("lastTransformation").equals(null))
return null;
return jsonToAggregationDetails(repositoryObject.getJSONObject("lastTransformation"));
}
public static List<Timezone> toTimezones(List<String> timezones) {
List<Timezone> tmz = new ArrayList<>();
for(String t : timezones){
String[] s = t.split("\t");
tmz.add(new Timezone(s[1],Double.parseDouble(s[0])));
}
return tmz;
}
}

View File

@ -0,0 +1,146 @@
package eu.dnetlib.repo.manager.service.utils;
import org.apache.log4j.Logger;
import org.dom4j.io.DOMWriter;
import org.w3c.dom.Document;
import se.kb.oai.pmh.*;
import se.kb.oai.pmh.Set;
import javax.net.ssl.*;
import javax.xml.namespace.NamespaceContext;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.cert.X509Certificate;
import java.util.*;
public class OaiTools {
{
disableSslVerification();
}
private static Logger LOGGER = Logger.getLogger(OaiTools.class);
public static List<String> getSetsOfRepo(String baseUrl) throws Exception {
try {
LOGGER.debug("Getting sets of repository " + baseUrl);
OaiPmhServer harvester = new OaiPmhServer(baseUrl);
SetsList setList = harvester.listSets();
ResumptionToken token = setList.getResumptionToken();
List<Set> sets = new ArrayList<Set>();
sets.addAll(setList.asList());
while (token != null) {
setList = harvester.listSets(token);
token = setList.getResumptionToken();
sets.addAll(setList.asList());
}
List<String> ret = new ArrayList<String>();
for (Set set : sets) {
ret.add(set.getSpec().trim());
}
if (ret.size() > 0 )
Collections.sort(ret);
return ret;
} catch (Exception e) {
LOGGER.error("Error getting sets of repository " + baseUrl, e);
return new ArrayList<String>();
//throw e;
}
}
public static boolean identifyRepository(String baseUrl) throws Exception {
LOGGER.debug("sending identify request to repo " + baseUrl);
OaiPmhServer harvester = new OaiPmhServer(baseUrl);
if (baseUrl.trim().isEmpty()) {
return false;
}
try {
Identification identification = harvester.identify();
DOMWriter d4Writer = new DOMWriter();
Document d = d4Writer.write(identification.getResponse());
return verifyIdentify(d);
} catch (Exception e) {
LOGGER.debug("Error verifying identify response", e);
throw e;
}
}
private static boolean verifyIdentify(Document doc) throws XPathExpressionException {
NamespaceContext ctx = new NamespaceContext() {
public String getNamespaceURI(String prefix) {
String uri;
if (prefix.equals("oai"))
uri = "http://www.openarchives.org/OAI/2.0/";
else
uri = null;
return uri;
}
// Dummy implementation - not used!
public Iterator<String> getPrefixes(String val) {
return null;
}
// Dummy implemenation - not used!
public String getPrefix(String uri) {
return null;
}
};
// Now the XPath expression
String xpathStr = "//oai:OAI-PMH/oai:Identify";
XPathFactory xpathFact = XPathFactory.newInstance();
XPath xpath = xpathFact.newXPath();
xpath.setNamespaceContext(ctx);
String result = xpath.evaluate(xpathStr, doc);
return (result != null && !result.equals(""));
}
private static void disableSslVerification() {
try
{
LOGGER.debug("disabling ssl verification");
// Create a trust manager that does not validate certificate chains
TrustManager[] trustAllCerts = new TrustManager[] {new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
}
};
// Install the all-trusting trust manager
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
// Create all-trusting host name verifier
HostnameVerifier allHostsValid = new HostnameVerifier() {
public boolean verify(String hostname, SSLSession session) {
return true;
}
};
// Install the all-trusting host verifier
HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);
} catch (NoSuchAlgorithmException e) {
LOGGER.error("disabling ssl verification", e);
} catch (KeyManagementException e) {
LOGGER.error("error while disabling ssl verification", e);
}
}
}

View File

@ -0,0 +1,47 @@
package eu.dnetlib.repo.manager.shared;
import java.util.Date;
public class AggregationDetails {
private String aggregationStage;
private Date date;
private int numberOfRecords;
private String collectionMode;
public AggregationDetails() {
}
public String getAggregationStage() {
return aggregationStage;
}
public String getCollectionMode() {
return collectionMode;
}
public void setCollectionMode(String collectionMode) {
this.collectionMode = collectionMode;
}
public void setAggregationStage(String aggregationStage) {
this.aggregationStage = aggregationStage;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public int getNumberOfRecords() {
return numberOfRecords;
}
public void setNumberOfRecords(int numberOfRecords) {
this.numberOfRecords = numberOfRecords;
}
}

View File

@ -0,0 +1,38 @@
package eu.dnetlib.repo.manager.shared;
import java.util.ArrayList;
import java.util.List;
public class Aggregations {
private List<AggregationDetails> aggregationHistory = new ArrayList<>();
private AggregationDetails lastCollection;
private AggregationDetails lastTransformation;
public Aggregations() {
}
public List<AggregationDetails> getAggregationHistory() {
return aggregationHistory;
}
public void setAggregationHistory(List<AggregationDetails> aggregationHistory) {
this.aggregationHistory = aggregationHistory;
}
public AggregationDetails getLastCollection() {
return lastCollection;
}
public void setLastCollection(AggregationDetails lastCollection) {
this.lastCollection = lastCollection;
}
public AggregationDetails getLastTransformation() {
return lastTransformation;
}
public void setLastTransformation(AggregationDetails lastTransformation) {
this.lastTransformation = lastTransformation;
}
}

View File

@ -0,0 +1,17 @@
package eu.dnetlib.repo.manager.shared;
/**
* Created by stefanos on 27-Oct-16.
*/
public class BrokerException extends Exception {
public BrokerException(Throwable th) {
super(th);
}
public BrokerException() {
}
}

View File

@ -0,0 +1,44 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by nikonas on 23/12/15.
*/
public class Constants implements IsSerializable {
public static final String MODE_LOCAL = "local";
public static final String MODE_DNET = "dnet";
public static final String MODE_LDAP = "ldap";
public static final String ENV_LAREFERENCIA = "lareferencia";
public static final String ENV_MINCYT = "mincyt";
public static final String ENV_OPENAIRE_PRODUCTION = "openaire-production";
public static final String ENV_OPENAIRE_BETA = "openaire-beta";
public static final String ENV_DEVELOPMENT = "development";
public static final String LATITUDE_PATTERN = "^(\\+|-)?(?:90(?:(?:\\.0{1,6})?)|(?:[0-9]|[1-8][0-9])(?:(?:\\.[0-9]{1,6})?))$";
public static final String LONGITUDE_PATTERN = "^(\\+|-)?(?:180(?:(?:\\.0{1,6})?)|(?:[0-9]|[1-9][0-9]|1[0-7][0-9])(?:(?:\\.[0-9]{1,6})?))$";
public static final String EMAIL_PATTERN = "^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$";
public static final String REPOSITORY_MODE_OPENDOAR = "opendoar";
public static final String REPOSITORY_MODE_RE3DATA = "re3data";
public static final String REPOSITORY_MODE_JOURNAL = "journal";
public static final String REPOSITORY_MODE_AGGREGATOR = "aggregator";
public static final String REPOSITORY_MODE_ALL = "all";
public static final String VALIDATION_MODE_LITERATURE = "literature";
public static final String VALIDATION_MODE_DATA = "data";
public static final String VALIDATION_MODE_CRIS = "cris";
public static final String VALIDATION_JOB_TYPE_COMPATIBILITY_TEST = "Compatibility Test";
public static final String VALIDATION_JOB_TYPE_REGISTRATION_REQUEST = "Registration Request";
public static final String VALIDATION_JOB_TYPE_WORKFLOW_REQUEST = "Workflow Request";
public static final String VALIDATION_JOB_STATUS_SUCCESSFUL = "successful";
public static final String VALIDATION_JOB_STATUS_FAILED = "failed";
public static final String VALIDATION_JOB_STATUS_ONGOING = "ongoing";
}

View File

@ -0,0 +1,24 @@
package eu.dnetlib.repo.manager.shared;
public class Country {
private String name;
private String code;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
}

View File

@ -0,0 +1,48 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
import eu.dnetlib.domain.data.Repository;
/**
* Created by stefania on 12/17/15.
*/
public class DatasourceRegistrationState extends WizardState implements IsSerializable {
private String mode;
private String selectedRepositoryId;
private Repository repository;
public DatasourceRegistrationState() {
}
public DatasourceRegistrationState(String mode, String selectedRepositoryId, Repository repository) {
this.mode = mode;
this.selectedRepositoryId = selectedRepositoryId;
this.repository = repository;
}
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public String getSelectedRepositoryId() {
return selectedRepositoryId;
}
public void setSelectedRepositoryId(String selectedRepositoryId) {
this.selectedRepositoryId = selectedRepositoryId;
}
public Repository getRepository() {
return repository;
}
public void setRepository(Repository repository) {
this.repository = repository;
}
}

View File

@ -0,0 +1,61 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
import java.util.List;
import java.util.Map;
/**
* Created by nikonas on 21/12/15.
*/
public class DatasourceVocabularies implements IsSerializable {
Map<String, String> countries;
List<Timezone> timezones;
Map<String, String> datasourceClasses;
List<String> typologies;
Map<String, String> compatibilityLevels;
public DatasourceVocabularies() {
}
public Map<String, String> getCountries() {
return countries;
}
public void setCountries(Map<String, String> countries) {
this.countries = countries;
}
public List<Timezone> getTimezones() {
return timezones;
}
public void setTimezones(List<Timezone> timezones) {
this.timezones = timezones;
}
public Map<String, String> getDatasourceClasses() {
return datasourceClasses;
}
public void setDatasourceClasses(Map<String, String> datasourceClasses) {
this.datasourceClasses = datasourceClasses;
}
public List<String> getTypologies() {
return typologies;
}
public void setTypologies(List<String> typologies) {
this.typologies = typologies;
}
public Map<String, String> getCompatibilityLevels() {
return compatibilityLevels;
}
public void setCompatibilityLevels(Map<String, String> compatibilityLevels) {
this.compatibilityLevels = compatibilityLevels;
}
}

View File

@ -0,0 +1,47 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
import eu.dnetlib.domain.data.Repository;
import java.util.ArrayList;
import java.util.List;
/**
* Created by nikonas on 14/1/16.
*/
public class DatasourcesCollection implements IsSerializable{
private List<Repository> datasourcesOfUser;
private List<Repository> sharedDatasources;
private List<Repository> datasourcesOfOthers;
public DatasourcesCollection() {
this.datasourcesOfOthers = new ArrayList<Repository>();
this.datasourcesOfUser = new ArrayList<Repository>();
this.datasourcesOfOthers = new ArrayList<Repository>();
}
public List<Repository> getDatasourcesOfUser() {
return datasourcesOfUser;
}
public void setDatasourcesOfUser(List<Repository> datasourcesOfUser) {
this.datasourcesOfUser = datasourcesOfUser;
}
public List<Repository> getDatasourcesOfOthers() {
return datasourcesOfOthers;
}
public void setDatasourcesOfOthers(List<Repository> datasourcesOfOthers) {
this.datasourcesOfOthers = datasourcesOfOthers;
}
public List<Repository> getSharedDatasources() {
return sharedDatasources;
}
public void setSharedDatasources(List<Repository> sharedDatasources) {
this.sharedDatasources = sharedDatasources;
}
}

View File

@ -0,0 +1,42 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
import java.util.List;
/**
* Created by nikonas on 7/1/16.
*/
public class InterfaceInformation implements IsSerializable {
private boolean identified;
private List<String> sets;
private List<String> adminEmails;
public InterfaceInformation() {
}
public boolean isIdentified() {
return identified;
}
public void setIdentified(boolean identified) {
this.identified = identified;
}
public List<String> getSets() {
return sets;
}
public void setSets(List<String> sets) {
this.sets = sets;
}
public List<String> getAdminEmails() {
return adminEmails;
}
public void setAdminEmails(List<String> adminEmails) {
this.adminEmails = adminEmails;
}
}

View File

@ -0,0 +1,59 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
import eu.dnetlib.domain.functionality.validator.StoredJob;
import java.util.List;
/**
* Created by nikonas on 29/3/16.
*/
public class JobsOfUser implements IsSerializable {
private int totalJobs;
private int totalJobsSuccessful;
private int totalJobsFailed;
private int totalJobsOngoing;
private List<StoredJob> jobs;
public int getTotalJobs() {
return totalJobs;
}
public void setTotalJobs(int totalJobs) {
this.totalJobs = totalJobs;
}
public int getTotalJobsSuccessful() {
return totalJobsSuccessful;
}
public void setTotalJobsSuccessful(int totalJobsSuccessful) {
this.totalJobsSuccessful = totalJobsSuccessful;
}
public int getTotalJobsFailed() {
return totalJobsFailed;
}
public void setTotalJobsFailed(int totalJobsFailed) {
this.totalJobsFailed = totalJobsFailed;
}
public int getTotalJobsOngoing() {
return totalJobsOngoing;
}
public void setTotalJobsOngoing(int totalJobsOngoing) {
this.totalJobsOngoing = totalJobsOngoing;
}
public List<StoredJob> getJobs() {
return jobs;
}
public void setJobs(List<StoredJob> jobs) {
this.jobs = jobs;
}
}

View File

@ -0,0 +1,53 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by nikonas on 7/12/15.
*/
public class RepositoryServiceException extends Exception implements IsSerializable {
public enum ErrorCode implements IsSerializable {
REPOSITORY_ALREADY_EXISTS,
SQL_ERROR,
NOT_ACTIVATED,
ACTIVATION_ERROR,
LDAP_ERROR,
MAIL_ALREADY_EXISTS,
GENERAL_ERROR,
ALREADY_ACTIVATED,
INVALID_EMAIL_FORMAT,
NO_REPOS_FOR_THIS_COUNTRY, REPOSITORY_NOT_EXISTS, INCORRECT_CAPTCHA
}
private ErrorCode errorCode = null;
public RepositoryServiceException() {
}
public RepositoryServiceException(ErrorCode errorCode) {
this.errorCode = errorCode;
}
public RepositoryServiceException(String message, Throwable cause, ErrorCode errorCode) {
super(message, cause);
this.errorCode = errorCode;
}
public RepositoryServiceException(String message, ErrorCode errorCode) {
super(message);
this.errorCode = errorCode;
}
public RepositoryServiceException(Throwable cause, ErrorCode errorCode) {
super(cause);
this.errorCode = errorCode;
}
public ErrorCode getErrorCode() {
return errorCode;
}
}

View File

@ -0,0 +1,17 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
public class Timezone implements IsSerializable {
public String name;
public double offset;
public Timezone(){
}
public Timezone(String name, double offset) {
super();
this.name = name;
this.offset = offset;
}
}

View File

@ -0,0 +1,27 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefania on 3/8/16.
*/
public class Triple<K, V, L> extends Tuple<K, V> implements IsSerializable {
private L third;
public Triple() {
}
public Triple(K first, V second, L third) {
super(first, second);
this.third = third;
}
public L getThird() {
return third;
}
public void setThird(L third) {
this.third = third;
}
}

View File

@ -0,0 +1,36 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefania on 12/18/15.
*/
public class Tuple<K, V> implements IsSerializable {
private K first;
private V second;
public Tuple() {
}
public Tuple(K first, V second) {
this.first = first;
this.second = second;
}
public K getFirst() {
return first;
}
public void setFirst(K first) {
this.first = first;
}
public V getSecond() {
return second;
}
public void setSecond(V second) {
this.second = second;
}
}

View File

@ -0,0 +1,51 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by nikonas on 7/12/15.
*/
public class UserAccessException extends Exception implements IsSerializable {
public enum ErrorCode implements IsSerializable {
USER_ALREADY_EXISTS,
SQL_ERROR,
INVALID_USERNAME,
INVALID_PASSWORD,
NOT_ACTIVATED,
ACTIVATION_ERROR,
LDAP_ERROR,
USERNAME_ALREADY_EXISTS, MAIL_ALREADY_EXISTS, GENERAL_ERROR, ALREADY_ACTIVATED, INVALID_EMAIL_FORMAT, WRONG_SECURITY_CODE, INCORRECT_CAPTCHA
}
private ErrorCode errorCode = null;
public UserAccessException() {
}
public UserAccessException(ErrorCode errorCode) {
this.errorCode = errorCode;
}
public UserAccessException(String message, Throwable cause, ErrorCode errorCode) {
super(message, cause);
this.errorCode = errorCode;
}
public UserAccessException(String message, ErrorCode errorCode) {
super(message);
this.errorCode = errorCode;
}
public UserAccessException(Throwable cause, ErrorCode errorCode) {
super(cause);
this.errorCode = errorCode;
}
public ErrorCode getErrorCode() {
return errorCode;
}
}

View File

@ -0,0 +1,46 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by nikonas on 7/12/15.
*/
public class ValidationServiceException extends Exception implements IsSerializable {
public enum ErrorCode implements IsSerializable {
NO_ADMIN_EMAILS,
NOT_VALID_BASEURL,
GENERAL_ERROR, NOT_VALID_SET
}
private ErrorCode errorCode = null;
public ValidationServiceException() {
}
public ValidationServiceException(ErrorCode errorCode) {
this.errorCode = errorCode;
}
public ValidationServiceException(String message, Throwable cause, ErrorCode errorCode) {
super(message, cause);
this.errorCode = errorCode;
}
public ValidationServiceException(String message, ErrorCode errorCode) {
super(message);
this.errorCode = errorCode;
}
public ValidationServiceException(Throwable cause, ErrorCode errorCode) {
super(cause);
this.errorCode = errorCode;
}
public ErrorCode getErrorCode() {
return errorCode;
}
}

View File

@ -0,0 +1,16 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
import eu.dnetlib.domain.functionality.validator.JobForValidation;
/**
* Created by stefania on 2/10/16.
*/
public class ValidationState extends WizardState implements IsSerializable {
private JobForValidation jobForValidation = new JobForValidation();
public JobForValidation getJobForValidation() {
return jobForValidation;
}
}

View File

@ -0,0 +1,36 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefania on 3/8/16.
*/
public class Vocabulary implements IsSerializable {
private String id;
private String name;
public Vocabulary() {
}
public Vocabulary(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -0,0 +1,9 @@
package eu.dnetlib.repo.manager.shared;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefania on 2/10/16.
*/
public class WizardState implements IsSerializable {
}

View File

@ -0,0 +1,99 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
import java.util.ArrayList;
import java.util.List;
public class AdvQueryObject implements IsSerializable {
private String datasource = "";
private String topic = "";
private List<String> titles = new ArrayList<>();
private List<String> subjects = new ArrayList<>();
private List<String> authors = new ArrayList<>();
private List<Range> dates = new ArrayList<>();
private Range trust = new Range("0", "1");
private long page = 0;
public AdvQueryObject() {
}
public AdvQueryObject(String datasource, String topic, List<String> titles, List<String> subjects, List<String> authors,
List<Range> dates, Range trust, long page) {
this.datasource = datasource;
this.topic = topic;
this.titles = titles;
this.subjects = subjects;
this.authors = authors;
this.dates = dates;
this.trust = trust;
this.page = page;
}
public String getDatasource() {
return datasource;
}
public void setDatasource(String datasource) {
this.datasource = datasource;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public List<String> getTitles() {
return titles;
}
public void setTitles(List<String> titles) {
this.titles = titles;
}
public List<String> getSubjects() {
return subjects;
}
public void setSubjects(List<String> subjects) {
this.subjects = subjects;
}
public List<String> getAuthors() {
return authors;
}
public void setAuthors(List<String> authors) {
this.authors = authors;
}
public List<Range> getDates() {
return dates;
}
public void setDates(List<Range> dates) {
this.dates = dates;
}
public Range getTrust() {
return trust;
}
public void setTrust(Range trust) {
this.trust = trust;
}
public long getPage() {
return page;
}
public void setPage(long page) {
this.page = page;
}
}

View File

@ -0,0 +1,42 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefanos on 26/10/2016.
*/
public class BrowseEntry implements Comparable<BrowseEntry>, IsSerializable{
public String value;
public Long size;
public BrowseEntry() {
}
public BrowseEntry(final String value, final Long size) {
this.value = value;
this.size = size;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Long getSize() {
return size;
}
public void setSize(Long size) {
this.size = size;
}
@Override
public int compareTo(final BrowseEntry bv) {
return Long.compare(getSize(), bv.getSize());
}
}

View File

@ -0,0 +1,10 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefanos on 17/3/2017.
*/
public enum ConditionOperator implements IsSerializable {
EXACT, MATCH_ANY, MATCH_ALL, RANGE
}

View File

@ -0,0 +1,36 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefanos on 17/3/2017.
*/
public class ConditionParams implements IsSerializable {
private String value;
private String otherValue;
public ConditionParams() {
}
public ConditionParams(final String value, final String otherValue) {
this.value = value;
this.otherValue = otherValue;
}
public String getValue() {
return this.value;
}
public void setValue(final String value) {
this.value = value;
}
public String getOtherValue() {
return this.otherValue;
}
public void setOtherValue(final String otherValue) {
this.otherValue = otherValue;
}
}

View File

@ -0,0 +1,58 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
import java.util.List;
public class Dataset implements IsSerializable {
private List<String> titles;
private List<String> collectedFrom;
private List<Pid> pids;
private List<Instance> instances;
public Dataset() {
}
public Dataset(final List<String> titles, final List<String> collectedFrom, final List<Pid> pids, final List<Instance> instances) {
this.titles = titles;
this.collectedFrom = collectedFrom;
this.pids = pids;
this.instances = instances;
}
public List<String> getTitles() {
return titles;
}
public void setTitles(List<String> titles) {
this.titles = titles;
}
public List<String> getCollectedFrom() {
return collectedFrom;
}
public void setCollectedFrom(List<String> collectedFrom) {
this.collectedFrom = collectedFrom;
}
public List<Pid> getPids() {
return pids;
}
public void setPids(List<Pid> pids) {
this.pids = pids;
}
public List<Instance> getInstances() {
return instances;
}
public void setInstances(List<Instance> instances) {
this.instances = instances;
}
}

View File

@ -0,0 +1,40 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
import eu.dnetlib.repo.manager.shared.Tuple;
import java.util.List;
/**
* Created by stefanos on 31/10/2016.
*/
public class DatasourcesBroker implements IsSerializable {
private List<Tuple<BrowseEntry, String>> datasourcesOfUser;
private List<Tuple<BrowseEntry, String>> sharedDatasources;
private List<Tuple<BrowseEntry, String>> datasourcesOfOthers;
public List<Tuple<BrowseEntry, String>> getDatasourcesOfUser() {
return datasourcesOfUser;
}
public void setDatasourcesOfUser(List<Tuple<BrowseEntry, String>> datasourcesOfUser) {
this.datasourcesOfUser = datasourcesOfUser;
}
public List<Tuple<BrowseEntry, String>> getSharedDatasources() {
return sharedDatasources;
}
public void setSharedDatasources(List<Tuple<BrowseEntry, String>> sharedDatasources) {
this.sharedDatasources = sharedDatasources;
}
public List<Tuple<BrowseEntry, String>> getDatasourcesOfOthers() {
return datasourcesOfOthers;
}
public void setDatasourcesOfOthers(List<Tuple<BrowseEntry, String>> datasourcesOfOthers) {
this.datasourcesOfOthers = datasourcesOfOthers;
}
}

View File

@ -0,0 +1,80 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
import java.util.List;
/**
* Created by stefanos on 26/10/2016.
*/
public class EventsPage implements IsSerializable{
private String datasource;
private String topic;
private long currPage;
private long totalPages;
private long total;
private List<OpenAireEventPayload> values;
public EventsPage() {
}
public EventsPage(final String datasource, final String topic, final long currPage, final long totalPages, final long total,
final List<OpenAireEventPayload> values) {
this.datasource = datasource;
this.topic = topic;
this.currPage = currPage;
this.totalPages = totalPages;
this.total = total;
this.values = values;
}
public String getDatasource() {
return datasource;
}
public void setDatasource(String datasource) {
this.datasource = datasource;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public long getCurrPage() {
return currPage;
}
public void setCurrPage(long currPage) {
this.currPage = currPage;
}
public long getTotalPages() {
return totalPages;
}
public void setTotalPages(long totalPages) {
this.totalPages = totalPages;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public List<OpenAireEventPayload> getValues() {
return values;
}
public void setValues(List<OpenAireEventPayload> values) {
this.values = values;
}
}

View File

@ -0,0 +1,52 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by claudio on 22/07/16.
*/
public class ExternalReference implements IsSerializable {
private String url;
private String sitename;
private String type;
private String refidentifier;
public ExternalReference() {
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getSitename() {
return sitename;
}
public void setSitename(String sitename) {
this.sitename = sitename;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getRefidentifier() {
return refidentifier;
}
public void setRefidentifier(String refidentifier) {
this.refidentifier = refidentifier;
}
}

View File

@ -0,0 +1,52 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by claudio on 22/07/16.
*/
public class Instance implements IsSerializable {
private String url;
private String license;
private String hostedby;
private String instancetype;
public Instance() {
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getLicense() {
return license;
}
public void setLicense(String license) {
this.license = license;
}
public String getHostedby() {
return hostedby;
}
public void setHostedby(String hostedby) {
this.hostedby = hostedby;
}
public String getInstancetype() {
return instancetype;
}
public void setInstancetype(String instancetype) {
this.instancetype = instancetype;
}
}

View File

@ -0,0 +1,52 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by claudio on 22/07/16.
*/
public class Journal implements IsSerializable {
private String name;
private String issn;
private String eissn;
private String lissn;
public Journal() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getIssn() {
return issn;
}
public void setIssn(String issn) {
this.issn = issn;
}
public String getEissn() {
return eissn;
}
public void setEissn(String eissn) {
this.eissn = eissn;
}
public String getLissn() {
return lissn;
}
public void setLissn(String lissn) {
this.lissn = lissn;
}
}

View File

@ -0,0 +1,52 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
import java.util.ArrayList;
import java.util.List;
/**
* Created by stefanos on 17/3/2017.
*/
public class MapConditions implements IsSerializable {
private String field;
private MapValueType fieldType;
private ConditionOperator operator;
private List<ConditionParams> listParams = new ArrayList<>();
public MapConditions() {
}
public String getField() {
return field;
}
public void setField(String field) {
this.field = field;
}
public MapValueType getFieldType() {
return fieldType;
}
public void setFieldType(MapValueType fieldType) {
this.fieldType = fieldType;
}
public ConditionOperator getOperator() {
return operator;
}
public void setOperator(ConditionOperator operator) {
this.operator = operator;
}
public List<ConditionParams> getListParams() {
return listParams;
}
public void setListParams(List<ConditionParams> listParams) {
this.listParams = listParams;
}
}

View File

@ -0,0 +1,10 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefanos on 17/3/2017.
*/
public enum MapValueType implements IsSerializable {
STRING, INTEGER, FLOAT, DATE, BOOLEAN, LIST_STRING, LIST_INTEGER, LIST_FLOAT, LIST_DATE, LIST_BOOLEAN;
}

View File

@ -0,0 +1,10 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefanos on 10-Mar-17.
*/
public enum NotificationFrequency implements IsSerializable {
never, realtime, daily, weekly, monthly
}

View File

@ -0,0 +1,10 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefanos on 10-Mar-17.
*/
public enum NotificationMode implements IsSerializable {
MOCK, EMAIL
}

View File

@ -0,0 +1,52 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by claudio on 11/07/16.
*/
public class OpenAireEventPayload implements IsSerializable {
private Publication publication;
private Publication highlight;
private Provenance provenance;
private float trust;
public OpenAireEventPayload() {
}
public Publication getPublication() {
return publication;
}
public void setPublication(Publication publication) {
this.publication = publication;
}
public Publication getHighlight() {
return highlight;
}
public void setHighlight(Publication highlight) {
this.highlight = highlight;
}
public Provenance getProvenance() {
return provenance;
}
public void setProvenance(Provenance provenance) {
this.provenance = provenance;
}
public float getTrust() {
return trust;
}
public void setTrust(float trust) {
this.trust = trust;
}
}

View File

@ -0,0 +1,61 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefanos on 10-Mar-17.
*/
public class OpenaireSubscription implements IsSerializable {
private String subscriber;
private NotificationFrequency frequency;
private NotificationMode mode;
private AdvQueryObject query;
public OpenaireSubscription() {
}
public OpenaireSubscription(final String subscriber, final NotificationFrequency frequency, final
NotificationMode mode,
final AdvQueryObject query) {
this.subscriber = subscriber;
this.frequency = frequency;
this.mode = mode;
this.query = query;
}
public String getSubscriber() {
return this.subscriber;
}
public void setSubscriber(final String subscriber) {
this.subscriber = subscriber;
}
public NotificationFrequency getFrequency() {
return this.frequency;
}
public void setFrequency(final NotificationFrequency frequency) {
this.frequency = frequency;
}
public NotificationMode getMode() {
return this.mode;
}
public void setMode(final NotificationMode mode) {
this.mode = mode;
}
public AdvQueryObject getQuery() {
return this.query;
}
public void setQuery(final AdvQueryObject query) {
this.query = query;
}
}

View File

@ -0,0 +1,32 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by claudio on 22/07/16.
*/
public class Pid implements IsSerializable {
private String value;
private String type;
public Pid() {
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

View File

@ -0,0 +1,73 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
public class Project implements IsSerializable {
private String code;
private String acronym;
private String title;
private String funder;
private String fundingProgram;
private String jurisdiction;
public Project() {
}
public Project(final String code, final String acronym, final String title, final String funder, final String fundingProgram, final String jurisdiction) {
this.code = code;
this.acronym = acronym;
this.title = title;
this.funder = funder;
this.fundingProgram = fundingProgram;
this.jurisdiction = jurisdiction;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getAcronym() {
return acronym;
}
public void setAcronym(String acronym) {
this.acronym = acronym;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getFunder() {
return funder;
}
public void setFunder(String funder) {
this.funder = funder;
}
public String getFundingProgram() {
return fundingProgram;
}
public void setFundingProgram(String fundingProgram) {
this.fundingProgram = fundingProgram;
}
public String getJurisdiction() {
return jurisdiction;
}
public void setJurisdiction(String jurisdiction) {
this.jurisdiction = jurisdiction;
}
}

View File

@ -0,0 +1,42 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by claudio on 26/07/16.
*/
public class Provenance implements IsSerializable {
private String repositoryName;
private String url;
private String id;
public Provenance() {
}
public String getRepositoryName() {
return repositoryName;
}
public void setRepositoryName(String repositoryName) {
this.repositoryName = repositoryName;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}

View File

@ -0,0 +1,185 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
import java.util.ArrayList;
import java.util.List;
/**
* Created by claudio on 22/07/16.
*/
public class Publication implements IsSerializable {
private String originalId;
private List<String> titles = new ArrayList<>();
private List<String> abstracts = new ArrayList<>();
private String language;
private List<String> subjects = new ArrayList<>();
private List<String> creators = new ArrayList<>();
private String publicationdate;
private String publisher;
private String embargoenddate;
private List<String> contributor = new ArrayList<>();
private Journal journal;
private List<String> collectedFrom = new ArrayList<>();
private List<Pid> pids = new ArrayList<>();
private List<Instance> instances = new ArrayList<>();
private List<ExternalReference> externalReferences = new ArrayList<>();
private List<Project> projects = new ArrayList<>();
private List<Dataset> datasets = new ArrayList<>();
public Publication() {
}
public String getOriginalId() {
return originalId;
}
public void setOriginalId(String originalId) {
this.originalId = originalId;
}
public List<String> getTitles() {
return titles;
}
public void setTitles(List<String> titles) {
this.titles = titles;
}
public List<String> getAbstracts() {
return abstracts;
}
public void setAbstracts(List<String> abstracts) {
this.abstracts = abstracts;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public List<String> getSubjects() {
return subjects;
}
public void setSubjects(List<String> subjects) {
this.subjects = subjects;
}
public List<String> getCreators() {
return creators;
}
public void setCreators(List<String> creators) {
this.creators = creators;
}
public String getPublicationdate() {
return publicationdate;
}
public void setPublicationdate(String publicationdate) {
this.publicationdate = publicationdate;
}
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
public String getEmbargoenddate() {
return embargoenddate;
}
public void setEmbargoenddate(String embargoenddate) {
this.embargoenddate = embargoenddate;
}
public List<String> getContributor() {
return contributor;
}
public void setContributor(List<String> contributor) {
this.contributor = contributor;
}
public Journal getJournal() {
return journal;
}
public void setJournal(Journal journal) {
this.journal = journal;
}
public List<String> getCollectedFrom() {
return collectedFrom;
}
public void setCollectedFrom(List<String> collectedFrom) {
this.collectedFrom = collectedFrom;
}
public List<Pid> getPids() {
return pids;
}
public void setPids(List<Pid> pids) {
this.pids = pids;
}
public List<Instance> getInstances() {
return instances;
}
public void setInstances(List<Instance> instances) {
this.instances = instances;
}
public List<ExternalReference> getExternalReferences() {
return externalReferences;
}
public void setExternalReferences(List<ExternalReference> externalReferences) {
this.externalReferences = externalReferences;
}
public List<Project> getProjects() {
return projects;
}
public void setProjects(List<Project> projects) {
this.projects = projects;
}
public List<Dataset> getDatasets() {
return datasets;
}
public void setDatasets(List<Dataset> datasets) {
this.datasets = datasets;
}
}

View File

@ -0,0 +1,38 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefanos on 26/10/2016.
*/
public class Range implements IsSerializable {
private String min;
private String max;
public Range() {
}
public Range(final String min, final String max) {
super();
this.min = min;
this.max = max;
}
public String getMin() {
return this.min;
}
public void setMin(final String min) {
this.min = min;
}
public String getMax() {
return this.max;
}
public void setMax(final String max) {
this.max = max;
}
}

View File

@ -0,0 +1,57 @@
package eu.dnetlib.repo.manager.shared.broker;
import com.google.gwt.user.client.rpc.IsSerializable;
/**
* Created by stefanos on 10-Mar-17.
*/
public class SimpleSubscriptionDesc implements IsSerializable {
private String id;
private String datasource;
private String topic;
private long count;
public SimpleSubscriptionDesc() {
}
public SimpleSubscriptionDesc(final String id, final String datasource, final String topic, final long count) {
this.id = id;
this.datasource = datasource;
this.topic = topic;
this.count = count;
}
public String getId() {
return this.id;
}
public void setId(final String id) {
this.id = id;
}
public String getDatasource() {
return this.datasource;
}
public void setDatasource(final String datasource) {
this.datasource = datasource;
}
public String getTopic() {
return this.topic;
}
public void setTopic(final String topic) {
this.topic = topic;
}
public long getCount() {
return this.count;
}
public void setCount(final long count) {
this.count = count;
}
}

View File

@ -0,0 +1,98 @@
package eu.dnetlib.repo.manager.shared.broker;
/**
* Created by stefanos on 10-Mar-17.
*/
import com.google.gwt.user.client.rpc.IsSerializable;
import java.util.Date;
import java.util.List;
public class Subscription implements IsSerializable {
private String subscriptionId;
private String subscriber;
private String topic;
private NotificationFrequency frequency;
private NotificationMode mode;
private Date lastNotificationDate;
private String conditions;
private List<MapConditions> conditionsAsList;
public Subscription() {
}
public String getSubscriptionId() {
return subscriptionId;
}
public void setSubscriptionId(String subscriptionId) {
this.subscriptionId = subscriptionId;
}
public String getSubscriber() {
return subscriber;
}
public void setSubscriber(String subscriber) {
this.subscriber = subscriber;
}
public String getTopic() {
return topic;
}
public void setTopic(String topic) {
this.topic = topic;
}
public NotificationFrequency getFrequency() {
return frequency;
}
public void setFrequency(NotificationFrequency frequency) {
this.frequency = frequency;
}
public NotificationMode getMode() {
return mode;
}
public void setMode(NotificationMode mode) {
this.mode = mode;
}
public Date getLastNotificationDate() {
return lastNotificationDate;
}
public void setLastNotificationDate(Date lastNotificationDate) {
this.lastNotificationDate = lastNotificationDate;
}
public String getConditions() {
return conditions;
}
public void setConditions(String conditions) {
this.conditions = conditions;
}
public List<MapConditions> getConditionsAsList() {
return conditionsAsList;
}
public void setConditionsAsList(List<MapConditions> conditionsAsList) {
this.conditionsAsList = conditionsAsList;
}
}

View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<import resource="classpath*:/cxf.xml"/>
<import resource="classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml"/>
<import resource="classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml"/>
<import resource="classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml"/>
<import resource="classpath*:/eu/dnetlib/users/springContext-users-ldap.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/util/springContext-locators.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml"/>
<import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/>
<import resource="classpath*:/eu/dnetlib/repos/springContext-repos-dms-cached.xml"/>
<context:property-placeholder location="classpath*:/eu/**/application.properties" />
<tx:annotation-driven transaction-manager="txManager"/>
<bean class="eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader" id="propertyLoader">
<property name="order" value="2" />
<property name="properties">
<bean class="eu.dnetlib.conf.WebappContextProperyFactory">
<property name="propertyFetcher">
<bean class="eu.dnetlib.conf.PropertyFetcher" />
</property>
</bean>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="locations">
<list>
<value>classpath*:/gr/**/springContext-*.properties</value>
<value>classpath*:/eu/**/springContext-*.properties</value>
<value>classpath*:/eu/dnetlib/repo/manager/service/email-texts.properties</value>
<value>classpath*:dnet-site-wizard.properties</value>
<value>classpath*:dnet-site-override.properties</value>
<value>classpath*:dnet-wizard.properties</value>
<value>classpath*:dnet-override.properties</value>
<value>classpath*:dnet-validator-wizard.properties</value>
<value>classpath*:dnet-validator-override.properties</value>
<value>classpath*:dnet-site-force-override.properties</value>
<value>classpath*:dnet-force-override.properties</value>
</list>
</property>
</bean>
<bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${repomanager.db.driverClassName}" />
<property name="url" value="${repomanager.db.url}" />
<property name="username" value="${repomanager.db.username}" />
<property name="password" value="${repomanager.db.password}" />
<property name="maxIdle" value="10" />
<property name="maxActive" value="100" />
<property name="maxWait" value="10000" />
<property name="validationQuery" value="SELECT 1;" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="1200000" />
<property name="minEvictableIdleTimeMillis" value="1800000" />
<property name="numTestsPerEvictionRun" value="5" />
<property name="poolPreparedStatements" value="true" />
<property name="defaultAutoCommit" value="true" />
</bean>
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="repomanager.dataSource"/>
</bean>
</beans>

View File

@ -0,0 +1,97 @@
infrastructure.name=integration
# Container properties
container.hostname = localhost
container.context=repoManager
container.port = 8080
# IS
ISLookUpService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isLookUp
ISRegistryService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isRegistry
ISSNService.url = http://node6.t.openaire.research-infrastructures.eu/is/services/isSN
#ISLookUpService.url = http://localhost:9190/is/services/isLookUp
#ISRegistryService.url = http://localhost:9190/is/services/isRegistry
#ISSNService.url = http://localhost:9190/is/services/isSN
# LDAP
services.users.ldap.address = 194.177.192.119
services.users.ldap.port = 389
services.users.ldap.username = cn=admin,dc=openaire,dc=eu
services.users.ldap.password = serenata
services.users.ldap.usersDN = ou=users,dc=openaire,dc=eu
#services.repo-manager.repository.testing.mode = true
ValidatorService.url=http://adonis.athenarc.gr:8080/validator-service/services/validatorWebService
# Broker Service
services.broker.url = http://broker1-dev-dnet.d4science.org
#services.broker.url = http://localhost
services.broker.port = 8080
#services.broker.port = 9090
services.broker.api = api/
services.broker.openaire = openaireBroker
#
# Configuration file classpath
configurationFileClassPath=classpath:application-context.xml
api.baseAddress=https://dev-openaire.d4science.org/openaire
service.repository-rest-api.baseUrl = http://localhost:8080
# the address where validator is running and is accessible from the controllers of the web
services.repo-manager.baseUrl = http://${container.hostname}:${container.port}/${container.context}
# base address for soap web services
transport.soap.baseAddress = http://${container.hostname}:${container.port}/${container.context}
transport.soap.force.local.address = false
# the email of the administrator
# he will receive all the automatic bug reports and feedback created
services.repo-manager.adminEmail = nikonas@di.uoa.gr
# if set to true, getRepositories will return dummy repositories
services.repo-manager.repository.testing.mode = false
services.repo-manager.deploy.environment = development
# the mailhost for the mail service
services.validator.mail.host = smtp.gmail.com
# the port where the mail service is running
services.validator.mail.port = 465
# the address that appears in the from field in the mails send by the validator
services.validator.mail.fromAddress = no-reply@openaire.eu
# the reply-to field value in the mails send by the validator
services.validator.mail.replyToAddress = no-reply@openaire.eu
# the username of the account used to login in the mail server
services.validator.mail.username = test.openaire@gmail.com
# the password of the account used to login in the mail server
services.validator.mail.password = ^($*@$)*!$
# if authentication should take place
# if set to false username and password is not needed
services.validator.mail.authenticate = true
# is set to yes then all mails will not be sent to their targets but to the address specified in services.validator.mail.overrideEmail
services.validator.mail.override = false
# if set to true then no mails are send, they are only logged as a debug message
services.validator.mail.logonly = false
# the mode used for the mails send by the validator
services.validator.mail.mode = ssl
# used by eu.dnetlib.utils.MailLibrary to control debuggin messages
services.validator.mail.debug = false
# if services.validator.mail.override is true then all mails will be send only to this address
services.validator.mail.overrideEmail = nikonas@di.uoa.gr
# a comma-seperated list of address that will receive all mails about validations and repo registrations
services.validator.mail.specialRecipients = nikonas@di.uoa.gr
# a comma-seperated list of addresses that have the ability to register repos without the need for validation and registration
services.validator.repoRegistration.override = nikonas@di.uoa.gr
repomanager.db.driverClassName = org.postgresql.Driver
repomanager.db.url = jdbc:postgresql://194.177.192.119:5432/repomanager
repomanager.db.username = dnet
repomanager.db.password = dnetPwd
services.repomanager.analyticsURL = http://analytics.openaire.eu/addsite.php?

View File

@ -0,0 +1,7 @@
user.registration.mail.subject = OpenAIRE Account Activation
user.registration.mail.message = Please follow this link to activate your account
user.forgotPassword.mail.Subject = OpenAIRE Reset Password Request
user.forgotPassword.mail.Body1 = To complete your password reset please follow this link
user.forgotPassword.mail.Body2 = Security Code

View File

@ -0,0 +1,195 @@
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua & Deps
Argentina
Armenia
Australia
Austria
Azerbaijan
Bahamas
Bahrain
Bangladesh
Barbados
Belarus
Belgium
Belize
Benin
Bhutan
Bolivia
Bosnia Herzegovina
Botswana
Brazil
Brunei
Bulgaria
Burkina
Burundi
Cambodia
Cameroon
Canada
Cape Verde
Central African Rep
Chad
Chile
China
Colombia
Comoros
Congo
Congo {Democratic Rep}
Costa Rica
Croatia
Cuba
Cyprus
Czech Republic
Denmark
Djibouti
Dominica
Dominican Republic
East Timor
Ecuador
Egypt
El Salvador
Equatorial Guinea
Eritrea
Estonia
Ethiopia
Fiji
Finland
France
Gabon
Gambia
Georgia
Germany
Ghana
Greece
Grenada
Guatemala
Guinea
Guinea-Bissau
Guyana
Haiti
Honduras
Hungary
Iceland
India
Indonesia
Iran
Iraq
Ireland {Republic}
Israel
Italy
Ivory Coast
Jamaica
Japan
Jordan
Kazakhstan
Kenya
Kiribati
Korea North
Korea South
Kosovo
Kuwait
Kyrgyzstan
Laos
Latvia
Lebanon
Lesotho
Liberia
Libya
Liechtenstein
Lithuania
Luxembourg
Macedonia
Madagascar
Malawi
Malaysia
Maldives
Mali
Malta
Marshall Islands
Mauritania
Mauritius
Mexico
Micronesia
Moldova
Monaco
Mongolia
Montenegro
Morocco
Mozambique
Myanmar, {Burma}
Namibia
Nauru
Nepal
Netherlands
New Zealand
Nicaragua
Niger
Nigeria
Norway
Oman
Pakistan
Palau
Panama
Papua New Guinea
Paraguay
Peru
Philippines
Poland
Portugal
Qatar
Romania
Russian Federation
Rwanda
St Kitts & Nevis
St Lucia
Saint Vincent & the Grenadines
Samoa
San Marino
Sao Tome & Principe
Saudi Arabia
Senegal
Serbia
Seychelles
Sierra Leone
Singapore
Slovakia
Slovenia
Solomon Islands
Somalia
South Africa
Spain
Sri Lanka
Sudan
Suriname
Swaziland
Sweden
Switzerland
Syria
Taiwan
Tajikistan
Tanzania
Thailand
Togo
Tonga
Trinidad & Tobago
Tunisia
Turkey
Turkmenistan
Tuvalu
Uganda
Ukraine
United Arab Emirates
United Kingdom
United States
Uruguay
Uzbekistan
Vanuatu
Vatican City
Venezuela
Vietnam
Yemen
Zambia
Zimbabwe

View File

@ -0,0 +1,11 @@
-2.0 [GMT - 2] Fernando de Noronha Time, South Georg...
-1.0 [GMT - 1] Azores Standard Time, Cape Verde Time...
0.0 [GMT] Western European Time, Greenwich Mean Time
1.0 [GMT + 1] Central European Time, West African Time
2.0 [GMT + 2] Eastern European Time, Central Africa...
3.0 [GMT + 3] Moscow Standard Time, Eastern African...
3.5 [GMT + 3:30] Iran Standard Time
4.0 [GMT + 4] Gulf Standard Time, Samara Standard Time
4.5 [GMT + 4:30] Afghanistan Time
5.0 [GMT + 5] Pakistan Standard Time, Yekaterinburg...
8.0 [GMT + 8] Beijing, Hong Kong, Irkutsk, Kuala Lumpur, Manila, Perth

View File

@ -0,0 +1,42 @@
CONTENTdm
Digibib
Digital Commons
DigiTool
DIVA
Diva-Portal
dLibra
Doks
Drupal
DSpace
Earmas
EPrints
ETD
ETD-db
Fedora
Fez
Greenstone
HAL
invenio
MyCoRe
Open Repository
OPUS
Pica-Verbundkatalog
Proprietary Software
PUMA
PURE
SciELO
SFIX
VITAL
VTOAI
WEKO
XooNIps
------------------------
OJS
HyperJournal
ePubTk
GAPworks
DPubS
E-Journal
------------------------
[Other]

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
<import resource="classpath*:/application-context.xml"/>
<!-- <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>-->
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-jaxws.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<import resource="classpath*:/cxf.xml"/>
<import resource="classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml"/>
<import resource="classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml"/>
<import resource="classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml"/>
<import resource="classpath*:/eu/dnetlib/users/springContext-users-ldap.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/util/springContext-locators.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml"/>
<import resource="classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-commons.xml"/>
<import resource="classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml"/>
<import resource="classpath*:/eu/dnetlib/repos/springContext-repos-dms-cached.xml"/>
<context:property-placeholder location="classpath*:/eu/**/application.properties" />
<bean class="eu.dnetlib.repo.manager.service.config.CascadingPropertyLoader" id="propertyLoader">
<property name="order" value="2" />
<property name="properties">
<bean class="eu.dnetlib.conf.WebappContextProperyFactory">
<property name="propertyFetcher">
<bean class="eu.dnetlib.conf.PropertyFetcher" />
</property>
</bean>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true" />
<property name="locations">
<list>
<value>classpath*:/gr/**/springContext-*.properties</value>
<value>classpath*:/eu/**/springContext-*.properties</value>
<value>classpath*:/eu/dnetlib/repo/manager/service/email-texts.properties</value>
<value>classpath*:dnet-site-wizard.properties</value>
<value>classpath*:dnet-site-override.properties</value>
<value>classpath*:dnet-wizard.properties</value>
<value>classpath*:dnet-override.properties</value>
<value>classpath*:dnet-validator-wizard.properties</value>
<value>classpath*:dnet-validator-override.properties</value>
<value>classpath*:dnet-site-force-override.properties</value>
<value>classpath*:dnet-force-override.properties</value>
</list>
</property>
</bean>
<bean id="repomanager.dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="${repomanager.db.driverClassName}" />
<property name="url" value="${repomanager.db.url}" />
<property name="username" value="${repomanager.db.username}" />
<property name="password" value="${repomanager.db.password}" />
<property name="maxIdle" value="10" />
<property name="maxActive" value="100" />
<property name="maxWait" value="10000" />
<property name="validationQuery" value="SELECT 1;" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="testWhileIdle" value="true" />
<property name="timeBetweenEvictionRunsMillis" value="1200000" />
<property name="minEvictableIdleTimeMillis" value="1800000" />
<property name="numTestsPerEvictionRun" value="5" />
<property name="poolPreparedStatements" value="true" />
<property name="defaultAutoCommit" value="true" />
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="repomanager.dataSource"/>
</bean>
<mvc:resources mapping="swagger-ui.html" location="classpath:/META-INF/resources/"/>
<mvc:resources mapping="/webjars/**" location="classpath:/META-INF/resources/webjars/"/>
<bean class="eu.dnetlib.repo.manager.service.config.SwaggerConfig"/>
</beans>

View File

@ -0,0 +1,37 @@
log4j.rootLogger = WARN, R
log4j.logger.eu.dnetlib = DEBUG
log4j.logger.eu.dnetlib.clients.data.datasourcemanager.ws.Converter = FATAL
log4j.logger.org.springframework = DEBUG, S
log4j.additivity.org.springframework = false
log4j.logger.com.opensymphony.xwork2.ognl.OgnlValueStack = FATAL
log4j.logger.com.opensymphony.xwork2.ObjectFactory = FATAL
log4j.logger.eu.dnetlib.repo.manager=DEBUG
log4j.appender.R=org.apache.log4j.RollingFileAppender
#log4j.appender.R.File=/var/log/dnet/repo-manager/repo-manager-gui.log
log4j.appender.R.File=/tmp/repo-manager-service.log
log4j.appender.R.MaxFileSize=10MB
log4j.appender.R.MaxBackupIndex=10
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern= %d %p %t [%c] - %m%n
log4j.appender.S=org.apache.log4j.RollingFileAppender
#log4j.appender.S.File=/var/log/dnet/repo-manager/repo-manager-gui-spring.log
log4j.appender.S.File=/tmp/repo-manager-service-spring.log
log4j.appender.S.MaxFileSize=10MB
log4j.appender.S.MaxBackupIndex=10
log4j.appender.S.layout=org.apache.log4j.PatternLayout
log4j.appender.S.layout.ConversionPattern= %d %p %t [%c] - %m%n
#org.apache.cxf.Logger=org.apache.cxf.common.logging.Log4jLogger
#
#log4j.rootLogger=INFO, CONSOLE
#log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
#log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
#log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
#
#log4j.logger.eu.dnetlib.repo.manager=DEBUG

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:task="http://www.springframework.org/schema/task"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder location="classpath*:/eu/**/application.properties" />
<context:annotation-config/>
<context:component-scan base-package="eu.dnetlib.repo.manager.service.controllers"/>
<mvc:annotation-driven/>
</beans:beans>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd
http://xmlns.jcp.org/xml/ns/javaee "
version="3.1">
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/log4j.properties</param-value>
</context-param>
<context-param>
<param-name>log4jRefreshInterval</param-name>
<param-value>1000</param-value>
</context-param>
<context-param>
<param-name>log4jExposeWebAppRoot</param-name>
<param-value>false</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml
</param-value>
</context-param>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>