public abstract class PolicyMonitor extends AbstractLifeCycle
AbstractLifeCycle.AbstractLifeCycleListener
LifeCycle.Listener
_listeners, FAILED, RUNNING, STARTED, STARTING, STOPPED, STOPPING
Constructor and Description |
---|
PolicyMonitor()
empty constructor
|
PolicyMonitor(String directory)
construtor with a predetermined directory to monitor
|
Modifier and Type | Method and Description |
---|---|
protected void |
doStart()
called by the abstract lifecycle to start the monitor
|
protected void |
doStop()
called by the abstract life cycle to turn off the monitor
|
int |
getScanCount()
gets the number of times the scan has been run
|
int |
getScanInterval()
gets the scanner interval
|
boolean |
isInitialized()
true of the monitor is initialized, meaning that at least one
scan cycle has completed and any policy grants found have been chirped
|
boolean |
isReloadEnabled()
true of reload is enabled, false otherwise
|
abstract void |
onPolicyChange(PolicyBlock grant)
implemented by the user of the policy monitor to handle custom logic
related to the usage of the policy grant instance/s.
|
void |
setPolicyDirectory(String directory)
set the policy directory to scan on a non-running monitor
|
void |
setReload(boolean reload)
sets the monitor to reload or not, but only if the monitor isn't already running
TODO this doesn't really _have_ to be on a non-running monitor
|
void |
setScanInterval(int scanInterval)
sets the scanner interval on a non-running instance of the monitor
|
void |
waitForScan()
initiates a scan and blocks until it has been completed
|
addLifeCycleListener, getState, getState, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
public PolicyMonitor()
public PolicyMonitor(String directory)
directory
- public void setPolicyDirectory(String directory)
directory
- public int getScanInterval()
public void setScanInterval(int scanInterval)
scanInterval
- in secondsScanner.setScanInterval(int)
public boolean isInitialized()
public int getScanCount()
public void waitForScan() throws Exception
Exception
public boolean isReloadEnabled()
public void setReload(boolean reload)
reload
- protected void doStart() throws Exception
doStart
in class AbstractLifeCycle
Exception
protected void doStop() throws Exception
doStop
in class AbstractLifeCycle
Exception
public abstract void onPolicyChange(PolicyBlock grant)
grant
- Copyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.