Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
AstrorEnales committed Nov 17, 2023
1 parent 2207b2c commit e969d09
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 25 deletions.
17 changes: 11 additions & 6 deletions src/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
<dependency>
<groupId>de.unibi.agbi.biodwh2</groupId>
<artifactId>biodwh2-core</artifactId>
<version>0.4.6</version>
<version>0.4.13</version>
</dependency>
<dependency>
<groupId>de.unibi.agbi.biodwh2</groupId>
Expand All @@ -99,27 +99,32 @@
<dependency>
<groupId>io.javalin</groupId>
<artifactId>javalin</artifactId>
<version>4.6.4</version>
<version>5.6.3</version>
</dependency>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.6.3</version>
<version>4.7.5</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.15</version>
<version>1.16.0</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java</artifactId>
<version>19.2</version>
<version>21.3</version>
</dependency>
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java-extended-scalars</artifactId>
<version>19.0</version>
<version>21.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j2-impl</artifactId>
<version>2.21.1</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@
import graphql.schema.idl.SchemaParser;
import graphql.schema.idl.TypeDefinitionRegistry;
import io.javalin.Javalin;
import io.javalin.core.JavalinConfig;
import io.javalin.config.JavalinConfig;
import io.javalin.http.Context;
import io.javalin.plugin.bundled.CorsPluginConfig;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import picocli.CommandLine;

import java.awt.*;
Expand All @@ -36,7 +37,7 @@
import java.util.stream.Collectors;

public class GraphQLServer {
private static final Logger LOGGER = LoggerFactory.getLogger(GraphQLServer.class);
private static final Logger LOGGER = LogManager.getLogger(GraphQLServer.class);
private static final String DATABASE_FILE_NAME = "mapped." + Graph.EXTENSION;
private static final String SCHEMA_FILE_NAME = "mapped." + GraphQLSchemaWriter.EXTENSION;

Expand Down Expand Up @@ -123,8 +124,8 @@ private static RuntimeWiring buildRuntimeWiring(final Graph graph) {
}

private void configureJavalin(final JavalinConfig config) {
config.defaultContentType = "application/json";
config.enableCorsForAllOrigins();
config.http.defaultContentType = "application/json";
config.plugins.enableCors(cors -> cors.add(CorsPluginConfig::anyHost));
config.showJavalinBanner = false;
}

Expand Down Expand Up @@ -155,7 +156,7 @@ private static void handleRootPost(final Context ctx) throws IOException {
}

private static boolean isLineEmptyOrComment(final String l) {
return l.length() == 0 || l.trim().startsWith("#");
return l.isEmpty() || l.trim().startsWith("#");
}

private void openBrowser(final int port) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ public void removeEdgeIds(final Collection<Long> ids) {
edgeIds.removeAll(ids);
}

@Override
public Iterable<Long> getNodeIds(final String label) {
return () -> new FilterIdsIterator(nodeIds, graph.getNodeIds(label).iterator());
}

@Override
public Iterable<Long> getEdgeIds(final String label) {
return () -> new FilterIdsIterator(edgeIds, graph.getEdgeIds(label).iterator());
}

@Override
public Iterable<Node> getNodes() {
return filterNodesIterable(graph.getNodes());
Expand Down Expand Up @@ -229,6 +239,36 @@ public Iterable<Edge> findEdges(final Map<String, Comparable<?>> properties) {
return filterEdgesIterable(graph.findEdges(properties));
}

private class FilterIdsIterator implements Iterator<Long> {
private final Set<Long> ids;
private final Iterator<Long> parent;
private Long nextNodeId = null;

FilterIdsIterator(final Set<Long> ids, final Iterator<Long> parent) {
this.ids = ids;
this.parent = parent;
}

@Override
public boolean hasNext() {
nextNodeId = null;
while (parent.hasNext()) {
nextNodeId = parent.next();
if (ids.contains(nextNodeId)) {
break;
} else {
nextNodeId = null;
}
}
return nextNodeId != null;
}

@Override
public Long next() {
return nextNodeId;
}
}

private class FilterNodesIterator implements Iterator<Node> {
private final Iterator<Node> parent;
private Node nextNode = null;
Expand Down
12 changes: 12 additions & 0 deletions src/src/main/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Configuration status="warn" name="biodwh2">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%-5p] %c:%L - %m%n%throwable"/>
</Console>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="console"/>
</Root>
</Loggers>
</Configuration>
12 changes: 0 additions & 12 deletions src/src/main/resources/logback.xml

This file was deleted.

0 comments on commit e969d09

Please sign in to comment.