org.opennms.netmgt.dao.hibernate
Class LocationMonitorDaoHibernate

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by org.springframework.orm.hibernate3.support.HibernateDaoSupport
          extended by org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate<OnmsLocationMonitor,Integer>
              extended by org.opennms.netmgt.dao.hibernate.LocationMonitorDaoHibernate
All Implemented Interfaces:
LocationMonitorDao, OnmsDao<OnmsLocationMonitor,Integer>, org.springframework.beans.factory.InitializingBean

public class LocationMonitorDaoHibernate
extends AbstractDaoHibernate<OnmsLocationMonitor,Integer>
implements LocationMonitorDao

LocationMonitorDaoHibernate class.

Version:
$Id: $
Author:
David Hustace

Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
LocationMonitorDaoHibernate()
          Constructor that also initializes the required XML configurations
 
Method Summary
 Collection<OnmsMonitoringLocationDefinition> findAllLocationDefinitions()
          findAllLocationDefinitions
 List<OnmsMonitoringLocationDefinition> findAllMonitoringLocationDefinitions()
          findAllMonitoringLocationDefinitions
 Collection<OnmsLocationMonitor> findByApplication(OnmsApplication application)
          findByApplication
 Collection<OnmsLocationMonitor> findByLocationDefinition(OnmsMonitoringLocationDefinition locationDefinition)
          findByLocationDefinition
 OnmsMonitoringLocationDefinition findMonitoringLocationDefinition(String monitoringLocationDefinitionName)
          findMonitoringLocationDefinition
 Collection<LocationMonitorIpInterface> findStatusChangesForNodeForUniqueMonitorAndInterface(int nodeId)
          findStatusChangesForNodeForUniqueMonitorAndInterface
 Collection<OnmsLocationSpecificStatus> getAllMostRecentStatusChanges()
          getAllMostRecentStatusChanges
 Collection<OnmsLocationSpecificStatus> getAllStatusChangesAt(Date timestamp)
          getAllStatusChangesAt
 org.springframework.core.io.Resource getMonitoringLocationConfigResource()
          getMonitoringLocationConfigResource
 OnmsLocationSpecificStatus getMostRecentStatusChange(OnmsLocationMonitor locationMonitor, OnmsMonitoredService monSvc)
          getMostRecentStatusChange
 Collection<OnmsLocationSpecificStatus> getMostRecentStatusChangesForLocation(String locationName)
          getMostRecentStatusChangesForLocation
 Collection<OnmsLocationSpecificStatus> getStatusChangesBetween(Date startDate, Date endDate)
          Returns all status changes since the date, and one previous status change (so that status at the beginning of the period can be determined).
 Collection<OnmsLocationSpecificStatus> getStatusChangesForApplicationBetween(Date startDate, Date endDate, String applicationName)
          getStatusChangesForApplicationBetween
 Collection<OnmsLocationSpecificStatus> getStatusChangesForLocationBetween(Date startDate, Date endDate, String locationName)
          getStatusChangesForLocationBetween
protected  void initDao()
          
 void pauseAll()
          Mark all location monitors as paused except those that are already stopped
 void resumeAll()
          Mark all paused location monitors as started
protected  void saveMonitoringConfig()
          saveMonitoringConfig
 void saveMonitoringLocationDefinition(OnmsMonitoringLocationDefinition onmsDef)
          saveMonitoringLocationDefinition
 void saveMonitoringLocationDefinitions(Collection<OnmsMonitoringLocationDefinition> onmsDefs)
          saveMonitoringLocationDefinitions
 void saveStatusChange(OnmsLocationSpecificStatus statusChange)
          saveStatusChange
protected  void saveXml(String xml)
          saveXml
 void setMonitoringLocationConfigResource(org.springframework.core.io.Resource monitoringLocationResource)
          setMonitoringLocationConfigResource
 
Methods inherited from class org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate
bulkDelete, clear, countAll, countMatching, delete, deleteAll, evict, find, find, findAll, findMatching, findMatchingObjects, findObjects, findUnique, findUnique, findUnique, flush, get, initialize, load, merge, queryInt, queryInt, save, saveOrUpdate, update
 
Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory
 
Methods inherited from class org.springframework.dao.support.DaoSupport
afterPropertiesSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opennms.netmgt.dao.OnmsDao
clear, countAll, countMatching, delete, findAll, findMatching, flush, get, initialize, load, save, saveOrUpdate, update
 

Constructor Detail

LocationMonitorDaoHibernate

public LocationMonitorDaoHibernate()
Constructor that also initializes the required XML configurations

Throws:
IOException - if any.
org.exolab.castor.xml.MarshalException - if any.
org.exolab.castor.xml.ValidationException - if any.
Method Detail

initDao

protected void initDao()
                throws Exception

Overrides:
initDao in class org.springframework.dao.support.DaoSupport
Throws:
Exception

findAllMonitoringLocationDefinitions

public List<OnmsMonitoringLocationDefinition> findAllMonitoringLocationDefinitions()

findAllMonitoringLocationDefinitions

Specified by:
findAllMonitoringLocationDefinitions in interface LocationMonitorDao
Returns:
a List object.

saveMonitoringLocationDefinitions

public void saveMonitoringLocationDefinitions(Collection<OnmsMonitoringLocationDefinition> onmsDefs)

saveMonitoringLocationDefinitions

Don't call this for now.

Specified by:
saveMonitoringLocationDefinitions in interface LocationMonitorDao
Parameters:
onmsDefs - a Collection object.

saveMonitoringLocationDefinition

public void saveMonitoringLocationDefinition(OnmsMonitoringLocationDefinition onmsDef)

saveMonitoringLocationDefinition

