Search in sources :

Example 1 with DataAccessPoint

use of org.apache.jena.fuseki.server.DataAccessPoint in project jena by apache.

the class ActionCtl method execCommonWorker.

@Override
protected final void execCommonWorker(HttpAction action) {
    DataAccessPoint dataAccessPoint;
    String datasetUri = mapRequestToDatasetName(action);
    if (datasetUri != null) {
        dataAccessPoint = action.getDataAccessPointRegistry().get(datasetUri);
        if (dataAccessPoint == null) {
            ServletOps.errorNotFound("Not found: " + datasetUri);
            return;
        }
    } else {
        // This is a placeholder when creating new DatasetRefs
        // and also if addressing a container, not a dataset
        dataAccessPoint = null;
    }
    action.setControlRequest(dataAccessPoint, datasetUri);
    // No operation or service name.
    action.setEndpoint(null, null);
    executeAction(action);
}
Also used : DataAccessPoint(org.apache.jena.fuseki.server.DataAccessPoint)

Example 2 with DataAccessPoint

use of org.apache.jena.fuseki.server.DataAccessPoint in project jena by apache.

the class FusekiFilter method doFilter.

@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
    try {
        HttpServletRequest req = (HttpServletRequest) request;
        HttpServletResponse resp = (HttpServletResponse) response;
        // Handle context path
        String uri = ActionLib.actionURI(req);
        String datasetUri = ActionLib.mapActionRequestToDataset(uri);
        DataAccessPointRegistry registry = DataAccessPointRegistry.get(request.getServletContext());
        if (LogFilter) {
            log.info("Filter: Request URI = " + req.getRequestURI());
            log.info("Filter: Action URI  = " + uri);
            log.info("Filter: Dataset URI = " + datasetUri);
        }
        if (datasetUri != null) {
            if (registry.isRegistered(datasetUri)) {
                if (LogFilter)
                    log.info("Filter: dispatch");
                überServlet.doCommon(req, resp);
                return;
            }
            // not rely on the überServlet. 
            if (Fuseki.GSP_DIRECT_NAMING) {
                // Not a dataset name ; may be a direct GSP direct name that does not look like a service name.
                for (String dsKey : registry.keys()) {
                    DataAccessPoint dap = registry.get(dsKey);
                    String dsName = dap.getName();
                    if (datasetUri.startsWith(dsName)) {
                        if (LogFilter)
                            log.info("Filter: dispatch (GSP direct name)");
                        überServlet.doCommon(req, resp);
                        return;
                    }
                }
            }
        }
    } catch (Exception ex) {
    }
    if (LogFilter)
        log.info("Filter: pass to chain");
    // Not found - continue. 
    chain.doFilter(request, response);
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) HttpServletResponse(javax.servlet.http.HttpServletResponse) DataAccessPoint(org.apache.jena.fuseki.server.DataAccessPoint) DataAccessPointRegistry(org.apache.jena.fuseki.server.DataAccessPointRegistry) IOException(java.io.IOException)

Example 3 with DataAccessPoint

use of org.apache.jena.fuseki.server.DataAccessPoint in project jena by apache.

the class FusekiBuilder method buildDataAccessPoint.

/** Build a DataAccessPoint, including DataService at Resource svc */
public static DataAccessPoint buildDataAccessPoint(Resource svc, DatasetDescriptionRegistry dsDescMap) {
    RDFNode n = FusekiLib.getOne(svc, "fu:name");
    if (!n.isLiteral())
        throw new FusekiConfigException("Not a literal for access point name: " + FmtUtils.stringForRDFNode(n));
    Literal object = n.asLiteral();
    if (object.getDatatype() != null && !object.getDatatype().equals(XSDDatatype.XSDstring))
        Fuseki.configLog.error(format("Service name '%s' is not a string", FmtUtils.stringForRDFNode(object)));
    String name = object.getLexicalForm();
    name = DataAccessPoint.canonical(name);
    DataService dataService = FusekiBuilder.buildDataService(svc, dsDescMap);
    DataAccessPoint dataAccess = new DataAccessPoint(name, dataService);
    return dataAccess;
}
Also used : FusekiConfigException(org.apache.jena.fuseki.FusekiConfigException) Literal(org.apache.jena.rdf.model.Literal) DataAccessPoint(org.apache.jena.fuseki.server.DataAccessPoint) RDFNode(org.apache.jena.rdf.model.RDFNode) DataService(org.apache.jena.fuseki.server.DataService)

Example 4 with DataAccessPoint

use of org.apache.jena.fuseki.server.DataAccessPoint in project jena by apache.

the class JsonDescription method arrayDatasets.

public static void arrayDatasets(JsonBuilder builder, DataAccessPointRegistry registry) {
    builder.startArray();
    for (String ds : registry.keys()) {
        DataAccessPoint access = registry.get(ds);
        JsonDescription.describe(builder, access);
    }
    builder.finishArray();
}
Also used : DataAccessPoint(org.apache.jena.fuseki.server.DataAccessPoint)

Aggregations

DataAccessPoint (org.apache.jena.fuseki.server.DataAccessPoint)4 IOException (java.io.IOException)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 FusekiConfigException (org.apache.jena.fuseki.FusekiConfigException)1 DataAccessPointRegistry (org.apache.jena.fuseki.server.DataAccessPointRegistry)1 DataService (org.apache.jena.fuseki.server.DataService)1 Literal (org.apache.jena.rdf.model.Literal)1 RDFNode (org.apache.jena.rdf.model.RDFNode)1