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 Object implements SpringServiceDaemon
Massively Parallel Java ProvisioningServiceDaemon
for OpenNMS.- Author:
- Mathew Brozowski
-
-
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(List<NodeScanSchedule> schedules)
checkNodeListForRemovalsForceRescanScan
createForceRescanScan(Integer nodeId, String monitorKey)
createForceRescanScanNewSuspectScan
createNewSuspectScan(InetAddress ipAddress, String foreignSource, String location, String monitorKey)
createNewSuspectScanNodeScan
createNodeScan(Integer nodeId, String foreignSource, String foreignId, OnmsMonitoringLocation location, String monitorKey)
createNodeScanvoid
destroy()
destroyvoid
doImport(String url, String rescanExisting, ProvisionMonitor monitor)
doImportvoid
doImport(IEvent event)
Begins importing from resource specified in model-importer.properties file or in event parameter: url.protected String
getEventForeignSource(Event event)
getEventForeignSourceEventForwarder
getEventForwarder()
getEventForwarderImportScheduler
getImportSchedule()
getImportScheduleMonitoringSystemDao
getMonitoringSystemDao()
ExecutorService
getNewSuspectExecutor()
ProvisionService
getProvisionService()
getProvisionServiceScheduledFuture<?>
getScheduledFutureForNode(int nodeId)
getScheduledFutureForNodeint
getScheduleLength()
getScheduleLengthvoid
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, String rescanExisting)
importModelFromResourceprotected RequisitionImport
importModelFromResource(org.springframework.core.io.Resource resource, String rescanExisting, ProvisionMonitor monitor)
importModelFromResourceprotected void
removeFromScheduleQueue(List<Integer> nodeIds)
removeFromScheduleQueueprotected void
removeNodeFromScheduleQueue(Integer nodeId)
removeNodeFromScheduleQueueprotected void
scheduleRescanForExistingNodes(String monitorKey)
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(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 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(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 Exception
start
- Specified by:
start
in interfaceSpringServiceDaemon
- Throws:
Exception
- if any.
-
destroy
public void destroy() throws Exception
destroy
- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
Exception
- if any.
-
afterPropertiesSet
public void afterPropertiesSet() throws Exception
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
- if any.
-
scheduleRescanForExistingNodes
protected void scheduleRescanForExistingNodes(String monitorKey)
scheduleRescanForExistingNodes
-
createNodeScan
public NodeScan createNodeScan(Integer nodeId, String foreignSource, String foreignId, OnmsMonitoringLocation location, String monitorKey)
createNodeScan
- Parameters:
nodeId
- aInteger
object.foreignSource
- aString
object.foreignId
- aString
object.location
- aOnmsMonitoringLocation
object.- Returns:
- a
NodeScan
object.
-
createNewSuspectScan
public NewSuspectScan createNewSuspectScan(InetAddress ipAddress, String foreignSource, String location, String monitorKey)
createNewSuspectScan
- Parameters:
ipAddress
- aInetAddress
object.- Returns:
- a
NewSuspectScan
object.
-
createForceRescanScan
public ForceRescanScan createForceRescanScan(Integer nodeId, String monitorKey)
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 ScheduledFuture<?> getScheduledFutureForNode(int nodeId)
getScheduledFutureForNode
- Parameters:
nodeId
- a int.- Returns:
- a
ScheduledFuture
object.
-
removeNodeFromScheduleQueue
protected void removeNodeFromScheduleQueue(Integer nodeId)
removeNodeFromScheduleQueue
- Parameters:
nodeId
- aInteger
object.
-
removeFromScheduleQueue
protected void removeFromScheduleQueue(List<Integer> nodeIds)
removeFromScheduleQueue
- Parameters:
nodeIds
- aList
object.
-
checkNodeListForRemovals
protected void checkNodeListForRemovals(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, String rescanExisting) throws Exception
importModelFromResource
-
importModelFromResource
protected RequisitionImport importModelFromResource(org.springframework.core.io.Resource resource, String rescanExisting, ProvisionMonitor monitor) throws Exception
importModelFromResource
- Parameters:
resource
- aResource
object.rescanExisting
- aString
object - Valid values are "true", "false" and "dbonly".monitor
- aProvisionMonitor
object.- Returns:
- the imported requesition
- Throws:
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) throws ExecutionException
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.- Throws:
ExecutionException
-
doImport
public void doImport(String url, String rescanExisting, ProvisionMonitor monitor)
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.
-
waitFor
public void waitFor()
-
getNewSuspectExecutor
public ExecutorService getNewSuspectExecutor()
-
-