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

Version:
$Id: $
Author:
brozow

Constructor Summary
DefaultProvisionService()
           
 
Method Summary
 OnmsMonitoredService addMonitoredService(Integer ipInterfaceId, String svcName)
          addMonitoredService
 OnmsMonitoredService addMonitoredService(Integer nodeId, String ipAddress, String svcName)
          addMonitoredService
 void clearCache()
          clearCache
 OnmsCategory createCategoryIfNecessary(String name)
          Look up the OnmsCategory with the give name, creating one if none exists.
 OnmsDistPoller createDistPollerIfNecessary(OnmsDistPoller scannedDistPoller)
           
 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.
 OnmsNode createUndiscoveredNode(String ipAddress)
          createUndiscoveredNode
 void deleteInterface(Integer nodeId, String ipAddr)
          deleteInterface
 void deleteNode(Integer nodeId)
          Delete the indicated node form the database.
 void deleteObsoleteInterfaces(Integer nodeId, Date scanStamp)
          deleteObsoleteInterfaces
 void deleteService(Integer nodeId, InetAddress addr, String service)
          deleteService
 OnmsNode getDbNodeInitCat(Integer nodeId)
          getDbNodeInitCat
 List<ServiceDetector> getDetectorsForForeignSource(String foreignSourceName)
          getDetectorsForForeignSource
 Map<String,Integer> getForeignIdToNodeIdMap(String foreignSource)
          Creates a map of foreignIds to nodeIds for all nodes that have the indicated foreignSorce.
 ForeignSourceRepository getForeignSourceRepository()
          getForeignSourceRepository
 List<IpInterfacePolicy> getIpInterfacePoliciesForForeignSource(String foreignSourceName)
          getIpInterfacePoliciesForForeignSource
 OnmsNode getNode(Integer nodeId)
          getNode
 List<NodePolicy> getNodePoliciesForForeignSource(String foreignSourceName)
          getNodePoliciesForForeignSource
<T> List<T>
getPluginsForForeignSource(Class<T> pluginClass, String foreignSourceName)
          getPluginsForForeignSource
 OnmsIpInterface getPrimaryInterfaceForNode(OnmsNode node)
          getPrimaryInterfaceForNode
 OnmsNode getRequisitionedNode(String foreignSource, String foreignId)
          getRequisitionedNode
 NodeScanSchedule getScheduleForNode(int nodeId, boolean force)
          getScheduleForNode
 List<NodeScanSchedule> getScheduleForNodes()
          getScheduleForNodes
 List<SnmpInterfacePolicy> getSnmpInterfacePoliciesForForeignSource(String foreignSourceName)
          getSnmpInterfacePoliciesForForeignSource
 void insertNode(OnmsNode node)
          Insert the provided node into the database
 boolean isDiscoveryEnabled()
          isDiscoveryEnabled
 boolean isRequisitioned(OnmsIpInterface ip)
           
 boolean isRequisitioned(OnmsMonitoredService monSvc)
           
 boolean isRequisitioned(OnmsNode node)
           
 boolean isRequisitionedEntityDeletionEnabled()
           
 Requisition loadRequisition(org.springframework.core.io.Resource resource)
          loadRequisition
 void setForeignSourceRepository(ForeignSourceRepository foreignSourceRepository)
          setForeignSourceRepository
 OnmsIpInterface setIsPrimaryFlag(Integer nodeId, String ipAddress)
          setIsPrimaryFlag
 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)
          updateIpInterfaceAttributes
 OnmsMonitoredService updateMonitoredServiceState(Integer nodeId, String ipAddress, String svcName)
          updateMonitoredServiceState
 void updateNode(OnmsNode node)
          Update the database entry for the given node.
 OnmsNode updateNodeAttributes(OnmsNode node)
          updateNodeAttributes
 void updateNodeScanStamp(Integer nodeId, Date scanStamp)
          updateNodeScanStamp
 OnmsSnmpInterface updateSnmpInterfaceAttributes(Integer nodeId, OnmsSnmpInterface snmpInterface)
          updateSnmpInterfaceAttributes
 
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

isDiscoveryEnabled

public boolean isDiscoveryEnabled()

isDiscoveryEnabled

Specified by:
isDiscoveryEnabled in interface ProvisionService
Returns:
a boolean.

isRequisitionedEntityDeletionEnabled

public boolean isRequisitionedEntityDeletionEnabled()
Specified by:
isRequisitionedEntityDeletionEnabled in interface ProvisionService

insertNode

@Transactional
public void insertNode(OnmsNode node)
Insert the provided node into the database

Specified by:
insertNode in interface ProvisionService
Parameters:
node - a OnmsNode object.

updateNode

@Transactional
public void updateNode(OnmsNode node)
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)
Delete the indicated node form the database.

