Class ToolkitLibrary

The runtime library toolkit provides a knowledge base and an interpreter that is not instrumented for debugging. This class implements the singleton pattern. There is only one instance per Java class loader.

The class can be used to execute the runtime library either with or without a graphical interface. For this purpose the main() method of the class can be statically called. The method will setup a knowledge base and an interpreter, and then enter a query answer loop. When started without a graphical interface, the method will also install a ^C interrupt handler for the duration of the interactive session.

The Android version of the class ToolkitLibrary does not provide a main() method and does not declare the constants for the command line options. Otherwise the class ToolkitLibrary is identical to the Swing version.

For debugging purposes the applet runtime and graphical user interface can be simulated as well from the main() method. To embed the Prolog interpreter as an applet in a HTML page the Java class AsterixApplet can be used.

The main() method for the Swing version recognizes the following options:

-h:
Don't create graphical user interface.
-w:
Simulate applet runtime and graphical user interface.
-v <level>:
Specify the console verbosity. The default value is “summary”.
-a <path>,...:
Add the paths <path>,....
-e <capability>,...:
Add the capabilities <capability>,....
-b <goal>:
Use <goal> as the console banner. The default value is “welcome”.
-t <goal>:
Use <goal> as the console top level. The default value is “prolog”.
package jekpro.platform.headless;

import jekpro.tools.api.Toolkit;

public final class ToolkitLibrary extends Toolkit {
public static final ToolkitLibrary DEFAULT;

public static final String OPTION_HEADLESS = "-h";
public static final String OPTION_WEBLET = "-w";
public static final String OPTION_VERBOSE = "-v";
  public static final String OPTION_PATHS = "-a";
 public static final String OPTION_CAPABILITIES = "-e";
public static final String OPTION_BANNER = "-b";
public static final String OPTION_TOPLEVEL = "-t";

public static final String PROP_SYS_MASK = "sys_mask";
public static final String PROP_BASE_URL = "base_url";
public static final String PROP_SYS_LOCALE = "sys_locale";
public static final String PROP_SYS_BELONGS_TO = "belongs_to";
public static final String PROP_VERBOSE = "verbose";

public static void main(String[] args);
}

Comments