Class Provisioner
- java.lang.Object
-
- org.opennms.netmgt.provision.service.Provisioner
-
- All Implemented Interfaces:
SpringServiceDaemon
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.InitializingBean
public class Provisioner extends java.lang.Object implements SpringServiceDaemon
Massively Parallel Java ProvisioningServiceDaemon
for OpenNMS.- Author:
- Mathew Brozowski
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NAME
ConstantNAME="Provisiond"
-
Constructor Summary
Constructors Constructor Description Provisioner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addToScheduleQueue(NodeScanSchedule schedule)
addToScheduleQueuevoid
afterPropertiesSet()
afterPropertiesSetprotected void
checkNodeListForRemovals(java.util.List<NodeScanSchedule> schedules)
checkNodeListForRemovalsForceRescanScan
createForceRescanScan(java.lang.Integer nodeId)
createForceRescanScanNewSuspectScan
createNewSuspectScan(java.net.InetAddress ipAddress, java.lang.String foreignSource, java.lang.String location)
createNewSuspectScanNodeScan
createNodeScan(java.lang.Integer nodeId, java.lang.String foreignSource, java.lang.String foreignId, OnmsMonitoringLocation location)
createNodeScanvoid
destroy()
destroyvoid
doImport(java.lang.String url, java.lang.String rescanExisting)
doImportvoid
doImport(IEvent event)
Begins importing from resource specified in model-importer.properties file or in event parameter: url.protected java.lang.String
getEventForeignSource(Event event)
getEventForeignSourceEventForwarder
getEventForwarder()
getEventForwarderImportScheduler
getImportSchedule()
getImportScheduleMonitoringSystemDao
getMonitoringSystemDao()
java.util.concurrent.ExecutorService
getNewSuspectExecutor()
ProvisionService
getProvisionService()
getProvisionServicejava.util.concurrent.ScheduledFuture<?>
getScheduledFutureForNode(int nodeId)
getScheduledFutureForNodeint
getScheduleLength()
getScheduleLengthjava.lang.String
getStats()
getStatsvoid
handleAddNode(IEvent event)
handleAddNodevoid
handleDeleteInterface(IEvent event)
handleDeleteInterfacevoid
handleDeleteNode(IEvent event)
handleDeleteNodevoid
handleDeleteService(IEvent event)
handleDeleteServicevoid
handleForceRescan(IEvent e)
handleForceRescanvoid
handleNewSuspectEvent(IEvent event)
void
handleNodeAddedEvent(IEvent e)
handleNodeAddedEventvoid
handleNodeDeletedEvent(IEvent e)
handleNodeDeletedEventvoid
handleNodeUpdated(IEvent e)
handleNodeUpdatedvoid
handleReloadConfigEvent(IEvent e)
handleReloadConfigEventprotected void
importModelFromResource(org.springframework.core.io.Resource resource, java.lang.String rescanExisting)
importModelFromResourceprotected RequisitionImport
importModelFromResource(org.springframework.core.io.Resource resource, java.lang.String rescanExisting, ProvisionMonitor monitor)
importModelFromResourceprotected void
removeFromScheduleQueue(java.util.List<java.lang.Integer> nodeIds)
removeFromScheduleQueueprotected void
removeNodeFromScheduleQueue(java.lang.Integer nodeId)
removeNodeFromScheduleQueueprotected void
scheduleRescanForExistingNodes()
scheduleRescanForExistingNodesvoid
setAgentConfigFactory(SnmpAgentConfigFactory agentConfigFactory)
setAgentConfigFactoryvoid
setEventForwarder(EventForwarder eventForwarder)
setEventForwardervoid
setImportActivities(CoreImportActivities importActivities)
setImportActivitiesvoid
setImportSchedule(ImportScheduler schedule)
setImportSchedulevoid
setLifeCycleRepository(LifeCycleRepository lifeCycleRepository)
setLifeCycleRepositoryvoid
setMonitoringSystemDao(MonitoringSystemDao monitoringSystemDao)
void
setProvisionService(ProvisionService provisionService)
setProvisionServicevoid
setScheduledExecutor(java.util.concurrent.ScheduledExecutorService scheduledExecutor)
setScheduledExecutorvoid
setTaskCoordinator(TaskCoordinator taskCoordinator)
setTaskCoordinatorvoid
setTracerRegistry(TracerRegistry tracerRegistry)
void
start()
startprotected void
updateNodeScheduleInQueue(NodeScanSchedule schedule)
updateNodeScheduleInQueuevoid
waitFor()
-
-
-
Field Detail
-
NAME
public static final java.lang.String NAME
ConstantNAME="Provisiond"
- See Also:
- Constant Field Values
-
-
Method Detail
-
setProvisionService
public void setProvisionService(ProvisionService provisionService)
setProvisionService
- Parameters:
provisionService
- aProvisionService
object.
-
getProvisionService
public ProvisionService getProvisionService()
getProvisionService
- Returns:
- a
ProvisionService
object.
-
setScheduledExecutor
public void setScheduledExecutor(java.util.concurrent.ScheduledExecutorService scheduledExecutor)
setScheduledExecutor
- Parameters:
scheduledExecutor
- aScheduledExecutorService
object.
-
setLifeCycleRepository
public void setLifeCycleRepository(LifeCycleRepository lifeCycleRepository)
setLifeCycleRepository
- Parameters:
lifeCycleRepository
- aLifeCycleRepository
object.
-
setImportSchedule
public void setImportSchedule(ImportScheduler schedule)
setImportSchedule
- Parameters:
schedule
- aImportScheduler
object.
-
setImportActivities
public void setImportActivities(CoreImportActivities importActivities)
setImportActivities
- Parameters:
importActivities
- the importActivities to set
-
setTaskCoordinator
public void setTaskCoordinator(TaskCoordinator taskCoordinator)
setTaskCoordinator
- Parameters:
taskCoordinator
- the taskCoordinator to set
-
setAgentConfigFactory
public void setAgentConfigFactory(SnmpAgentConfigFactory agentConfigFactory)
setAgentConfigFactory
- Parameters:
agentConfigFactory
- the agentConfigFactory to set
-
getImportSchedule
public ImportScheduler getImportSchedule()
getImportSchedule
- Returns:
- a
ImportScheduler
object.
-
getMonitoringSystemDao
public MonitoringSystemDao getMonitoringSystemDao()
-
setMonitoringSystemDao
public void setMonitoringSystemDao(MonitoringSystemDao monitoringSystemDao)
-
setTracerRegistry
public void setTracerRegistry(TracerRegistry tracerRegistry)
-
start
public void start() throws java.lang.Exception
start
- Specified by:
start
in interfaceSpringServiceDaemon
- Throws:
java.lang.Exception
- if any.
-
destroy
public void destroy() throws java.lang.Exception
destroy
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
java.lang.Exception
- if any.
-
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
java.lang.Exception
- if any.
-
scheduleRescanForExistingNodes
protected void scheduleRescanForExistingNodes()
scheduleRescanForExistingNodes
-
createNodeScan
public NodeScan createNodeScan(java.lang.Integer nodeId, java.lang.String foreignSource, java.lang.String foreignId, OnmsMonitoringLocation location)
createNodeScan
- Parameters:
nodeId
- aInteger
object.foreignSource
- aString
object.foreignId
- aString
object.location
- aOnmsMonitoringLocation
object.- Returns:
- a
NodeScan
object.
-
createNewSuspectScan
public NewSuspectScan createNewSuspectScan(java.net.InetAddress ipAddress, java.lang.String foreignSource, java.lang.String location)
createNewSuspectScan
- Parameters:
ipAddress
- aInetAddress
object.- Returns:
- a
NewSuspectScan
object.
-
createForceRescanScan
public ForceRescanScan createForceRescanScan(java.lang.Integer nodeId)
createForceRescanScan
- Parameters:
nodeId
- a nodeId- Returns:
- a
ForceRescanScan
object.
-
addToScheduleQueue
protected void addToScheduleQueue(NodeScanSchedule schedule)
addToScheduleQueue
- Parameters:
schedule
- aNodeScanSchedule
object.
-
updateNodeScheduleInQueue
protected void updateNodeScheduleInQueue(NodeScanSchedule schedule)
updateNodeScheduleInQueue
- Parameters:
schedule
- aNodeScanSchedule
object.
-
getScheduledFutureForNode
public java.util.concurrent.ScheduledFuture<?> getScheduledFutureForNode(int nodeId)
getScheduledFutureForNode
- Parameters:
nodeId
- a int.- Returns:
- a
ScheduledFuture
object.
-
removeNodeFromScheduleQueue
protected void removeNodeFromScheduleQueue(java.lang.Integer nodeId)
removeNodeFromScheduleQueue
- Parameters:
nodeId
- aInteger
object.
-
removeFromScheduleQueue
protected void removeFromScheduleQueue(java.util.List<java.lang.Integer> nodeIds)
removeFromScheduleQueue
- Parameters:
nodeIds
- aList
object.
-
checkNodeListForRemovals
protected void checkNodeListForRemovals(java.util.List<NodeScanSchedule> schedules)
checkNodeListForRemovals
- Parameters:
schedules
- aList
object.
-
getScheduleLength
public int getScheduleLength()
getScheduleLength
- Returns:
- a int.
-
importModelFromResource
protected void importModelFromResource(org.springframework.core.io.Resource resource, java.lang.String rescanExisting) throws java.lang.Exception
importModelFromResource
- Parameters:
resource
- aResource
object.rescanExisting
- aString
object - Valid values are "true", "false" and "dbonly".- Throws:
java.lang.Exception
- if any.
-
importModelFromResource
protected RequisitionImport importModelFromResource(org.springframework.core.io.Resource resource, java.lang.String rescanExisting, ProvisionMonitor monitor) throws java.lang.Exception
importModelFromResource
- Parameters:
resource
- aResource
object.rescanExisting
- aString
object - Valid values are "true", "false" and "dbonly".monitor
- aProvisionMonitor
object.- Returns:
- the imported requesition
- Throws:
java.lang.Exception
- if any.
-
setEventForwarder
public void setEventForwarder(EventForwarder eventForwarder)
setEventForwarder
- Parameters:
eventForwarder
- aEventForwarder
object.
-
getEventForwarder
public EventForwarder getEventForwarder()
getEventForwarder
- Returns:
- a
EventForwarder
object.
-
doImport
public void doImport(IEvent event)
Begins importing from resource specified in model-importer.properties file or in event parameter: url. Import Resources are managed with a "key" called "foreignSource" specified in the XML retrieved by the resource and can be overridden as a parameter of an event.- Parameters:
event
- aIEvent
object.
-
doImport
public void doImport(java.lang.String url, java.lang.String rescanExisting)
doImport
- Parameters:
url
- aString
object.
-
handleNodeAddedEvent
public void handleNodeAddedEvent(IEvent e)
handleNodeAddedEvent
- Parameters:
e
- aIEvent
object.
-
handleForceRescan
public void handleForceRescan(IEvent e)
handleForceRescan
- Parameters:
e
- aIEvent
object.
-
handleNewSuspectEvent
public void handleNewSuspectEvent(IEvent event)
-
handleNodeUpdated
public void handleNodeUpdated(IEvent e)
handleNodeUpdated
A re-import has occurred, attempt a rescan now.- Parameters:
e
- aIEvent
object.
-
handleNodeDeletedEvent
public void handleNodeDeletedEvent(IEvent e)
handleNodeDeletedEvent
- Parameters:
e
- aIEvent
object.
-
handleReloadConfigEvent
public void handleReloadConfigEvent(IEvent e)
handleReloadConfigEvent
- Parameters:
e
- aIEvent
object.
-
handleAddNode
public void handleAddNode(IEvent event)
handleAddNode
- Parameters:
event
- aIEvent
object.
-
handleDeleteInterface
public void handleDeleteInterface(IEvent event)
handleDeleteInterface
- Parameters:
event
- aIEvent
object.
-
handleDeleteNode
public void handleDeleteNode(IEvent event)
handleDeleteNode
- Parameters:
event
- aIEvent
object.
-
handleDeleteService
public void handleDeleteService(IEvent event)
handleDeleteService
- Parameters:
event
- aIEvent
object.
-
getStats
public java.lang.String getStats()
getStats
- Returns:
- a
String
object.
-
getEventForeignSource
protected java.lang.String getEventForeignSource(Event event)
getEventForeignSource
- Parameters:
event
- aEvent
object.- Returns:
- a
String
object.
-
waitFor
public void waitFor()
-
getNewSuspectExecutor
public java.util.concurrent.ExecutorService getNewSuspectExecutor()
-
-