nl.toolforge.karma.core.cmd
Class CommandFactory

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

public final class CommandFactory
extends java.lang.Object

This factory is the single resource of Command objects. KarmaRuntimeExceptions are thrown when something fails.

Version:
$Id: CommandFactory.java,v 1.34 2004/11/10 23:53:07 asmedes Exp $
Author:
W.H. Schraal

Method Summary
 Command getCommand(java.lang.String commandLineString)
          Retrieves the correct Command-instance, by looking up the implementation class through commandLine.
 Command getCommand(java.lang.String commandName, java.lang.String[] arguments)
           
 CommandDescriptor getCommandDescriptor(java.lang.String commandId)
          Retrieves the correct command descriptor either by name or by alias (whichever is passed as a parameter).
 java.util.Collection getCommands()
           
static CommandFactory getInstance()
          Gets the singleton CommandFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CommandFactory getInstance()
                                  throws CommandLoadException
Gets the singleton CommandFactory.

Returns:
The singleton CommandFactory instance.
Throws:
CommandLoadException

getCommand

public Command getCommand(java.lang.String commandLineString)
                   throws CommandException
Retrieves the correct Command-instance, by looking up the implementation class through commandLine.

Parameters:
commandLineString - Command arguments (e.g. select-manifest -m karma-1.0).
Returns:
The implementation of a Command object.
Throws:
CommandException - When a correct command could not be constructed. See CommandException.INVALID_COMMAND.

getCommand

public Command getCommand(java.lang.String commandName,
                          java.lang.String[] arguments)
                   throws CommandException
Throws:
CommandException

getCommands

public java.util.Collection getCommands()

getCommandDescriptor

public CommandDescriptor getCommandDescriptor(java.lang.String commandId)
Retrieves the correct command descriptor either by name or by alias (whichever is passed as a parameter). Returns null if the descriptor could not be found.



Copyright © 2002-2004 Toolforge. All Rights Reserved.