org.apache.maven.doxia.linkcheck.validation
Class LinkValidatorManager

java.lang.Object
  extended by org.apache.maven.doxia.linkcheck.validation.LinkValidatorManager
All Implemented Interfaces:
Serializable

public class LinkValidatorManager
extends Object
implements Serializable

A LinkValidator manager which manages validators with a cache.

Version:
$Id: LinkValidatorManager.java 1004651 2010-10-05 14:09:10Z ltheussl $
Author:
Ben Walding, Carlos Sanchez, Arnaud Heritier, Vincent Siveton
See Also:
Serialized Form

Constructor Summary
LinkValidatorManager()
           
 
Method Summary
 void addLinkValidator(LinkValidator lv)
          Adds a LinkValidator to this manager.
 LinkValidationResult getCachedResult(LinkValidationItem lvi)
          Returns a LinkValidationResult for the given LinkValidationItem if it has been cached from a previous run, returns null otherwise.
 String[] getExcludedLinks()
          Returns the excludedLinks.
 List getValidators()
          Returns the list of validators.
 void loadCache(File cacheFile)
          Loads a cache file.
protected static boolean matchPattern(String link, String pattern)
           
 void saveCache(File cacheFile)
          Saves a cache file.
 void setCachedResult(Object resourceKey, LinkValidationResult lvr)
          Puts the given LinkValidationResult into the cache.
 void setExcludedLinks(String[] excl)
          Sets the excludedLinks.
 LinkValidationResult validateLink(LinkValidationItem lvi)
          Validates the links of the given LinkValidationItem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkValidatorManager

public LinkValidatorManager()
Method Detail

getValidators

public List getValidators()
Returns the list of validators.

Returns:
List

getExcludedLinks

public String[] getExcludedLinks()
Returns the excludedLinks. Could contains a link, i.e. http://maven.apache.org/, or pattern links i.e. http://maven.apache.org/**/*.html

Returns:
String[]

setExcludedLinks

public void setExcludedLinks(String[] excl)
Sets the excludedLinks. Could contains a link, i.e. http://maven.apache.org/, or pattern links i.e. http://maven.apache.org/**/*.html

Parameters:
excl - The excludes to set.

addLinkValidator

public void addLinkValidator(LinkValidator lv)
Adds a LinkValidator to this manager.

Parameters:
lv - The LinkValidator to add.

validateLink

public LinkValidationResult validateLink(LinkValidationItem lvi)
Validates the links of the given LinkValidationItem.

Parameters:
lvi - The LinkValidationItem to validate.
Returns:
A LinkValidationResult.

loadCache

public void loadCache(File cacheFile)
               throws IOException
Loads a cache file.

Parameters:
cacheFile - The cache file. May be null, in which case the request is ignored.
Throws:
IOException - if any

saveCache

public void saveCache(File cacheFile)
               throws IOException
Saves a cache file.

Parameters:
cacheFile - The name of the cache file. May be null, in which case the request is ignored.
Throws:
IOException - if any

getCachedResult

public LinkValidationResult getCachedResult(LinkValidationItem lvi)
Returns a LinkValidationResult for the given LinkValidationItem if it has been cached from a previous run, returns null otherwise.

Parameters:
lvi - The LinkValidationItem.
Returns:
LinkValidationResult

setCachedResult

public void setCachedResult(Object resourceKey,
                            LinkValidationResult lvr)
Puts the given LinkValidationResult into the cache.

Parameters:
resourceKey - The key to retrieve the result.
lvr - the LinkValidationResult to cache.

matchPattern

protected static boolean matchPattern(String link,
                                      String pattern)
Parameters:
link - not null
pattern - not null
Returns:
true if pattern match


Copyright © 2005-2011 Apache Software Foundation. All Rights Reserved.