first commit

This commit is contained in:
Cesare Concordia 2020-10-21 10:08:48 +02:00
commit 32f3301dd1
18 changed files with 1077 additions and 0 deletions

235
pom.xml Normal file
View File

@ -0,0 +1,235 @@
<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">
<modelVersion>4.0.0</modelVersion>
<groupId>eu.sshoc</groupId>
<artifactId>citation</artifactId>
<version>0.0.2-SNAPSHOT</version>
<packaging>war</packaging>
<name>CitationService</name>
<description>The Citation Service of the SSHOC system</description>
<properties>
<maven.test.failure.ignore>true</maven.test.failure.ignore>
<spring.framework.version>0.0.1-SNPSHOT</spring.framework.version>
<start-class>eu.sshoc.citation.service.CitationServiceStart</start-class>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>rabbitmq-client</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
<!-- <dependency> <groupId>spring</groupId> <artifactId>spring-aop</artifactId>
<version>1.0.2</version> </dependency> -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>4.3.6.RELEASE</version>
</dependency>
<dependency>
<groupId>springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>jta</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-data-rest</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-bean-validators</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-activemq</artifactId>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>2.4.4.5</version>
</dependency>
-->
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>apache-curator</artifactId>
<version>3.3.0</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-client</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180130</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-x-discovery</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-x-async</artifactId>
<version>4.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
<version>4.0.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>data-local</id>
<name>data</name>
<url>file://${project.basedir}/repo</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<!-- <webResources>
<resource> <directory>doc</directory> <targetPath>doc</targetPath>
</resource>
</webResources>-->
<attachClasses>true</attachClasses>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,28 @@
package eu.sshoc.citation.service;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import org.springframework.context.annotation.Configuration;
@Configuration
@WebListener
public class CitationContextListener implements ServletContextListener {
@Override
public void contextDestroyed(ServletContextEvent arg0) {
System.out.println("******************CitationService context stopping ");
}
@Override
public void contextInitialized(ServletContextEvent arg0) {
System.out.println("******************CitationService context initialized " + this);
}
}

View File

@ -0,0 +1,48 @@
/*******************************************************************************
* Copyright (c) 2018 VRE4EIC Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package eu.sshoc.citation.service;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.SpringApplication;
//@Configuration
//@ComponentScan
//@EnableAutoConfiguration
@SpringBootApplication
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class CitationServiceStart {
/*private static AuthModule module;
private static MDModule MDmodule;
*/
public static void main(String[] args) {
//ZKServer.init();
SpringApplication.run(CitationServiceStart.class, args);
}
}

View File

@ -0,0 +1,18 @@
package eu.sshoc.citation.service;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
//@SpringBootApplication
public class CitationServiceWAR extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(CitationServiceStart.class);
}
}

View File

@ -0,0 +1,80 @@
package eu.sshoc.citation.service;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.base.Predicate;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import static springfox.documentation.builders.PathSelectors.*;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import static com.google.common.base.Predicates.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Configuration
//@SpringBootApplication
@EnableSwagger2
//@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class SwaggerConfig {
private Logger log = LoggerFactory.getLogger(this.getClass());
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("citationservice-api")
.apiInfo(apiInfo())
.select()
//.apis(!(RequestHandlerSelectors.withClassAnnotation(JsonIgnore.class))
.apis(RequestHandlerSelectors.any())
//.paths(PathSelectors.any())
//.paths(PathSelectors.regex("/user.*"))
.paths(paths())
.build()
.pathMapping("/");
}
private Predicate<String> paths() {
//return or(PathSelectors.regex("/wfservice.*"),
// PathSelectors.regex("/wfservice.*"));
return or(PathSelectors.regex("/citservice.*"),
PathSelectors.regex("/citharvester.*"));
}
private ApiInfo apiInfo() {
InputStream in;
Properties property = new Properties();
try {
in = this.getClass().getClassLoader()
.getResourceAsStream("Settings.properties");
property.load(in);
in.close();
} catch (FileNotFoundException e) {
log.error(e.getMessage());
} catch (IOException e) {
log.error(e.getMessage());
}
return new ApiInfoBuilder()
.title("SSHOC Citation Service")
.description("This page shows the Web Services entry points for the SSHOC Citation Service.")
.version(property.getProperty("Version_default"))
.termsOfServiceUrl("http://terms-of-services.sshoc")
.license("Apache License, Version 2.0")
.licenseUrl("https://www.apache.org/licenses/LICENSE-2.0")
.build();
}
}

