info.magnolia.commands
Class MgnlCommand

java.lang.Object
  extended by info.magnolia.commands.MgnlCommand
All Implemented Interfaces:
Command
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
           
 
Fields inherited from interface info.magnolia.commands.chain.Command
CONTINUE_PROCESSING, PROCESSING_COMPLETE
 
Constructor Summary
MgnlCommand()
           
 
Method Summary
 MgnlCommand copy(Command command)
          This method allows to create new copy of a command, so the instances in the CommandManager's catalogs are masters, and the execution always uses new instance created by this method.
NOTE: If your command uses default parameters (set from a JCR property), you MUST override this method to copy the values from the master command to the actually used copy.
 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static org.slf4j.Logger log
Constructor Detail

MgnlCommand

public MgnlCommand()
Method Detail

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)

copy

public MgnlCommand copy(Command command)
Description copied from interface: Command
This method allows to create new copy of a command, so the instances in the CommandManager's catalogs are masters, and the execution always uses new instance created by this method.
NOTE: If your command uses default parameters (set from a JCR property), you MUST override this method to copy the values from the master command to the actually used copy.

Specified by:
copy in interface Command


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