use of org.opennms.features.poller.remote.gwt.client.location.LocationInfo in project opennms by OpenNMS.
the class LocationDataServiceIT method testLocationInfo.
@Test
public void testLocationInfo() throws Exception {
m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_localhostHttpService.getId(), getAvailable(new Date(now() - days(20) - hours(3))));
m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_localhostHttpService.getId(), getDown(new Date(now() - days(20) - hours(2))));
m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_localhostHttpService.getId(), getAvailable(new Date(now() - days(20) - hours(1))));
m_pollerBackEnd.reportResult(m_rduMonitor1.getId(), m_googleHttpService.getId(), getDown(new Date(now() - days(20) - hours(4))));
LocationInfo li = m_locationDataService.getLocationInfo("RDU");
assertNotNull(li);
assertEquals("RDU", li.getName());
// Down because one of the services is down.
assertEquals(Status.DOWN, li.getStatusDetails().getStatus());
}
use of org.opennms.features.poller.remote.gwt.client.location.LocationInfo in project opennms by OpenNMS.
the class LocationBroadcastProcessor method handleEventParm.
private void handleEventParm(final String name, final String value) {
if (name.equals(EventConstants.PARM_LOCATION_MONITOR_ID)) {
final LocationInfo info = m_locationDataService.getLocationInfoForMonitor(Integer.valueOf(value));
m_eventHandler.sendEvent(new LocationUpdatedRemoteEvent(info));
for (final ApplicationInfo applicationInfo : m_locationDataService.getApplicationsForLocation(info)) {
m_eventHandler.sendEvent(new ApplicationUpdatedRemoteEvent(applicationInfo));
}
}
}
use of org.opennms.features.poller.remote.gwt.client.location.LocationInfo in project opennms by OpenNMS.
the class DefaultLocationManager method updateLocation.
/**
* {@inheritDoc}
*
* Invoked by the {@link LocationUpdatedRemoteEvent} and
* {@link LocationsUpdatedRemoteEvent} events.
*/
@Override
public void updateLocation(final LocationInfo newLocation) {
if (newLocation != null) {
LocationInfo oldLocation = m_dataManager.getLocation(newLocation.getName());
// Update the location information in the model
m_dataManager.updateLocation(newLocation);
m_view.updateApplicationNames(m_dataManager.getAllApplicationNames());
placeMarker(newLocation);
if (m_updated) {
// Update the icon/caption in the LHN
if (oldLocation == null || (m_selectedVisibleFilter.matches(newLocation) != m_selectedVisibleFilter.matches(oldLocation)) || (oldLocation.getStatus() != newLocation.getStatus())) {
m_view.updateLocationList(getLocationsForLocationPanel());
}
m_eventBus.fireEvent(new LocationsUpdatedEvent());
}
}
}
use of org.opennms.features.poller.remote.gwt.client.location.LocationInfo in project opennms by OpenNMS.
the class DefaultLocationManager method getLocationsForLocationPanel.
/**
* TODO: Figure out if this public function is necessary or if we can get
* by just responding to incoming events.
*
* @return a {@link java.util.ArrayList} object.
*/
public List<LocationInfo> getLocationsForLocationPanel() {
// Use an ArrayList so that it has good random-access efficiency
// since the pageable lists use get() to fetch based on index.
final List<LocationInfo> visibleLocations = m_dataManager.getMatchingLocations(m_selectedVisibleFilter);
GWTBounds mapBounds = m_view.getMapBounds();
final ArrayList<LocationInfo> inBounds = new ArrayList<>();
for (final LocationInfo location : visibleLocations) {
final GWTMarkerState markerState = location.getMarkerState();
if (markerState.isWithinBounds(mapBounds)) {
inBounds.add(location);
}
}
// TODO: this should use the current filter set eventually, for now
// sort by priority, then name
// for now, LocationInfo is Comparable and has a natural sort ordering
// based on status, priority, and name
Collections.sort(inBounds, new Comparator<LocationInfo>() {
@Override
public int compare(LocationInfo o1, LocationInfo o2) {
return o1.compareTo(o2);
}
});
return inBounds;
}
use of org.opennms.features.poller.remote.gwt.client.location.LocationInfo in project opennms by OpenNMS.
the class PageableLocationList method onItemClickHandler.
/**
* {@inheritDoc}
*/
@Override
public void onItemClickHandler(final ClickEvent event) {
final Cell cell = getCellForEvent(event);
LocationInfo location = m_locations.get(cell.getRowIndex() + (getCurrentPageIndex() * getTotalListItemsPerPage()));
fireEvent(new LocationPanelSelectEvent(location.getName()));
}
Aggregations