-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major refactoring: split core and lib libraris
- Loading branch information
Showing
51 changed files
with
459 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<artifactId>bionetdb</artifactId> | ||
<groupId>org.opencb.bionetdb</groupId> | ||
<version>0.2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>bionetdb-client</artifactId> | ||
<version>${bionetdb.version}</version> | ||
<packaging>jar</packaging> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.opencb.bionetdb</groupId> | ||
<artifactId>bionetdb-core</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.glassfish.jersey.core</groupId> | ||
<artifactId>jersey-client</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.glassfish.jersey.inject</groupId> | ||
<artifactId>jersey-hk2</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.glassfish.jersey.containers</groupId> | ||
<artifactId>jersey-container-servlet</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.platform</groupId> | ||
<artifactId>junit-platform-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
103 changes: 103 additions & 0 deletions
103
bionetdb-client/src/main/java/org/opencb/bionetdb/client/config/ClientConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* Copyright 2015-2020 OpenCB | ||
* | ||
* 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 org.opencb.bionetdb.client.config; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
|
||
/** | ||
* Created by imedina on 12/05/16. | ||
*/ | ||
public class ClientConfiguration { | ||
|
||
private String version; | ||
private String logLevel; | ||
private RestConfig rest; | ||
|
||
public ClientConfiguration() { | ||
} | ||
|
||
public static ClientConfiguration load(InputStream configurationInputStream) throws IOException { | ||
return load(configurationInputStream, "YAML"); | ||
} | ||
|
||
public static ClientConfiguration load(InputStream configurationInputStream, String format) | ||
throws IOException { | ||
ClientConfiguration clientConfiguration; | ||
ObjectMapper objectMapper; | ||
switch (format.toUpperCase()) { | ||
case "JSON": | ||
objectMapper = new ObjectMapper(); | ||
clientConfiguration = objectMapper.readValue(configurationInputStream, ClientConfiguration.class); | ||
break; | ||
case "YML": | ||
case "YAML": | ||
default: | ||
objectMapper = new ObjectMapper(new YAMLFactory()); | ||
clientConfiguration = objectMapper.readValue(configurationInputStream, ClientConfiguration.class); | ||
break; | ||
} | ||
|
||
return clientConfiguration; | ||
} | ||
|
||
public void serialize(OutputStream configurationOutputStream) throws IOException { | ||
ObjectMapper jsonMapper = new ObjectMapper(new YAMLFactory()); | ||
jsonMapper.writerWithDefaultPrettyPrinter().writeValue(configurationOutputStream, this); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
final StringBuilder sb = new StringBuilder("ClientConfiguration{"); | ||
sb.append("version='").append(version).append('\''); | ||
sb.append(", logLevel='").append(logLevel).append('\''); | ||
sb.append(", rest=").append(rest); | ||
sb.append('}'); | ||
return sb.toString(); | ||
} | ||
|
||
public String getVersion() { | ||
return version; | ||
} | ||
|
||
public ClientConfiguration setVersion(String version) { | ||
this.version = version; | ||
return this; | ||
} | ||
|
||
public String getLogLevel() { | ||
return logLevel; | ||
} | ||
|
||
public ClientConfiguration setLogLevel(String logLevel) { | ||
this.logLevel = logLevel; | ||
return this; | ||
} | ||
|
||
public RestConfig getRest() { | ||
return rest; | ||
} | ||
|
||
public ClientConfiguration setRest(RestConfig rest) { | ||
this.rest = rest; | ||
return this; | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
bionetdb-client/src/main/java/org/opencb/bionetdb/client/config/RestConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright 2015-2020 OpenCB | ||
* | ||
* 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 org.opencb.bionetdb.client.config; | ||
|
||
/** | ||
* Created by imedina on 04/05/16. | ||
*/ | ||
public class RestConfig { | ||
|
||
private String host; | ||
private int timeout; | ||
|
||
public RestConfig() { | ||
} | ||
|
||
public RestConfig(String host, int timeout) { | ||
this.host = host; | ||
this.timeout = timeout; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
final StringBuilder sb = new StringBuilder("RestConfig{"); | ||
sb.append("host=").append(host); | ||
sb.append(", timeout=").append(timeout); | ||
sb.append('}'); | ||
return sb.toString(); | ||
} | ||
|
||
public String getHosts() { | ||
return host; | ||
} | ||
|
||
public RestConfig setHosts(String host) { | ||
this.host = host; | ||
return this; | ||
} | ||
|
||
public int getTimeout() { | ||
return timeout; | ||
} | ||
|
||
public RestConfig setTimeout(int timeout) { | ||
this.timeout = timeout; | ||
return this; | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
version: "v1" | ||
|
||
## These are the RESTful configurations parameters | ||
rest: | ||
host: "localhost:8080/bionetdb" | ||
timeout: 2000 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
bionetdb-core/src/test/java/org/opencb/bionetdb/core/neo4j/query/Neo4JQueryParserTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.