org.opennms.netmgt.provision
Class RancidProvisioningAdapter

java.lang.Object
  extended by org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter
      extended by org.opennms.netmgt.provision.RancidProvisioningAdapter
All Implemented Interfaces:
ProvisioningAdapter, org.springframework.beans.factory.InitializingBean

public class RancidProvisioningAdapter
extends SimpleQueuedProvisioningAdapter
implements org.springframework.beans.factory.InitializingBean

A Rancid provisioning adapter for integration with OpenNMS Provisioning daemon API.

Version:
$Id: $
Author:
Antonio Russo

Nested Class Summary
 
Nested classes/interfaces inherited from class org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter
SimpleQueuedProvisioningAdapter.AdapterOperationQueue, SimpleQueuedProvisioningAdapter.AdapterOperationQueueListener
 
Field Summary
static String NAME
          Constant NAME="RancidProvisioningAdapter"
 
Constructor Summary
RancidProvisioningAdapter()
           
 
Method Summary
 void afterPropertiesSet()
          afterPropertiesSet
 void doAdd(int nodeId, org.opennms.rancid.ConnectionProperties cp, boolean retry)
          doAdd
 void doDelete(int nodeId, org.opennms.rancid.ConnectionProperties cp, boolean retry)
          doDelete
 void doNodeConfigChanged(int nodeId, org.opennms.rancid.ConnectionProperties cp, boolean retry)
          doNodeConfigChanged
 void doUpdate(int nodeId, org.opennms.rancid.ConnectionProperties cp, boolean retry)
          doUpdate
 EventForwarder getEventForwarder()
          getEventForwarder
 String getName()
          getName
 NodeDao getNodeDao()
          getNodeDao
 RancidAdapterConfig getRancidAdapterConfig()
          getRancidAdapterConfig
 RWSConfig getRwsConfig()
          getRwsConfig
 org.springframework.transaction.support.TransactionTemplate getTemplate()
          getTemplate
 void handleRancidDownLoadFailure(Event e)
          handleRancidDownLoadFailure
 void handleRancidDownLoadSuccess(Event e)
          handleRancidDownLoadSuccess
 void handleRancidGroupProcessingCompleted(Event e)
          handleRancidGroupProcessingCompleted
 void handleReloadConfigEvent(Event event)
          handleReloadConfigEvent
 boolean isNodeReady(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperation op)
          Adapters extending this class must implement this method.
 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 setEventForwarder(EventForwarder eventForwarder)
          setEventForwarder
 void setNodeDao(NodeDao dao)
          setNodeDao
 void setRancidAdapterConfig(RancidAdapterConfig rancidAdapterConfig)
          setRancidAdapterConfig
 void setRwsConfig(RWSConfig rwsConfig)
          setRwsConfig
 void setTemplate(org.springframework.transaction.support.TransactionTemplate template)
          setTemplate
 
Methods inherited from class org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter
addNode, deleteNode, getOperationQueue, init, nodeConfigChanged, updateNode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

public static final String NAME
Constant NAME="RancidProvisioningAdapter"

See Also:
Constant Field Values
Constructor Detail

RancidProvisioningAdapter

public RancidProvisioningAdapter()
Method Detail

getTemplate

public org.springframework.transaction.support.TransactionTemplate getTemplate()

getTemplate

Returns:
a TransactionTemplate object.

setTemplate

public void setTemplate(org.springframework.transaction.support.TransactionTemplate template)

setTemplate

Parameters:
template - a TransactionTemplate object.

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception

afterPropertiesSet

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception - if any.

doAdd

public void doAdd(int nodeId,
                  org.opennms.rancid.ConnectionProperties cp,
                  boolean retry)
           throws ProvisioningAdapterException

doAdd

Parameters:
nodeId - a int.
cp - a ConnectionProperties object.
retry - a boolean.
Throws:
ProvisioningAdapterException - if any.

doUpdate

public void doUpdate(int nodeId,
                     org.opennms.rancid.ConnectionProperties cp,
                     boolean retry)
              throws ProvisioningAdapterException

doUpdate

