Package org.opennms.netmgt.provision
Class SimpleQueuedProvisioningAdapter2
- java.lang.Object
-
- org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter2
-
- All Implemented Interfaces:
ProvisioningAdapter
public abstract class SimpleQueuedProvisioningAdapter2 extends Object implements ProvisioningAdapter
This class takes the work out of scheduling and queuing calls from the provisioner. Each provisioning adapter can extend this class for this functionality. The interface API methods are final so that the child class can not implement them and override the queuing for what would be the point. (Unless of course we decide that it is worth while to override a subset of the API methods. To use the class, have your provisioning adapter extend this abstract class. You see that you must implement abstract methods to compile. To change the schedule, override the createScheduleForNode method and return a schedule suitable for the node. In this base class, the same schedule is used for all nodes. TODO: Add logging TODO: Verify correct Exception handling TODO: Write tests (especially the equals method of the NodeOperation for proper queue handling)- Version:
- $Id: $
- Author:
- David Hustace
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SimpleQueuedProvisioningAdapter2()
Constructor for SimpleQueuedProvisioningAdapter2.protected
SimpleQueuedProvisioningAdapter2(PausibleScheduledThreadPoolExecutor executorService)
Constructor for SimpleQueuedProvisioningAdapter2.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ScheduledFuture<?>
addNode(int nodeId)
This method is called by the Provisioner when a new node is provisioned.ScheduledFuture<?>
deleteNode(int nodeId)
This method is called by the Provisioner when a node is deleted through provisioning.PausibleScheduledThreadPoolExecutor
getExecutorService()
getExecutorServiceabstract String
getName()
getNameabstract boolean
isNodeReady(int nodeId)
This method is called when the scheduled Adapters extending this class must implement this methodScheduledFuture<?>
nodeConfigChanged(int nodeId)
This method is called when a configuration change event has occurred from any source.abstract void
processPendingOperationForNode(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter2.AdapterOperation op)
processPendingOperationForNodeScheduledFuture<?>
updateNode(int nodeId)
This method is called by the Provisioner when a node is updated through provisioning.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.opennms.netmgt.provision.ProvisioningAdapter
init
-
-
-
-
Constructor Detail
-
SimpleQueuedProvisioningAdapter2
protected SimpleQueuedProvisioningAdapter2(PausibleScheduledThreadPoolExecutor executorService)
Constructor for SimpleQueuedProvisioningAdapter2.
- Parameters:
executorService
- aPausibleScheduledThreadPoolExecutor
object.
-
SimpleQueuedProvisioningAdapter2
protected SimpleQueuedProvisioningAdapter2()
Constructor for SimpleQueuedProvisioningAdapter2.
-
-
Method Detail
-
getName
public abstract String getName()
getName
- Specified by:
getName
in interfaceProvisioningAdapter
- Returns:
- a
String
object.
-
isNodeReady
public abstract boolean isNodeReady(int nodeId)
This method is called when the scheduled Adapters extending this class must implement this method- Parameters:
nodeId
- a int.- Returns:
- a boolean.
-
processPendingOperationForNode
public abstract void processPendingOperationForNode(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter2.AdapterOperation op) throws ProvisioningAdapterException
processPendingOperationForNode
- Parameters:
op
- aSimpleQueuedProvisioningAdapter2.AdapterOperation
object.- Throws:
ProvisioningAdapterException
- if any.
-
addNode
public final ScheduledFuture<?> addNode(int nodeId)
This method is called by the Provisioner when a new node is provisioned.- Specified by:
addNode
in interfaceProvisioningAdapter
- Parameters:
nodeId
- a int.- Returns:
-
updateNode
public final ScheduledFuture<?> updateNode(int nodeId)
This method is called by the Provisioner when a node is updated through provisioning.- Specified by:
updateNode
in interfaceProvisioningAdapter
- Parameters:
nodeId
- a int.
-
deleteNode
public final ScheduledFuture<?> deleteNode(int nodeId)
This method is called by the Provisioner when a node is deleted through provisioning.- Specified by:
deleteNode
in interfaceProvisioningAdapter
- Parameters:
nodeId
- a int.
-
nodeConfigChanged
public final ScheduledFuture<?> nodeConfigChanged(int nodeId)
This method is called when a configuration change event has occurred from any source. Typically, Traps sent from a device are converted to an event and that event is then identified for translation and translated into a generic configuration changed event.- Specified by:
nodeConfigChanged
in interfaceProvisioningAdapter
- Parameters:
nodeId
- a int.
-
getExecutorService
public PausibleScheduledThreadPoolExecutor getExecutorService()
getExecutorService
- Returns:
- a
PausibleScheduledThreadPoolExecutor
object.
-
-