org.opennms.netmgt.provision
Class SimpleQueuedProvisioningAdapter2

java.lang.Object
  extended by 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)

Author:
David Hustace

Constructor Summary
protected SimpleQueuedProvisioningAdapter2()
           
protected SimpleQueuedProvisioningAdapter2(PausibleScheduledThreadPoolExecutor executorService)
           
 
Method Summary
 void addNode(int nodeId)
          This method is called by the Provisioner when a new node is provisioned.
 void deleteNode(int nodeId)
          This method is called by the Provisioner when a node is deleted through provisioning.
 PausibleScheduledThreadPoolExecutor getExecutorService()
           
abstract  String getName()
           
abstract  boolean isNodeReady(int nodeId)
          This method is called when the scheduled Adapters extending this class must implement this method
 void 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)
           
 void 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
 

Constructor Detail

SimpleQueuedProvisioningAdapter2

protected SimpleQueuedProvisioningAdapter2(PausibleScheduledThreadPoolExecutor executorService)

SimpleQueuedProvisioningAdapter2

protected SimpleQueuedProvisioningAdapter2()
Method Detail

getName

public abstract String getName()
Specified by:
getName in interface ProvisioningAdapter

isNodeReady

public abstract boolean isNodeReady(int nodeId)
This method is called when the scheduled Adapters extending this class must implement this method


processPendingOperationForNode

public abstract void processPendingOperationForNode(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter2.AdapterOperation op)
                                             throws ProvisioningAdapterException
Throws:
ProvisioningAdapterException

addNode

public final void addNode(int nodeId)
Description copied from interface: ProvisioningAdapter
This method is called by the Provisioner when a new node is provisioned.

Specified by:
addNode in interface ProvisioningAdapter

updateNode

public final void updateNode(int nodeId)
Description copied from interface: ProvisioningAdapter
This method is called by the Provisioner when a node is updated through provisioning.

Specified by:
updateNode in interface ProvisioningAdapter

deleteNode

public final void deleteNode(int nodeId)
Description copied from interface: ProvisioningAdapter
This method is called by the Provisioner when a node is deleted through provisioning.

Specified by:
deleteNode in interface ProvisioningAdapter

nodeConfigChanged

public final void nodeConfigChanged(int nodeId)
Description copied from interface: ProvisioningAdapter
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 interface ProvisioningAdapter

getExecutorService

public PausibleScheduledThreadPoolExecutor getExecutorService()


Copyright © 2009. All Rights Reserved.