org.opennms.web.svclayer.support
Class DefaultDistributedStatusService

java.lang.Object
  extended by org.opennms.web.svclayer.support.DefaultDistributedStatusService
All Implemented Interfaces:
DistributedStatusService, org.springframework.beans.factory.InitializingBean

public class DefaultDistributedStatusService
extends Object
implements DistributedStatusService, org.springframework.beans.factory.InitializingBean

DefaultDistributedStatusService class.

Author:
DJ Gregor, Mathew Brozowski, Jeff Gehlbach

Nested Class Summary
static class DefaultDistributedStatusService.LocationStatusComparator
           
static class DefaultDistributedStatusService.MonitoredServiceComparator
           
static class DefaultDistributedStatusService.ServiceGraphComparator
          Comparator for ServiceGraph objects.
static class DefaultDistributedStatusService.Severity
           
 
Constructor Summary
DefaultDistributedStatusService()
           
 
Method Summary
 void afterPropertiesSet()
          afterPropertiesSet
 DefaultDistributedStatusService.Severity calculateCurrentStatus(Collection<OnmsLocationMonitor> monitors, Collection<OnmsMonitoredService> applicationServices, Collection<OnmsLocationSpecificStatus> statuses)
          calculateCurrentStatus
 DefaultDistributedStatusService.Severity calculateCurrentStatus(OnmsLocationMonitor monitor, Collection<OnmsMonitoredService> applicationServices, Collection<OnmsLocationSpecificStatus> statuses)
          calculateCurrentStatus
 String calculatePercentageUptime(Collection<OnmsMonitoredService> applicationServices, Collection<OnmsLocationSpecificStatus> statuses, Date startDate, Date endDate)
          Calculate the percentage of time that all services are up for this application on this remote monitor.
 DefaultDistributedStatusService.Severity calculateStatus(Collection<PollStatus> pollStatuses)
          calculateStatus
 SimpleWebTable createFacilityStatusTable(Date start, Date end)
          createFacilityStatusTable
 DistributedStatusHistoryModel createHistoryModel(String locationName, String monitorId, String applicationName, String timeSpan, String previousLocationName)
          createHistoryModel
 SimpleWebTable createStatusTable(DistributedStatusDetailsCommand command, org.springframework.validation.Errors errors)
          createStatusTable
protected  List<OnmsLocationSpecificStatus> findLocationSpecificStatus(DistributedStatusDetailsCommand command, org.springframework.validation.Errors errors)
          findLocationSpecificStatus
 int getApplicationCount()
          getApplicationCount
 GraphDao getGraphDao()
          getGraphDao
 ResourceDao getResourceDao()
          getResourceDao
 boolean isLayoutApplicationsVertically()
          isLayoutApplicationsVertically
 void setApplicationDao(ApplicationDao applicationDao)
          setApplicationDao
 void setGraphDao(GraphDao graphDao)
          setGraphDao
 void setLayoutApplicationsVertically(boolean layoutApplicationsVertically)
          setLayoutApplicationsVertically
 void setLocationMonitorDao(LocationMonitorDao locationMonitorDao)
          setLocationMonitorDao
 void setMonitoredServiceDao(MonitoredServiceDao monitoredServiceDao)
          setMonitoredServiceDao
 void setResourceDao(ResourceDao resourceDao)
          setResourceDao
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDistributedStatusService

public DefaultDistributedStatusService()
Method Detail

getApplicationCount

public int getApplicationCount()

getApplicationCount

Specified by:
getApplicationCount in interface DistributedStatusService
Returns:
a int.

createStatusTable

public SimpleWebTable createStatusTable(DistributedStatusDetailsCommand command,
                                        org.springframework.validation.Errors errors)

createStatusTable

Specified by:
createStatusTable in interface DistributedStatusService
Parameters:
command - a DistributedStatusDetailsCommand object.
errors - a Errors object.
Returns:
a SimpleWebTable object.

findLocationSpecificStatus

protected List<OnmsLocationSpecificStatus> findLocationSpecificStatus(DistributedStatusDetailsCommand command,
                                                                      org.springframework.validation.Errors errors)
                                                               throws IllegalArgumentException

findLocationSpecificStatus

