use of org.apache.jena.fuseki.server.SPARQLServer in project jena by apache.
the class MgtCmdServlet method doGet.
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) {
try {
// serverLog.info("Fuseki Server Config servlet") ;
PrintWriter out = resp.getWriter();
resp.setContentType("text/plain");
SPARQLServer server = Fuseki.getServer();
out.println("Software:");
String fusekiVersion = Fuseki.VERSION;
if (fusekiVersion.equals("${project.version}"))
fusekiVersion = "(development)";
out.printf(" %s %s\n", Fuseki.NAME, fusekiVersion);
out.printf(" %s %s\n", TDB.NAME, TDB.VERSION);
out.printf(" %s %s\n", ARQ.NAME, ARQ.VERSION);
out.printf(" %s %s\n", Jena.NAME, Jena.VERSION);
// out.printf("Port: %s\n",
// server.getServer().getConnectors()[0].getPort()) ;
out.println();
for (DatasetRef dsRef : server.getDatasets()) {
datasetRefDetails(out, dsRef);
out.println();
}
} catch (IOException ex) {
}
}
use of org.apache.jena.fuseki.server.SPARQLServer 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);
}
Aggregations