org.opennms.netmgt.provision.service
Class DefaultProvisionService

java.lang.Object
  extended by org.opennms.netmgt.provision.service.DefaultProvisionService
All Implemented Interfaces:
ProvisionService

@Service
public class DefaultProvisionService
extends Object
implements ProvisionService

DefaultProvisionService

Author:
brozow

Constructor Summary
DefaultProvisionService()
           
 
Method Summary
 OnmsMonitoredService addMonitoredService(Integer ipInterfaceId, String svcName)
           
 OnmsMonitoredService addMonitoredService(Integer nodeId, String ipAddress, String svcName)
           
 void clearCache()
          Clear the Hibernate object cache.
 OnmsCategory createCategoryIfNecessary(String name)
          Look up the OnmsCategory with the give name, creating one if none exists.
 OnmsDistPoller createDistPollerIfNecessary(String dpName, String dpAddr)
          Lookup a distPoller in the database, creating it if necessary.
 OnmsServiceType createServiceTypeIfNecessary(String serviceName)
          Look up the OnmsServiceType with the given name, creating one if it doesn't exist.
 void deleteNode(Integer nodeId)
          Delete the indicated node form the database.
 void deleteObsoleteInterfaces(Integer nodeId, Date scanStamp)
           
 List<ServiceDetector> getDetectorsForForeignSource(String foreignSourceName)
           
 Map<String,Integer> getForeignIdToNodeIdMap(String foreignSource)
          Creates a map of foreignIds to nodeIds for all nodes that have the indicated foreignSorce.
 ForeignSourceRepository getForeignSourceRepository()
           
 List<IpInterfacePolicy> getIpInterfacePoliciesForForeignSource(String foreignSourceName)
           
 List<NodePolicy> getNodePoliciesForForeignSource(String foreignSourceName)
           
<T> List<T>
getPluginsForForeignSource(Class<T> pluginClass, String foreignSourceName)
           
 OnmsNode getRequisitionedNode(String foreignSource, String foreignId)
           
 NodeScanSchedule getScheduleForNode(int nodeId, boolean force)
           
 List<NodeScanSchedule> getScheduleForNodes()
          Returns a list of scheduled nodes.
 List<SnmpInterfacePolicy> getSnmpInterfacePoliciesForForeignSource(String foreignSourceName)
           
 void insertNode(OnmsNode node)
          Insert the provided node into the database
 Requisition loadRequisition(org.springframework.core.io.Resource resource)
           
 void setForeignSourceRepository(ForeignSourceRepository foriengSourceRepository)
           
 void setNodeParentAndDependencies(String foreignSource, String foreignId, String parentForeignId, String parentNodeLabel)
          Sets the parent of the node and adds the relationship to the path element for the node.
 OnmsIpInterface updateIpInterfaceAttributes(Integer nodeId, OnmsIpInterface scannedIface)
           
 void updateNode(OnmsNode node)
          Update the database entry for the given node.
 OnmsNode updateNodeAttributes(OnmsNode node)
           
 void updateNodeScanStamp(Integer nodeId, Date scanStamp)
           
 OnmsSnmpInterface updateSnmpInterfaceAttributes(Integer nodeId, OnmsSnmpInterface snmpInterface)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultProvisionService

public DefaultProvisionService()
Method Detail

insertNode

@Transactional
public void insertNode(OnmsNode node)
Description copied from interface: ProvisionService
Insert the provided node into the database

Specified by:
insertNode in interface ProvisionService

updateNode

@Transactional
public void updateNode(OnmsNode node)
Description copied from interface: ProvisionService
Update the database entry for the given node. The node supplied is used to update the database. Entries that have been change in the node are copied into the database. It is assumed that the node passed in has been previously loaded from the database and modified.

Specified by:
updateNode in interface ProvisionService
Parameters:
node - The node that has been updated and should be written to the database

deleteNode

@Transactional
public void deleteNode(Integer nodeId)
Description copied from interface: ProvisionService
Delete the indicated node form the database.

Specified by:
deleteNode in interface ProvisionService

updateIpInterfaceAttributes

public OnmsIpInterface updateIpInterfaceAttributes(Integer nodeId,
                                                   OnmsIpInterface scannedIface)
Specified by:
updateIpInterfaceAttributes in interface ProvisionService

updateSnmpInterfaceAttributes

public OnmsSnmpInterface updateSnmpInterfaceAttributes(Integer nodeId,
                                                       OnmsSnmpInterface snmpInterface)
Specified by:
updateSnmpInterfaceAttributes in interface ProvisionService

addMonitoredService

public OnmsMonitoredService addMonitoredService(Integer ipInterfaceId,
                                                String svcName)
Specified by:
addMonitoredService in interface ProvisionService

addMonitoredService

public OnmsMonitoredService addMonitoredService(Integer nodeId,
                                                String ipAddress,
                                                String svcName)
Specified by:
addMonitoredService in interface ProvisionService

clearCache

public void clearCache()
Description copied from interface: ProvisionService
Clear the Hibernate object cache. This is used to clear the object cache created by Hibernate. This is needed so large imports don't end up caching the entire database when it has no intention of using a node's data again. This is needed only to help memory performance.

Specified by:
clearCache in interface ProvisionService

createDistPollerIfNecessary

@Transactional
public OnmsDistPoller createDistPollerIfNecessary(String dpName,
                                                                String dpAddr)