Parameters:
command - a DistributedStatusDetailsCommand object.
errors - a Errors object.
Returns:
a List object or null if no location monitors are registered for the specified location and application tuple
Throws:
IllegalArgumentException

createFacilityStatusTable

public SimpleWebTable createFacilityStatusTable(Date start,
                                                Date end)

createFacilityStatusTable

Specified by:
createFacilityStatusTable in interface DistributedStatusService
Parameters:
start - a java$util$Date object.
end - a java$util$Date object.
Returns:
a SimpleWebTable object.

calculateCurrentStatus

public DefaultDistributedStatusService.Severity calculateCurrentStatus(Collection<OnmsLocationMonitor> monitors,
                                                                       Collection<OnmsMonitoredService> applicationServices,
                                                                       Collection<OnmsLocationSpecificStatus> statuses)

calculateCurrentStatus

Parameters:
monitors - a Collection object.
applicationServices - a Collection object.
statuses - a Collection object.
Returns:
a DefaultDistributedStatusService.Severity object.

calculateCurrentStatus

public DefaultDistributedStatusService.Severity calculateCurrentStatus(OnmsLocationMonitor monitor,
                                                                       Collection<OnmsMonitoredService> applicationServices,
                                                                       Collection<OnmsLocationSpecificStatus> statuses)

calculateCurrentStatus

Parameters:
monitor - a OnmsLocationMonitor object.
applicationServices - a Collection object.
statuses - a Collection object.
Returns:
a DefaultDistributedStatusService.Severity object.

calculateStatus

public DefaultDistributedStatusService.Severity calculateStatus(Collection<PollStatus> pollStatuses)

calculateStatus

Parameters:
pollStatuses - a Collection object.
Returns:
a DefaultDistributedStatusService.Severity object.

calculatePercentageUptime

public String calculatePercentageUptime(Collection<OnmsMonitoredService> applicationServices,
                                        Collection<OnmsLocationSpecificStatus> statuses,
                                        Date startDate,
                                        Date endDate)
Calculate the percentage of time that all services are up for this application on this remote monitor.

Parameters:
applicationServices - services to report on
statuses - status entries to use for report
startDate - start date. The report starts on this date.
endDate - end date. The report ends the last millisecond prior this date.
Returns:
representation of the percentage uptime out to three decimal places. Null is returned if there is no data.

createHistoryModel

public DistributedStatusHistoryModel createHistoryModel(String locationName,
                                                        String monitorId,
                                                        String applicationName,
                                                        String timeSpan,
                                                        String previousLocationName)

createHistoryModel

Specified by:
createHistoryModel in interface DistributedStatusService
Parameters:
locationName - a String object.
monitorId - a String object.
applicationName - a String object.
timeSpan - a String object.
previousLocationName - a String object.
Returns:
a DistributedStatusHistoryModel object.

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception

afterPropertiesSet

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception - if any.

setMonitoredServiceDao

public void setMonitoredServiceDao(MonitoredServiceDao monitoredServiceDao)

setMonitoredServiceDao

Parameters:
monitoredServiceDao - a MonitoredServiceDao object.

setLocationMonitorDao

public void setLocationMonitorDao(LocationMonitorDao locationMonitorDao)

setLocationMonitorDao

Parameters:
locationMonitorDao - a LocationMonitorDao object.

setApplicationDao

public void setApplicationDao(ApplicationDao applicationDao)

setApplicationDao

Parameters:
applicationDao - a ApplicationDao object.

getResourceDao

public ResourceDao getResourceDao()

getResourceDao

Returns:
a ResourceDao object.

setResourceDao

public void setResourceDao(ResourceDao resourceDao)

setResourceDao

Parameters:
resourceDao - a ResourceDao object.

getGraphDao

public GraphDao getGraphDao()

getGraphDao

Returns:
a GraphDao object.

setGraphDao

public void setGraphDao(GraphDao graphDao)

setGraphDao

Parameters:
graphDao - a GraphDao object.

setLayoutApplicationsVertically

public void setLayoutApplicationsVertically(boolean layoutApplicationsVertically)

setLayoutApplicationsVertically

Parameters:
layoutApplicationsVertically - a boolean.

isLayoutApplicationsVertically

public boolean isLayoutApplicationsVertically()

isLayoutApplicationsVertically

Returns:
a boolean.


Copyright © 2011. All Rights Reserved.