use of org.apache.jena.fuseki.FusekiConfigException in project jena by apache.
the class FusekiConfig method loadAndInit.
private static void loadAndInit(String className) {
try {
Class<?> classObj = Class.forName(className);
log.info("Loaded " + className);
Method initMethod = classObj.getMethod("init");
initMethod.invoke(null);
} catch (ClassNotFoundException ex) {
log.warn("Class not found: " + className);
} catch (Exception e) {
throw new FusekiConfigException(e);
}
}
use of org.apache.jena.fuseki.FusekiConfigException in project jena by apache.
the class FusekiBuilder method getDataset.
static Dataset getDataset(Resource datasetDesc, DatasetDescriptionRegistry dsDescMap) {
// check if this one already built
Dataset ds = dsDescMap.get(datasetDesc);
if (ds == null) {
// Check if the description is in the model.
if (!datasetDesc.hasProperty(RDF.type))
throw new FusekiConfigException("No rdf:type for dataset " + nodeLabel(datasetDesc));
ds = (Dataset) Assembler.general.open(datasetDesc);
}
// Some kind of check that it is "the same" dataset.
// It can be different if two descriptions in different files have the same URI.
dsDescMap.register(datasetDesc, ds);
return ds;
}
use of org.apache.jena.fuseki.FusekiConfigException 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.FusekiConfigException in project jena by apache.
the class FusekiBuilder method getOne.
public static RDFNode getOne(Resource svc, String property) {
String ln = property.substring(property.indexOf(':') + 1);
ResultSet rs = FusekiLib.query("SELECT * { ?svc " + property + " ?x}", svc.getModel(), "svc", svc);
if (!rs.hasNext())
throw new FusekiConfigException("No " + ln + " for service " + FusekiLib.nodeLabel(svc));
RDFNode x = rs.next().get("x");
if (rs.hasNext())
throw new FusekiConfigException("Multiple " + ln + " for service " + FusekiLib.nodeLabel(svc));
return x;
}
use of org.apache.jena.fuseki.FusekiConfigException in project jena by apache.
the class FusekiConfig method server.
private static void server(Model model) {
// Find one server.
List<Resource> servers = getByType(FusekiVocab.tServer, model);
if (servers.size() == 0)
return;
if (servers.size() > 1)
throw new FusekiConfigException(servers.size() + " servers found (must be exactly one in a configuration file)");
// ---- Server
Resource server = servers.get(0);
processServer(server);
}
Aggregations