net.sourceforge.rssowl.controller.thread
Class FeedValidator

java.lang.Object
  extended byjava.lang.Thread
      extended bynet.sourceforge.rssowl.controller.thread.ExtendedThread
          extended bynet.sourceforge.rssowl.controller.thread.FeedValidator
All Implemented Interfaces:
Runnable

public class FeedValidator
extends ExtendedThread

This thread is used to validate a newsfeed and give the results to the calling ValidateFeedDialog

Version:
1.1.3
Author:
Benjamin Pasero

Field Summary
(package private)  String dtdToValidate
           
private  String feedPath
           
private  String format
           
private  String humanReadableFeedFormat
           
(package private)  boolean isWarningOrError
           
(package private)  boolean overrideDTD
           
(package private)  ValidateFeedDialog rssOwlValidateFeedDialog
           
private static String TMP_XML_NAME
          Temp name of the locally saved XML document
 
Fields inherited from class net.sourceforge.rssowl.controller.thread.ExtendedThread
stopped
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
FeedValidator(ValidateFeedDialog rssOwlValidateFeedDialog, String feedPath, String format, boolean overrideDTD)
          Instantiate a new FeedValidator
 
Method Summary
private  void autoDetectFormat(org.jdom.Document document)
          Auto detect the format from the given document
private  void downloadFeed()
          Download the newsfeed to save it locally.
 void run()
          Download, Save and Validate given feed.
private  void saveFeed(org.jdom.Document document)
          Write the document to disk.
private  void setDTDToValidate(org.jdom.Document document)
          This method sets a null.dtd as Doctype to the document and then sets the DTD that should be used to validate the XML.
 void stopThread()
          Stop the Feed Validator
private  void validateFeed()
          Validate the newsfeed using JDom
 
Methods inherited from class net.sourceforge.rssowl.controller.thread.ExtendedThread
isStopped, startThread
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TMP_XML_NAME

private static final String TMP_XML_NAME
Temp name of the locally saved XML document

See Also:
Constant Field Values

feedPath

private String feedPath

format

private String format

humanReadableFeedFormat

private String humanReadableFeedFormat

dtdToValidate

String dtdToValidate

isWarningOrError

boolean isWarningOrError

overrideDTD

boolean overrideDTD

rssOwlValidateFeedDialog

ValidateFeedDialog rssOwlValidateFeedDialog
Constructor Detail

FeedValidator

public FeedValidator(ValidateFeedDialog rssOwlValidateFeedDialog,
                     String feedPath,
                     String format,
                     boolean overrideDTD)
Instantiate a new FeedValidator

Parameters:
rssOwlValidateFeedDialog - The calling validate feed dialog
feedPath - The path of the feed to validate
format - The feed format (may be auto-detection to let RSSOwl detect it)
overrideDTD - TRUE if the DTD declaration should get overriden
Method Detail

run

public void run()
Download, Save and Validate given feed.

See Also:
Runnable.run()

stopThread

public void stopThread()
Stop the Feed Validator

Overrides:
stopThread in class ExtendedThread

autoDetectFormat

private void autoDetectFormat(org.jdom.Document document)
                       throws NewsfeedFactoryException
Auto detect the format from the given document

Parameters:
document - The newsfeed as XMl document
Throws:
NewsfeedFactoryException - If an error occurs

downloadFeed

private void downloadFeed()
                   throws org.jdom.JDOMException,
                          IOException,
                          NewsfeedFactoryException,
                          IllegalArgumentException
Download the newsfeed to save it locally. This allows to apply a custom DTD to the document. In dependance of the newsfeed format a DTD is chosen from the res.jar.

Throws:
org.jdom.JDOMException - If an error occurs
IOException - If an error occurs
NewsfeedFactoryException - If an error occurs
IllegalArgumentException - If an error occurs

saveFeed

private void saveFeed(org.jdom.Document document)
Write the document to disk.

Parameters:
document - The document to save

setDTDToValidate

private void setDTDToValidate(org.jdom.Document document)
                       throws NewsfeedFactoryException
This method sets a null.dtd as Doctype to the document and then sets the DTD that should be used to validate the XML.

Parameters:
document - The document to validate
Throws:
NewsfeedFactoryException - If an error occurs

validateFeed

private void validateFeed()
                   throws org.jdom.JDOMException,
                          IOException,
                          IllegalArgumentException
Validate the newsfeed using JDom

Throws:
org.jdom.JDOMException - If an error occurs
IOException - If an error occurs
IllegalArgumentException - If an error occurs


RSSOwl - RSS / RDF / Atom Newsreader

SourceForge.net Logo