diff --git a/Dockerfile b/Dockerfile index 7b83351f..935bace6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,12 +6,12 @@ # docker build -t vaimeedock/sepa:v0.15.0 -t vaimeedock/sepa:latest . # docker push vaimeedock/sepa --all-tag -FROM maven:latest AS build +FROM maven:3.6-jdk-11 AS build COPY . . RUN mvn clean package -FROM eclipse-temurin:latest +FROM openjdk:11.0-jre COPY --from=build ./run.sh /run.sh COPY --from=build ./engine/target/engine-1.0.0-SNAPSHOT.jar /engine.jar @@ -25,11 +25,12 @@ COPY --from=build ./engine/src/main/resources/endpoints /endpoints RUN chmod 600 /jmxremote.password RUN chmod 777 /run.sh -ENV JMX_HOST=0.0.0.0 -ENV JMX_PORT=7099 +# MUST BE SET WITH THE HOST NAME (e.g. vaimee.com , vaimee.org, ...) +ENV JMX_HOSTNAME=0.0.0.0 +ENV JMX_PORT=7999 +EXPOSE ${JMX_PORT} EXPOSE 8000 EXPOSE 9000 -EXPOSE ${JMX_PORT} ENTRYPOINT ["/run.sh"] diff --git a/client-api/pom.xml b/client-api/pom.xml index 6924a656..785a08c0 100644 --- a/client-api/pom.xml +++ b/client-api/pom.xml @@ -8,8 +8,6 @@ ${revision} client-api - - org.apache.commons @@ -52,5 +50,10 @@ jaxb-api 2.3.0 + + org.apache.logging.log4j + log4j-core + 2.23.1 + diff --git a/client-api/src/main/java/it/unibo/arces/wot/sepa/commons/sparql/BindingsResults.java b/client-api/src/main/java/it/unibo/arces/wot/sepa/commons/sparql/BindingsResults.java index e0111410..e8894bc5 100644 --- a/client-api/src/main/java/it/unibo/arces/wot/sepa/commons/sparql/BindingsResults.java +++ b/client-api/src/main/java/it/unibo/arces/wot/sepa/commons/sparql/BindingsResults.java @@ -20,8 +20,6 @@ import java.util.ArrayList; import java.util.List; -import org.apache.logging.log4j.core.appender.rolling.action.IfAccumulatedFileCount; - import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; diff --git a/client-api/src/main/java/it/unibo/arces/wot/sepa/logging/Logging.java b/client-api/src/main/java/it/unibo/arces/wot/sepa/logging/Logging.java index b49dd960..efef8fd8 100644 --- a/client-api/src/main/java/it/unibo/arces/wot/sepa/logging/Logging.java +++ b/client-api/src/main/java/it/unibo/arces/wot/sepa/logging/Logging.java @@ -9,10 +9,11 @@ import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.core.LoggerContext; import org.apache.logging.log4j.core.config.AppenderRef; import org.apache.logging.log4j.core.config.Configuration; import org.apache.logging.log4j.core.config.LoggerConfig; +import org.apache.logging.log4j.core.LoggerContext; + public class Logging { public static final Logger logger = LogManager.getLogger(); diff --git a/engine/src/main/java/it/unibo/arces/wot/sepa/engine/gates/http/HttpUtilities.java b/engine/src/main/java/it/unibo/arces/wot/sepa/engine/gates/http/HttpUtilities.java index 3de02724..fda13d4b 100644 --- a/engine/src/main/java/it/unibo/arces/wot/sepa/engine/gates/http/HttpUtilities.java +++ b/engine/src/main/java/it/unibo/arces/wot/sepa/engine/gates/http/HttpUtilities.java @@ -90,7 +90,54 @@ private static JsonPrimitive getRequestBodyJSON(HttpRequest request) { } public static Map> splitQuery(String query) throws UnsupportedEncodingException { - Map> query_pairs = new LinkedHashMap>(); + /* + * query (exactly 1) + * default-graph-uri (0 or more) + * named-graph-uri (0 or more) + * + * using-graph-uri (0 or more) + * using-named-graph-uri (0 or more) + * */ + Map> query_pairs = new LinkedHashMap>(); + int query_index = query.indexOf("query="); + int update_index = query.indexOf("update="); + + int index = (query_index != -1 ? query_index : update_index); + + int content_index = query.indexOf('=',index); + String keyString = URLDecoder.decode(query.substring(0, content_index), "UTF-8"); + String valueString = URLDecoder.decode(query.substring(content_index + 1), "UTF-8"); + if (!query_pairs.containsKey(keyString)) query_pairs.put(keyString, new HashSet()); + query_pairs.get(keyString).add(valueString); + + /*int default_graph_uri_index = query.indexOf("default-graph-uri="); + int named_graph_uri_index = query.indexOf("named-graph-uri="); + + int using_graph_uri_index = query.indexOf("using-graph-uri="); + int using_named_graph_uri_index = query.indexOf("using-named-graph-uri="); + + if (query_index!=-1) { + int query_content_index = query.indexOf('=',query_index); + + if (default_graph_uri_index==-1 && named_graph_uri_index==-1) { + String keyString = URLDecoder.decode(query.substring(0, query_content_index), "UTF-8"); + String valueString = URLDecoder.decode(query.substring(query_content_index + 1), "UTF-8"); + if (!query_pairs.containsKey(keyString)) query_pairs.put(keyString, new HashSet()); + query_pairs.get(keyString).add(valueString); + } else if (default_graph_uri_index!=-1 && named_graph_uri_index==-1){ + if (default_graph_uri_index > query_index) { + + } + else { + + } + } else if (default_graph_uri_index==-1 && named_graph_uri_index!=-1) { + + } else { + + } + } + String[] pairs = query.split("&"); for (String pair : pairs) { int idx = pair.indexOf("="); @@ -98,7 +145,7 @@ public static Map> splitQuery(String query) throws Unsupport String valueString = URLDecoder.decode(pair.substring(idx + 1), "UTF-8"); if (!query_pairs.containsKey(keyString)) query_pairs.put(keyString, new HashSet()); query_pairs.get(keyString).add(valueString); - } + }*/ return query_pairs; } } diff --git a/engine/src/main/java/it/unibo/arces/wot/sepa/engine/protocol/sparql11/SPARQL11Handler.java b/engine/src/main/java/it/unibo/arces/wot/sepa/engine/protocol/sparql11/SPARQL11Handler.java index f6c3f8c5..f97a1b11 100644 --- a/engine/src/main/java/it/unibo/arces/wot/sepa/engine/protocol/sparql11/SPARQL11Handler.java +++ b/engine/src/main/java/it/unibo/arces/wot/sepa/engine/protocol/sparql11/SPARQL11Handler.java @@ -116,9 +116,11 @@ protected InternalUQRequest parse(HttpAsyncExchange exchange, ClientAuthorizatio * *
 			 * 