Specified by:
deleteNode in interface ProvisionService
Parameters:
nodeId - a Integer object.

deleteInterface

@Transactional
public void deleteInterface(Integer nodeId,
                                          String ipAddr)

deleteInterface

Specified by:
deleteInterface in interface ProvisionService
Parameters:
nodeId - a Integer object.
ipAddr - a String object.

deleteService

@Transactional
public void deleteService(Integer nodeId,
                                        InetAddress addr,
                                        String service)

deleteService

Specified by:
deleteService in interface ProvisionService
Parameters:
nodeId - a Integer object.
addr - a String object.
service - a String object.

isRequisitioned

public boolean isRequisitioned(OnmsNode node)

isRequisitioned

public boolean isRequisitioned(OnmsIpInterface ip)

isRequisitioned

public boolean isRequisitioned(OnmsMonitoredService monSvc)

updateIpInterfaceAttributes

@Transactional
public OnmsIpInterface updateIpInterfaceAttributes(Integer nodeId,
                                                                 OnmsIpInterface scannedIface)

updateIpInterfaceAttributes

Specified by:
updateIpInterfaceAttributes in interface ProvisionService
Parameters:
nodeId - a Integer object.
scannedIface - a OnmsIpInterface object.
Returns:
a OnmsIpInterface object.

updateSnmpInterfaceAttributes

@Transactional
public OnmsSnmpInterface updateSnmpInterfaceAttributes(Integer nodeId,
                                                                     OnmsSnmpInterface snmpInterface)

updateSnmpInterfaceAttributes

Specified by:
updateSnmpInterfaceAttributes in interface ProvisionService
Parameters:
nodeId - a Integer object.
snmpInterface - a OnmsSnmpInterface object.
Returns:
a OnmsSnmpInterface object.

addMonitoredService

@Transactional
public OnmsMonitoredService addMonitoredService(Integer ipInterfaceId,
                                                              String svcName)

addMonitoredService

Specified by:
addMonitoredService in interface ProvisionService
Parameters:
ipInterfaceId - a Integer object.
svcName - a String object.
Returns:
a OnmsMonitoredService object.

addMonitoredService

@Transactional
public OnmsMonitoredService addMonitoredService(Integer nodeId,
                                                              String ipAddress,
                                                              String svcName)

addMonitoredService

Specified by:
addMonitoredService in interface ProvisionService
Parameters:
nodeId - a Integer object.
ipAddress - a String object.
svcName - a String object.
Returns:
a OnmsMonitoredService object.

updateMonitoredServiceState

@Transactional
public OnmsMonitoredService updateMonitoredServiceState(Integer nodeId,
                                                                      String ipAddress,
                                                                      String svcName)
Description copied from interface: ProvisionService

updateMonitoredServiceState

Specified by:
updateMonitoredServiceState in interface ProvisionService
Parameters:
nodeId - a Integer object.
ipAddress - a String object.
svcName - a String object.
Returns:
a OnmsMonitoredService object.

clearCache

@Transactional
public void clearCache()

clearCache

Specified by:
clearCache in interface ProvisionService

createDistPollerIfNecessary

public OnmsDistPoller createDistPollerIfNecessary(String dpName,
                                                  String dpAddr)
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.

createDistPollerIfNecessary

public OnmsDistPoller createDistPollerIfNecessary(OnmsDistPoller scannedDistPoller)

getRequisitionedNode

@Transactional
public OnmsNode getRequisitionedNode(String foreignSource,
                                                   String foreignId)
                              throws ForeignSourceRepositoryException

getRequisitionedNode

Specified by:
getRequisitionedNode in interface ProvisionService
Parameters:
foreignSource - a String object.
foreignId - a String object.
Returns:
a OnmsNode object.
Throws:
ForeignSourceRepositoryException

createServiceTypeIfNecessary

@Transactional
public OnmsServiceType createServiceTypeIfNecessary(String serviceName)
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)
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)
Creates a map of foreignIds to nodeIds for all nodes that have the indicated foreignSorce.

Specified by:
getForeignIdToNodeIdMap in interface ProvisionService
Parameters:
foreignSource - a String object.
Returns:
a Map object.

setNodeParentAndDependencies

@Transactional
public 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. 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

@Transactional(readOnly=true)
public NodeScanSchedule getScheduleForNode(int nodeId,
                                                         boolean force)

getScheduleForNode

Specified by:
getScheduleForNode in interface ProvisionService
Parameters:
nodeId - a int.
force - a boolean.
Returns:
a NodeScanSchedule object.

getScheduleForNodes

@Transactional(readOnly=true)
public List<NodeScanSchedule> getScheduleForNodes()

getScheduleForNodes

