net.sf.urlchecker.commands
Class CheckUrlsCommand

Package class diagram package CheckUrlsCommand
java.lang.Object
  extended by net.sf.urlchecker.commands.AbstractCommand
      extended by net.sf.urlchecker.commands.CheckUrlsGeneric<org.apache.commons.httpclient.HttpClient>
          extended by net.sf.urlchecker.commands.CheckUrlsCommand
All Implemented Interfaces:
Command

public class CheckUrlsCommand
extends CheckUrlsGeneric<org.apache.commons.httpclient.HttpClient>

The main Command of the URLChecker using the old httpClient from jakarta commons. If the context was initialized for multi-threaded use, this class will spawn one thread for each result. Each thread will use the CheckUrlsProcess which in turn will try to verify the availability of one URL.

$Id: CheckUrlsCommand.java 181 2010-12-12 23:39:00Z georgosn $

Version:
$LastChangedRevision: 181 $
Author:
$LastChangedBy: georgosn $

Field Summary
 
Fields inherited from class net.sf.urlchecker.commands.CheckUrlsGeneric
client, LOGGER, TERMINATION_TIME_IN_SECONDS, terminationTime
 
Constructor Summary
CheckUrlsCommand(Command successor, org.apache.commons.httpclient.HttpClient newClient)
          Instantiates a new check URLs command.
 
Method Summary
 boolean isMultithreaded()
          Checks if the client is set up for multithreaded operation.
protected  void multithreadedExecution(Context context, Iterator<Result> iter)
          Spawns threads to check individual URLs.
protected  void singlethreadedExecution(Iterator<Result> iter)
          Executes checking using one thread for all URLs to check.
 
Methods inherited from class net.sf.urlchecker.commands.CheckUrlsGeneric
process
 
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
 

Constructor Detail

CheckUrlsCommand

public CheckUrlsCommand(Command successor,
                        org.apache.commons.httpclient.HttpClient newClient)
Instantiates a new check URLs command. The successor parameter can be null if no successor is needed.

Parameters:
successor - the successor command
newClient - the client to be used
Method Detail

isMultithreaded

public boolean isMultithreaded()
Checks if the client is set up for multithreaded operation. It is left to the subclasses to define this method as different clients will provide different ways to determine the state of the ConnectionManager. Checks if is multithreaded.

Specified by:
isMultithreaded in class CheckUrlsGeneric<org.apache.commons.httpclient.HttpClient>
Returns:
if is multithreaded.

multithreadedExecution

protected void multithreadedExecution(Context context,
                                      Iterator<Result> iter)
                               throws org.apache.commons.configuration.ConfigurationException
Spawns threads to check individual URLs. Spawns threads to check individual URLs.

Specified by:
multithreadedExecution in class CheckUrlsGeneric<org.apache.commons.httpclient.HttpClient>
Parameters:
context - , the enginge's context
iter - , the valid context results iterator to check over the Internet.
Throws:
org.apache.commons.configuration.ConfigurationException - the configuration exception

singlethreadedExecution

protected void singlethreadedExecution(Iterator<Result> iter)
                                throws org.apache.commons.configuration.ConfigurationException
Executes checking using one thread for all URLs to check. Executes checking using one thread for all URLs to check.

Specified by:
singlethreadedExecution in class CheckUrlsGeneric<org.apache.commons.httpclient.HttpClient>
Parameters:
iter - , the valid context results iterator to check over the Internet.
Throws:
org.apache.commons.configuration.ConfigurationException - the configuration exception.


Copyright © 2010 Nikolaos Georgosopoulos. All Rights Reserved.