-			 * 					HTTP Method 	Query String Parameters 	Request 	| Content Type 	Request Message Body
+			 * 					| HTTP Method 	| Query String Parameters 	| Request Content Type 	| Request Message Body
 			 * ---------------------------------------------------------------------------------------------------------------------------------------- 
-			 * query via GET 	| GET 			|	query (exactly 1) 		|  None 	| None 			| default-graph-uri (0 or more)  named-graph-uri (0 or more)
+			 * query via GET 	| GET 			|  query (exactly 1) 		|  None 	            | None
+			 *                                  | default-graph-uri (0 or more)
+			 *                                  | named-graph-uri (0 or more)
 			 * 
 			 * 2.1.4 Specifying an RDF Dataset
 			 * 
diff --git a/engine/src/main/resources/endpoints/virtuoso-dld.jpar b/engine/src/main/resources/endpoints/virtuoso-dld.jpar
new file mode 100644
index 00000000..3880643b
--- /dev/null
+++ b/engine/src/main/resources/endpoints/virtuoso-dld.jpar
@@ -0,0 +1,33 @@
+{
+	"host": "dld.arces.unibo.it",
+	"oauth": {
+		"enable": false,
+		"register": "https://localhost:8443/oauth/register",
+		"tokenRequest": "https://localhost:8443/oauth/token",
+		"client_id": "",
+		"client_secret": "",
+		"jwt": "",
+		"expires": "",
+		"type": ""
+	},
+	"graphs": {
+		"default-graph-uri": "http://default",
+		"named-graph-uri": "http://default",
+		"using-graph-uri": "http://default",
+		"using-named-graph-uri": "http://default"
+	},
+	"sparql11protocol": {
+		"protocol": "http",
+		"port": 8890,
+		"query": {
+			"path": "/sparql",
+			"method": "URL_POST_ENCODED",
+			"format": "JSON"
+		},
+		"update": {
+			"path": "/sparql",
+			"method": "POST",
+			"format": "JSON"
+		}
+	}
+}
\ No newline at end of file
diff --git a/logging-jconsole.properties b/logging-jconsole.properties
new file mode 100644
index 00000000..b7345f5c
--- /dev/null
+++ b/logging-jconsole.properties
@@ -0,0 +1,9 @@
+handlers=java.util.logging.ConsoleHandler
+
+.level=ALL
+java.util.logging.ConsoleHandler.level=ALL
+#java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
+javax.management.level=ALL
+javax.management.remote.level=ALL
+
+# usage: jconsole -J-Djava.util.logging.config.file=logging-jconsole.properties
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 95cc09ea..3449aa27 100644
--- a/pom.xml
+++ b/pom.xml
@@ -185,12 +185,12 @@
 		
 			org.apache.logging.log4j
 			log4j-api
-			2.20.0
+			2.23.1
 		
 		
 			org.apache.logging.log4j
 			log4j-core
-			2.20.0
+			2.23.1
 		
 		
 			com.google.code.gson