Package org.basex

Class BaseXServer

  • All Implemented Interfaces:
    Runnable

    public final class BaseXServer
    extends CLI
    implements Runnable
    This is the starter class for running the database server. It handles concurrent requests from multiple users.
    Author:
    BaseX Team 2005-24, BSD License, Christian Gruen, Andreas Weiler
    • Constructor Detail

      • BaseXServer

        public BaseXServer​(String... args)
                    throws IOException
        Constructor.
        Parameters:
        args - command-line arguments
        Throws:
        IOException - I/O exception
      • BaseXServer

        public BaseXServer​(Context ctx,
                           String... args)
                    throws IOException
        Constructor.
        Parameters:
        ctx - database context
        args - command-line arguments
        Throws:
        IOException - I/O exception
    • Method Detail

      • main

        public static void main​(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 Runnable
      • parseArgs

        protected void parseArgs()
                          throws IOException
        Description copied from class: Main
        Parses the command-line arguments, specified by the user.
        Specified by:
        parseArgs in class Main
        Throws:
        IOException - I/O exception
      • header

        public String header()
        Description copied from class: Main
        Returns a header string for command-line information.
        Specified by:
        header in class Main
        Returns:
        header string
      • usage

        public String usage()
        Description copied from class: Main
        Returns a usage string for command-line information.
        Specified by:
        usage in class Main
        Returns:
        usage string
      • start

        public static void start​(int port,
                                 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​(String host,
                                   int port)
        Checks if a server is running.
        Parameters:
        host - host
        port - server port
        Returns:
        boolean success
      • stop

        public static void stop​(String host,
                                int port)
                         throws IOException
        Stops the server.
        Parameters:
        host - server host
        port - server port
        Throws:
        IOException - I/O exception
      • remove

        public void remove​(ClientListener client)
        Removes a client listener that is waiting for authentication.
        Parameters:
        client - client to be removed