use of org.apache.jena.fuseki.server.DatasetRef in project jena by apache.
the class SPARQL_UberServlet method doGraphStoreProtocol.
private void doGraphStoreProtocol(HttpAction action) {
// The GSP servlets handle direct and indirect naming.
DatasetRef desc = action.dsRef;
String method = action.request.getMethod();
if (HttpNames.METHOD_GET.equalsIgnoreCase(method) || HttpNames.METHOD_HEAD.equalsIgnoreCase(method)) {
if (!allowREST_R(action))
// Indirect naming. Prefer the R service if available.
if (desc.readGraphStore.isActive())
executeRequest(action, restServlet_R, desc.readGraphStore);
else if (desc.readWriteGraphStore.isActive())
executeRequest(action, restServlet_RW, desc.readWriteGraphStore);
else
errorMethodNotAllowed(method);
return;
}
// Graphs Store Protocol, indirect naming, write
if (!allowREST_W(action))
errorForbidden("Forbidden: SPARQL Graph Store Protocol : Write operation : " + method);
executeRequest(action, restServlet_RW, desc.readWriteGraphStore);
return;
}
use of org.apache.jena.fuseki.server.DatasetRef in project jena by apache.
the class MgtCmdServlet method doGet.
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) {
try {
// serverLog.info("Fuseki Server Config servlet") ;
PrintWriter out = resp.getWriter();
resp.setContentType("text/plain");
SPARQLServer server = Fuseki.getServer();
out.println("Software:");
String fusekiVersion = Fuseki.VERSION;
if (fusekiVersion.equals("${project.version}"))
fusekiVersion = "(development)";
out.printf(" %s %s\n", Fuseki.NAME, fusekiVersion);
out.printf(" %s %s\n", TDB.NAME, TDB.VERSION);
out.printf(" %s %s\n", ARQ.NAME, ARQ.VERSION);
out.printf(" %s %s\n", Jena.NAME, Jena.VERSION);
// out.printf("Port: %s\n",
// server.getServer().getConnectors()[0].getPort()) ;
out.println();
for (DatasetRef dsRef : server.getDatasets()) {
datasetRefDetails(out, dsRef);
out.println();
}
} catch (IOException ex) {
}
}
use of org.apache.jena.fuseki.server.DatasetRef in project jena by apache.
the class MgtFunctions method serviceQuery.
// Service name getters ...
/** Return a SPARQL query service name for the dataset */
public static String serviceQuery(String dataset) {
String dft = "sparql";
DatasetRef ref = getFromRegistry(dataset);
if (ref == null)
return dft;
return serviceNameOrDefault(ref.query, dft);
}
use of org.apache.jena.fuseki.server.DatasetRef in project jena by apache.
the class ActionBackup method doPost.
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
String dataset = FusekiLib.safeParameter(request, "dataset");
if (dataset == null) {
response.sendError(HttpSC.BAD_REQUEST_400, "Required parameter missing: ?dataset=");
return;
}
if (!dataset.startsWith("/"))
dataset = "/" + dataset;
// HttpSession session = request.getSession(true) ;
// session.setAttribute("dataset", dataset) ;
// session.setMaxInactiveInterval(15*60) ; // 10 mins
boolean known = DatasetRegistry.get().isRegistered(dataset);
if (!known) {
response.sendError(HttpSC.BAD_REQUEST_400, "No such dataset: " + dataset);
return;
}
long id = allocRequestId(request, response);
HttpAction action = new HttpAction(id, request, response, false);
DatasetRef ref = DatasetRegistry.get().get(dataset);
action.setDataset(ref);
scheduleBackup(action);
}
use of org.apache.jena.fuseki.server.DatasetRef in project jena by apache.
the class MgtFunctions method getFromRegistry.
private static DatasetRef getFromRegistry(String dataset) {
DatasetRegistry registry = DatasetRegistry.get();
if (registry == null) {
Fuseki.serverLog.warn("No dataset registry");
return null;
}
DatasetRef ref = registry.get(dataset);
if (ref == null)
Fuseki.serverLog.warn("Dataset not found: " + dataset);
return ref;
}
Aggregations