use of org.opennms.features.poller.remote.gwt.client.ApplicationInfo in project opennms by OpenNMS.
the class LocationBroadcastProcessor method handleEventParms.
private void handleEventParms(final List<Parm> parms) {
for (final Parm p : parms) {
if (p.getParmName().equals(EventConstants.PARM_LOCATION_MONITOR_ID)) {
final LocationInfo info = m_locationDataService.getLocationInfoForMonitor(Integer.valueOf(p.getValue().getContent()));
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.ApplicationInfo in project opennms by OpenNMS.
the class DefaultApplicationHandler method handle.
/**
* <p>handle</p>
*
* @param application a {@link org.opennms.netmgt.model.OnmsApplication} object.
*/
@Override
public void handle(final OnmsApplication application) {
final ApplicationInfo applicationInfo = getLocationDataService().getApplicationInfo(application);
final ApplicationUpdatedRemoteEvent event = new ApplicationUpdatedRemoteEvent(applicationInfo);
sendEvent(event);
if (m_oldApplicationNames != null) {
m_oldApplicationNames.remove(application.getName());
}
m_foundApplicationNames.add(application.getName());
}
use of org.opennms.features.poller.remote.gwt.client.ApplicationInfo in project opennms by OpenNMS.
the class DefaultLocationDataService method getApplicationInfo.
/** {@inheritDoc} */
@Transactional
@Override
public ApplicationInfo getApplicationInfo(final OnmsApplication app, final StatusDetails status) {
waitForGeocoding("getApplicationInfo");
if (app == null) {
LOG.warn("no application specified");
return null;
}
final Set<GWTMonitoredService> services = new TreeSet<GWTMonitoredService>();
final Set<String> locationNames = new TreeSet<String>();
for (final OnmsMonitoredService service : m_monitoredServiceDao.findByApplication(app)) {
services.add(transformMonitoredService(service));
}
for (final OnmsLocationMonitor mon : m_locationDao.findByApplication(app)) {
locationNames.add(mon.getLocation());
}
final ApplicationInfo applicationInfo = new ApplicationInfo(app.getId(), app.getName(), services, locationNames, status);
LOG.debug("getApplicationInfo({}) returning {}", app.getName(), applicationInfo);
return applicationInfo;
}
use of org.opennms.features.poller.remote.gwt.client.ApplicationInfo in project opennms by OpenNMS.
the class DefaultLocationDataService method getApplicationDetails.
/**
* <p>getApplicationDetails</p>
*
* @param app a {@link org.opennms.netmgt.model.OnmsApplication} object.
* @return a {@link org.opennms.features.poller.remote.gwt.client.ApplicationDetails} object.
*/
@Transactional
@Override
public ApplicationDetails getApplicationDetails(final OnmsApplication app) {
waitForGeocoding("getApplicationDetails");
final ApplicationInfo applicationInfo = getApplicationInfo(app, StatusDetails.unknown());
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>();
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));
}
}
}
ApplicationDetails details = new ApplicationDetails(applicationInfo, from, to, monitors, statuses);
LOG.warn("getApplicationDetails({}) returning {}", app.getName(), details);
return details;
}
use of org.opennms.features.poller.remote.gwt.client.ApplicationInfo in project opennms by OpenNMS.
the class LocationDataManager method pushApplicationData.
private void pushApplicationData(final EventExecutorService service) {
LOG.debug("pushing initialized applications");
final List<ApplicationInfo> appInfos = getLocationDataService().getInfoForAllApplications();
for (final ApplicationInfo appInfo : appInfos) {
service.addEventUserSpecific(new ApplicationUpdatedRemoteEvent(appInfo));
}
LOG.debug("finished pushing initialized applications");
}
Aggregations