Skip to content

Commit

Permalink
config: new Dockerfile for JMX
Browse files Browse the repository at this point in the history
  • Loading branch information
lroffia committed Nov 26, 2024
2 parents 97b49b5 + 721377c commit 1c38f93
Show file tree
Hide file tree
Showing 14 changed files with 151 additions and 8,017 deletions.
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ RUN mvn clean package

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
COPY --from=build ./engine/src/main/resources/jmxremote.password /jmxremote.password
COPY --from=build ./engine/src/main/resources/jmxremote.access /jmxremote.access
Expand All @@ -22,14 +23,14 @@ COPY --from=build ./engine/src/main/resources/endpoint.jpar /endpoint.jpar
COPY --from=build ./engine/src/main/resources/endpoints /endpoints

RUN chmod 600 /jmxremote.password

EXPOSE 8000
EXPOSE 9000
RUN chmod 777 /run.sh

# MUST BE SET WITH THE HOST NAME (e.g. vaimee.com , vaimee.org, ...)
#ENV JMX_ARGS="-Dcom.sun.management.jmxremote.rmi.port=7090 -Dcom.sun.management.jmxremote.port=7090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote"
ENV JMX_HOSTNAME=0.0.0.0
ENV JMX_PORT=7999

EXPOSE ${JMX_PORT}
ENTRYPOINT ["sh","-c","java -Djava.rmi.server.hostname=${JMX_HOSTNAME} -Dcom.sun.management.jmxremote.rmi.port=${JMX_PORT} -Dcom.sun.management.jmxremote.port=${JMX_PORT} -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote -jar engine.jar"]
#ENTRYPOINT ["sh","-c","\"java -Djava.rmi.server.hostname=${JMX_HOSTNAME} -Dcom.sun.management.jmxremote.rmi.port=7090 -Dcom.sun.management.jmxremote.port=7090 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote -jar engine.jar\""]
EXPOSE 8000
EXPOSE 9000

ENTRYPOINT ["/run.sh"]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ SEPA (**S**PARQL **E**vent **P**rocessing **A**rchitecture) is a publish-subscri

