Class DefaultProvisionService
- java.lang.Object
-
- org.opennms.netmgt.provision.service.DefaultProvisionService
-
- All Implemented Interfaces:
ProvisionService,org.springframework.beans.factory.InitializingBean
@Service public class DefaultProvisionService extends Object implements ProvisionService, org.springframework.beans.factory.InitializingBean
DefaultProvisionService- Version:
- $Id: $
- Author:
- brozow
-
-
Field Summary
Fields Modifier and Type Field Description static StringPROVISIOND-
Fields inherited from interface org.opennms.netmgt.provision.service.ProvisionService
ABORT, DETECTOR_NAME, ERROR, FOREIGN_ID, FOREIGN_SOURCE, IP_ADDRESS, LOCATION, NODE_ID
-
-
Constructor Summary
Constructors Constructor Description DefaultProvisionService()
-
Method Summary
-
-
-
Field Detail
-
PROVISIOND
public static final String PROVISIOND
- See Also:
- Constant Field Values
-
-
Method Detail
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
isDiscoveryEnabled
public boolean isDiscoveryEnabled()
isDiscoveryEnabled
- Specified by:
isDiscoveryEnabledin interfaceProvisionService- Returns:
- a boolean.
-
insertNode
@Transactional public void insertNode(OnmsNode node, String monitorKey)
Insert the provided node into the database- Specified by:
insertNodein interfaceProvisionService
-
updateNode
@Transactional public void updateNode(OnmsNode node, String rescanExisting, String monitorKey)
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:
updateNodein interfaceProvisionService- Parameters:
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)
-
deleteNode
@Transactional public void deleteNode(Integer nodeId)
Delete the indicated node from the database.- Specified by:
deleteNodein interfaceProvisionService
-
deleteInterface
@Transactional public void deleteInterface(Integer nodeId, String ipAddr)
- Specified by:
deleteInterfacein interfaceProvisionService
-
deleteService
@Transactional public void deleteService(Integer nodeId, InetAddress addr, String svcName, boolean ignoreUnmanaged)
Delete the indicated service from the database. If the service is the last service on the interface, delete the interface as well. If the interface is the last interface on the node, delete the node as well.- Specified by:
deleteServicein interfaceProvisionService- Parameters:
nodeId- the node containing the serviceaddr- the IP address containing the servicesvcName- the service to deleteignoreUnmanaged- if true, cascade delete the containing interface if only unmanaged services remain
-
updateIpInterfaceAttributes
@Transactional public OnmsIpInterface updateIpInterfaceAttributes(Integer nodeId, OnmsIpInterface scannedIface, String monitorKey)
- Specified by:
updateIpInterfaceAttributesin interfaceProvisionService
-
updateSnmpInterfaceAttributes
@Transactional public OnmsSnmpInterface updateSnmpInterfaceAttributes(Integer nodeId, OnmsSnmpInterface snmpInterface)
- Specified by:
updateSnmpInterfaceAttributesin interfaceProvisionService
-
addMonitoredService
@Transactional public OnmsMonitoredService addMonitoredService(Integer ipInterfaceId, String svcName, String monitorKey)
- Specified by:
addMonitoredServicein interfaceProvisionService
-
addMonitoredService
@Transactional public OnmsMonitoredService addMonitoredService(Integer nodeId, String ipAddress, String svcName, String monitorKey)
- Specified by:
addMonitoredServicein interfaceProvisionService
-
updateMonitoredServiceState
@Transactional public OnmsMonitoredService updateMonitoredServiceState(Integer nodeId, String ipAddress, String svcName)
- Specified by:
updateMonitoredServiceStatein interfaceProvisionService
-
clearCache
@Transactional public void clearCache()
clearCache
- Specified by:
clearCachein interfaceProvisionService
-
createLocationIfNecessary
public OnmsMonitoringLocation createLocationIfNecessary(String locationName)
Description copied from interface:ProvisionServiceLookup a monitoring location in the database, creating it if necessary. This method looks up theOnmsMonitoringLocationobject with the ID 'locationId' in the database and returns it. If there is noOnmsMonitoringLocationwith that name then one is created using the name provided, saved in the database, and returned.- Specified by:
createLocationIfNecessaryin interfaceProvisionService- Parameters:
locationName- The ID of theOnmsMonitoringLocationthat is needed- Returns:
- a new
OnmsMonitoringLocationthat will be saved to the database when the transaction is committed.
-
createLocationDefIfNecessary
protected OnmsMonitoringLocation createLocationDefIfNecessary(OnmsMonitoringLocation location)
-
getRequisitionedNode
@Transactional public OnmsNode getRequisitionedNode(String foreignSource, String foreignId) throws ForeignSourceRepositoryException
- Specified by:
getRequisitionedNodein interfaceProvisionService- 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:
createServiceTypeIfNecessaryin interfaceProvisionService- 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:
createCategoryIfNecessaryin interfaceProvisionService- Parameters:
name- the name of the OnmsCategory to look up- Returns:
- an OnmsCategory 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:
getForeignIdToNodeIdMapin interfaceProvisionService
-
setNodeParentAndDependencies
@Transactional public 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. The foreignId is used to reference the node and the parentForeignId and the parentNodeLabel are used to locate the parentNodeId- Specified by:
setNodeParentAndDependenciesin interfaceProvisionService- Parameters:
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
-
getScheduleForNode
@Transactional(readOnly=true) public NodeScanSchedule getScheduleForNode(int nodeId, boolean force, String monitorKey)
- Specified by:
getScheduleForNodein interfaceProvisionService
-
getScheduleForNodes
@Transactional(readOnly=true) public List<NodeScanSchedule> getScheduleForNodes(String monitorKey)
getScheduleForNodes
- Specified by:
getScheduleForNodesin interfaceProvisionService- Returns:
- a
Listobject.
-
setForeignSourceRepository
public void setForeignSourceRepository(ForeignSourceRepository foreignSourceRepository)
- Specified by:
setForeignSourceRepositoryin interfaceProvisionService
-
getForeignSourceRepository
public ForeignSourceRepository getForeignSourceRepository()
getForeignSourceRepository
- Returns:
- a
ForeignSourceRepositoryobject.
-
loadRequisition
public Requisition loadRequisition(org.springframework.core.io.Resource resource)
- Specified by:
loadRequisitionin interfaceProvisionService
-
updateNodeAttributes
@Transactional public OnmsNode updateNodeAttributes(OnmsNode node)
- Specified by:
updateNodeAttributesin interfaceProvisionService
-
getDetectorsForForeignSource
public List<PluginConfig> getDetectorsForForeignSource(String foreignSourceName)
- Specified by:
getDetectorsForForeignSourcein interfaceProvisionService
-
getNodePoliciesForForeignSource
public List<NodePolicy> getNodePoliciesForForeignSource(String foreignSourceName)
- Specified by:
getNodePoliciesForForeignSourcein interfaceProvisionService
-
getIpInterfacePoliciesForForeignSource
public List<IpInterfacePolicy> getIpInterfacePoliciesForForeignSource(String foreignSourceName)
- Specified by:
getIpInterfacePoliciesForForeignSourcein interfaceProvisionService
-
getSnmpInterfacePoliciesForForeignSource
public List<SnmpInterfacePolicy> getSnmpInterfacePoliciesForForeignSource(String foreignSourceName)
- Specified by:
getSnmpInterfacePoliciesForForeignSourcein interfaceProvisionService
-
getPluginsForForeignSource
public <T> List<T> getPluginsForForeignSource(Class<T> pluginClass, String foreignSourceName)
getPluginsForForeignSource
-
deleteObsoleteInterfaces
@Transactional public void deleteObsoleteInterfaces(Integer nodeId, Date scanStamp)
- Specified by:
deleteObsoleteInterfacesin interfaceProvisionService
-
updateNodeScanStamp
@Transactional public void updateNodeScanStamp(Integer nodeId, Date scanStamp)
- Specified by:
updateNodeScanStampin interfaceProvisionService
-
setIsPrimaryFlag
@Transactional public OnmsIpInterface setIsPrimaryFlag(Integer nodeId, String ipAddress)
- Specified by:
setIsPrimaryFlagin interfaceProvisionService
-
getPrimaryInterfaceForNode
@Transactional public OnmsIpInterface getPrimaryInterfaceForNode(OnmsNode node)
- Specified by:
getPrimaryInterfaceForNodein interfaceProvisionService
-
createUndiscoveredNode
@Transactional public OnmsNode createUndiscoveredNode(String ipAddress, String foreignSource, String locationString, String monitorKey)
- Specified by:
createUndiscoveredNodein interfaceProvisionService
-
getNode
@Transactional public OnmsNode getNode(Integer nodeId)
- Specified by:
getNodein interfaceProvisionService
-
getDbNodeInitCat
@Transactional public OnmsNode getDbNodeInitCat(Integer nodeId)
- Specified by:
getDbNodeInitCatin interfaceProvisionService
-
setHostnameResolver
public void setHostnameResolver(HostnameResolver resolver)
- Specified by:
setHostnameResolverin interfaceProvisionService
-
getHostnameResolver
public HostnameResolver getHostnameResolver()
- Specified by:
getHostnameResolverin interfaceProvisionService
-
getLocationAwareDetectorClient
public LocationAwareDetectorClient getLocationAwareDetectorClient()
- Specified by:
getLocationAwareDetectorClientin interfaceProvisionService
-
getLocationAwareSnmpClient
public LocationAwareSnmpClient getLocationAwareSnmpClient()
- Specified by:
getLocationAwareSnmpClientin interfaceProvisionService
-
getSnmpProfileMapper
public SnmpProfileMapper getSnmpProfileMapper()
- Specified by:
getSnmpProfileMapperin interfaceProvisionService
-
setSnmpProfileMapper
public void setSnmpProfileMapper(SnmpProfileMapper snmpProfileMapper)
- Specified by:
setSnmpProfileMapperin interfaceProvisionService
-
setTracer
public void setTracer(io.opentracing.Tracer tracer)
- Specified by:
setTracerin interfaceProvisionService
-
getLocationAwareDnsLookupClient
public LocationAwareDnsLookupClient getLocationAwareDnsLookupClient()
- Specified by:
getLocationAwareDnsLookupClientin interfaceProvisionService
-
setMonitoringLocationDao
public void setMonitoringLocationDao(MonitoringLocationDao dao)
-
setNodeDao
public void setNodeDao(NodeDao dao)
-
setIpInterfaceDao
public void setIpInterfaceDao(IpInterfaceDao dao)
-
setSnmpInterfaceDao
public void setSnmpInterfaceDao(SnmpInterfaceDao dao)
-
setMonitoredServiceDao
public void setMonitoredServiceDao(MonitoredServiceDao dao)
-
setServiceTypeDao
public void setServiceTypeDao(ServiceTypeDao dao)
-
setEventForwarder
public void setEventForwarder(EventForwarder eventForwarder)
-
buildAndStartSpan
public io.opentracing.Span buildAndStartSpan(String name, io.opentracing.SpanContext spanContext)
- Specified by:
buildAndStartSpanin interfaceProvisionService
-
-