org.talika.tarsis.command.factory
Class CommandFactoryService

java.lang.Object
  extended by org.talika.tarsis.service.AbstractService
      extended by org.talika.tarsis.command.factory.CommandFactoryService
All Implemented Interfaces:
CommandFactory, Service
Direct Known Subclasses:
XmlCommandFactory, XmlCommandsFactory

public abstract class CommandFactoryService
extends AbstractService
implements CommandFactory

Base implementation of CommandFactory interface.

Command factories plug in system like a service extending AbstractService.

Version:
$Revision: 269 $
Author:
Jose M. Palomar

Constructor Summary
CommandFactoryService()
          Creates a new CommandFactoryService object.
 
Method Summary
protected  void addCommand(java.lang.String name, Command cmd)
          Adds a command definition to factory.
protected  void addCommands(java.util.Map cmds)
          Adds a map of command definitions to factory.
 Command findCommand(java.lang.String name)
          Returns matching name command instance.
protected abstract  void loadCommand(java.lang.String commandName)
          Tries to load command definition from repository for a given name.
protected abstract  void loadPackage(java.lang.String packageName)
          Tries to load all command definitions from repository for a given package.
 
Methods inherited from class org.talika.tarsis.service.AbstractService
destroy, getContext, getLogger, getName, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandFactoryService

public CommandFactoryService()
Creates a new CommandFactoryService object.

Method Detail

findCommand

public final Command findCommand(java.lang.String name)
Returns matching name command instance.

Specified by:
findCommand in interface CommandFactory
Parameters:
name - String name of command.
Returns:
Command command instance for given name or null if none found.
See Also:
CommandFactory.findCommand(String)

loadCommand

protected abstract void loadCommand(java.lang.String commandName)
Tries to load command definition from repository for a given name.

Parameters:
commandName - String name of command to load.

loadPackage

protected abstract void loadPackage(java.lang.String packageName)
Tries to load all command definitions from repository for a given package.

Parameters:
packageName - String name for package to load.

addCommand

protected final void addCommand(java.lang.String name,
                                Command cmd)
Adds a command definition to factory.

Parameters:
name - String name of command.
cmd - Command instance of command.

addCommands

protected final void addCommands(java.util.Map cmds)
Adds a map of command definitions to factory. Map keys are command's names and values are command's instances.

Parameters:
cmds - Map map of command instances.


Copyright © 2002-2012 Talika Open Source Group. All Rights Reserved.