net.sf.urlchecker.v2.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.http.client.HttpClient>
          extended by net.sf.urlchecker.v2.commands.CheckUrlsCommand
All Implemented Interfaces:
Command

public class CheckUrlsCommand
extends CheckUrlsGeneric<org.apache.http.client.HttpClient>

The Class CheckUrlsCommand for the new httpClient. Use this implementation together with the CommunicationBuilder in the v2.communication package if you want to move on to the new appache.http.client. The new Constructor in this class allows for deeper configuration of the execution environment.

$Id: CheckUrlsCommand.java 183 2010-12-17 19:10:21Z georgosn $

Version:
$LastChangedRevision: 183 $
Author:
$LastChangedBy: georgosn $

Field Summary
protected  org.apache.http.protocol.HttpContext localContext
          The local context.
 
Fields inherited from class net.sf.urlchecker.commands.CheckUrlsGeneric
client, TERMINATION_TIME_IN_SECONDS, terminationTime
 
Constructor Summary
CheckUrlsCommand(Command successor, org.apache.http.client.HttpClient newClient)
          Instantiates a new check URLs command.
CheckUrlsCommand(Command successor, org.apache.http.client.HttpClient newClient, org.apache.http.protocol.HttpContext foreignContext)
          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
 

Field Detail

localContext

protected final org.apache.http.protocol.HttpContext localContext
The local context.

Constructor Detail

CheckUrlsCommand

public CheckUrlsCommand(Command successor,
                        org.apache.http.client.HttpClient newClient)
Instantiates a new check URLs command.

Parameters:
successor - the successor
newClient - the new client

CheckUrlsCommand

public CheckUrlsCommand(Command successor,
                        org.apache.http.client.HttpClient newClient,
                        org.apache.http.protocol.HttpContext foreignContext)
Instantiates a new check URLs command.

Parameters:
successor - the successor
newClient - the new client
foreignContext - the foreign context
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.

Specified by:
isMultithreaded in class CheckUrlsGeneric<org.apache.http.client.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.

Specified by:
multithreadedExecution in class CheckUrlsGeneric<org.apache.http.client.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.

Specified by:
singlethreadedExecution in class CheckUrlsGeneric<org.apache.http.client.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.