net.sf.urlchecker.communication
Class GenericCommunicationFactory<T,M,S,E>

Package class diagram package GenericCommunicationFactory
java.lang.Object
  extended by net.sf.urlchecker.communication.GenericCommunicationFactory<T,M,S,E>
Type Parameters:
T - the generic type
M - the generic type
S - the generic type
E - the element type

$Id: GenericCommunicationFactory.java 180 2010-12-12 18:47:56Z georgosn $

Direct Known Subclasses:
CommunicationFactory, CommunicationFactory

public abstract class GenericCommunicationFactory<T,M,S,E>
extends Object

A factory for creating GenericCommunication objects. This class was created to serve the two different httpClients and may be removed in future versions of the library.

Version:
$LastChangedRevision: 184 $
Author:
$LastChangedBy: georgosn $

Field Summary
protected  T client
          The client.
protected  boolean configured
          The configured.
static Pattern DEFAULT_PATTERN
          The Constant PATTERN to be used if no URL pattern is configured.
protected  Map<String,ExceptionHandler<?>> exceptionHandlers
          The exception handlers.
protected static String FILE_NOT_FOUND
          The Constant FILE_NOT_FOUND.
protected  String fileName
          The file name.
protected static String HTTPCONFIGURATION_FILENAME
          The Constant HTTPCONFIGURATION_FILENAME.
protected static org.apache.log4j.Logger LOGGER
          The Constant LOGGER.
protected  M manager
          The manager.
protected  int maxretries
          The maxretries.
protected  Map<String,S> methods
          The methods.
protected  boolean multithreaded
          The multithreaded.
protected static String NO_CONFIG
          The Constant NO_CONFIG.
protected  Pattern urlpattern
          The urlpattern.
protected  Map<String,Integer[]> validCodes
          The valid codes.
protected static String[] WARNINGS
          The Constant WARNINGS.
 
Constructor Summary
GenericCommunicationFactory()
           
 
Method Summary
abstract  T configureClient(boolean localThreadSceme)
          Configure client.
abstract  T configureClient(boolean localThreadSceme, String FileName)
          Configure client.
 Map<String,ExceptionHandler<?>> getExceptionHandlers()
          Returns the exception handlers.
 int getMaxretries()
          Returns the maxretries.
abstract  E getMethod(String source)
          Returns the method.
abstract  S getMethodType(String source)
          Returns the method type.
 Integer[] getOnlyValidCodes(String source)
          Returns the only valid codes.
 Pattern getUrlpattern()
          Returns the urlpattern.
 Map<String,Integer[]> getValidCodes()
          Returns the valid codes.
 boolean isConfigured()
          Checks if client is configured.
 boolean isMultiThreaded()
          Checks if client connection manager is multi threaded.
 boolean isValidResponse(Result result)
          Checks if a response is valid .
abstract  void shutdown()
          Shuts down the client.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PATTERN

public static final Pattern DEFAULT_PATTERN
The Constant PATTERN to be used if no URL pattern is configured. Value
 ((https?|ftp|gopher):((//)|(\\\\))+([\\w\\d:#@%/;$\\(\\)~_?\\+-=\\\\.]|&(?!(lt;|gt;|amp;|apos;|quot;)))*)
 


HTTPCONFIGURATION_FILENAME

protected static final String HTTPCONFIGURATION_FILENAME
The Constant HTTPCONFIGURATION_FILENAME.

See Also:
Constant Field Values

WARNINGS

protected static final String[] WARNINGS
The Constant WARNINGS.


NO_CONFIG

protected static final String NO_CONFIG
The Constant NO_CONFIG.

See Also:
Constant Field Values

FILE_NOT_FOUND

protected static final String FILE_NOT_FOUND
The Constant FILE_NOT_FOUND.

See Also:
Constant Field Values

LOGGER

protected static final org.apache.log4j.Logger LOGGER
The Constant LOGGER.


configured

protected transient boolean configured
The configured.


client

protected transient T client
The client.


manager

protected transient M manager
The manager.


multithreaded

protected boolean multithreaded
The multithreaded.


validCodes

protected Map<String,Integer[]> validCodes
The valid codes.


exceptionHandlers

protected Map<String,ExceptionHandler<?>> exceptionHandlers
The exception handlers.


maxretries

protected int maxretries
The maxretries.


methods

protected Map<String,S> methods
The methods.


fileName

protected String fileName
The file name.


urlpattern

protected Pattern urlpattern
The urlpattern.

Constructor Detail

GenericCommunicationFactory

public GenericCommunicationFactory()
Method Detail

configureClient

public abstract T configureClient(boolean localThreadSceme)
                           throws org.apache.commons.configuration.ConfigurationException
Configure client.

Type Parameters:
T - a T object.
M - a M object.
S - a S object.
E - a E object.
Parameters:
localThreadSceme - the multi threaded
Returns:
the http client
Throws:
org.apache.commons.configuration.ConfigurationException - the configuration exception

configureClient

public abstract T configureClient(boolean localThreadSceme,
                                  String FileName)
                           throws org.apache.commons.configuration.ConfigurationException
Configure client.

Parameters:
localThreadSceme - the local thread sceme
FileName - the file name
Returns:
the t
Throws:
org.apache.commons.configuration.ConfigurationException - the configuration exception

getExceptionHandlers

public Map<String,ExceptionHandler<?>> getExceptionHandlers()
Returns the exception handlers.

Returns:
the exceptionHandlers

getMaxretries

public int getMaxretries()
Returns the maxretries.

Returns:
the maxretries

getMethod

public abstract E getMethod(String source)
Returns the method.

Parameters:
source - the source
Returns:
the method

getMethodType

public abstract S getMethodType(String source)
Returns the method type.

Parameters:
source - the source
Returns:
the method

getOnlyValidCodes

public Integer[] getOnlyValidCodes(String source)
Returns the only valid codes.

Parameters:
source - the source
Returns:
the only valid codes

getUrlpattern

public Pattern getUrlpattern()
Returns the urlpattern.

Returns:
the urlpattern

getValidCodes

public Map<String,Integer[]> getValidCodes()
Returns the valid codes.

Returns:
the validCodes

isConfigured

public boolean isConfigured()
Checks if client is configured.

Returns:
true, if is configured

isMultiThreaded

public boolean isMultiThreaded()
Checks if client connection manager is multi threaded.

Returns:
true, if is multi threaded

isValidResponse

public boolean isValidResponse(Result result)
Checks if a response is valid .

Parameters:
result - the result
Returns:
true, if is valid response

shutdown

public abstract void shutdown()
Shuts down the client.



Copyright © 2010 Nikolaos Georgosopoulos. All Rights Reserved.