|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.urlchecker.commands.AbstractCommand net.sf.urlchecker.commands.CheckUrlsGeneric<T>
T
- the generic type
$Id: CheckUrlsGeneric.java 180 2010-12-12 18:47:56Z georgosn $
public abstract class CheckUrlsGeneric<T>
The Abstract Generic CheckUrls Command. It simply serves the purposes of this release and future releases of the library may not contain it. This class was needed to relieve the individual commands from carrying code that is common regardless of the client being used. Individual subclasses implement the methods that use the client and thus should do different things to ensure operation. immutable
Field Summary | |
---|---|
protected T |
client
The client. |
protected static org.apache.log4j.Logger |
LOGGER
The Constant LOGGER. |
protected static long |
TERMINATION_TIME_IN_SECONDS
The Constant TERMINATION_TIME_IN_SECONDS. |
protected Long |
terminationTime
The termination time. |
Constructor Summary | |
---|---|
CheckUrlsGeneric(Command successor,
T newClient)
Instantiates a new checkURLs generic command. |
Method Summary | |
---|---|
abstract boolean |
isMultithreaded()
Checks if the client is set up for multithreaded operation. |
protected abstract void |
multithreadedExecution(Context context,
Iterator<Result> iter)
Spawns threads to check individual URLs. |
Set<Result> |
process(Context context)
This method processes the input Context and forwards the results on to
the successor. |
protected abstract void |
singlethreadedExecution(Iterator<Result> iter)
Executes checking using one thread for all URLs to check. |
Methods inherited from class net.sf.urlchecker.commands.AbstractCommand |
---|
fireEvent, getSuccessor |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final long TERMINATION_TIME_IN_SECONDS
protected final Long terminationTime
protected static final org.apache.log4j.Logger LOGGER
protected final T client
Constructor Detail |
---|
public CheckUrlsGeneric(Command successor, T newClient)
T
- a T object.successor
- the successor commandnewClient
- the new clientMethod Detail |
---|
public abstract boolean isMultithreaded()
protected abstract void multithreadedExecution(Context context, Iterator<Result> iter) throws org.apache.commons.configuration.ConfigurationException
context
- , the enginge's contextiter
- , the valid context results iterator to check over the
Internet.
org.apache.commons.configuration.ConfigurationException
- the configuration exceptionpublic Set<Result> process(Context context) 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
process
in class AbstractCommand
context
- the input
org.apache.commons.configuration.ConfigurationException
- the configuration exceptionprotected abstract void singlethreadedExecution(Iterator<Result> iter) throws org.apache.commons.configuration.ConfigurationException
iter
- , the valid context results iterator to check over the
Internet.
org.apache.commons.configuration.ConfigurationException
- the configuration exception.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |