Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop: (225 commits)
  fairmetadata4j lib renaming issues fixed
  Update README.md
  Install instruction
  Active fdps
  Some documentation correction
  api docs added
  some docs
  some docs
  Unused imports are removed
  Code cleaning
  Log location is changed
  reduced NPath complexity from codacy analysis
  Code cleaning an attempt to fix test coverage issues
  2nd attempt to fix codacy issues
  An attempt to fix codacy issues
  2nd attempt to fix versioneye issues
  An attempt to fix versioneye issues
  Update README.md
  Update README.md
  aoipmh part is removed
  ...
  • Loading branch information
kburger committed Feb 13, 2017
2 parents f7f7a54 + f39d0b9 commit d6b886c
Show file tree
Hide file tree
Showing 64 changed files with 5,073 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: java
jdk:
- oraclejdk8
before_install:
- git clone --branch=develop https://github.com/DTL-FAIRData/FairMetadata.git ~/FairMetadata
- cd ~/FairMetadata
- mvn install
- cd $TRAVIS_BUILD_DIR
after_success:
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent test org.jacoco:jacoco-maven-plugin:report coveralls:report
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
[![Build Status](https://travis-ci.org/DTL-FAIRData/FAIRDataPoint.svg?branch=fdp-spec-1_0)](https://travis-ci.org/DTL-FAIRData/FAIRDataPoint)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/61f029299b814ca8be2b8edbaab6ce50)](https://www.codacy.com/app/rajaram5/FAIRDataPoint?utm_source=github.com&utm_medium=referral&utm_content=DTL-FAIRData/FAIRDataPoint&utm_campaign=Badge_Grade)
[![Dependency Status](https://www.versioneye.com/user/projects/589adf56475a4f003b59406e/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/589adf56475a4f003b59406e)
[![Coverage Status](https://coveralls.io/repos/github/DTL-FAIRData/FAIRDataPoint/badge.svg?branch=fdp-spec-1_0)](https://coveralls.io/github/DTL-FAIRData/FAIRDataPoint?branch=fdp-spec-1_0)

### Summary
`FAIRDataPoint` is a REST api for creating, storing and servering `FAIR metadata`. The metadata contents are in this api are generated `semi-automatically` according to the [FAIR Data Point software specification](https://dtl-fair.atlassian.net/wiki/display/FDP/FAIR+Data+Point+software+specification) document. In the current version of api we support `GET, POST and PATCH` requests.

#### Deployment machine's requirement
* JRE 1.8
* Tomcat 7 or higher

#### How to Install

Make sure your deployment machine meets the requirements listed above. Deploy the `fdp.war` file (download link can be found [here](https://github.com/DTL-FAIRData/FAIRDataPoint/releases)) in your deployment machine's tomcat server. The instructions for deploying `.war` in the tomcat server can be found in this [link](https://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html).

#### API documentation
`FAIRDataPoint` (fdp) api comes with an embedded [swagger document] (http://swagger.io/), the details of api calls can be found here. To access the fdp swagger document please visit the following url via web browser

`<TOMCAT_BASE_URL>/fdp/swagger-ui.html`

`An example swagger doc uri :` http://localhost:8084/fdp/swagger-ui.html

In the current implementation the `REPOSITORY` layer metadata is automatically created, however this metadata can be updated through PATCH calls. The metadata of `other` layers can be stored in the `FAIRDataPoint` through POST calls. The table below gives an overview of api calls allowed on different `FAIR metadata` layers.

|Metadata layer|GET|POST|PATCH|
| :---: | :---: | :---: | :---: |
| Repository | Yes | No | Yes <br/>([Example request body](https://github.com/DTL-FAIRData/FAIRDataPoint/blob/fdp-spec-1_0/src/main/resources/nl/dtls/fairdatapoint/utils/dtl-fdp.ttl)) |
| Catalog | Yes | Yes <br/>([Example request body](https://github.com/DTL-FAIRData/FAIRDataPoint/blob/fdp-spec-1_0/src/main/resources/nl/dtls/fairdatapoint/utils/textmining-catalog.ttl)) | No |
| Dataset | Yes | Yes <br/>([Example request body](https://github.com/DTL-FAIRData/FAIRDataPoint/blob/fdp-spec-1_0/src/main/resources/nl/dtls/fairdatapoint/utils/gda-lumc.ttl)) | No |
| Distribution | Yes | Yes <br/>([Example request body](https://github.com/DTL-FAIRData/FAIRDataPoint/blob/fdp-spec-1_0/src/main/resources/nl/dtls/fairdatapoint/utils/gda-lumc-sparql.ttl)) | No |


#### List of active FAIRDataPoints

|Short name (dct:title)|Description|Location|
| :---: | :---: | :---: |
|ID card FAIR Data Point (beta) | FDP containing dummified data from Biobanks and Registries | [Link](http://semlab1.liacs.nl:8080/fdp/swagger-ui.html)
|DTL FAIR Data Point (beta) | FDP for the fairification doc (VCF); fantom5; GeneDisease/DisGeNet | [Link](http://dev-vm.fair-dtls.surf-hosted.nl:8082/fdp/swagger-ui.html)
5 changes: 5 additions & 0 deletions config/fdp-server.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.

base-uri=http://localhost:9095/
9 changes: 9 additions & 0 deletions config/triple-store.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.

# valid store type options { 1 = inMemoryStore , 2 = http SPARQLRepository }
store-type=1
store-prepopulate=true
store-url=http://agraph.biosemantics.org/catalogs/rajatest/repositories/fdp

231 changes: 231 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>

<groupId>nl.dtls</groupId>
<artifactId>fairdatapoint</artifactId>
<packaging>war</packaging>
<version>0.1 BETA</version>

<name>FairDataPoint</name>
<inceptionYear>2016</inceptionYear>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<springframework.version>4.3.5.RELEASE</springframework.version>
<springdata.version>2.5.6.RELEASE</springdata.version>
<springfox-swagger.version>2.6.1</springfox-swagger.version>
<springsecurity.version>4.2.1.RELEASE</springsecurity.version>
<javaxservlet.version>3.1.0</javaxservlet.version>
<jackson.version>2.8.6</jackson.version>
<rdf4j.version>2.1.4</rdf4j.version>
<log4j.version>2.7</log4j.version>
<handlebars.version>4.0.6</handlebars.version>
<fairmetadata.version>0.1-beta</fairmetadata.version>
<velocity.version>1.7</velocity.version>
<junit.version>4.12</junit.version>
<mockito.version>2.6.2</mockito.version>
<plugin.mavenwar.version>3.0.0</plugin.mavenwar.version>
<plugin.mavenlic.version>3.0</plugin.mavenlic.version>
<plugin.coveralls.version>4.3.0</plugin.coveralls.version>
<plugin.cobertura.version>2.7</plugin.cobertura.version>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-webmvc</artifactId>
<version>${springdata.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox-swagger.version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox-swagger.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${springsecurity.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${springsecurity.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javaxservlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>${velocity.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.rdf4j</groupId>
<artifactId>rdf4j-runtime</artifactId>
<version>${rdf4j.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.rdf4j</groupId>
<artifactId>rdf4j-rio-api</artifactId>
<version>${rdf4j.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.github.jknack</groupId>
<artifactId>handlebars-springmvc</artifactId>
<version>${handlebars.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${springframework.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>nl.dtl</groupId>
<artifactId>fairmetadata4j</artifactId>
<version>${fairmetadata.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jcenter-snapshots</id>
<name>jcenter</name>
<url>https://jcenter.bintray.com/</url>
</repository>
</repositories>
<build>
<finalName>fdp</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${plugin.mavenwar.version}</version>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<warName>fdp</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>${plugin.mavenlic.version}</version>
<configuration>
<header>com/mycila/maven/plugin/license/templates/MIT.txt</header>
<properties>
<owner>DTL</owner>
</properties>
<excludes>
<exclude>pom.xml</exclude>
<exclude>**/*.ttl</exclude>
<exclude>**/*.sparql</exclude>
<exclude>**/*.properties</exclude>
<exclude>**/log4j2.xml</exclude>
<!-- exclude oai-pmh code until origin is known -->
<exclude>**/aoipmh/**</exclude>
</excludes>
</configuration>
<executions>
<execution>
<phase>process-sources</phase>
<goals>
<goal>format</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eluder.coveralls</groupId>
<artifactId>coveralls-maven-plugin</artifactId>
<version>${plugin.coveralls.version}</version>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${plugin.cobertura.version}</version>
</plugin>
</plugins>
</reporting>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/**
* The MIT License
* Copyright © 2016 DTL
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package nl.dtls.fairdatapoint.api.config;

import java.io.IOException;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.logging.log4j.ThreadContext;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.filter.OncePerRequestFilter;

/**
* Filter to add mandatory headers to all request.
* @author Rajaram Kaliyaperumal
* @since 2015-11-19
* @version 0.1
*/
@Component
public class ApplicationFilter extends OncePerRequestFilter {

@Override
public void doFilterInternal(final HttpServletRequest request,
final HttpServletResponse response, final FilterChain fc)
throws IOException, ServletException {
String allowedMtds = (RequestMethod.GET.name() + "," +
RequestMethod.POST.name() + "," + RequestMethod.PATCH.name());
response.setHeader(HttpHeaders.SERVER, "FAIR data point (JAVA)");
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, "*");
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS,
HttpHeaders.CONTENT_TYPE);
response.setHeader(HttpHeaders.ALLOW, allowedMtds);
response.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS,
(HttpHeaders.ACCEPT));
ThreadContext.put("ipAddress", request.getRemoteAddr());
ThreadContext.put("responseStatus", String.valueOf(
response.getStatus()));
fc.doFilter(request, response);
ThreadContext.clearAll();
}
}

0 comments on commit d6b886c

Please sign in to comment.