org.jboss.deployment.scanner
Class AbstractDeploymentScanner

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.deployment.scanner.AbstractDeploymentScanner
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, DeploymentScanner, DeploymentScannerMBean, Service, ServiceMBean
Direct Known Subclasses:
URLDeploymentScanner, URLDirectoryScanner

public abstract class AbstractDeploymentScanner
extends ServiceMBeanSupport
implements DeploymentScanner, DeploymentScannerMBean

An abstract support class for implementing a deployment scanner.

Provides the implementation of period-based scanning, as well as Deployer integration.

Sub-classes only need to implement DeploymentScanner.scan().

Version:
$Revision: 1.15.2.5 $
Author:
Jason Dillon, Scott.Stark@jboss.org

Nested Class Summary
 class AbstractDeploymentScanner.ScannerThread
          Should use Timer/TimerTask instead? This has some issues with interaction with ScanEnabled attribute.
 
Field Summary
protected  Deployer deployer
          A proxy to the deployer we are using.
protected  MainDeployerMBean mainDeployer
           
protected  boolean scanEnabled
          True if period based scanning is enabled.
protected  AbstractDeploymentScanner.ScannerThread scannerThread
          The scanner thread.
protected  long scanPeriod
          The scan period in milliseconds
protected  long stopTimeOut
          The stop timeout
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
AbstractDeploymentScanner()
           
 
Method Summary
protected  void createService()
          Sub-classes should override this method to provide custum 'create' logic.
protected  void destroyService()
          Sub-classes should override this method to provide custum 'destroy' logic.
 javax.management.ObjectName getDeployer()
          Get the ObjectName of the Deployer which we are using.
 long getScanPeriod()
          Get the scan period for the scanner.
 long getStopTimeOut()
          How long to wait in stop for the background thread to stop
 boolean isScanEnabled()
          Check if period based scanning is enabled.
abstract  void scan()
          This is here to work around a bug in the IBM vm that causes an AbstractMethodError to be thrown when the ScannerThread calls scan.
 void setDeployer(javax.management.ObjectName deployerName)
          The ObjectName of the Deployer which we will use.
 void setScanEnabled(boolean flag)
          Disable or enable the period based deployment scanning.
 void setScanPeriod(long period)
          Period must be >= 0.
 void setStopTimeOut(long stopTimeOut)
          How long to wait in stop for the background thread to stop
protected  void startService()
          Sub-classes should override this method to provide custum 'start' logic.
protected  void stopService()
          Sub-classes should override this method to provide custum 'stop' logic.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, destroy, getDeploymentInfo, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean
getName, getState, getStateString, jbossInternalLifecycle
 

Field Detail

scanPeriod

protected long scanPeriod
The scan period in milliseconds


scanEnabled

protected boolean scanEnabled
True if period based scanning is enabled.


stopTimeOut

protected long stopTimeOut
The stop timeout


deployer

protected Deployer deployer
A proxy to the deployer we are using.


mainDeployer

protected MainDeployerMBean mainDeployer

scannerThread

protected AbstractDeploymentScanner.ScannerThread scannerThread
The scanner thread.

Constructor Detail

AbstractDeploymentScanner

public AbstractDeploymentScanner()
Method Detail

setDeployer

public void setDeployer(javax.management.ObjectName deployerName)
Description copied from interface: DeploymentScanner
The ObjectName of the Deployer which we will use.

Specified by:
setDeployer in interface DeploymentScanner
Specified by:
setDeployer in interface DeploymentScannerMBean
Parameters:
deployerName - The object name of the deployer to use.

getDeployer

public javax.management.ObjectName getDeployer()
Description copied from interface: DeploymentScanner
Get the ObjectName of the Deployer which we are using.

Specified by:
getDeployer in interface DeploymentScanner
Specified by:
getDeployer in interface DeploymentScannerMBean
Returns:
The object name of the deployer we are using.

setScanPeriod

public void setScanPeriod(long period)
Period must be >= 0.

Specified by:
setScanPeriod in interface DeploymentScanner
Specified by:
setScanPeriod in interface DeploymentScannerMBean
Parameters:
period - This is the time in milliseconds between scans.

getScanPeriod

public long getScanPeriod()
Description copied from interface: DeploymentScanner
Get the scan period for the scanner.

Specified by:
getScanPeriod in interface DeploymentScanner
Returns:
This is the time in milliseconds between scans.

setScanEnabled

public void setScanEnabled(boolean flag)
Description copied from interface: DeploymentScanner
Disable or enable the period based deployment scanning.

Manual scanning can still be performed by calling DeploymentScanner.scan().

Specified by:
setScanEnabled in interface DeploymentScanner
Specified by:
setScanEnabled in interface DeploymentScannerMBean
Parameters:
flag - True to enable or false to disable period based scanning.

isScanEnabled

public boolean isScanEnabled()
Description copied from interface: DeploymentScanner
Check if period based scanning is enabled.

Specified by:
isScanEnabled in interface DeploymentScanner
Specified by:
isScanEnabled in interface DeploymentScannerMBean
Returns:
True if enabled, false if disabled.

getStopTimeOut

public long getStopTimeOut()
Description copied from interface: DeploymentScannerMBean
How long to wait in stop for the background thread to stop

Specified by:
getStopTimeOut in interface DeploymentScannerMBean
Returns:
the time in milliseconds.

setStopTimeOut

public void setStopTimeOut(long stopTimeOut)
Description copied from interface: DeploymentScannerMBean
How long to wait in stop for the background thread to stop

Specified by:
setStopTimeOut in interface DeploymentScannerMBean
Parameters:
stopTimeOut - the time in milliseconds.

scan

public abstract void scan()
                   throws Exception
This is here to work around a bug in the IBM vm that causes an AbstractMethodError to be thrown when the ScannerThread calls scan.

Specified by:
scan in interface DeploymentScanner
Specified by:
scan in interface DeploymentScannerMBean
Throws:
Exception
IllegalStateException - Not initialized.

createService

protected void createService()
                      throws Exception
Description copied from class: ServiceMBeanSupport
Sub-classes should override this method to provide custum 'create' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
createService in class ServiceMBeanSupport
Throws:
Exception

startService

protected void startService()
                     throws Exception
Description copied from class: ServiceMBeanSupport
Sub-classes should override this method to provide custum 'start' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
startService in class ServiceMBeanSupport
Throws:
Exception

stopService

protected void stopService()
                    throws Exception
Description copied from class: ServiceMBeanSupport
Sub-classes should override this method to provide custum 'stop' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
stopService in class ServiceMBeanSupport
Throws:
Exception

destroyService

protected void destroyService()
                       throws Exception
Description copied from class: ServiceMBeanSupport
Sub-classes should override this method to provide custum 'destroy' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
destroyService in class ServiceMBeanSupport
Throws:
Exception


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.