use of org.opennms.features.poller.remote.gwt.client.StatusDetails in project opennms by OpenNMS.
the class LocationDataManagerTest method testGetStatusDetailsForApplication.
@Test
public void testGetStatusDetailsForApplication() {
String appName = "Domain Controllers";
int count = 100;
long start = System.currentTimeMillis();
for (int i = 0; i < count; i++) {
OnmsApplication app = m_applicationDao.findByName(appName);
// System.err.println("TEST testGetSatusDetailsForApplication: calling getStatusDetailsForApplication");
StatusDetails details = m_locationDataService.getStatusDetailsForApplication(app);
assertEquals(Status.UP, details.getStatus());
}
System.err.println(String.format("Avg getStatusDetailsForApplication: %d\n", (System.currentTimeMillis() - start) / count));
}
use of org.opennms.features.poller.remote.gwt.client.StatusDetails in project opennms by OpenNMS.
the class DefaultLocationDataService method getInfoForAllLocations.
/**
* <p>getInfoForAllLocations</p>
*
* @return a {@link java.util.List} object.
*/
@Transactional
@Override
public List<LocationInfo> getInfoForAllLocations() {
waitForGeocoding("getInfoForAllLocations");
Map<String, StatusDetails> statusDetails = getStatusDetailsForAllLocations();
List<LocationInfo> locations = new ArrayList<LocationInfo>();
for (Map.Entry<String, StatusDetails> entry : statusDetails.entrySet()) {
OnmsMonitoringLocation def = m_monitoringLocationDao.get(entry.getKey());
LocationInfo locationInfo = this.getLocationInfo(def, entry.getValue());
locations.add(locationInfo);
}
return locations;
}
use of org.opennms.features.poller.remote.gwt.client.StatusDetails in project opennms by OpenNMS.
the class DefaultLocationDataService method getInfoForAllApplications.
/**
* <p>getInfoForAllApplications</p>
*
* @return a {@link java.util.List} object.
*/
@Transactional
@Override
public List<ApplicationInfo> getInfoForAllApplications() {
waitForGeocoding("handleAllApplications");
Map<OnmsApplication, StatusDetails> statusDetails = getStatusDetailsForAllApplications();
final List<ApplicationInfo> appInfos = new ArrayList<ApplicationInfo>();
for (Map.Entry<OnmsApplication, StatusDetails> entry : statusDetails.entrySet()) {
final ApplicationInfo appInfo = getApplicationInfo(entry.getKey(), entry.getValue());
appInfos.add(appInfo);
}
return appInfos;
}
use of org.opennms.features.poller.remote.gwt.client.StatusDetails in project opennms by OpenNMS.
the class DefaultLocationDataService method getLocationInfo.
/**
* <p>getLocationInfo</p>
*
* @param def a {@link org.opennms.netmgt.model.OnmsMonitoringLocationDefinition} object.
* @return a {@link org.opennms.features.poller.remote.gwt.client.location.LocationInfo} object.
*/
@Transactional
@Override
public LocationInfo getLocationInfo(final OnmsMonitoringLocation def) {
waitForGeocoding("getLocationInfo");
if (def == null) {
LOG.warn("no location definition specified");
return null;
}
final StatusDetails monitorStatus = getStatusDetailsForLocation(def);
return getLocationInfo(def, monitorStatus);
}
use of org.opennms.features.poller.remote.gwt.client.StatusDetails in project opennms by OpenNMS.
the class DefaultLocationDataService method getStatusDetailsForApplicationOld.
/**
* <p>getStatusDetailsForApplicationOld</p>
*
* @param app a {@link org.opennms.netmgt.model.OnmsApplication} object.
* @return a {@link org.opennms.features.poller.remote.gwt.client.StatusDetails} object.
*/
@Transactional
public StatusDetails getStatusDetailsForApplicationOld(final OnmsApplication app) {
waitForGeocoding("getStatusDetailsForApplication");
List<GWTLocationSpecificStatus> statuses = new ArrayList<GWTLocationSpecificStatus>();
final Date to = new Date();
final Date from = new Date(to.getTime() - AVAILABILITY_MS);
final Collection<OnmsMonitoredService> services = m_monitoredServiceDao.findByApplication(app);
final List<GWTLocationMonitor> monitors = new ArrayList<GWTLocationMonitor>();
final Set<GWTMonitoredService> gwtServices = new LinkedHashSet<GWTMonitoredService>(services.size());
for (final OnmsMonitoredService service : services) {
gwtServices.add(transformMonitoredService(service));
}
for (final OnmsLocationMonitor monitor : m_locationDao.findByApplication(app)) {
monitors.add(transformLocationMonitor(monitor));
for (final OnmsLocationSpecificStatus locationSpecificStatus : m_locationDao.getStatusChangesForLocationBetween(from, to, monitor.getLocation())) {
if (services.contains(locationSpecificStatus.getMonitoredService())) {
statuses.add(transformLocationSpecificStatus(locationSpecificStatus));
}
}
}
StatusDetails statusDetails = new AppStatusDetailsComputer(from, to, monitors, gwtServices, statuses).compute();
LOG.warn("getStatusDetailsForApplication({}) returning {}", app.getName(), statusDetails);
return statusDetails;
}
Aggregations