use of it.unibo.arces.wot.sepa.commons.response.Response in project SEPA by arces-wot.
the class SEPATest method requestAccessTokenTest.
protected static boolean requestAccessTokenTest() {
Response response;
response = client.requestToken();
logger.debug(response.toString());
return !response.getClass().equals(ErrorResponse.class);
}
use of it.unibo.arces.wot.sepa.commons.response.Response in project SEPA by arces-wot.
the class SEPATest method registrationTest.
protected static boolean registrationTest(String id) {
Response response;
response = client.register(id);
return !response.getClass().equals(ErrorResponse.class);
}
use of it.unibo.arces.wot.sepa.commons.response.Response in project SEPA by arces-wot.
the class MessageSender method sendMessage.
public boolean sendMessage(String receiver, String text) {
message.addBinding("receiver", new RDFTermLiteral(receiver));
message.addBinding("text", new RDFTermLiteral(text));
Response ret = update(message);
return ret.isUpdateResponse();
}
use of it.unibo.arces.wot.sepa.commons.response.Response in project SEPA by arces-wot.
the class GarbageCollector method subscribe.
public boolean subscribe() {
Response ret;
ret = super.subscribe(null);
if (ret.isError())
return false;
SubscribeResponse results = (SubscribeResponse) ret;
for (Bindings binding : results.getBindingsResults().getBindings()) {
numbers += Integer.parseInt(binding.getBindingValue("numbers"));
logger.info("Total numbers: " + numbers);
}
if (numbers >= getApplicationProfile().getExtendedData().get("gcnumbers").getAsInt()) {
logger.info("Collecting triples...");
update(null);
}
return true;
}
use of it.unibo.arces.wot.sepa.commons.response.Response in project SEPA by arces-wot.
the class MeanCalculator method start.
public boolean start() {
Response ret;
ret = subscribe(null);
if (ret.isError())
return false;
mean = 0;
counter = 0;
// Update!
forcedBindings.addBinding("counter", new RDFTermLiteral(String.format("%d", counter)));
forcedBindings.addBinding("value", new RDFTermLiteral(String.format("%.3f", mean)));
update(forcedBindings);
return true;
}
Aggregations