dk.netarkivet.harvester.harvesting.distribute
Class CrawlProgressMessage

java.lang.Object
  extended by dk.netarkivet.common.distribute.NetarkivetMessage
      extended by dk.netarkivet.harvester.distribute.HarvesterMessage
          extended by dk.netarkivet.harvester.harvesting.distribute.CrawlProgressMessage
All Implemented Interfaces:
java.io.Serializable

public class CrawlProgressMessage
extends HarvesterMessage
implements java.io.Serializable

This class wraps information stored in the Heritrix MBeans, CrawlService and CrawlService.Job, and represents the crawl progress. Additionally this object extends HarvesterMessage so that it can be sent on the JMS bus to be processed by HarvestMonitor.

See Also:
HeritrixLauncher.doCrawl(), Serialized Form

Nested Class Summary
 class CrawlProgressMessage.CrawlServiceInfo
          Wraps CrawlService MBean attributes.
 class CrawlProgressMessage.CrawlServiceJobInfo
          Wraps CrawlService.Job MBean attributes.
static class CrawlProgressMessage.CrawlStatus
          The general status of a job in NAS.
 
Field Summary
 
Fields inherited from class dk.netarkivet.common.distribute.NetarkivetMessage
replyOfId
 
Constructor Summary
CrawlProgressMessage(long harvestID, long jobId)
          Builds an empty message.
CrawlProgressMessage(long harvestID, long jobId, java.lang.String progressStatisticsLegend)
          Builds an empty message.
 
Method Summary
 void accept(HarvesterMessageVisitor v)
          Should be implemented as a part of the visitor pattern.
 boolean crawlIsFinished()
          Checks whether Heritrix has finished crawling the job.
 long getHarvestID()
           
 CrawlProgressMessage.CrawlServiceInfo getHeritrixStatus()
           
 java.lang.String getHostUrl()
           
 long getJobID()
           
 CrawlProgressMessage.CrawlServiceJobInfo getJobStatus()
           
 java.lang.String getProgressStatisticsLegend()
           
 CrawlProgressMessage.CrawlStatus getStatus()
           
 boolean isPaused()
          Returns true if the crawler has been paused, and thus not supposed to fetch anything.
 void setHostUrl(java.lang.String hostUrl)
           
 void setStatus(CrawlProgressMessage.CrawlStatus status)
           
 
Methods inherited from class dk.netarkivet.common.distribute.NetarkivetMessage
getErrMsg, getID, getReplyOfId, getReplyTo, getTo, hasBeenSent, isOk, setNotOk, setNotOk, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CrawlProgressMessage

public CrawlProgressMessage(long harvestID,
                            long jobId,
                            java.lang.String progressStatisticsLegend)
Builds an empty message. MBean wrapper values are not set and the appropriate getters should be used to do so.

Parameters:
harvestID - the harvest definition ID
jobId - the job ID
progressStatisticsLegend - the legend of the progress statistics summary string
See Also:
progressStatisticsLegend

CrawlProgressMessage

public CrawlProgressMessage(long harvestID,
                            long jobId)
Builds an empty message. MBean wrapper values are not set and the appropriate getters should be used to do so. The progressStatisticsLegend is set to the empty string.

Parameters:
harvestID - the harvest definition ID
jobId - the job ID
Method Detail

getHarvestID

public long getHarvestID()

getHostUrl

public java.lang.String getHostUrl()

setHostUrl

public void setHostUrl(java.lang.String hostUrl)

getStatus

public CrawlProgressMessage.CrawlStatus getStatus()

setStatus

public void setStatus(CrawlProgressMessage.CrawlStatus status)

getJobID

public long getJobID()

getProgressStatisticsLegend

public java.lang.String getProgressStatisticsLegend()

getHeritrixStatus

public CrawlProgressMessage.CrawlServiceInfo getHeritrixStatus()

getJobStatus

public CrawlProgressMessage.CrawlServiceJobInfo getJobStatus()

accept

public void accept(HarvesterMessageVisitor v)
Description copied from class: HarvesterMessage
Should be implemented as a part of the visitor pattern. fx.: public void accept(HarvesterMessageVisitor v) { v.visit(this); }

Specified by:
accept in class HarvesterMessage
Parameters:
v - A message visitor

isPaused

public boolean isPaused()
Returns true if the crawler has been paused, and thus not supposed to fetch anything. Heritrix may still be fetching stuff, as it takes some time for it to go into full pause mode. This method can be used as an indicator that we should not be worried if Heritrix appears to be idle.

Returns:
True if the crawler has been paused, e.g. by using the Heritrix GUI.

crawlIsFinished

public boolean crawlIsFinished()
Checks whether Heritrix has finished crawling the job.

Returns:
true if Heritrix has finished crawling the job, false otherwise.