Skip to content

Commit

Permalink
fix api on with insert where updates
Browse files Browse the repository at this point in the history
  • Loading branch information
lroffia committed Nov 28, 2024
1 parent f20f214 commit 37a5d54
Showing 14 changed files with 394 additions and 312 deletions.
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@
import it.unibo.arces.wot.sepa.commons.exceptions.SEPAPropertiesException;
import it.unibo.arces.wot.sepa.commons.exceptions.SEPAProtocolException;
import it.unibo.arces.wot.sepa.commons.exceptions.SEPASecurityException;
import it.unibo.arces.wot.sepa.commons.properties.SubscriptionProtocolProperties;
import it.unibo.arces.wot.sepa.commons.request.Request;
import it.unibo.arces.wot.sepa.commons.request.SubscribeRequest;
import it.unibo.arces.wot.sepa.commons.request.UnsubscribeRequest;
@@ -44,27 +45,31 @@ public class WebsocketSubscriptionProtocol extends SubscriptionProtocol implemen

private final Object mutex;

public WebsocketSubscriptionProtocol(String host, int port, String path, ISubscriptionHandler handler)
throws SEPASecurityException, SEPAProtocolException {
this(host, port, path, handler, null);
}
// public WebsocketSubscriptionProtocol(String host, int port, String path, ISubscriptionHandler handler)
// throws SEPASecurityException, SEPAProtocolException {
// this(host, port, path, handler, null);
// }

public WebsocketSubscriptionProtocol(String scheme, String host, int port, String path,
ISubscriptionHandler handler) throws SEPASecurityException, SEPAProtocolException {
this(scheme, host, port, path, handler, null);
}
// public WebsocketSubscriptionProtocol(String scheme, String host, int port, String path,
// ISubscriptionHandler handler) throws SEPASecurityException, SEPAProtocolException {
// this(scheme, host, port, path, handler, null);
// }

public WebsocketSubscriptionProtocol(String host, int port, String path, ISubscriptionHandler handler,
ClientSecurityManager sm) throws SEPASecurityException, SEPAProtocolException {
this("ws", host, port, path, handler, sm);
}
// public WebsocketSubscriptionProtocol(String host, int port, String path, ISubscriptionHandler handler,
// ClientSecurityManager sm) throws SEPASecurityException, SEPAProtocolException {
// this("ws", host, port, path, handler, sm);
// }

public WebsocketSubscriptionProtocol(String scheme, String host, int port, String path,
ISubscriptionHandler handler, ClientSecurityManager sm)
public WebsocketSubscriptionProtocol(String host, SubscriptionProtocolProperties properties,
ISubscriptionHandler handler, ClientSecurityManager sm)
throws SEPASecurityException, SEPAProtocolException {
super(handler, sm);

mutex = new Object();

String scheme = properties.getScheme();
String path = properties.getPath();
int port = properties.getPort();

if (!scheme.equals("ws") && !scheme.equals("wss"))
throw new SEPAProtocolException("Scheme must be 'ws' or 'wss'");
@@ -87,6 +92,10 @@ public WebsocketSubscriptionProtocol(String scheme, String host, int port, Strin
client = new WebsocketClientEndpoint(sm, this);
}

{
// TODO Auto-generated constructor stub
}

private void connect() throws SEPASecurityException {
Logging.logger.trace("connect");

Original file line number Diff line number Diff line change
@@ -47,13 +47,37 @@ public String getQueryAcceptHeader() {
};


public String path = "/sparql";
public QueryHTTPMethod method = QueryHTTPMethod.URL_ENCODED_POST;
public QueryResultsFormat format = QueryResultsFormat.JSON;
private String path = "/sparql";
private QueryHTTPMethod method = QueryHTTPMethod.URL_ENCODED_POST;
private QueryResultsFormat format = QueryResultsFormat.JSON;

public void merge(QueryProperties query) {
if (query.path != null) this.path = query.path;
if (query.method != null) this.method = query.method;
if (query.format != null) this.format = query.format;
if (query.getPath() != null) this.setPath(query.getPath());
if (query.getMethod() != null) this.setMethod(query.getMethod());
if (query.getFormat() != null) this.setFormat(query.getFormat());
}

public QueryHTTPMethod getMethod() {
return method;
}

public void setMethod(QueryHTTPMethod method) {
this.method = method;
}

public QueryResultsFormat getFormat() {
return format;
}

public void setFormat(QueryResultsFormat format) {
this.format = format;
}

public String getPath() {
return path;
}

public void setPath(String path) {
this.path = path;
}
}
Loading

0 comments on commit 37a5d54

Please sign in to comment.