Search in sources :

Example 1 with DatasetRef

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;
}
Also used : DatasetRef(org.apache.jena.fuseki.server.DatasetRef)

Example 2 with DatasetRef

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) {
    }
}
Also used : IOException(java.io.IOException) DatasetRef(org.apache.jena.fuseki.server.DatasetRef) SPARQLServer(org.apache.jena.fuseki.server.SPARQLServer) PrintWriter(java.io.PrintWriter)

Example 3 with DatasetRef

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);
}
Also used : DatasetRef(org.apache.jena.fuseki.server.DatasetRef)

Example 4 with DatasetRef

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);
}
Also used : DatasetRef(org.apache.jena.fuseki.server.DatasetRef) HttpAction(org.apache.jena.fuseki.servlets.HttpAction)

Example 5 with DatasetRef

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;
}
Also used : DatasetRegistry(org.apache.jena.fuseki.server.DatasetRegistry) DatasetRef(org.apache.jena.fuseki.server.DatasetRef)

Aggregations

DatasetRef (org.apache.jena.fuseki.server.DatasetRef)10 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 IndentedLineBuffer (org.apache.jena.atlas.io.IndentedLineBuffer)1 DatasetRegistry (org.apache.jena.fuseki.server.DatasetRegistry)1 SPARQLServer (org.apache.jena.fuseki.server.SPARQLServer)1 HttpAction (org.apache.jena.fuseki.servlets.HttpAction)1 PrefixMapping (org.apache.jena.shared.PrefixMapping)1 DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)1 Prologue (org.apache.jena.sparql.core.Prologue)1 DatasetGraphTDB (org.apache.jena.tdb.store.DatasetGraphTDB)1