org.apache.oodt.cas.pushpull.daemon
Class Daemon

java.lang.Object
  extended by java.rmi.server.RemoteObject
      extended by java.rmi.server.RemoteServer
          extended by java.rmi.server.UnicastRemoteObject
              extended by org.apache.oodt.cas.pushpull.daemon.Daemon
All Implemented Interfaces:
Serializable, Remote, DaemonMBean, DaemonRmiInterface

public class Daemon
extends UnicastRemoteObject
implements DaemonRmiInterface, DaemonMBean

Controls the execution times of the Crawler it is given. The Crawler is specified by the properties file passed in. A Crawler will be created per the properties file and executed at six hour intervals. This class can be controlled by CrawlDaemonController after is has been started up.

Author:
bfoster
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
Daemon(int rmiRegPort, int daemonID, Config config, DaemonInfo daemonInfo, SiteInfo siteInfo)
          Constructor
 
Method Summary
 String[] downloadedFilesInStagingArea()
           
 String[] downloadingFilesInStagingArea()
           
 boolean getAllowAliasOverride()
           
 long getAverageRunTime()
          Average runtime for the Crawler
 long getDaemonCreationTime()
          Gets the time in milliseconds for when the CrawlDaemon constructor was invoked.
 int getDaemonID()
           
 String getDataFilesRemoteSite()
           
 String getDataFilesRenamingConv()
           
 File getDataFilesStagingArea()
           
 boolean getDeleteDataFilesFromServer()
           
 boolean getDeletePropertyFilesFromServer()
           
 long getEpsilonInMilliseconds()
           
 Date getFirstRunDateTime()
           
 boolean getHasBeenToldToQuit()
           
 long getMillisCrawling()
          Gets the total crawling time of the Crawler
 String getName()
           
 int getNumCrawls()
          Gets the total number of times the Crawler has been run
 File getPropertyFilesLocalDir()
           
 String getPropertyFilesOnFailDir()
           
 String getPropertyFilesOnSuccessDir()
           
 String getPropertyFilesRemoteSite()
           
 String getPropertyFilesRenamingConv()
           
 String getQueryMetadataElementName()
           
 boolean getRunOnReboot()
           
 long getTimeInterval()
          Gets the time between the start of Crawler executions
 long getTimeIntervalInMilliseconds()
           
 boolean isRunning()
          Can be used to determine if Crawler is presently running
static void main(String[] args)
          Starts the program
 int numberOfFilesDownloadedInStagingArea()
           
 int numberOfFilesDownloadingInStagingArea()
           
 void pauseDaemon()
           
 void quit()
          Will terminate the CrawlDaemon.
 void registerDaemonListener(DaemonListener daemonListener)
           
 void resume()
          Wakes up the CrawlDaemon if it is sleeping
 void startDaemon()
          Loads and executes the Crawler specified by the properties file.
 String toString()
           
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Daemon

public Daemon(int rmiRegPort,
              int daemonID,
              Config config,
              DaemonInfo daemonInfo,
              SiteInfo siteInfo)
       throws RemoteException,
              InstantiationException
Constructor

Throws:
RemoteException
RemoteException
InstantiationException
IOException
SecurityException
Method Detail

getName

public String getName()

registerDaemonListener

public void registerDaemonListener(DaemonListener daemonListener)

startDaemon

public void startDaemon()
Loads and executes the Crawler specified by the properties file. It will crawl the URLs specified in the properties file in the sequence given--one at a time.

Parameters:
property - The system property whose value is the path to a java .properties file that is be used to create the Crawler
Throws:
DirStructException

getDaemonID

public int getDaemonID()

pauseDaemon

public void pauseDaemon()

resume

public void resume()
Wakes up the CrawlDaemon if it is sleeping

Specified by:
resume in interface DaemonRmiInterface

quit

public void quit()
Will terminate the CrawlDaemon. If its Crawler is crawling a site when this method is called, the terminate won't take place until after the Crawler has complete crawling that site.

Specified by:
quit in interface DaemonMBean
Specified by:
quit in interface DaemonRmiInterface

isRunning

public boolean isRunning()
Can be used to determine if Crawler is presently running

Specified by:
isRunning in interface DaemonMBean
Specified by:
isRunning in interface DaemonRmiInterface
Returns:
true if Crawler is runnning

getAverageRunTime

public long getAverageRunTime()
Average runtime for the Crawler

Specified by:
getAverageRunTime in interface DaemonRmiInterface
Returns:
average runtime for the Crawler

