org.basex.core
Class Main

java.lang.Object
  extended by org.basex.core.Main
Direct Known Subclasses:
BaseX, BaseXServer

public abstract class Main
extends Object

This is the abstract main class for all starter classes. Moreover, it offers some utility methods which are used throughout the project.

Author:
Workgroup DBIS, University of Konstanz 2005-10, ISC License, Christian Gruen

Field Summary
 Context context
          Database Context.
 
Method Summary
static String bug(Object... ext)
          Prints some information for an unexpected exception.
static void debug(Object str, Object... ext)
          Global method for printing debug information if the Prop.debug flag is set.
static boolean debug(Throwable ex)
          Global method for printing the exception stack trace if the Prop.debug flag is set.
static void err(String string, Object... ext)
          Global method for printing information to the standard output.
static void errln(Object obj, Object... ext)
          Global method for printing information to the standard output.
static void gc(Performance perf)
          Global method for garbage collecting and printing performance information if the Prop.debug flag is set.
static byte[] inf(Object str, Object... ext)
          Global method, replacing all % characters (see TokenBuilder.add(Object, Object...) for details.
static String info(Object str, Object... ext)
          Global method, replacing all % characters (see TokenBuilder.add(Object, Object...) for details.
static String name(Class<?> o)
          Returns the class name of the specified object.
static String name(Object o)
          Returns the class name of the specified object.
static Object notexpected(Object... ext)
          Throws a runtime exception for an unexpected exception.
static Object notimplemented(Object... ext)
          Throws a runtime exception for an unimplemented method.
static void out(Object str, Object... ext)
          Global method for printing information to the standard output.
static void outln()
          Global method for printing a newline.
static void outln(Object str, Object... ext)
          Global method for printing information to the standard output.
static String server(Exception ex)
          Returns a server error message.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

public final Context context
Database Context.

Method Detail

bug

public static String bug(Object... ext)
Prints some information for an unexpected exception.

Parameters:
ext - optional extension
Returns:
dummy object

notexpected

public static Object notexpected(Object... ext)
Throws a runtime exception for an unexpected exception.

Parameters:
ext - optional extension
Returns:
dummy object

notimplemented

public static Object notimplemented(Object... ext)
Throws a runtime exception for an unimplemented method.

Parameters:
ext - optional extension
Returns:
dummy object

name

public static String name(Class<?> o)
Returns the class name of the specified object.

Parameters:
o - object
Returns:
class name

name

public static String name(Object o)
Returns the class name of the specified object.

Parameters:
o - object
Returns:
class name

outln

public static void outln()
Global method for printing a newline.


outln

public static void outln(Object str,
                         Object... ext)
Global method for printing information to the standard output.

Parameters:
str - output string
ext - text optional extensions

out

public static void out(Object str,
                       Object... ext)
Global method for printing information to the standard output.

Parameters:
str - output string
ext - text optional extensions

errln

public static void errln(Object obj,
                         Object... ext)
Global method for printing information to the standard output.

Parameters:
obj - error string
ext - text optional extensions

err

public static void err(String string,
                       Object... ext)
Global method for printing information to the standard output.

Parameters:
string - debug string
ext - text optional extensions

server

public static String server(Exception ex)
Returns a server error message.

Parameters:
ex - exception reference
Returns:
error message

debug

public static boolean debug(Throwable ex)
Global method for printing the exception stack trace if the Prop.debug flag is set.

Parameters:
ex - exception
Returns:
always false

debug

public static void debug(Object str,
                         Object... ext)
Global method for printing debug information if the Prop.debug flag is set.

Parameters:
str - debug string
ext - text optional extensions

gc

public static void gc(Performance perf)
Global method for garbage collecting and printing performance information if the Prop.debug flag is set.

Parameters:
perf - performance reference

info

public static String info(Object str,
                          Object... ext)
Global method, replacing all % characters (see TokenBuilder.add(Object, Object...) for details.

Parameters:
str - string to be extended
ext - text text extensions
Returns:
extended string

inf

public static byte[] inf(Object str,
                         Object... ext)
Global method, replacing all % characters (see TokenBuilder.add(Object, Object...) for details.

Parameters:
str - string to be extended
ext - text text extensions
Returns:
token