nl.toolforge.karma.core.cmd
Class CommandLoader

java.lang.Object
  extended bynl.toolforge.karma.core.cmd.CommandLoader

public final class CommandLoader
extends java.lang.Object

Loads command-descriptors from an XML-file. The default filename is commands.xml, which should be available in the classpath. It should have been shipped with the Karma Core release jar-file.

Version:
$Id: CommandLoader.java,v 1.33 2004/11/10 23:53:08 asmedes Exp $
Author:
W.M. Oosterom, D.A. Smedes

Field Summary
static java.lang.String COMMAND_PLUGINS_DIR
          Directory where plugins are located.
static java.lang.String CORE_COMMANDS_FILE
          File name for core commands.
static java.lang.String DEFAULT_COMMANDS_BASEDIR
          Default filename for the command descriptor file
static java.lang.String PLUGIN_COMMANDS_FILE
          File name for plugin commands definitions.
 
Method Summary
static CommandLoader getInstance()
          Gets the singleton instance of the CommandLoader.
(package private)  CommandDescriptorMap load()
          Loads command xml files from a predefined base directory.
(package private)  CommandDescriptorMap load(java.net.URL resource)
          Loads the xml file containing command descriptors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_COMMANDS_BASEDIR

public static final java.lang.String DEFAULT_COMMANDS_BASEDIR
Default filename for the command descriptor file

See Also:
Constant Field Values

CORE_COMMANDS_FILE

public static final java.lang.String CORE_COMMANDS_FILE
File name for core commands.

See Also:
Constant Field Values

COMMAND_PLUGINS_DIR

public static final java.lang.String COMMAND_PLUGINS_DIR
Directory where plugins are located.

See Also:
Constant Field Values

PLUGIN_COMMANDS_FILE

public static final java.lang.String PLUGIN_COMMANDS_FILE
File name for plugin commands definitions.

See Also:
Constant Field Values
Method Detail

getInstance

public static CommandLoader getInstance()
Gets the singleton instance of the CommandLoader.

Returns:
The singleton instance of the CommandLoader.

load

CommandDescriptorMap load()
                    throws CommandLoadException
Loads command xml files from a predefined base directory. The base directory is determined by DEFAULT_COMMANDS_BASEDIR, relative to the runtime classpath. Core commands are considered to be in core-commands.xml. The rest of the commands are located in plugin directories on the classpath.

Returns:
The full set of commands for Karma.
Throws:
CommandLoadException

load

CommandDescriptorMap load(java.net.URL resource)
                    throws CommandLoadException

Loads the xml file containing command descriptors.

Parameters:
resource - The resource url to a command xml file. Use load() to use the default settings.
Returns:
A List of CommandDescriptor instances.
Throws:
CommandLoadException


Copyright © 2002-2004 Toolforge. All Rights Reserved.