Parameters:
nodeId - a int.
cp - a ConnectionProperties object.
retry - a boolean.
Throws:
ProvisioningAdapterException - if any.

doDelete

public void doDelete(int nodeId,
                     org.opennms.rancid.ConnectionProperties cp,
                     boolean retry)
              throws ProvisioningAdapterException

doDelete

Parameters:
nodeId - a int.
cp - a ConnectionProperties object.
retry - a boolean.
Throws:
ProvisioningAdapterException - if any.

doNodeConfigChanged

public void doNodeConfigChanged(int nodeId,
                                org.opennms.rancid.ConnectionProperties cp,
                                boolean retry)
                         throws ProvisioningAdapterException

doNodeConfigChanged

Parameters:
nodeId - a int.
cp - a ConnectionProperties object.
retry - a boolean.
Throws:
ProvisioningAdapterException - if any.

getNodeDao

public NodeDao getNodeDao()

getNodeDao

Returns:
a NodeDao object.

setNodeDao

public void setNodeDao(NodeDao dao)

setNodeDao

Parameters:
dao - a NodeDao object.

setEventForwarder

public void setEventForwarder(EventForwarder eventForwarder)

setEventForwarder

Parameters:
eventForwarder - a EventForwarder object.

getEventForwarder

public EventForwarder getEventForwarder()

getEventForwarder

Returns:
a EventForwarder object.

getRwsConfig

public RWSConfig getRwsConfig()

getRwsConfig

Returns:
a RWSConfig object.

setRwsConfig

public void setRwsConfig(RWSConfig rwsConfig)

setRwsConfig

Parameters:
rwsConfig - a RWSConfig object.

getRancidAdapterConfig

public RancidAdapterConfig getRancidAdapterConfig()

getRancidAdapterConfig

Returns:
a RancidAdapterConfig object.

setRancidAdapterConfig

public void setRancidAdapterConfig(RancidAdapterConfig rancidAdapterConfig)

setRancidAdapterConfig

Parameters:
rancidAdapterConfig - a RancidAdapterConfig object.

getName

public String getName()

getName

Specified by:
getName in interface ProvisioningAdapter
Specified by:
getName in class SimpleQueuedProvisioningAdapter
Returns:
a String object.

isNodeReady

public boolean isNodeReady(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperation op)
Adapters extending this class must implement this method. This method is called in the run method of an operation to insure that the adapter is ready for the operation to run for the associated node. The adapter is responsible for setting the schedule, however, something could have altered the state of readiness for the provisioning system in the meantime. If this method returns false, the operation is rescheduled with the and the attempts remaining on the operation are not decremented.

Specified by:
isNodeReady in class SimpleQueuedProvisioningAdapter
Parameters:
op - a SimpleQueuedProvisioningAdapter.AdapterOperation object.
Returns:
a boolean representing the state of readiness from the underlying system integrated by the implementing adapter.

processPendingOperationForNode

public void processPendingOperationForNode(org.opennms.netmgt.provision.SimpleQueuedProvisioningAdapter.AdapterOperation op)
                                    throws ProvisioningAdapterException
The class implements the API and therefore the concrete class implements this method to handle dequeued operations. The concrete implementation should check the operation type to derive the its behavior.

Specified by:
processPendingOperationForNode in class SimpleQueuedProvisioningAdapter
Parameters:
op - a SimpleQueuedProvisioningAdapter.AdapterOperation object.
Throws:
ProvisioningAdapterException - if any.

handleReloadConfigEvent

public void handleReloadConfigEvent(Event event)

handleReloadConfigEvent

Parameters:
event - a Event object.

handleRancidDownLoadFailure

public void handleRancidDownLoadFailure(Event e)

handleRancidDownLoadFailure

Parameters:
e - a Event object.

handleRancidDownLoadSuccess

public void handleRancidDownLoadSuccess(Event e)

handleRancidDownLoadSuccess

Parameters:
e - a Event object.

handleRancidGroupProcessingCompleted

public void handleRancidGroupProcessingCompleted(Event e)

handleRancidGroupProcessingCompleted

Parameters:
e - a Event object.


Copyright © 2011. All Rights Reserved.