Specified by:
getScheduleForNodes in interface ProvisionService
Returns:
a List object.

setForeignSourceRepository

public void setForeignSourceRepository(ForeignSourceRepository foreignSourceRepository)

setForeignSourceRepository

Specified by:
setForeignSourceRepository in interface ProvisionService
Parameters:
foreignSourceRepository - a ForeignSourceRepository object.

getForeignSourceRepository

public ForeignSourceRepository getForeignSourceRepository()

getForeignSourceRepository

Returns:
a ForeignSourceRepository object.

loadRequisition

public Requisition loadRequisition(org.springframework.core.io.Resource resource)

loadRequisition

Specified by:
loadRequisition in interface ProvisionService
Parameters:
resource - a Resource object.
Returns:
a Requisition object.

updateNodeAttributes

@Transactional
public OnmsNode updateNodeAttributes(OnmsNode node)

updateNodeAttributes

Specified by:
updateNodeAttributes in interface ProvisionService
Parameters:
node - a OnmsNode object.
Returns:
a OnmsNode object.

getDetectorsForForeignSource

public List<ServiceDetector> getDetectorsForForeignSource(String foreignSourceName)

getDetectorsForForeignSource

Specified by:
getDetectorsForForeignSource in interface ProvisionService
Parameters:
foreignSourceName - a String object.
Returns:
a List object.

getNodePoliciesForForeignSource

public List<NodePolicy> getNodePoliciesForForeignSource(String foreignSourceName)

getNodePoliciesForForeignSource

Specified by:
getNodePoliciesForForeignSource in interface ProvisionService
Parameters:
foreignSourceName - a String object.
Returns:
a List object.

getIpInterfacePoliciesForForeignSource

public List<IpInterfacePolicy> getIpInterfacePoliciesForForeignSource(String foreignSourceName)

getIpInterfacePoliciesForForeignSource

Specified by:
getIpInterfacePoliciesForForeignSource in interface ProvisionService
Parameters:
foreignSourceName - a String object.
Returns:
a List object.

getSnmpInterfacePoliciesForForeignSource

public List<SnmpInterfacePolicy> getSnmpInterfacePoliciesForForeignSource(String foreignSourceName)

getSnmpInterfacePoliciesForForeignSource

Specified by:
getSnmpInterfacePoliciesForForeignSource in interface ProvisionService
Parameters:
foreignSourceName - a String object.
Returns:
a List object.

getPluginsForForeignSource

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

getPluginsForForeignSource

Type Parameters:
T - a T object.
Parameters:
pluginClass - a Class object.
foreignSourceName - a String object.
Returns:
a List object.

deleteObsoleteInterfaces

@Transactional
public void deleteObsoleteInterfaces(Integer nodeId,
                                                   Date scanStamp)

deleteObsoleteInterfaces

Specified by:
deleteObsoleteInterfaces in interface ProvisionService
Parameters:
nodeId - a Integer object.
scanStamp - a Date object.

updateNodeScanStamp

@Transactional
public void updateNodeScanStamp(Integer nodeId,
                                              Date scanStamp)

updateNodeScanStamp

Specified by:
updateNodeScanStamp in interface ProvisionService
Parameters:
nodeId - a Integer object.
scanStamp - a Date object.

setIsPrimaryFlag

@Transactional
public OnmsIpInterface setIsPrimaryFlag(Integer nodeId,
                                                      String ipAddress)

setIsPrimaryFlag

Specified by:
setIsPrimaryFlag in interface ProvisionService
Parameters:
nodeId - a Integer object.
ipAddress - a String object.
Returns:
a OnmsIpInterface object.

getPrimaryInterfaceForNode

@Transactional
public OnmsIpInterface getPrimaryInterfaceForNode(OnmsNode node)

getPrimaryInterfaceForNode

Specified by:
getPrimaryInterfaceForNode in interface ProvisionService
Parameters:
node - a OnmsNode object.
Returns:
a OnmsIpInterface object.

createUndiscoveredNode

@Transactional
public OnmsNode createUndiscoveredNode(String ipAddress)

createUndiscoveredNode

Specified by:
createUndiscoveredNode in interface ProvisionService
Parameters:
ipAddress - a String object.
Returns:
a OnmsNode object.

getNode

@Transactional
public OnmsNode getNode(Integer nodeId)

getNode

Specified by:
getNode in interface ProvisionService
Parameters:
nodeId - a Integer object.
Returns:
a OnmsNode object.

getDbNodeInitCat

@Transactional
public OnmsNode getDbNodeInitCat(Integer nodeId)

getDbNodeInitCat

Specified by:
getDbNodeInitCat in interface ProvisionService
Parameters:
nodeId - a Integer object.
Returns:
a OnmsNode object.


Copyright © 2011. All Rights Reserved.