Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.autoinventory
Class ScanManager

java.lang.Object
  extended by org.hyperic.hq.autoinventory.ScanManager
All Implemented Interfaces:
ScanListener

public class ScanManager
extends java.lang.Object
implements ScanListener

The ScanManager controls the Scanner and ensures that only 1 scan is running at a time. If someone tries to start a scan while another scan is running, we'll cue up that scan to run immediately after the current scan completes.


Constructor Summary
ScanManager(ScanListener listener, org.apache.commons.logging.Log log, AutoinventoryPluginManager apm, RuntimeScanner rtScanner)
          Create a scan manager.
 
Method Summary
 ScanState getStatus()
          Get the status of the currently running scan.
 void interruptHangingScan()
           
 boolean isScanQueued()
           
 boolean isScanRunning()
           
 boolean queueScan(ScanConfiguration scanConfig)
          Start a new scan, using the specified scan configuration.
 void scanComplete(ScanState state)
          The scanner calls this method when the scan has completed.
 void shutdown(long timeout)
          Stop the ScanManager.
 void startup()
          Startup the ScanManager.
 boolean stopScan()
          Stops the currently running scan.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScanManager

public ScanManager(ScanListener listener,
                   org.apache.commons.logging.Log log,
                   AutoinventoryPluginManager apm,
                   RuntimeScanner rtScanner)
Create a scan manager.

Parameters:
listener - The ScanListener to be notified when scans complete.
log - The log to use.
apm - The Autoinventory plugin manager to use for loading platform and server detectors.
rtScanner - The RuntimeScanner to use for runtime scans. This can be null if no runtime scans are to be performed.
Method Detail

startup

public void startup()
Startup the ScanManager. This fires off a Thread that manages the scan queue.


shutdown

public void shutdown(long timeout)
Stop the ScanManager. Any currently running scan will be stopped.

Parameters:
timeout - How long to wait for the ScanManager to gracefully exit before Thread.stop-ing it.

queueScan

public boolean queueScan(ScanConfiguration scanConfig)
Start a new scan, using the specified scan configuration.

Parameters:
scanConfig - The configuration to use for the scan.
Returns:
true if a scan with an identical configuration has already been scheduled, false if this is a new configuration not yet scheduled.

interruptHangingScan

public void interruptHangingScan()

stopScan

public boolean stopScan()
                 throws AutoinventoryException
Stops the currently running scan.

Returns:
true if a scan was actually running and was interrupted, false otherwise.
Throws:
AutoinventoryException

getStatus

public ScanState getStatus()
Get the status of the currently running scan.

Returns:
A ScanState object representing the current status of the running scan.

isScanRunning

public boolean isScanRunning()
Returns:
true if there is a scan currently running, false otherwise.

isScanQueued

public boolean isScanQueued()

scanComplete

public void scanComplete(ScanState state)
                  throws AutoinventoryException,
                         SystemException
Description copied from interface: ScanListener
The scanner calls this method when the scan has completed. This method is called whenever the scan completes, for ANY reason (including partial errors and fatal errors). It is the responsbility of the class that implements this interface to investigate the Scanner's ScanState object to determine how the scan completed and take the appropriate course of action.

Specified by:
scanComplete in interface ScanListener
Parameters:
state - The final state of the scan. This object is provided for convenience, as the class implementing this interface will likely already have a way to get to it.
Throws:
AutoinventoryException
SystemException

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.