|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.urlchecker.commands.AbstractCommand
public abstract class AbstractCommand
The default implementation of the chain of responsibility for the commands. All implementations of the URLChecker commands should better extend from this class to avoid repeating the tedious methods to maintain the chain. When extending this class the overriding method process must call super.process(Context) to assure the continuation of the chain of responsibility. End events are fired here just as soon as the process method is called. immutable
$Id: AbstractCommand.java 181 2010-12-12 23:39:00Z georgosn $
Constructor Summary | |
---|---|
AbstractCommand()
Empty constructor to use when no successor is needed. |
|
AbstractCommand(Command successor)
Instantiates a new abstract command setting the successor command. |
Method Summary | |
---|---|
protected void |
fireEvent(ChainEvent event)
Fires an event by passing the event object to all registered listeners. |
Command |
getSuccessor()
Returns the successor command.CAUTION: this method will return null if no successor is set during instantiation of the class. |
Set<Result> |
process(Context input)
This method processes the input Context and forwards the results on to
the successor. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractCommand()
public AbstractCommand(Command successor)
successor
- the successorMethod Detail |
---|
protected void fireEvent(ChainEvent event)
event
- the event object to be passed to all listeners.public Command getSuccessor()
getSuccessor
in interface Command
public Set<Result> process(Context input) throws org.apache.commons.configuration.ConfigurationException
Context
and forwards the results on to
the successor.
This implementation of the method simply checks if there are any
successors and passes the context. if no successor is registered for the
command then it merely returns the results from the context. The method
also fires a BasicChainEvent before sending the control to the successor
command with an END Type. This behavior allows the subclasses to
concentrate in processing the input while the rest of the package
releases all the features of event firing and handling. Events can be
fired from within subclasses but it is better not to fire END events as
this is handled here. START events though, must be fired in the
subclasses if they are needed.
process
in interface Command
input
- the input
org.apache.commons.configuration.ConfigurationException
- the configuration exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |