Search in sources :

Example 1 with ServerConfig

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

the class EmbeddedFusekiServer1 method configure.

public static EmbeddedFusekiServer1 configure(int port, String fileConfig) {
    ServerConfig conf = FusekiConfig.configure(fileConfig);
    conf.port = port;
    conf.pagesPort = port;
    if (!FileOps.exists(conf.pages))
        conf.pages = null;
    return new EmbeddedFusekiServer1(conf);
}
Also used : ServerConfig(org.apache.jena.fuseki.server.ServerConfig)

Example 2 with ServerConfig

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

the class FusekiCmd method exec.

@Override
protected void exec() {
    if (homeDir == null) {
        if (System.getenv(Fuseki.FusekiHomeEnv) != null)
            homeDir = System.getenv(Fuseki.FusekiHomeEnv);
        else
            homeDir = ".";
    }
    homeDir = sort_out_dir(homeDir);
    Fuseki.configLog.info("Home Directory: " + FileOps.fullDirectoryPath(homeDir));
    if (!FileOps.exists(homeDir))
        Fuseki.configLog.warn("No such directory for Fuseki home: " + homeDir);
    String staticContentDir = pagesDir;
    if (staticContentDir == null)
        staticContentDir = homeDir + Fuseki.PagesStatic;
    Fuseki.configLog.debug("Static Content Directory: " + FileOps.fullDirectoryPath(staticContentDir));
    if (!FileOps.exists(staticContentDir)) {
        Fuseki.configLog.warn("No such directory for static content: " + FileOps.fullDirectoryPath(staticContentDir));
        Fuseki.configLog.warn("You may need to set the --pages or --home option to configure static content correctly");
    }
    if (jettyConfigFile != null)
        Fuseki.configLog.info("Jetty configuration: " + jettyConfigFile);
    ServerConfig serverConfig;
    if (fusekiConfigFile != null) {
        Fuseki.configLog.info("Configuration file: " + fusekiConfigFile);
        serverConfig = FusekiConfig.configure(fusekiConfigFile);
    } else {
        serverConfig = FusekiConfig.defaultConfiguration(datasetPath, dsg, allowUpdate, listenLocal);
        if (!allowUpdate)
            Fuseki.serverLog.info("Running in read-only mode.");
    }
    // TODO Get from parsing config file.
    serverConfig.port = port;
    serverConfig.pages = staticContentDir;
    serverConfig.mgtPort = mgtPort;
    serverConfig.pagesPort = port;
    serverConfig.loopback = listenLocal;
    serverConfig.enableCompression = enableCompression;
    serverConfig.jettyConfigFile = jettyConfigFile;
    serverConfig.authConfigFile = authConfigFile;
    serverConfig.verboseLogging = (super.isVerbose() || super.isDebug());
    SPARQLServer server = new SPARQLServer(serverConfig);
    // Temporary
    Fuseki.setServer(server);
    Server mgtServer = null;
    if (mgtPort > 0) {
        Fuseki.configLog.info("Management services on port " + mgtPort);
        mgtServer = ManagementServer.createManagementServer(mgtPort);
        try {
            mgtServer.start();
        } catch (java.net.BindException ex) {
            serverLog.error("SPARQLServer: Failed to start management server: " + ex.getMessage());
            System.exit(1);
        } catch (Exception ex) {
            serverLog.error("SPARQLServer: Failed to start management server: " + ex.getMessage(), ex);
            System.exit(1);
        }
    }
    try {
        server.start();
    } catch (FusekiException ex) {
        serverLog.warn("Failed to start the server.", ex);
    }
    try {
        server.getServer().join();
    } catch (Exception ex) {
    }
    if (mgtServer != null) {
        try {
            mgtServer.stop();
        } catch (Exception e) {
            serverLog.warn("Failed to cleanly stop the management server", e);
        }
    }
    System.exit(0);
}
Also used : ServerConfig(org.apache.jena.fuseki.server.ServerConfig) SPARQLServer(org.apache.jena.fuseki.server.SPARQLServer) Server(org.eclipse.jetty.server.Server) ManagementServer(org.apache.jena.fuseki.mgt.ManagementServer) SPARQLServer(org.apache.jena.fuseki.server.SPARQLServer) CmdException(jena.cmd.CmdException)

Example 3 with ServerConfig

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

the class EmbeddedFusekiServer1 method create.

public static EmbeddedFusekiServer1 create(int port, DatasetGraph dsg, String datasetPath) {
    ServerConfig conf = FusekiConfig.defaultConfiguration(datasetPath, dsg, true, true);
    conf.port = port;
    conf.pagesPort = port;
    if (!FileOps.exists(conf.pages))
        conf.pages = null;
    return new EmbeddedFusekiServer1(conf);
}
Also used : ServerConfig(org.apache.jena.fuseki.server.ServerConfig)

Aggregations

ServerConfig (org.apache.jena.fuseki.server.ServerConfig)3 CmdException (jena.cmd.CmdException)1 ManagementServer (org.apache.jena.fuseki.mgt.ManagementServer)1 SPARQLServer (org.apache.jena.fuseki.server.SPARQLServer)1 Server (org.eclipse.jetty.server.Server)1