org.basex
Class BaseXServer

java.lang.Object
  extended by org.basex.core.Main
      extended by org.basex.BaseXServer
All Implemented Interfaces:
java.lang.Runnable

public final class BaseXServer
extends Main
implements java.lang.Runnable

This is the starter class for running the database server. It handles concurrent requests from multiple users.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen, Andreas Weiler

Field Summary
 
Fields inherited from class org.basex.core.Main
console, context, newline, out, session, verbose
 
Constructor Summary
BaseXServer(Context ctx, java.lang.String... args)
          Constructor.
BaseXServer(java.lang.String... args)
          Constructor.
 
Method Summary
 void initEvents()
          Initializes the event listener.
static void main(java.lang.String[] args)
          Main method, launching the server process.
protected  void parseArguments(java.lang.String... args)
          Parses the command-line arguments, specified by the user.
static boolean ping(java.lang.String host, int port)
          Checks if a server is running.
protected  void quit()
          Quits the console mode.
 void remove(ClientListener client)
          Removes an authenticated session.
 void run()
           
protected  Session session()
          Returns the session.
static void start(int port, java.lang.String... args)
          Starts the database server in a separate process.
 void stop()
          Stops the server of this instance.
static void stop(int port, int eport)
          Stops the server.
 
Methods inherited from class org.basex.core.Main
console, execute, execute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseXServer

public BaseXServer(java.lang.String... args)
            throws java.io.IOException
Constructor.

Parameters:
args - command-line arguments
Throws:
java.io.IOException - I/O exception

BaseXServer

public BaseXServer(Context ctx,
                   java.lang.String... args)
            throws java.io.IOException
Constructor.

Parameters:
ctx - database context
args - command-line arguments
Throws:
java.io.IOException - I/O exception
Method Detail

main

public static void main(java.lang.String[] args)
Main method, launching the server process. Command-line arguments are listed with the -h argument.

Parameters:
args - command-line arguments

run

public void run()
Specified by:
run in interface java.lang.Runnable

quit

protected void quit()
             throws java.io.IOException
Description copied from class: Main
Quits the console mode.

Overrides:
quit in class Main
Throws:
java.io.IOException - I/O exception

session

protected Session session()
Description copied from class: Main
Returns the session.

Specified by:
session in class Main
Returns:
session

parseArguments

protected void parseArguments(java.lang.String... args)
                       throws java.io.IOException
Description copied from class: Main
Parses the command-line arguments, specified by the user.

Specified by:
parseArguments in class Main
Parameters:
args - command-line arguments
Throws:
java.io.IOException - I/O exception

stop

public void stop()
          throws java.io.IOException
Stops the server of this instance.

Throws:
java.io.IOException - I/O exception

start

public static void start(int port,
                         java.lang.String... args)
                  throws BaseXException
Starts the database server in a separate process.

Parameters:
port - server port
args - command-line arguments
Throws:
BaseXException - database exception

ping

public static boolean ping(java.lang.String host,
                           int port)
Checks if a server is running.

Parameters:
host - host
port - server port
Returns:
boolean success

stop

public static void stop(int port,
                        int eport)
                 throws java.io.IOException
Stops the server.

Parameters:
port - server port
eport - event port
Throws:
java.io.IOException - I/O exception

remove

public void remove(ClientListener client)
Removes an authenticated session.

Parameters:
client - client to be removed

initEvents

public void initEvents()
Initializes the event listener.