Search in sources :

Example 16 with Events

use of org.opennms.netmgt.xml.eventconf.Events in project opennms by OpenNMS.

the class SpectrumTrapImporter method main.

public static void main(String[] argv) {
    SpectrumTrapImporter importer = new SpectrumTrapImporter();
    importer.configureArgs(argv);
    try {
        importer.afterPropertiesSet();
    } catch (Throwable e) {
        importer.printHelp("Fatal exception caught at startup: " + e.getMessage());
        System.exit(1);
    }
    Events events = new Events();
    try {
        events = importer.makeEvents();
    } catch (IOException e) {
        importer.printHelp("Fatal exception caught at runtime: " + e.getMessage());
    }
    try {
        //events.marshal(importer.getOutputWriter());
        StringWriter sw = new StringWriter();
        events.marshal(sw);
        importer.prettyPrintXML(sw.toString());
    } catch (MarshalException e) {
        importer.printHelp("Fatal exception while marshaling output: " + e.getMessage());
    } catch (ValidationException e) {
        importer.printHelp("Fatal exception while validating output: " + e.getMessage());
    } catch (IOException e) {
        importer.printHelp("Fatal I/O exception: " + e.getMessage(), e);
    } catch (SAXException e) {
        importer.printHelp("Fatal SAX exception: " + e.getMessage());
    } catch (ParserConfigurationException e) {
        importer.printHelp("Fatal parser configuration exception: " + e.getMessage());
    }
}
Also used : MarshalException(org.exolab.castor.xml.MarshalException) ValidationException(org.exolab.castor.xml.ValidationException) StringWriter(java.io.StringWriter) Events(org.opennms.netmgt.xml.eventconf.Events) IOException(java.io.IOException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) SAXException(org.xml.sax.SAXException)

Aggregations

Events (org.opennms.netmgt.xml.eventconf.Events)16 File (java.io.File)8 Test (org.junit.Test)5 IOException (java.io.IOException)4 Event (org.opennms.netmgt.xml.eventconf.Event)4 EventOrdering (org.opennms.netmgt.xml.eventconf.EventOrdering)4 StringWriter (java.io.StringWriter)3 Maskelement (org.opennms.netmgt.xml.eventconf.Maskelement)3 HashSet (java.util.HashSet)2 EventBuilder (org.opennms.netmgt.model.events.EventBuilder)2 Varbindsdecode (org.opennms.netmgt.xml.eventconf.Varbindsdecode)2 DataAccessException (org.springframework.dao.DataAccessException)2 DataRetrievalFailureException (org.springframework.dao.DataRetrievalFailureException)2 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)1 CommitException (com.vaadin.data.fieldgroup.FieldGroup.CommitException)1 Button (com.vaadin.ui.Button)1 ClickEvent (com.vaadin.ui.Button.ClickEvent)1 ComboBox (com.vaadin.ui.ComboBox)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Label (com.vaadin.ui.Label)1