Description copied from interface: ProvisionService
Lookup a distPoller in the database, creating it if necessary. This method looks up the OnmsDistPoller object with the name 'dpName' in the database and returns it. If there is not distPoller with that name that one is created using the name and the address provided, saved in the database, and returned.

Specified by:
createDistPollerIfNecessary in interface ProvisionService
Parameters:
dpName - The name of the distPoller that is needed
dpAddr - The address to give the new distPoller if it is necessary to create one
Returns:
a new distPoller that will be saved to the database when the transaction is committed.

getRequisitionedNode

@Transactional
public OnmsNode getRequisitionedNode(String foreignSource,
                                                   String foreignId)
                              throws ForeignSourceRepositoryException
Specified by:
getRequisitionedNode in interface ProvisionService
Throws:
ForeignSourceRepositoryException

createServiceTypeIfNecessary

@Transactional
public OnmsServiceType createServiceTypeIfNecessary(String serviceName)
Description copied from interface: ProvisionService
Look up the OnmsServiceType with the given name, creating one if it doesn't exist.

Specified by:
createServiceTypeIfNecessary in interface ProvisionService
Parameters:
serviceName - the name of the OnmsServiceType to look up
Returns:
a OnmsServiceType object with the given name, if none existed in the database then a new one will been created and saved in the database.

createCategoryIfNecessary

@Transactional
public OnmsCategory createCategoryIfNecessary(String name)
Description copied from interface: ProvisionService
Look up the OnmsCategory with the give name, creating one if none exists.

Specified by:
createCategoryIfNecessary in interface ProvisionService
Parameters:
name - the name of the OnmsCategory to look up
Returns:
a OnmsCategor that represents the given name, if none existed in the database a new one will have been created.

getForeignIdToNodeIdMap

@Transactional(readOnly=true)
public Map<String,Integer> getForeignIdToNodeIdMap(String foreignSource)
Description copied from interface: ProvisionService
Creates a map of foreignIds to nodeIds for all nodes that have the indicated foreignSorce.

Specified by:
getForeignIdToNodeIdMap in interface ProvisionService

setNodeParentAndDependencies

@Transactional
public void setNodeParentAndDependencies(String foreignSource,
                                                       String foreignId,
                                                       String parentForeignId,
                                                       String parentNodeLabel)
Description copied from interface: ProvisionService
Sets the parent of the node and adds the relationship to the path element for the node. The foreignId is used to reference the node and the parentForeignId and the parentNodeLabel are used to locate the parentNodeId

Specified by:
setNodeParentAndDependencies in interface ProvisionService
Parameters:
foreignSource - the foreignSource to use when looking for the nodeId and parentNodeId by foreignId.
foreignId - the foreignId for the node being set
parentForeignId - the foreignId of the parent node
parentNodeLabel - if the parent node cannot be found using its foreignId then an attempt to locate it using the its nodeLabel is made

getScheduleForNode

public NodeScanSchedule getScheduleForNode(int nodeId,
                                           boolean force)
Specified by:
getScheduleForNode in interface ProvisionService

getScheduleForNodes

public List<NodeScanSchedule> getScheduleForNodes()
Description copied from interface: ProvisionService
Returns a list of scheduled nodes.

Specified by:
getScheduleForNodes in interface ProvisionService
Returns:

setForeignSourceRepository

public void setForeignSourceRepository(ForeignSourceRepository foriengSourceRepository)
Specified by:
setForeignSourceRepository in interface ProvisionService

getForeignSourceRepository

public ForeignSourceRepository getForeignSourceRepository()

loadRequisition

public Requisition loadRequisition(org.springframework.core.io.Resource resource)
Specified by:
loadRequisition in interface ProvisionService
Returns:

updateNodeAttributes

public OnmsNode updateNodeAttributes(OnmsNode node)
Specified by:
updateNodeAttributes in interface ProvisionService

getDetectorsForForeignSource

public List<ServiceDetector> getDetectorsForForeignSource(String foreignSourceName)
Specified by:
getDetectorsForForeignSource in interface ProvisionService

getNodePoliciesForForeignSource

public List<NodePolicy> getNodePoliciesForForeignSource(String foreignSourceName)
Specified by:
getNodePoliciesForForeignSource in interface ProvisionService

getIpInterfacePoliciesForForeignSource

public List<IpInterfacePolicy> getIpInterfacePoliciesForForeignSource(String foreignSourceName)
Specified by:
getIpInterfacePoliciesForForeignSource in interface ProvisionService

getSnmpInterfacePoliciesForForeignSource

public List<SnmpInterfacePolicy> getSnmpInterfacePoliciesForForeignSource(String foreignSourceName)
Specified by:
getSnmpInterfacePoliciesForForeignSource in interface ProvisionService

getPluginsForForeignSource

public <T> List<T> getPluginsForForeignSource(Class<T> pluginClass,
                                              String foreignSourceName)

deleteObsoleteInterfaces

public void deleteObsoleteInterfaces(Integer nodeId,
                                     Date scanStamp)
Specified by:
deleteObsoleteInterfaces in interface ProvisionService

updateNodeScanStamp

public void updateNodeScanStamp(Integer nodeId,
                                Date scanStamp)
Specified by:
updateNodeScanStamp in interface ProvisionService


Copyright © 2009. All Rights Reserved.