Search in sources :

Example 1 with ApplicationInfo

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));
            }
        }
    }
}
Also used : ApplicationInfo(org.opennms.features.poller.remote.gwt.client.ApplicationInfo) Parm(org.opennms.netmgt.xml.event.Parm) LocationUpdatedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.LocationUpdatedRemoteEvent) ApplicationUpdatedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.ApplicationUpdatedRemoteEvent) LocationInfo(org.opennms.features.poller.remote.gwt.client.location.LocationInfo)

Example 2 with 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());
}
Also used : ApplicationInfo(org.opennms.features.poller.remote.gwt.client.ApplicationInfo) ApplicationUpdatedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.ApplicationUpdatedRemoteEvent)

Example 3 with ApplicationInfo

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;
}
Also used : TreeSet(java.util.TreeSet) ApplicationInfo(org.opennms.features.poller.remote.gwt.client.ApplicationInfo) GWTMonitoredService(org.opennms.features.poller.remote.gwt.client.GWTMonitoredService) OnmsLocationMonitor(org.opennms.netmgt.model.OnmsLocationMonitor) OnmsMonitoredService(org.opennms.netmgt.model.OnmsMonitoredService) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with 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;
}
Also used : GWTLocationSpecificStatus(org.opennms.features.poller.remote.gwt.client.GWTLocationSpecificStatus) OnmsLocationSpecificStatus(org.opennms.netmgt.model.OnmsLocationSpecificStatus) ApplicationInfo(org.opennms.features.poller.remote.gwt.client.ApplicationInfo) ArrayList(java.util.ArrayList) GWTLocationMonitor(org.opennms.features.poller.remote.gwt.client.GWTLocationMonitor) OnmsLocationMonitor(org.opennms.netmgt.model.OnmsLocationMonitor) ApplicationDetails(org.opennms.features.poller.remote.gwt.client.ApplicationDetails) Date(java.util.Date) OnmsMonitoredService(org.opennms.netmgt.model.OnmsMonitoredService) Transactional(org.springframework.transaction.annotation.Transactional)

Example 5 with ApplicationInfo

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");
}
Also used : ApplicationInfo(org.opennms.features.poller.remote.gwt.client.ApplicationInfo) ApplicationUpdatedRemoteEvent(org.opennms.features.poller.remote.gwt.client.remoteevents.ApplicationUpdatedRemoteEvent)

Aggregations

ApplicationInfo (org.opennms.features.poller.remote.gwt.client.ApplicationInfo)11 Transactional (org.springframework.transaction.annotation.Transactional)6 OnmsApplication (org.opennms.netmgt.model.OnmsApplication)4 ArrayList (java.util.ArrayList)3 Date (java.util.Date)3 ApplicationUpdatedRemoteEvent (org.opennms.features.poller.remote.gwt.client.remoteevents.ApplicationUpdatedRemoteEvent)3 OnmsLocationMonitor (org.opennms.netmgt.model.OnmsLocationMonitor)3 OnmsLocationSpecificStatus (org.opennms.netmgt.model.OnmsLocationSpecificStatus)3 OnmsMonitoredService (org.opennms.netmgt.model.OnmsMonitoredService)3 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 TreeSet (java.util.TreeSet)2 GWTLocationMonitor (org.opennms.features.poller.remote.gwt.client.GWTLocationMonitor)2 GWTMonitoredService (org.opennms.features.poller.remote.gwt.client.GWTMonitoredService)2 HashSet (java.util.HashSet)1 LinkedHashSet (java.util.LinkedHashSet)1 Map (java.util.Map)1 Test (org.junit.Test)1 ApplicationDetails (org.opennms.features.poller.remote.gwt.client.ApplicationDetails)1 ApplicationState (org.opennms.features.poller.remote.gwt.client.ApplicationState)1