Class 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 Provisioning ServiceDaemon for OpenNMS.
    Author:
    Mathew Brozowski
    • Field Detail

      • NAME

        public static final java.lang.String NAME
        Constant NAME="Provisiond"
        See Also:
        Constant Field Values
    • Constructor Detail

      • Provisioner

        public Provisioner()
    • Method Detail

      • setProvisionService

        public void setProvisionService​(ProvisionService provisionService)

        setProvisionService

        Parameters:
        provisionService - a ProvisionService object.
      • setScheduledExecutor

        public void setScheduledExecutor​(java.util.concurrent.ScheduledExecutorService scheduledExecutor)

        setScheduledExecutor

        Parameters:
        scheduledExecutor - a ScheduledExecutorService object.
      • setLifeCycleRepository

        public void setLifeCycleRepository​(LifeCycleRepository lifeCycleRepository)

        setLifeCycleRepository

        Parameters:
        lifeCycleRepository - a LifeCycleRepository 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
      • 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 interface SpringServiceDaemon
        Throws:
        java.lang.Exception - if any.
      • destroy

        public void destroy()
                     throws java.lang.Exception

        destroy

        Specified by:
        destroy in interface org.springframework.beans.factory.DisposableBean
        Throws:
        java.lang.Exception - if any.
      • afterPropertiesSet

        public void afterPropertiesSet()
                                throws java.lang.Exception

        afterPropertiesSet

        Specified by:
        afterPropertiesSet in interface org.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 - a Integer object.
        foreignSource - a String object.
        foreignId - a String object.
        location - a OnmsMonitoringLocation object.
        Returns:
        a NodeScan object.
      • createNewSuspectScan

        public NewSuspectScan createNewSuspectScan​(java.net.InetAddress ipAddress,
                                                   java.lang.String foreignSource,
                                                   java.lang.String location)

        createNewSuspectScan

        Parameters:
        ipAddress - a InetAddress object.
        Returns:
        a NewSuspectScan object.
      • createForceRescanScan

        public ForceRescanScan createForceRescanScan​(java.lang.Integer nodeId)

        createForceRescanScan

        Parameters:
        nodeId - a nodeId
        Returns:
        a ForceRescanScan object.
      • updateNodeScheduleInQueue

        protected void updateNodeScheduleInQueue​(NodeScanSchedule schedule)

        updateNodeScheduleInQueue

        Parameters:
        schedule - a NodeScanSchedule 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 - a Integer object.
      • removeFromScheduleQueue

        protected void removeFromScheduleQueue​(java.util.List<java.lang.Integer> nodeIds)

        removeFromScheduleQueue

        Parameters:
        nodeIds - a List object.
      • checkNodeListForRemovals

        protected void checkNodeListForRemovals​(java.util.List<NodeScanSchedule> schedules)

        checkNodeListForRemovals

        Parameters:
        schedules - a List 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 - a Resource object.
        rescanExisting - a String 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 - a Resource object.
        rescanExisting - a String object - Valid values are "true", "false" and "dbonly".
        monitor - a ProvisionMonitor object.
        Returns:
        the imported requesition
        Throws:
        java.lang.Exception - if any.
      • setEventForwarder

        public void setEventForwarder​(EventForwarder eventForwarder)

        setEventForwarder

        Parameters:
        eventForwarder - 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 - a IEvent object.
      • doImport

        public void doImport​(java.lang.String url,
                             java.lang.String rescanExisting)

        doImport

        Parameters:
        url - a String object.
      • handleNodeAddedEvent

        public void handleNodeAddedEvent​(IEvent e)

        handleNodeAddedEvent

        Parameters:
        e - a IEvent object.
      • handleForceRescan

        public void handleForceRescan​(IEvent e)

        handleForceRescan

        Parameters:
        e - a IEvent 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 - a IEvent object.
      • handleNodeDeletedEvent

        public void handleNodeDeletedEvent​(IEvent e)

        handleNodeDeletedEvent

        Parameters:
        e - a IEvent object.
      • handleReloadConfigEvent

        public void handleReloadConfigEvent​(IEvent e)

        handleReloadConfigEvent

        Parameters:
        e - a IEvent object.
      • handleAddNode

        public void handleAddNode​(IEvent event)

        handleAddNode

        Parameters:
        event - a IEvent object.
      • handleDeleteInterface

        public void handleDeleteInterface​(IEvent event)

        handleDeleteInterface

        Parameters:
        event - a IEvent object.
      • handleDeleteNode

        public void handleDeleteNode​(IEvent event)

        handleDeleteNode

        Parameters:
        event - a IEvent object.
      • handleDeleteService

        public void handleDeleteService​(IEvent event)

        handleDeleteService

        Parameters:
        event - a IEvent object.
      • getStats

        public java.lang.String getStats()

        getStats

        Returns:
        a String object.
      • getEventForeignSource

        protected java.lang.String getEventForeignSource​(Event event)

        getEventForeignSource

        Parameters:
        event - a Event object.
        Returns:
        a String object.
      • waitFor

        public void waitFor()
      • getNewSuspectExecutor

        public java.util.concurrent.ExecutorService getNewSuspectExecutor()