Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.greenstone.gatherer.collection
Class Job  view Job download Job.java

java.lang.Object
  extended byorg.greenstone.gatherer.collection.Job
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class Job
extends java.lang.Object
implements java.awt.event.ActionListener

Version:
2.0

Field Summary
private  boolean clobber
           
static int COMPLETE
           
private  java.lang.String current_url
           
private  boolean debug
           
private  int depth
           
private  java.lang.String destination
           
private  java.util.Vector encountered_urls
           
private  java.util.Vector failed_urls
           
private  boolean higher_directories
           
private  org.greenstone.gatherer.util.GURL initial
           
private  org.greenstone.gatherer.WGet mummy
           
private  boolean no_parents
           
private  boolean other_hosts
           
private  boolean page_requisites
           
static int PAUSED
           
private  int previous_state
           
private  org.greenstone.gatherer.gui.GProgressBar progress
           
private  java.lang.String proxy_pass
           
private  java.lang.String proxy_user
           
private  boolean quiet
           
static int RUNNING
           
private  int state
           
static int STOPPED
           
private  org.greenstone.gatherer.util.GURL url
           
 
Constructor Summary
Job(boolean clobber, boolean debug, boolean no_parents, boolean other_hosts, boolean page_requisites, boolean quiet, java.net.URL initial, int depth, java.lang.String destination, java.lang.String proxy_pass, java.lang.String proxy_user, org.greenstone.gatherer.WGet mummy, boolean simple)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Depending on which button on the progress bar was pushed, this method will affect the state of the Job and perhaps make calls to wget.class if necessary.
 void addDownload(java.lang.String raw_url)
          Called by the WGet native code to inform us of a new download starting.
 boolean addLink(java.lang.String raw_url, int type)
          Used to advise the Job of a newly parsed link.
 void callWGet()
           
 void callWGetNative()
          The most important part of the Job class, this method is responsible for calling the WGet native methods used to mirror the indicated url.
 void downloadComplete()
          Called by the WGet native code when the current download is completed.
 void downloadFailed()
          Called by the WGet native code when the requested download returns a status code other than 200.
 void downloadWarning()
           
 java.lang.String getHost()
           
 org.greenstone.gatherer.gui.GProgressBar getProgressBar()
           
 int getState()
          Called to discover if the user wanted this thread to run or if it is paused.
 boolean hasSignalledStop()
          Returns the current state of the stop flag for this job.
 java.lang.String toString()
          A convinence call.
 void updateProgress(long current, long expected)
          Called by the WGet native code to signal the current progress of downloading.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

clobber

private boolean clobber

debug

private boolean debug

higher_directories

private boolean higher_directories

no_parents

private boolean no_parents

other_hosts

private boolean other_hosts

page_requisites

private boolean page_requisites

quiet

private boolean quiet

progress

private org.greenstone.gatherer.gui.GProgressBar progress

initial

private org.greenstone.gatherer.util.GURL initial

url

private org.greenstone.gatherer.util.GURL url

depth

private int depth

previous_state

private int previous_state

state

private int state

current_url

private java.lang.String current_url

destination

private java.lang.String destination

proxy_pass

private java.lang.String proxy_pass

proxy_user

private java.lang.String proxy_user

encountered_urls

private java.util.Vector encountered_urls

failed_urls

private java.util.Vector failed_urls

mummy

private org.greenstone.gatherer.WGet mummy

COMPLETE

public static int COMPLETE

PAUSED

public static int PAUSED

RUNNING

public static int RUNNING

STOPPED

public static int STOPPED
Constructor Detail

Job

public Job(boolean clobber,
           boolean debug,
           boolean no_parents,
           boolean other_hosts,
           boolean page_requisites,
           boolean quiet,
           java.net.URL initial,
           int depth,
           java.lang.String destination,
           java.lang.String proxy_pass,
           java.lang.String proxy_user,
           org.greenstone.gatherer.WGet mummy,
           boolean simple)
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Depending on which button on the progress bar was pushed, this method will affect the state of the Job and perhaps make calls to wget.class if necessary.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

addDownload

public void addDownload(java.lang.String raw_url)
Called by the WGet native code to inform us of a new download starting.


addLink

public boolean addLink(java.lang.String raw_url,
                       int type)
Used to advise the Job of a newly parsed link. Its up to Job to decide if it already knows about this url, and if not to update its progress bar.


callWGet

public void callWGet()

callWGetNative

public void callWGetNative()
The most important part of the Job class, this method is responsible for calling the WGet native methods used to mirror the indicated url. By this stage all the variables necessary should be set and we need only build up the parameter string and make the call.


downloadComplete

public void downloadComplete()
Called by the WGet native code when the current download is completed. In turn all download listeners are informed.


downloadFailed

public void downloadFailed()
Called by the WGet native code when the requested download returns a status code other than 200.


downloadWarning

public void downloadWarning()

getHost

public java.lang.String getHost()

getProgressBar

public org.greenstone.gatherer.gui.GProgressBar getProgressBar()

getState

public int getState()
Called to discover if the user wanted this thread to run or if it is paused.


hasSignalledStop

public boolean hasSignalledStop()
Returns the current state of the stop flag for this job.


toString

public java.lang.String toString()
A convinence call.


updateProgress

public void updateProgress(long current,
                           long expected)
Called by the WGet native code to signal the current progress of downloading.