info.magnolia.commands
Class MgnlCommand
java.lang.Object
info.magnolia.commands.MgnlCommand
- All Implemented Interfaces:
- Command, Cloneable
- Direct Known Subclasses:
- BaseRepositoryCommand, LogCommand, MessageCommand
public abstract class MgnlCommand
- extends Object
- implements Command
To make the coding of commands as easy as possible the default values set in
the config are set and the values of the context are set as properties too if
the naming matches.
Field Summary |
static org.slf4j.Logger |
log
|
Method Summary |
Command |
clone()
This method allows to create new clone of a command, so the instances in
the CommandManager's catalogs are masters, and the execution always uses
clone created by this method. |
boolean |
execute(Context ctx)
Make sure that the context is castable to a magnolia context. |
abstract boolean |
execute(Context context)
This is the actual method to be overridden in descendant classes. |
boolean |
isEnabled()
|
void |
release()
If a clone is passivated we call this method. |
void |
setEnabled(boolean isEnabled)
|
log
public static org.slf4j.Logger log
MgnlCommand
public MgnlCommand()
execute
public boolean execute(Context ctx)
throws Exception
- Make sure that the context is castable to a magnolia context. DO NOT
override this method (with the info.magnolia.commands.chain.Context
parameter type) in the descendant classes - unless you know for 100% what
you are going to do.
- Specified by:
execute
in interface Command
- Returns:
- true on success, false otherwise
- Throws:
Exception
execute
public abstract boolean execute(Context context)
throws Exception
- This is the actual method to be overridden in descendant classes.
- Throws:
Exception
release
public void release()
- If a clone is passivated we call this method. Please clean up private
properties.
isEnabled
public boolean isEnabled()
setEnabled
public void setEnabled(boolean isEnabled)
clone
public Command clone()
throws CloneNotSupportedException
- Description copied from interface:
Command
- This method allows to create new clone of a command, so the instances in
the CommandManager's catalogs are masters, and the execution always uses
clone created by this method.
NOTE: CommandsManager clone the command instances by standard
Java cloning mechanism. If deep copy is needed then you have to override
clone method of command.
- Specified by:
clone
in interface Command
- Overrides:
clone
in class Object
- Throws:
CloneNotSupportedException
Copyright © 2003-2014 Magnolia International Ltd.. All Rights Reserved.