Search in sources :

Example 1 with DataCollectionWindow

use of org.opennms.features.vaadin.datacollection.DataCollectionWindow in project opennms by OpenNMS.

the class MibCompilerPanel method generateDataCollection.

/**
     * Generate data collection.
     *
     * @param logger the logger
     * @param fileName the file name
     */
private void generateDataCollection(final Logger logger, final String fileName) {
    if (parseMib(logger, new File(MIBS_COMPILED_DIR, fileName))) {
        final DatacollectionGroup dcGroup = mibParser.getDataCollection();
        if (dcGroup == null) {
            Notification.show("The MIB couldn't be processed for data collection because: " + mibParser.getFormattedErrors(), Notification.Type.ERROR_MESSAGE);
        } else {
            if (dcGroup.getGroups().size() > 0) {
                try {
                    final String dataFileName = fileName.replaceFirst("\\..*$", ".xml");
                    final DataCollectionWindow w = new DataCollectionWindow(mibParser, dataCollectionDao, dataFileName, dcGroup, logger);
                    getUI().addWindow(w);
                } catch (Throwable t) {
                    Notification.show(t.getMessage(), Notification.Type.ERROR_MESSAGE);
                }
            } else {
                Notification.show("The MIB doesn't contain any metric for data collection.", Notification.Type.WARNING_MESSAGE);
            }
        }
    }
}
Also used : DataCollectionWindow(org.opennms.features.vaadin.datacollection.DataCollectionWindow) File(java.io.File) DatacollectionGroup(org.opennms.netmgt.config.datacollection.DatacollectionGroup)

Aggregations

File (java.io.File)1 DataCollectionWindow (org.opennms.features.vaadin.datacollection.DataCollectionWindow)1 DatacollectionGroup (org.opennms.netmgt.config.datacollection.DatacollectionGroup)1