@Service public class DefaultProvisionService extends Object implements ProvisionService, org.springframework.beans.factory.InitializingBean
Constructor and Description |
---|
DefaultProvisionService() |
Modifier and Type | Method and Description |
---|---|
OnmsMonitoredService |
addMonitoredService(Integer ipInterfaceId,
String svcName)
addMonitoredService
|
OnmsMonitoredService |
addMonitoredService(Integer nodeId,
String ipAddress,
String svcName)
addMonitoredService
|
void |
afterPropertiesSet() |
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,
String foreignSource)
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
|
Set<String> |
getCategoriesForNode(OnmsNode node) |
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 parentForeignSource,
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,
String rescanExisting)
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
|
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
Exception
public boolean isDiscoveryEnabled()
isDiscoveryEnabled
isDiscoveryEnabled
in interface ProvisionService
public boolean isRequisitionedEntityDeletionEnabled()
isRequisitionedEntityDeletionEnabled
in interface ProvisionService
@Transactional public void insertNode(OnmsNode node)
insertNode
in interface ProvisionService
node
- a OnmsNode
object.@Transactional public void updateNode(OnmsNode node, String rescanExisting)
updateNode
in interface ProvisionService
node
- The node that has been updated and should be written to the
databaserescanExisting
- true, if the node must be rescanned.
false, if the node should not be rescanned (perform only add/delete operations on the DB)
dbonly, if the node should not be rescanned (perform all DB operations)@Transactional public void deleteNode(Integer nodeId)
deleteNode
in interface ProvisionService
nodeId
- a Integer
object.@Transactional public void deleteInterface(Integer nodeId, String ipAddr)
deleteInterface
deleteInterface
in interface ProvisionService
nodeId
- a Integer
object.ipAddr
- a String
object.@Transactional public void deleteService(Integer nodeId, InetAddress addr, String service)
deleteService
deleteService
in interface ProvisionService
nodeId
- a Integer
object.addr
- a String
object.service
- a String
object.public boolean isRequisitioned(OnmsNode node)
public boolean isRequisitioned(OnmsIpInterface ip)
public boolean isRequisitioned(OnmsMonitoredService monSvc)
@Transactional public OnmsIpInterface updateIpInterfaceAttributes(Integer nodeId, OnmsIpInterface scannedIface)
updateIpInterfaceAttributes
updateIpInterfaceAttributes
in interface ProvisionService
nodeId
- a Integer
object.scannedIface
- a OnmsIpInterface
object.OnmsIpInterface
object.@Transactional public OnmsSnmpInterface updateSnmpInterfaceAttributes(Integer nodeId, OnmsSnmpInterface snmpInterface)
updateSnmpInterfaceAttributes
updateSnmpInterfaceAttributes
in interface ProvisionService
nodeId
- a Integer
object.snmpInterface
- a OnmsSnmpInterface
object.OnmsSnmpInterface
object.@Transactional public OnmsMonitoredService addMonitoredService(Integer ipInterfaceId, String svcName)
addMonitoredService
addMonitoredService
in interface ProvisionService
ipInterfaceId
- a Integer
object.svcName
- a String
object.OnmsMonitoredService
object.@Transactional public OnmsMonitoredService addMonitoredService(Integer nodeId, String ipAddress, String svcName)
addMonitoredService
addMonitoredService
in interface ProvisionService
nodeId
- a Integer
object.ipAddress
- a String
object.svcName
- a String
object.OnmsMonitoredService
object.@Transactional public OnmsMonitoredService updateMonitoredServiceState(Integer nodeId, String ipAddress, String svcName)
ProvisionService
updateMonitoredServiceState
updateMonitoredServiceState
in interface ProvisionService
nodeId
- a Integer
object.ipAddress
- a String
object.svcName
- a String
object.OnmsMonitoredService
object.@Transactional public void clearCache()
clearCache
clearCache
in interface ProvisionService
public OnmsDistPoller createDistPollerIfNecessary(String dpName, String dpAddr)
createDistPollerIfNecessary
in interface ProvisionService
dpName
- The name of the distPoller that is neededdpAddr
- The address to give the new distPoller if it is necessary to
create onepublic OnmsDistPoller createDistPollerIfNecessary(OnmsDistPoller scannedDistPoller)
@Transactional public OnmsNode getRequisitionedNode(String foreignSource, String foreignId) throws ForeignSourceRepositoryException
getRequisitionedNode
getRequisitionedNode
in interface ProvisionService
foreignSource
- a String
object.foreignId
- a String
object.OnmsNode
object.ForeignSourceRepositoryException
@Transactional public OnmsServiceType createServiceTypeIfNecessary(String serviceName)
createServiceTypeIfNecessary
in interface ProvisionService
serviceName
- the name of the OnmsServiceType to look up@Transactional public OnmsCategory createCategoryIfNecessary(String name)
createCategoryIfNecessary
in interface ProvisionService
name
- the name of the OnmsCategory to look up@Transactional(readOnly=true) public Map<String,Integer> getForeignIdToNodeIdMap(String foreignSource)
getForeignIdToNodeIdMap
in interface ProvisionService
foreignSource
- a String
object.Map
object.@Transactional public void setNodeParentAndDependencies(String foreignSource, String foreignId, String parentForeignSource, String parentForeignId, String parentNodeLabel)
setNodeParentAndDependencies
in interface ProvisionService
foreignSource
- the foreignSource to use when looking for the nodeId and
parentNodeId by foreignId.foreignId
- the foreignId for the node being setparentForeignId
- the foreignId of the parent nodeparentNodeLabel
- if the parent node cannot be found using its
foreignId then an attempt to locate it using the its nodeLabel
is made@Transactional(readOnly=true) public NodeScanSchedule getScheduleForNode(int nodeId, boolean force)
getScheduleForNode
getScheduleForNode
in interface ProvisionService
nodeId
- a int.force
- a boolean.NodeScanSchedule
object.@Transactional(readOnly=true) public List<NodeScanSchedule> getScheduleForNodes()
getScheduleForNodes
getScheduleForNodes
in interface ProvisionService
List
object.public void setForeignSourceRepository(ForeignSourceRepository foreignSourceRepository)
setForeignSourceRepository
setForeignSourceRepository
in interface ProvisionService
foreignSourceRepository
- a ForeignSourceRepository
object.public ForeignSourceRepository getForeignSourceRepository()
getForeignSourceRepository
ForeignSourceRepository
object.public Requisition loadRequisition(org.springframework.core.io.Resource resource)
loadRequisition
loadRequisition
in interface ProvisionService
resource
- a Resource
object.Requisition
object.@Transactional public OnmsNode updateNodeAttributes(OnmsNode node)
updateNodeAttributes
updateNodeAttributes
in interface ProvisionService
node
- a OnmsNode
object.OnmsNode
object.public List<ServiceDetector> getDetectorsForForeignSource(String foreignSourceName)
getDetectorsForForeignSource
getDetectorsForForeignSource
in interface ProvisionService
foreignSourceName
- a String
object.List
object.public List<NodePolicy> getNodePoliciesForForeignSource(String foreignSourceName)
getNodePoliciesForForeignSource
getNodePoliciesForForeignSource
in interface ProvisionService
foreignSourceName
- a String
object.List
object.public List<IpInterfacePolicy> getIpInterfacePoliciesForForeignSource(String foreignSourceName)
getIpInterfacePoliciesForForeignSource
getIpInterfacePoliciesForForeignSource
in interface ProvisionService
foreignSourceName
- a String
object.List
object.public List<SnmpInterfacePolicy> getSnmpInterfacePoliciesForForeignSource(String foreignSourceName)
getSnmpInterfacePoliciesForForeignSource
getSnmpInterfacePoliciesForForeignSource
in interface ProvisionService
foreignSourceName
- a String
object.List
object.public <T> List<T> getPluginsForForeignSource(Class<T> pluginClass, String foreignSourceName)
getPluginsForForeignSource
@Transactional public void deleteObsoleteInterfaces(Integer nodeId, Date scanStamp)
deleteObsoleteInterfaces
deleteObsoleteInterfaces
in interface ProvisionService
nodeId
- a Integer
object.scanStamp
- a Date
object.@Transactional public void updateNodeScanStamp(Integer nodeId, Date scanStamp)
updateNodeScanStamp
updateNodeScanStamp
in interface ProvisionService
nodeId
- a Integer
object.scanStamp
- a Date
object.@Transactional public OnmsIpInterface setIsPrimaryFlag(Integer nodeId, String ipAddress)
setIsPrimaryFlag
setIsPrimaryFlag
in interface ProvisionService
nodeId
- a Integer
object.ipAddress
- a String
object.OnmsIpInterface
object.@Transactional public OnmsIpInterface getPrimaryInterfaceForNode(OnmsNode node)
getPrimaryInterfaceForNode
getPrimaryInterfaceForNode
in interface ProvisionService
node
- a OnmsNode
object.OnmsIpInterface
object.@Transactional public OnmsNode createUndiscoveredNode(String ipAddress, String foreignSource)
createUndiscoveredNode
createUndiscoveredNode
in interface ProvisionService
ipAddress
- a String
object representing the IP Address.foreignSource
- a String
object representing the foreign source.OnmsNode
object.@Transactional public OnmsNode getNode(Integer nodeId)
getNode
getNode
in interface ProvisionService
nodeId
- a Integer
object.OnmsNode
object.@Transactional public OnmsNode getDbNodeInitCat(Integer nodeId)
getDbNodeInitCat
getDbNodeInitCat
in interface ProvisionService
nodeId
- a Integer
object.OnmsNode
object.Copyright © 2015. All rights reserved.