getMillisCrawling

public long getMillisCrawling()
Gets the total crawling time of the Crawler

Specified by:
getMillisCrawling in interface DaemonRmiInterface
Returns:
Total crawling time of Crawler

getTimeInterval

public long getTimeInterval()
Gets the time between the start of Crawler executions

Specified by:
getTimeInterval in interface DaemonRmiInterface
Returns:
Time interval between Crawler start times

getNumCrawls

public int getNumCrawls()
Gets the total number of times the Crawler has been run

Specified by:
getNumCrawls in interface DaemonRmiInterface
Returns:
The number of times Crawler has run

downloadedFilesInStagingArea

public String[] downloadedFilesInStagingArea()
Specified by:
downloadedFilesInStagingArea in interface DaemonMBean

downloadingFilesInStagingArea

public String[] downloadingFilesInStagingArea()
Specified by:
downloadingFilesInStagingArea in interface DaemonMBean

numberOfFilesDownloadingInStagingArea

public int numberOfFilesDownloadingInStagingArea()
Specified by:
numberOfFilesDownloadingInStagingArea in interface DaemonMBean

numberOfFilesDownloadedInStagingArea

public int numberOfFilesDownloadedInStagingArea()
Specified by:
numberOfFilesDownloadedInStagingArea in interface DaemonMBean

getTimeIntervalInMilliseconds

public long getTimeIntervalInMilliseconds()
Specified by:
getTimeIntervalInMilliseconds in interface DaemonMBean

getEpsilonInMilliseconds

public long getEpsilonInMilliseconds()
Specified by:
getEpsilonInMilliseconds in interface DaemonMBean

getRunOnReboot

public boolean getRunOnReboot()
Specified by:
getRunOnReboot in interface DaemonMBean

getFirstRunDateTime

public Date getFirstRunDateTime()
Specified by:
getFirstRunDateTime in interface DaemonMBean

getDataFilesRemoteSite

public String getDataFilesRemoteSite()
Specified by:
getDataFilesRemoteSite in interface DaemonMBean

getDataFilesRenamingConv

public String getDataFilesRenamingConv()
Specified by:
getDataFilesRenamingConv in interface DaemonMBean

getDeleteDataFilesFromServer

public boolean getDeleteDataFilesFromServer()
Specified by:
getDeleteDataFilesFromServer in interface DaemonMBean

getQueryMetadataElementName

public String getQueryMetadataElementName()
Specified by:
getQueryMetadataElementName in interface DaemonMBean

getDataFilesStagingArea

public File getDataFilesStagingArea()
Specified by:
getDataFilesStagingArea in interface DaemonMBean

getAllowAliasOverride

public boolean getAllowAliasOverride()
Specified by:
getAllowAliasOverride in interface DaemonMBean

getPropertyFilesRemoteSite

public String getPropertyFilesRemoteSite()
Specified by:
getPropertyFilesRemoteSite in interface DaemonMBean

getPropertyFilesRenamingConv

public String getPropertyFilesRenamingConv()
Specified by:
getPropertyFilesRenamingConv in interface DaemonMBean

getDeletePropertyFilesFromServer

public boolean getDeletePropertyFilesFromServer()
Specified by:
getDeletePropertyFilesFromServer in interface DaemonMBean

getPropertyFilesOnSuccessDir

public String getPropertyFilesOnSuccessDir()
Specified by:
getPropertyFilesOnSuccessDir in interface DaemonMBean

getPropertyFilesOnFailDir

public String getPropertyFilesOnFailDir()
Specified by:
getPropertyFilesOnFailDir in interface DaemonMBean

getPropertyFilesLocalDir

public File getPropertyFilesLocalDir()
Specified by:
getPropertyFilesLocalDir in interface DaemonMBean

getDaemonCreationTime

public long getDaemonCreationTime()
Gets the time in milliseconds for when the CrawlDaemon constructor was invoked.

Specified by:
getDaemonCreationTime in interface DaemonRmiInterface
Returns:

getHasBeenToldToQuit

public boolean getHasBeenToldToQuit()
Specified by:
getHasBeenToldToQuit in interface DaemonMBean
Specified by:
getHasBeenToldToQuit in interface DaemonRmiInterface

toString

public String toString()
Overrides:
toString in class RemoteObject

main

public static void main(String[] args)
Starts the program

Parameters:
args - Not Used
Throws:
IOException
SecurityException


Copyright © 1999-2013
Apache OODT. All Rights Reserved.