org.keridwen.core.messaging
Interface Command<ResultType,MessageType>

Type Parameters:
ResultType - type of the value returned by the Command.
MessageType - type of the message the Command can handle.
All Superinterfaces:
Controllable, Progressable
All Known Implementing Classes:
AbstractCommand, AbstractCommandScheme

public interface Command<ResultType,MessageType>
extends Controllable, Progressable

A Command represents and encapsultes the business logic to be executed upon reception of a specific Event.


Method Summary
 boolean checkPreConditions()
          Check that the Command preconditions are fulfilled.
 ResultType execute(MessageType message)
          Executes the Command's logic with a given message.
 DataModel getApplicationModel()
          Gets the data model of the application.
 DataModel getBundleModel()
          Gets the data model of the bundle.
 String getDescription()
          Returns the localized Command description.
 String getLabel()
          Returns the localized Command name.
 CommandLogLevel getLogLevel()
          Gets the verbosity level at which this command should be logged.
 boolean isUndoable()
          Checks whether the Command can be undone by the user.
 void setModels(DataModel applicationModel, DataModel bundleModel)
          Initializes the models of that the command can access.
 void undo()
          Undo the Command actions.
 boolean validatePostConditions()
          Sets all postconditions to true if they have been validated by the Command.
 
Methods inherited from interface org.keridwen.core.data.model.progress.Controllable
addControllableListener, clearControllableListener, getState, interrupt, isInterrupted, isInterruptible, isPausable, pause, removeControllableListener, resume
 
Methods inherited from interface org.keridwen.core.data.model.progress.Progressable
addProgressableListener, clearProgressableListener, getProgress, getState, isDetermined, removeProgressableListener
 

Method Detail

execute

ResultType execute(MessageType message)
                   throws CommandException
Executes the Command's logic with a given message.

Parameters:
message - the message to use for the execution.
Returns:
the result of the command execution
Throws:
CommandException - exceptions raised during the execution of the command.

undo

void undo()
Undo the Command actions.


isUndoable

boolean isUndoable()
Checks whether the Command can be undone by the user.

Returns:
true if the Command can be undone, false otherwise

getLogLevel

CommandLogLevel getLogLevel()
Gets the verbosity level at which this command should be logged.

Returns:
the log level

getLabel

String getLabel()
Returns the localized Command name.

Returns:
the command name

getDescription

String getDescription()
Returns the localized Command description.

Returns:
the command description

checkPreConditions

boolean checkPreConditions()
Check that the Command preconditions are fulfilled.

Returns:
true is the preconditions of the command are all fulfilled.

validatePostConditions

boolean validatePostConditions()
Sets all postconditions to true if they have been validated by the Command.

Returns:
true if all postconditions have been validated, false if at least one condition has not been validated.

setModels

void setModels(DataModel applicationModel,
               DataModel bundleModel)
Initializes the models of that the command can access.

Parameters:
applicationModel - the model of the application
bundleModel - the model of the command bundle

getApplicationModel

DataModel getApplicationModel()
Gets the data model of the application.

Returns:
the data model of the application

getBundleModel

DataModel getBundleModel()
Gets the data model of the bundle.

Returns:
the data model of the bundle


Copyright © 2010-2013 Artenum. All Rights Reserved.