- Download [Blazegraph](https://github.com/blazegraph/database/releases/latest) (or use any other SPARQL 1.1 Protocol compliant service) and run it as shown [here](https://wiki.blazegraph.com/wiki/index.php/Quick_Start)

- Use the [SEPA Playground](http://mml.arces.unibo.it/apps/dashboard?mode=local) to check basic functionalities of the engine.
- Use the [SEPA Playground](https://studio.sepa.vaimee.com) to check basic functionalities of the engine.

### For Hackers 💻👩‍💻👨‍💻
<a href="https://asciinema.org/a/251211">
Expand Down Expand Up @@ -251,4 +251,4 @@ SEPA stands for *SPARQL Event Processing Architecture*. SEPA is promoted and mai

## License

SEPA Engine is released under the [GNU GPL](https://github.com/arces-wot/SEPA/blob/master/engine/LICENSE), SEPA APIs are released under the [GNU LGPL](https://github.com/arces-wot/SEPA/blob/master/client-api/LICENSE)
SEPA Engine is released under the [GNU GPL](https://github.com/arces-wot/SEPA/blob/master/engine/LICENSE), SEPA APIs are released under the [GNU LGPL](https://github.com/arces-wot/SEPA/blob/master/client-api/LICENSE)
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.io.IOException;
import java.io.Reader;
import java.util.HashMap;

import com.google.gson.Gson;
import com.google.gson.JsonIOException;
Expand Down Expand Up @@ -82,7 +83,7 @@ public enum SPARQL11SEPrimitive {
protected SPARQL11SEProtocolProperties sparql11seprotocol;

public SPARQL11SEProperties() {
sparql11seprotocol = new SPARQL11SEProtocolProperties();
super();

override(null);
}
Expand Down Expand Up @@ -150,52 +151,59 @@ private void parseJSAP(Reader in) throws SEPAPropertiesException {
}

protected final void setParameter(String key,String value) {
super.setParameter(key, value);

switch (key) {
case "-host" :
this.host = value;
break;
case "-sparql11protocol.port":
this.sparql11protocol.port = Integer.valueOf(value);
break;
case "-sparql11protocol.host":
this.sparql11protocol.host = host;
break;
case "-sparql11protocol.protocol":
this.sparql11protocol.protocol = (value == "http" ? ProtocolScheme.http : ProtocolScheme.https);
break;
case "-sparql11protocol.update.method":
this.sparql11protocol.update.method = (value == "post" ? UpdateProperties.UpdateHTTPMethod.POST : UpdateProperties.UpdateHTTPMethod.URL_ENCODED_POST);
break;
case "-sparql11protocol.update.format":
this.sparql11protocol.update.format = (value == "json" ? UpdateProperties.UpdateResultsFormat.JSON : UpdateProperties.UpdateResultsFormat.HTML);
break;
case "-sparql11protocol.update.path":
this.sparql11protocol.update.path = value;
break;
case "-sparql11protocol.query.method":
this.sparql11protocol.query.method = (value == "get" ? QueryProperties.QueryHTTPMethod.GET : (value == "post" ? QueryProperties.QueryHTTPMethod.POST : QueryProperties.QueryHTTPMethod.URL_ENCODED_POST));
break;
case "-sparql11protocol.query.format":
this.sparql11protocol.query.format = (value == "json" ? QueryProperties.QueryResultsFormat.JSON : (value == "xml" ? QueryProperties.QueryResultsFormat.XML : QueryProperties.QueryResultsFormat.CSV));
break;
case "-sparql11protocol.query.path":
this.sparql11protocol.query.path = value;
break;
// case "-host" :
// this.host = value;
// break;
// case "-sparql11protocol.port":
// this.sparql11protocol.port = Integer.valueOf(value);
// break;
// case "-sparql11protocol.host":
// this.sparql11protocol.host = host;
// break;
// case "-sparql11protocol.protocol":
// this.sparql11protocol.protocol = (value == "http" ? ProtocolScheme.http : ProtocolScheme.https);
// break;
// case "-sparql11protocol.update.method":
// this.sparql11protocol.update.method = (value == "post" ? UpdateProperties.UpdateHTTPMethod.POST : UpdateProperties.UpdateHTTPMethod.URL_ENCODED_POST);
// break;
// case "-sparql11protocol.update.format":
// this.sparql11protocol.update.format = (value == "json" ? UpdateProperties.UpdateResultsFormat.JSON : UpdateProperties.UpdateResultsFormat.HTML);
// break;
// case "-sparql11protocol.update.path":
// this.sparql11protocol.update.path = value;
// break;
// case "-sparql11protocol.query.method":
// this.sparql11protocol.query.method = (value == "get" ? QueryProperties.QueryHTTPMethod.GET : (value == "post" ? QueryProperties.QueryHTTPMethod.POST : QueryProperties.QueryHTTPMethod.URL_ENCODED_POST));
// break;
// case "-sparql11protocol.query.format":
// this.sparql11protocol.query.format = (value == "json" ? QueryProperties.QueryResultsFormat.JSON : (value == "xml" ? QueryProperties.QueryResultsFormat.XML : QueryProperties.QueryResultsFormat.CSV));
// break;
// case "-sparql11protocol.query.path":
// this.sparql11protocol.query.path = value;
// break;
case "-sparql11seprotocol.host":
this.sparql11seprotocol.host = value;
this.sparql11seprotocol.setHost(value);
break;
case "-sparql11seprotocol.protocol":
this.sparql11seprotocol.protocol = value;
this.sparql11seprotocol.setProtocol(value);
break;
case "-sparql11seprotocol.reconnect":
this.sparql11seprotocol.reconnect = Boolean.valueOf(value);
this.sparql11seprotocol.setReconnect(Boolean.valueOf(value));
break;
default:
if (key.startsWith("-sparql11seprotocol.availableProtocols")) {
String[] token = key.split("\\.");
if (token[3] == "path") this.sparql11seprotocol.availableProtocols.get(token[2]).path = value;
else if (token[3] == "port") this.sparql11seprotocol.availableProtocols.get(token[2]).port = Integer.valueOf(value);
else if (token[3] == "scheme") this.sparql11seprotocol.availableProtocols.get(token[2]).scheme = value;
if (this.sparql11seprotocol == null) sparql11seprotocol = new SPARQL11SEProtocolProperties();
if (this.sparql11seprotocol.getAvailableProtocols() == null) {
this.sparql11seprotocol.setAvailableProtocols(new HashMap<String,SubscriptionProtocolProperties>());
this.sparql11seprotocol.getAvailableProtocols().put(token[2], new SubscriptionProtocolProperties());
}
if (token[3] == "path") this.sparql11seprotocol.getAvailableProtocols().get(token[2]).setPath(value);
else if (token[3] == "port") this.sparql11seprotocol.getAvailableProtocols().get(token[2]).setPort(Integer.valueOf(value));
else if (token[3] == "scheme") this.sparql11seprotocol.getAvailableProtocols().get(token[2]).setScheme(value);
}
}
}
Expand All @@ -205,39 +213,39 @@ public String toString() {
}

public String getSubscribeHost() {
return (sparql11seprotocol.host != null ? sparql11seprotocol.host : super.host);
return (sparql11seprotocol.getHost() != null ? sparql11seprotocol.getHost() : super.host);
}

public void setHost(String host) {
sparql11seprotocol.host = host;
sparql11seprotocol.setHost(host);
}

public String getSubscribePath() {
return sparql11seprotocol.availableProtocols.get(sparql11seprotocol.protocol).path;
return sparql11seprotocol.getAvailableProtocols().get(sparql11seprotocol.getProtocol()).getPath();
}

public void setSubscribePath(String path) {
sparql11seprotocol.availableProtocols.get(sparql11seprotocol.protocol).path = path;
sparql11seprotocol.getAvailableProtocols().get(sparql11seprotocol.getProtocol()).setPath(path);
}

public int getSubscribePort() {
return sparql11seprotocol.availableProtocols.get(sparql11seprotocol.protocol).port;
return sparql11seprotocol.getAvailableProtocols().get(sparql11seprotocol.getProtocol()).getPort();
}

public void setSubscribePort(int port) {
sparql11seprotocol.availableProtocols.get(sparql11seprotocol.protocol).port = port;
sparql11seprotocol.getAvailableProtocols().get(sparql11seprotocol.getProtocol()).setPort(port);
}

public SubscriptionProtocolProperties getSubscriptionProtocol() {
return sparql11seprotocol.availableProtocols.get(sparql11seprotocol.protocol);
return sparql11seprotocol.getAvailableProtocols().get(sparql11seprotocol.getProtocol());
}

public boolean getReconnect() {
return sparql11seprotocol.reconnect;
return sparql11seprotocol.isReconnect();
}

public void setSubscriptionProtocol(String scheme) {
sparql11seprotocol.protocol = scheme;
sparql11seprotocol.setProtocol(scheme);

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,62 @@
import java.util.HashMap;

public class SPARQL11SEProtocolProperties {
public String protocol = null;
public HashMap<String,SubscriptionProtocolProperties> availableProtocols = null;
public String host = null;
public boolean reconnect = true;
private String protocol = null;
private HashMap<String,SubscriptionProtocolProperties> availableProtocols = new HashMap<String,SubscriptionProtocolProperties>();
private String host = null;
private boolean reconnect = true;

public SPARQL11SEProtocolProperties merge(SPARQL11SEProtocolProperties temp) {
if (temp != null) {
protocol = (temp.protocol != null ? temp.protocol : protocol);
host = (temp.host != null ? temp.host : host);
reconnect = temp.reconnect;
availableProtocols = (temp.availableProtocols != null ? temp.availableProtocols : availableProtocols);
setProtocol((temp.getProtocol() != null ? temp.getProtocol() : getProtocol()));
setHost((temp.getHost() != null ? temp.getHost() : getHost()));
setReconnect(temp.isReconnect());
setAvailableProtocols((temp.getAvailableProtocols() != null ? temp.getAvailableProtocols() : getAvailableProtocols()));
}
return this;
}

public int getPort() {
return availableProtocols.get(protocol).port;
return getAvailableProtocols().get(getProtocol()).getPort();
}

public String getPath() {
return availableProtocols.get(protocol).path;
return getAvailableProtocols().get(getProtocol()).getPath();
}

public SubscriptionProtocolProperties getSubscriptionProtocol() {
return availableProtocols.get(protocol);
return getAvailableProtocols().get(getProtocol());
}

public String getHost() {
return host;
}

public void setHost(String host) {
this.host = host;
}

public String getProtocol() {
return protocol;
}

public void setProtocol(String protocol) {
this.protocol = protocol;
}

public boolean isReconnect() {
return reconnect;
}

public void setReconnect(boolean reconnect) {
this.reconnect = reconnect;
}

public HashMap<String,SubscriptionProtocolProperties> getAvailableProtocols() {
return availableProtocols;
}

public void setAvailableProtocols(HashMap<String,SubscriptionProtocolProperties> availableProtocols) {
this.availableProtocols = availableProtocols;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
package it.unibo.arces.wot.sepa.commons.properties;

public class SubscriptionProtocolProperties {
public String path = null;
public String scheme = null;
public int port = -1;
private String path = null;
private String scheme = null;
private int port = -1;

public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getScheme() {
return scheme;
}
public void setScheme(String scheme) {
this.scheme = scheme;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -412,13 +412,13 @@ private void _subscribe(String ID, String sparql, Bindings forced, String alias,
if (req != null)
subLock.wait();

url = appProfile.getSubscribeProtocol(ID).scheme+ "_" + appProfile.getSubscribeHost(ID) + "_" + appProfile.getSubscribePort(ID) + "_"
url = appProfile.getSubscribeProtocol(ID).getScheme()+ "_" + appProfile.getSubscribeHost(ID) + "_" + appProfile.getSubscribePort(ID) + "_"
+ appProfile.getSubscribePath(ID);

if (activeClients.containsKey(url)) {
subscription = activeClients.get(url);
} else {
protocol = new WebsocketSubscriptionProtocol(appProfile.getSubscribeProtocol(ID).scheme,appProfile.getSubscribeHost(ID),
protocol = new WebsocketSubscriptionProtocol(appProfile.getSubscribeProtocol(ID).getScheme(),appProfile.getSubscribeHost(ID),
appProfile.getSubscribePort(ID), appProfile.getSubscribePath(ID), this, sm);
subscription = new SPARQL11SEProtocol(protocol);
}
Expand Down
Loading

0 comments on commit 1c38f93

Please sign in to comment.