View File

@ -0,0 +1,13 @@
package eu.sshoc.citation.service;
import eu.sshoc.citation.service.wfconfigurator.impl.CitationHarvesterImpl;
public class TestGetCitation {
public static void main(String[] args) {
CitationHarvesterImpl chi= new CitationHarvesterImpl();
chi.getCitation("test", "test", "test");
}
}

View File

@ -0,0 +1,87 @@
package eu.sshoc.citation.service.services;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Properties;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import eu.sshoc.citation.service.wfconfigurator.impl.CitationHarvesterImpl;
import io.swagger.annotations.ApiOperation;
/**
*
* @author Cesare
*
*/
@RestController
public class CitationHarvester {
Properties property = new Properties();
CitationHarvesterImpl wfc= new CitationHarvesterImpl();
public CitationHarvester() {
super();
/*InputStream in;
try {
in = this.getClass().getClassLoader()
.getResourceAsStream("Settings.properties");
property.load(in);
in.close();
} catch (FileNotFoundException e) {
} catch (IOException e) {
}*/
}
@ApiOperation(value = "Returns a list of citations from specific citation source",
notes = "A client with a valid identifier can invoke this web service to obtain a list of citations from a specified source",
response = String.class)
@RequestMapping(value="/citharvester/getcitationlist", method=RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String getCitationList(@RequestParam(value="sourceid") String sourceid, @RequestParam(value="token") String token) {
return wfc.getCitationList(sourceid, token);
}
@ApiOperation(value = "Retrieves the metadata of a citation via the API of the specified DOI Registration Agency",
notes = "A client with a valid identifier can invoke this web service to retrieve the citation metadata using the API provided by the DOI Registration Agency",
response = String.class)
@RequestMapping(value="/citharvester/getmetadataapi", method=RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String getCitation(@RequestParam(value="doira") String sourceid, @RequestParam(value="pid") String pid, @RequestParam(value="token") String token) {
return wfc.getCitation(sourceid, pid, token).toString();
}
@ApiOperation(value = "Returns a metadata of a citation via Content Negotiated requests",
notes = "A client with a valid identifier can invoke this web service to to retrieve the citation metadata using DOI content negotiated requests",
response = String.class)
@RequestMapping(value="/citharvester/getmetadatacn", method=RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String getCitationMD(@RequestParam(value="pid") String pid, @RequestParam(value="token") String token) {
return wfc.getCitationMetadata(pid, token).toString();
}
@ApiOperation(value = "Returns formatted citation using via content negotiated request",
notes = "A client with a valid identifier can invoke this web service to obtain a formatted citation, the text/bibliography content type is used ",
response = String.class)
@RequestMapping(value="/citharvester/getformcit", method=RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String getCitationCSL(@RequestParam(value="pid") String pid, @RequestParam(value="token") String token) {
return wfc.getCitationCSL(pid, token).toString();
}
}

View File

@ -0,0 +1,103 @@
/*******************************************************************************
* Copyright (c) 2018 VRE4EIC Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package eu.sshoc.citation.service.services;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Properties;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import eu.sshoc.citation.service.wfconfigurator.impl.CitationServiceImpl;
import io.swagger.annotations.ApiOperation;
/**
*
* @author Cesare
*
*/
@RestController
public class CitationService {
Properties property = new Properties();
CitationServiceImpl wfc= new CitationServiceImpl();
public CitationService() {
super();
/*InputStream in;
try {
in = this.getClass().getClassLoader()
.getResourceAsStream("Settings.properties");
property.load(in);
in.close();
} catch (FileNotFoundException e) {
} catch (IOException e) {
}*/
}
@ApiOperation(value = "Returns a list of citations",
notes = "A client with a valid identifier can invoke this web service to obtain a list of citations stored in SSHOC citation repository",
response = String.class)
@RequestMapping(value="/citservice/getcitation", method=RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String getServiceDescriptions(@RequestParam(value="sshocid") String sshocid, @RequestParam(value="token") String token) {
return wfc.getServiceDescriptions(sshocid, token);
}
@ApiOperation(value = "Search for citation",
notes = "A client with a valid identifier can invoke this web service to search the SSHOC repository for citations",
response = String.class)
@RequestMapping(value="/citservice/searchcitation", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String searchServiceDescriptions(@RequestParam(value="sshocid") String sshocid, @RequestParam(value="query") String query, @RequestParam(value="token") String token){
return null;
}
@ApiOperation(value = "Save a citation",
notes = "A client with a valid identifier can invoke this web service to save the citation in the SSHOC repository",
response = String.class)
@RequestMapping(value="/citservice/savecitation", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String saveCitations(@RequestParam(value="sshocid") String sshocid, @RequestParam(value="description") String description, @RequestParam(value="token") String token){
return wfc.saveCitations(sshocid, description, token);
}
@ApiOperation(value = "Search for citations ",
notes = "A client with a valid identifier can invoke this web service to search the SSHOC repository for citations",
response = String.class)
@RequestMapping(value="/citservice/searchcite", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public String searchWfDescriptions(@RequestParam(value="sshocid") String sshocid, @RequestParam(value="query") String query, @RequestParam(value="token") String token){
return wfc.getCitations(sshocid, query, token);
}
}

View File

@ -0,0 +1,80 @@
/*******************************************************************************
* Copyright (c) 2018 VRE4EIC Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package eu.sshoc.citation.service.services;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import java.util.Properties;
import javax.servlet.http.HttpSession;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
/**
* This class contains methods for managing users.
* @author Cesare
*
*/
@Controller
public class CitationServiceController {
private static final String RELEASE = "release";
private static final String WELCOME_PAGE = "welcome";
Properties property = new Properties();
public CitationServiceController() {
super();
InputStream in;
try {
in = this.getClass().getClassLoader()
.getResourceAsStream("Settings.properties");
property.load(in);
in.close();
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
}
//@JsonIgnore
@RequestMapping(value="/", method=RequestMethod.GET)
public String WelcomePage(ModelMap model, HttpSession session) {
session.setAttribute(RELEASE, property.getProperty("Version_default"));
return WELCOME_PAGE;
}
}

View File

@ -0,0 +1,133 @@
package eu.sshoc.citation.service.wfconfigurator.impl;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.Charset;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class CitationHarvesterImpl {
public CitationHarvesterImpl(){
}
private static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
return sb.toString();
}
public static JSONObject readJsonFromUrl(String url) throws IOException, JSONException {
InputStream is = new URL(url).openStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(is, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
JSONObject json = new JSONObject(jsonText);
return json;
} finally {
is.close();
}
}
private static String getStandardCitation(String citurl) throws IOException{
URL myURL = new URL(citurl);
HttpURLConnection myURLConnection = (HttpURLConnection)myURL.openConnection();
myURLConnection.setRequestProperty("Accept", "text/x-bibliography; style=harvard3; locale=fr-FR");
InputStream mis = myURLConnection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(mis, Charset.forName("UTF-8")));
return (readAll(rd));
}
public String getCitationList(String id, String token){
return null;
}
public JSONObject getCitation(String id, String pid, String token){
JSONObject jsondata=null;
try {
String sid="10.1007/s11082-018-1327-1";
if (pid!=null && pid.trim()!="" && !pid.trim().equalsIgnoreCase("test"))
sid=pid.trim();
jsondata = readJsonFromUrl("https://api.test.datacite.org/dois/"+sid);
System.out.println(jsondata.toString());
// System.out.println(json.get("id"));
} catch (IOException | JSONException e) {
e.printStackTrace();
}
return jsondata;
}
public JSONObject getCitationMetadata(String pid, String token){
JSONObject jsondata=null;
try {
String sid="10.1007/s11082-018-1327-1";
if (pid!=null && pid.trim()!="" && !pid.trim().equalsIgnoreCase("test"))
sid=pid.trim();
URL myURL = new URL("https://doi.org/"+sid);
HttpURLConnection myURLConnection = (HttpURLConnection)myURL.openConnection();
myURLConnection.setRequestProperty("Accept", "application/rdf+xml;q=0.5, application/vnd.citationstyles.csl+json;q=1.0");
InputStream mis = myURLConnection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(mis, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
jsondata = new JSONObject(jsonText);
System.out.println(jsondata.toString());
//JSONObject jsoncit = new JSONObject();
//jsondata.put("citation", getStandardCitation("https://doi.org/"+sid));
} catch (Exception e) {
e.printStackTrace();
}
return jsondata;
}
public JSONObject getCitationCSL(String pid, String token){
String jsonText="";
JSONObject jsondata=null;
try {
String sid="10.1007/s11082-018-1327-1"; //10.1126/science.169.3946.635
if (pid!=null && pid.trim()!="" && !pid.trim().equalsIgnoreCase("test"))
sid=pid.trim();
URL myURL = new URL("https://doi.org/"+sid);
//URL myURL = new URL("https://doi.org/10.1126/science.169.3946.635");
HttpURLConnection myURLConnection = (HttpURLConnection)myURL.openConnection();
myURLConnection.setRequestProperty("Accept", "text/x-bibliography; style=harvard3; locale=en-EN");
InputStream mis = myURLConnection.getInputStream();
BufferedReader rd = new BufferedReader(new InputStreamReader(mis, Charset.forName("UTF-8")));
jsonText = readAll(rd);
System.out.println(jsonText);
jsondata = new JSONObject();
jsondata.put("citation", jsonText);
} catch (Exception e) {
e.printStackTrace();
}
return jsondata;
}
}

View File

@ -0,0 +1,38 @@
package eu.sshoc.citation.service.wfconfigurator.impl;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.URL;
import java.net.URLEncoder;
import javax.net.ssl.HttpsURLConnection;
import org.json.JSONArray;
import org.json.JSONObject;
public class CitationServiceImpl {
public CitationServiceImpl(){
}
public String getServiceDescriptions(String id, String token){
return null;
}
public String saveCitations(String userId, String citation, String token){
return null;
}
public String getCitations(String userId, String query, String token){
return null;
}
}

View File

@ -0,0 +1,61 @@
/*******************************************************************************
* Copyright (c) 2018 VRE4EIC Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package eu.sshoc.citation.service.wfconfigurator.impl;
import java.time.LocalDateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import eu.vre4eic.evre.core.messages.AuthenticationMessage;
import eu.vre4eic.evre.core.messages.MetadataMessage;
import eu.vre4eic.evre.nodeservice.modules.metadata.MDModule;
import eu.vre4eic.evre.core.comm.MessageListener;
/**
*
* Class used to receive asynchronous messages related to users authenticated by the system.
* The authentication message can represent Login or Logout operations and contains token which must be used by users for each service invocation.
* @author francesco
*
*/
public class MDListener implements MessageListener<MetadataMessage>{
private MDModule module;
private Logger log = LoggerFactory.getLogger(this.getClass());
public MDListener(MDModule mdModule) {
this.module = mdModule;
}
/* (non-Javadoc)
* @see javax.jms.MessageListener#onMessage(javax.jms.Message)
*/
@Override
public void onMessage(MetadataMessage message) {
log.info("##### metadata message arrived #####");
//log.info("token: " + am.getToken());
//log.info("time limit: "+ am.getTimeLimit());
log.info(message.getToken()+" "+message.getMessage());
}
}

View File

@ -0,0 +1,57 @@
<?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:mvc="http://www.springframework.org/schema/mvc"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo.xsd">
<bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
<property name="prefix" value="/resources/templates/" />
<property name="suffix" value=".html" />
<!-- HTML is the default value, added here for the sake of clarity. -->
<property name="templateMode" value="HTML" />
<!-- Template cache is true by default. Set to false if you want -->
<!-- templates to be automatically updated when modified. -->
<property name="cacheable" value="true" />
</bean>
<!-- SpringTemplateEngine automatically applies SpringStandardDialect and -->
<!-- enables Spring's own MessageSource message resolution mechanisms. -->
<bean id="templateEngine"
class="org.thymeleaf.spring4.SpringTemplateEngine">
<property name="templateResolver" ref="templateResolver" />
<!-- Enabling the SpringEL compiler with Spring 4.2.4 or newer can speed up -->
<!-- execution in most scenarios, but might be incompatible with specific -->
<!-- cases when expressions in one template are reused across different data -->
<!-- types, so this flag is "false" by default for safer backwards -->
<!-- compatibility. -->
<property name="enableSpringELCompiler" value="true" />
</bean>
<bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
<property name="templateEngine" ref="templateEngine" />
<!-- NOTE 'order' and 'viewNames' are optional -->
<property name="order" value="1" />
<property name="viewNames" value="*.html" />
</bean>
<mvc:resources mapping="/resources/**" location="/resources/" />
<!-- <context:component-scan base-package="eu.vre4eic.evre." />-->
</beans>

Binary file not shown.

View File

@ -0,0 +1,31 @@
# Orchestra Repository Settings
ZooKeeper_default=localhost:2181
Version_path=/evre/settings/version
Version_default=0.0.1
TokenTimeout_path=/evre/settings/authentication/token_timeout
TokenTimeout_default=60
TokenSecret_path=/evre/services/authentication/token_secret
CodeTimeout_path=/evre/settings/authentication/code_timeout
CodeTimeout_default=60
MessageBroker_path=/evre/services/MessageBroker/URL
MessageBroker_default=tcp://v4e-lab.isti.cnr.it:61616
ProfileStorage_path=/evre/services/ProfileStorage/URL
ProfileStorage_default=127.0.0.1
ProfileStoragePort_path=/evre/services/ProfileStorage/Port
ProfileStoragePort_default=27017
AAAI_login=/evre/services/ProfileStorage/login
AAAI_login_default=user_test
AAAI_pwd=/evre/services/ProfileStorage/pwd
AAAI_pwd_default=pwd_test

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>e-VRE</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="css/style.css"/>
</head>
<body>
<div id="header">
<div class="colright">
<img src="img/eVRE-logo_r.png"/>
</div>
</div>
<div class="colmask fullpage">
<div class="col1">
<h2>Welcome to e-VRE system.</h2>
<p >The following e-VRE services are available:
<ul>
<li><a href="http://v4e-lab.isti.cnr.it:8080/NodeService/">Node Service</a></li>
<li> <a href="http://139.91.183.48:8181/EVREMetadataServices">Metadata Service</a></li>
<li> <a href="http://www.unity-idm.eu/documentation/unity-1.9.4/manual.html#_how_to_work_">AAAI</a></li>
</ul>
</p>
<p></p>
</div>
</div>
<div class="footer">
<hr/>
<p> <i><a href="https://www.vre4eic.eu">VRE4EIC project</a></i></p>
</div>
</body>
</html>

View File

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>SSHOC: Citation Service description page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="css/style.css"/>
</head>
<body>
<div class="colmask fullpage">
<h2>Welcome to SSHOC Citation Service (release <i th:text="${session.release}"></i>)</h2>
<p >
</p>
<p>
The <a href="swagger-ui.html#/"> Web Services API documentation</a></p>
<p>The <a href="http://v4e-lab.isti.cnr.it/citview/demo/index.html">Citation Viewer</a> example</p>
</div>
<div class="footer">
<hr/>
<p><i>Powered by</i> <img alt="SSHOC logo" src="logo.png" width="80" height="50" style="vertical-align:middle"> </img></p>
</div>
</body>
</html>