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);
}
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);
}
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;
}
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();
}
Aggregations