Search in sources :

Example 6 with FusekiConfigException

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);
    }
}
Also used : FusekiConfigException(org.apache.jena.fuseki.FusekiConfigException) Method(java.lang.reflect.Method) IOException(java.io.IOException) FusekiConfigException(org.apache.jena.fuseki.FusekiConfigException)

Example 7 with FusekiConfigException

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

Example 8 with FusekiConfigException

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;
}
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 9 with FusekiConfigException

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;
}
Also used : FusekiConfigException(org.apache.jena.fuseki.FusekiConfigException) ResultSet(org.apache.jena.query.ResultSet) RDFNode(org.apache.jena.rdf.model.RDFNode)

Example 10 with FusekiConfigException

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

Aggregations

FusekiConfigException (org.apache.jena.fuseki.FusekiConfigException)12 Path (java.nio.file.Path)3 IOException (java.io.IOException)2 Method (java.lang.reflect.Method)2 RDFNode (org.apache.jena.rdf.model.RDFNode)2 InputStream (java.io.InputStream)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 DataAccessPoint (org.apache.jena.fuseki.server.DataAccessPoint)1 DataService (org.apache.jena.fuseki.server.DataService)1 Dataset (org.apache.jena.query.Dataset)1 ResultSet (org.apache.jena.query.ResultSet)1 Literal (org.apache.jena.rdf.model.Literal)1