info.magnolia.commands
Class CommandsManager

java.lang.Object
  extended by info.magnolia.cms.beans.config.ObservedManager
      extended by info.magnolia.commands.CommandsManager

@Singleton
public class CommandsManager
extends ObservedManager

Manages the Commands and Catalogs.


Field Summary
static String COMMAND_DELIM
           
static String DEFAULT_CATALOG
           
 
Fields inherited from class info.magnolia.cms.beans.config.ObservedManager
log, registeredUUIDs
 
Constructor Summary
CommandsManager(Node2BeanProcessor nodeToBean)
           
 
Method Summary
 boolean executeCommand(Command command, Map<String,Object> params)
          Executes the given command.
 boolean executeCommand(String commandName, Map<String,Object> params)
          Executes the given command by first looking in the default catalog.
 boolean executeCommand(String catalogName, String commandName, Map<String,Object> params)
          Executes the given command at the given catalog with the given parameters.
 Command getCommand(String commandName)
          Use a delimiter to separate the catalog and command name.
 Command getCommand(String catalogName, String commandName)
          Get the command.
static CommandsManager getInstance()
          Deprecated. since 4.5, use IoC !
protected  void onClear()
          Clear all catalogs.
protected  void onRegister(Content node)
          Register observation for command catalogs.
protected  void registerCatalog(Content node)
           
 
Methods inherited from class info.magnolia.cms.beans.config.ObservedManager
clear, register, reload, reload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CATALOG

public static final String DEFAULT_CATALOG
See Also:
Constant Field Values

COMMAND_DELIM

public static final String COMMAND_DELIM
See Also:
Constant Field Values
Constructor Detail

CommandsManager

@Inject
public CommandsManager(Node2BeanProcessor nodeToBean)
Method Detail

onRegister

protected void onRegister(Content node)
Register observation for command catalogs.

Specified by:
onRegister in class ObservedManager

registerCatalog

protected void registerCatalog(Content node)

onClear

protected void onClear()
Clear all catalogs.

Specified by:
onClear in class ObservedManager

getCommand

public Command getCommand(String catalogName,
                          String commandName)
Get the command.

Parameters:
catalogName - the catalog containing the command
commandName - the name of the command
Returns:
the command to execute

getCommand

public Command getCommand(String commandName)
Use a delimiter to separate the catalog and command name.


getInstance

@Deprecated
public static CommandsManager getInstance()
Deprecated. since 4.5, use IoC !

Returns:
Returns the instance.

executeCommand

public boolean executeCommand(String catalogName,
                              String commandName,
                              Map<String,Object> params)
                       throws Exception
Executes the given command at the given catalog with the given parameters.

Throws:
Exception - if an error occurs during command execution or if the command could not be found in any catalog.

executeCommand

public boolean executeCommand(String commandName,
                              Map<String,Object> params)
                       throws Exception
Executes the given command by first looking in the default catalog. Should the command not be found, it will try to look in all other catalogs.

Throws:
Exception
See Also:
executeCommand(String, String, Map)

executeCommand

public boolean executeCommand(Command command,
                              Map<String,Object> params)
                       throws Exception
Executes the given command.

Throws:
Exception
See Also:
executeCommand(String, Map)


Copyright © 2003-2013 Magnolia International Ltd.. All Rights Reserved.