public class NanoSparqlServer extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
NanoSparqlServer.SystemProperties |
Constructor and Description |
---|
NanoSparqlServer() |
Modifier and Type | Method and Description |
---|---|
static void |
awaitServerStart(org.eclipse.jetty.server.Server server)
Await a
Server start up to a timeout. |
protected static String |
getHost()
Utility method to get the host for the currently running NSS.
|
static int |
getLocalPort(org.eclipse.jetty.server.Server server)
Best effort attempt to return the port at which the local jetty
Server is receiving http connections. |
static org.eclipse.jetty.webapp.WebAppContext |
getWebApp(org.eclipse.jetty.server.Server server)
Return the
WebAppContext for the Server . |
static void |
main(String[] args)
Run an httpd service exposing a SPARQL endpoint.
|
static org.eclipse.jetty.server.Server |
newInstance(int port,
IIndexManager indexManager,
Map<String,String> initParams)
Start the embedded
Server . |
static org.eclipse.jetty.server.Server |
newInstance(int port,
String jettyXml,
IIndexManager indexManager,
Map<String,String> initParams)
Start the embedded
Server . |
static org.eclipse.jetty.server.Server |
newInstance(String jettyXml,
IIndexManager indexManager,
Map<String,String> initParams)
Variant used when you already have the
IIndexManager . |
protected static void |
usage(int status,
String msg)
Print the optional message on stderr, print the usage information on
stderr, and then force the program to exit with the given status code.
|
public static void main(String[] args) throws Exception
namespace
command line argument.NAMESPACE
is the namespace of some triple store or
quad store, may be used to address ANY triple or quads store in the
bigdata instance.args
- USAGE:(options) port namespace (propertyFile|configFile) )
Where:
0
to use any open port.kb
if none was specified when
the triple/quad store was created).Journal
.Server
(default is the file in the JAR).
The default will locate the jetty.xml
resource
that is bundled with the JAR. This preserves the historical
behavior. If you want to use a different
jetty.xml
file, just override this property on
the command line -or- specify the
NanoSparqlServer.SystemProperties.JETTY_XML
system
property.-1
(MINUS ONE) to assert a read
lock against the last commit point. When given, queries will
default to read against this commit point. Otherwise queries
will default to read against the most recent commit point on
the database. Regardless, each query will be issued against a
read-only transaction.
BigdataRDFServletContextListener
. This allows you to
hook the ServletContextListener
events.Exception
public static void awaitServerStart(org.eclipse.jetty.server.Server server) throws InterruptedException, TimeoutException, Exception
Server
start up to a timeout.protected static String getHost() throws SocketException, IOException
NicUtil
returns a null pointer, it is set to the
value of Config.DEFAULT_HOST
.SocketException
IOException
public static org.eclipse.jetty.server.Server newInstance(int port, IIndexManager indexManager, Map<String,String> initParams) throws Exception
Server
.
Note: The port override argument given here is applied by setting the
NanoSparqlServer.SystemProperties.JETTY_PORT
System property. The
old value of that property is restored afterwards, but there is a
side-effect which could be visible to concurrent threads.
port
- The port on which the service will run -OR- ZERO (0) for any
open port.indexManager
- The IIndexManager
(optional).initParams
- Initialization parameters for the web application as specified
by ConfigParams
(optional).Exception
NanoSparqlServer.SystemProperties
public static org.eclipse.jetty.server.Server newInstance(int port, String jettyXml, IIndexManager indexManager, Map<String,String> initParams) throws Exception
Server
.
Note: The port override argument given here is applied by setting the
NanoSparqlServer.SystemProperties.JETTY_PORT
System property. The
old value of that property is restored afterwards, but there is a
side-effect which could be visible to concurrent threads.
port
- The port on which the service will run -OR- ZERO (0) for any
open port.jettyXml
- The location of the jetty.xml
resource.indexManager
- The IIndexManager
(optional).initParams
- Initialization parameters for the web application as specified
by ConfigParams
(optional).Exception
NanoSparqlServer.SystemProperties
public static org.eclipse.jetty.server.Server newInstance(String jettyXml, IIndexManager indexManager, Map<String,String> initParams) throws Exception
IIndexManager
.
When the optional IIndexManager
argument is specified, it will be
set as an attribute on the WebAppContext
. This will cause the
webapp to use the pre-existing IIndexManager
rather than
attempting to open a new IIndexManager
based on the
propertyFile
init parameter specified in
web.xml
. The HA initialization pattern relies on this.
When the IIndexManager
is NOT specified, the life cycle of the
IIndexManager
will be managed by the server and the
IndexManager
instance will be opened (and eventually closed) by
the BigdataRDFServletContextListener
based on the configured
value of the propertyFile
init parameter in
web.xml
. This form is used by main(String[])
and
can be used with either the Journal
or the scale-out
architecture.
jettyXml
- The jetty.xml
file that will be used to configure
jetty.indexManager
- The IIndexManager
(optional).initParams
- Optional map containing overrides for the init parameters
declared in web.xml
.Exception
public static org.eclipse.jetty.webapp.WebAppContext getWebApp(org.eclipse.jetty.server.Server server)
WebAppContext
for the Server
.server
- The Server
.WebAppContext
associated with the bigdata webapp.public static int getLocalPort(org.eclipse.jetty.server.Server server)
Server
is receiving http connections.server
- The server.IllegalArgumentException
- if the argument is null
.protected static void usage(int status, String msg)
status
- The status code.msg
- The optional messageCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.