Specified by:
saveMonitoringLocationDefinition in interface LocationMonitorDao
Parameters:
onmsDef - a OnmsMonitoringLocationDefinition object.

saveMonitoringConfig

protected void saveMonitoringConfig()

saveMonitoringConfig


saveXml

protected void saveXml(String xml)
                throws IOException

saveXml

Parameters:
xml - a String object.
Throws:
IOException - if any.

findAllLocationDefinitions

public Collection<OnmsMonitoringLocationDefinition> findAllLocationDefinitions()

findAllLocationDefinitions

Returns:
a Collection object.

getMonitoringLocationConfigResource

public org.springframework.core.io.Resource getMonitoringLocationConfigResource()

getMonitoringLocationConfigResource

Returns:
a Resource object.

setMonitoringLocationConfigResource

public void setMonitoringLocationConfigResource(org.springframework.core.io.Resource monitoringLocationResource)

setMonitoringLocationConfigResource

Parameters:
monitoringLocationResource - a Resource object.

findMonitoringLocationDefinition

public OnmsMonitoringLocationDefinition findMonitoringLocationDefinition(String monitoringLocationDefinitionName)

findMonitoringLocationDefinition

Specified by:
findMonitoringLocationDefinition in interface LocationMonitorDao
Parameters:
monitoringLocationDefinitionName - a String object.
Returns:
a OnmsMonitoringLocationDefinition object.

getMostRecentStatusChange

public OnmsLocationSpecificStatus getMostRecentStatusChange(OnmsLocationMonitor locationMonitor,
                                                            OnmsMonitoredService monSvc)

getMostRecentStatusChange

Specified by:
getMostRecentStatusChange in interface LocationMonitorDao
Parameters:
locationMonitor - a OnmsLocationMonitor object.
monSvc - a OnmsMonitoredService object.
Returns:
a OnmsLocationSpecificStatus object.

saveStatusChange

public void saveStatusChange(OnmsLocationSpecificStatus statusChange)

saveStatusChange

Specified by:
saveStatusChange in interface LocationMonitorDao
Parameters:
statusChange - a OnmsLocationSpecificStatus object.

findByApplication

public Collection<OnmsLocationMonitor> findByApplication(OnmsApplication application)

findByApplication

Returns the location monitors which have reported on services belonging to the provided application

Specified by:
findByApplication in interface LocationMonitorDao
Parameters:
application - a OnmsApplication object.
Returns:
a Collection object.

findByLocationDefinition

public Collection<OnmsLocationMonitor> findByLocationDefinition(OnmsMonitoringLocationDefinition locationDefinition)

findByLocationDefinition

Specified by:
findByLocationDefinition in interface LocationMonitorDao
Parameters:
locationDefinition - a OnmsMonitoringLocationDefinition object.
Returns:
a Collection object.

getAllMostRecentStatusChanges

public Collection<OnmsLocationSpecificStatus> getAllMostRecentStatusChanges()

getAllMostRecentStatusChanges

Specified by:
getAllMostRecentStatusChanges in interface LocationMonitorDao
Returns:
a Collection object.

getAllStatusChangesAt

public Collection<OnmsLocationSpecificStatus> getAllStatusChangesAt(Date timestamp)

getAllStatusChangesAt

Specified by:
getAllStatusChangesAt in interface LocationMonitorDao
Parameters:
timestamp - a Date object.
Returns:
a Collection object.

getStatusChangesBetween

public Collection<OnmsLocationSpecificStatus> getStatusChangesBetween(Date startDate,
                                                                      Date endDate)
Returns all status changes since the date, and one previous status change (so that status at the beginning of the period can be determined).

Specified by:
getStatusChangesBetween in interface LocationMonitorDao
Parameters:
startDate - a Date object.
endDate - a Date object.
Returns:
a Collection object.

getStatusChangesForLocationBetween

public Collection<OnmsLocationSpecificStatus> getStatusChangesForLocationBetween(Date startDate,
                                                                                 Date endDate,
                                                                                 String locationName)

getStatusChangesForLocationBetween

Specified by:
getStatusChangesForLocationBetween in interface LocationMonitorDao
Parameters:
startDate - a Date object.
endDate - a Date object.
locationName - a String object.
Returns:
a Collection object.

getStatusChangesForApplicationBetween

public Collection<OnmsLocationSpecificStatus> getStatusChangesForApplicationBetween(Date startDate,
                                                                                    Date endDate,
                                                                                    String applicationName)

getStatusChangesForApplicationBetween

Specified by:
getStatusChangesForApplicationBetween in interface LocationMonitorDao
Parameters:
startDate - a Date object.
endDate - a Date object.
applicationName - a String object.
Returns:
a Collection object.

getMostRecentStatusChangesForLocation

public Collection<OnmsLocationSpecificStatus> getMostRecentStatusChangesForLocation(String locationName)

getMostRecentStatusChangesForLocation

Specified by:
getMostRecentStatusChangesForLocation in interface LocationMonitorDao
Parameters:
locationName - a String object.
Returns:
a Collection object.

findStatusChangesForNodeForUniqueMonitorAndInterface

public Collection<LocationMonitorIpInterface> findStatusChangesForNodeForUniqueMonitorAndInterface(int nodeId)

findStatusChangesForNodeForUniqueMonitorAndInterface

Specified by:
findStatusChangesForNodeForUniqueMonitorAndInterface in interface LocationMonitorDao
Parameters:
nodeId - a int.
Returns:
a Collection object.

pauseAll

public void pauseAll()
Mark all location monitors as paused except those that are already stopped

Specified by:
pauseAll in interface LocationMonitorDao

resumeAll

public void resumeAll()
Mark all paused location monitors as started

Specified by:
resumeAll in interface LocationMonitorDao


Copyright © 2011. All Rights Reserved.