net.sweetohm.ant.html
Class LinkTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by net.sweetohm.ant.util.FileTask
              extended by net.sweetohm.ant.html.LinkTask
All Implemented Interfaces:
java.lang.Cloneable

public class LinkTask
extends FileTask

This task checks links in HTML files.

Version:
1.0
Author:
Michel CASABIANCA

Nested Class Summary
(package private)  class LinkTask.Parser
          This class handles parser callbacks.
 
Field Summary
(package private)  boolean debug
          Debug flag
(package private)  javax.swing.text.html.parser.ParserDelegator delegator
          SGML parser to parse HTML
(package private)  boolean external
          External files check flag
(package private)  boolean ignoreCharSet
          Ignore charset when parsing
(package private) static java.lang.String INDENT
          Indentation block
(package private)  boolean interrupt
          Interruption flag
(package private)  boolean interrupted
          Interruption requested
(package private)  java.util.Hashtable koCache
          Cache for KO URLs
(package private)  java.lang.String log
          Log file name
(package private)  java.io.Writer logWriter
          Log writer
(package private) static int OK
          Response code for OK
(package private)  java.util.Hashtable okCache
          Cache for OK URLs
(package private)  java.io.File parsedFile
          The file being parsed
(package private)  LinkTask.Parser parser
          The parser
 
Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
LinkTask()
          Creates a new LinkTask instance.
 
Method Summary
 void execute()
          The method to launch the program as an Ant task.
 void log(java.lang.String message)
          This method logs a message.
 void setDebug(boolean debug)
          Debug flag.
 void setExternal(boolean external)
          External files check setter.
 void setIgnoreCharSet(boolean ignoreCharSet)
          Indicates if the parser should ignore charset when parsing.
 void setInterrupt(boolean interrupt)
          Interrupt setter.
 void setLog(java.lang.String log)
          Log file setter.
(package private)  void startTag(javax.swing.text.html.HTML.Tag tag, javax.swing.text.MutableAttributeSet attrSet)
          This method is called when an opening tag is met.
(package private)  void testURL(java.lang.String location)
          This method test a given URL.
 
Methods inherited from class net.sweetohm.ant.util.FileTask
addFileset, getFiles, setDir, setFile
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

external

boolean external
External files check flag


interrupt

boolean interrupt
Interruption flag


interrupted

boolean interrupted
Interruption requested


log

java.lang.String log
Log file name


logWriter

java.io.Writer logWriter
Log writer


debug

boolean debug
Debug flag


delegator

javax.swing.text.html.parser.ParserDelegator delegator
SGML parser to parse HTML


parser

LinkTask.Parser parser
The parser


parsedFile

java.io.File parsedFile
The file being parsed


okCache

java.util.Hashtable okCache
Cache for OK URLs


koCache

java.util.Hashtable koCache
Cache for KO URLs


OK

static final int OK
Response code for OK

See Also:
Constant Field Values

INDENT

static final java.lang.String INDENT
Indentation block

See Also:
Constant Field Values

ignoreCharSet

boolean ignoreCharSet
Ignore charset when parsing

Constructor Detail

LinkTask

public LinkTask()
Creates a new LinkTask instance.

Method Detail

setExternal

public void setExternal(boolean external)
External files check setter.

Parameters:
external - A boolean indicating if external links should be checked.

setInterrupt

public void setInterrupt(boolean interrupt)
Interrupt setter.

Parameters:
interrupt -

setLog

public void setLog(java.lang.String log)
Log file setter.

Parameters:
log - A String that is the file name of the log.

setDebug

public void setDebug(boolean debug)
Debug flag.

Parameters:
debug - A boolean that indicates if debug should be displayed.

setIgnoreCharSet

public void setIgnoreCharSet(boolean ignoreCharSet)
Indicates if the parser should ignore charset when parsing. Defaults to true.

Parameters:
ignoreCharSet - A boolean that indicates if charset should be ignored when parsing.

execute

public void execute()
The method to launch the program as an Ant task.

Overrides:
execute in class org.apache.tools.ant.Task

startTag

void startTag(javax.swing.text.html.HTML.Tag tag,
              javax.swing.text.MutableAttributeSet attrSet)
This method is called when an opening tag is met.

Parameters:
tag - An HTML.Tag object that is the tag.
attrSet - An MutableAttributeSet that lists attributes.

testURL

void testURL(java.lang.String location)
This method test a given URL.

Parameters:
location - The URL to test as a String.

log

public void log(java.lang.String message)
This method logs a message. This message is sent to the log method of the ancestor and (if log was set) written in a log file.

Overrides:
log in class org.apache.tools.ant.Task
Parameters:
message - The String message to write.