use of org.apache.jena.update.UpdateRequest in project jena by apache.
the class TestAuth method update_with_auth_09.
@Test(expected = HttpException.class)
public void update_with_auth_09() throws URISyntaxException {
UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
// Auth credentials for valid user with correct password but scoped to
// wrong URI
ue.setClient(withBasicAuth(new AuthScope("example", authPort), "allowed", "password"));
ue.execute();
}
use of org.apache.jena.update.UpdateRequest in project jena by apache.
the class TestAuth method update_with_auth_05.
@Test(expected = HttpException.class)
public void update_with_auth_05() {
UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemoteForm(updates, authServiceUpdate);
// No auth credentials should result in an error
ue.execute();
}
use of org.apache.jena.update.UpdateRequest in project jena by apache.
the class TestAuth method update_with_auth_04.
@Test(expected = HttpException.class)
public void update_with_auth_04() {
UpdateRequest updates = UpdateFactory.create("CREATE SILENT GRAPH <http://graph>");
UpdateProcessRemoteBase ue = (UpdateProcessRemoteBase) UpdateExecutionFactory.createRemote(updates, authServiceUpdate);
// Auth credentials for valid user with correct password BUT not in
// correct role
ue.setClient(withBasicAuth(ANY, "forbidden", "password"));
ue.execute();
}
use of org.apache.jena.update.UpdateRequest in project jena by apache.
the class SPARQL_Update method execute.
private void execute(HttpAction action, InputStream input) {
// OPTIONS
if (action.request.getMethod().equals(HttpNames.METHOD_OPTIONS)) {
// Share with update via SPARQL_Protocol.
doOptions(action);
return;
}
UsingList usingList = processProtocol(action.request);
// If the dsg is transactional, then we can parse and execute the update in a streaming fashion.
// If it isn't, we need to read the entire update request before performing any updates, because
// we have to attempt to make the request atomic in the face of malformed updates
UpdateRequest req = null;
if (!action.isTransactional()) {
try {
req = UpdateFactory.read(usingList, input, UpdateParseBase, Syntax.syntaxARQ);
} catch (UpdateException ex) {
ServletOps.errorBadRequest(ex.getMessage());
return;
} catch (QueryParseException ex) {
ServletOps.errorBadRequest(messageForQueryException(ex));
return;
}
}
action.beginWrite();
try {
if (req == null)
UpdateAction.parseExecute(usingList, action.getActiveDSG(), input, UpdateParseBase, Syntax.syntaxARQ);
else
UpdateAction.execute(req, action.getActiveDSG());
action.commit();
} catch (UpdateException ex) {
action.abort();
incCounter(action.getEndpoint().getCounters(), UpdateExecErrors);
ServletOps.errorOccurred(ex.getMessage());
} catch (QueryParseException | QueryBuildException ex) {
action.abort();
// Counter inc'ed further out.
ServletOps.errorBadRequest(messageForQueryException(ex));
} catch (Throwable ex) {
if (!(ex instanceof ActionErrorException)) {
try {
action.abort();
} catch (Exception ex2) {
}
ServletOps.errorOccurred(ex.getMessage(), ex);
}
} finally {
action.endWrite();
}
}
use of org.apache.jena.update.UpdateRequest in project jena by apache.
the class ExTDB_Txn2 method execUpdate.
public static void execUpdate(String sparqlUpdateString, GraphStore graphStore) {
UpdateRequest request = UpdateFactory.create(sparqlUpdateString);
UpdateProcessor proc = UpdateExecutionFactory.create(request, graphStore);
proc.execute();
}
Aggregations