|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter
public abstract class SimpleQueuedProvisioningAdapter
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 ProvisioningAdapter Interface API methods are final so that the child class can not implement them and override the queuing... for what would be the point. To use this class, have your provisioning adapter extend this abstract class. You see that you must implement abstract methods. 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. This class throws away duplicate node/operation tuples. This way you are guaranteed to only receive one node/operation from the queue, until it is removed from the queue that is. This is the purpose of the initial delay. It is suspected that the add/update/delete operations will not have any delay. Since there is only one thread per adapter, you will get these in the order they're scheduled. Be sure that adds/updates/deletes use the same schedule to insure the proper order. TODO: Add logging TODO: Verify correct Exception handling TODO: Write tests (especially the equals method of the NodeOperation for proper queue handling)
| Constructor Summary | |
|---|---|
protected |
SimpleQueuedProvisioningAdapter()
|
protected |
SimpleQueuedProvisioningAdapter(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. |
abstract String |
getName()
|
abstract boolean |
isNodeReady(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperation op)
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.SimpleQueuedProvisioningAdapter.AdapterOperation op)
The class implements the API and therefore the concrete class implements this method to handle dequeued operations. |
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 |
|---|
protected SimpleQueuedProvisioningAdapter(PausibleScheduledThreadPoolExecutor executorService)
protected SimpleQueuedProvisioningAdapter()
| Method Detail |
|---|
public abstract String getName()
getName in interface ProvisioningAdapterpublic abstract boolean isNodeReady(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperation op)
op -
public abstract void processPendingOperationForNode(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperation op)
throws ProvisioningAdapterException
op -
ProvisioningAdapterExceptionpublic final void addNode(int nodeId)
ProvisioningAdapter
addNode in interface ProvisioningAdapterpublic final void updateNode(int nodeId)
ProvisioningAdapter
updateNode in interface ProvisioningAdapterpublic final void deleteNode(int nodeId)
ProvisioningAdapter
deleteNode in interface ProvisioningAdapterpublic final void nodeConfigChanged(int nodeId)
ProvisioningAdapter
nodeConfigChanged in interface ProvisioningAdapter
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||