/** * <p>handleInsufficientInfo</p> * * @param e a {@link org.opennms.core.utils.InsufficientInformationException} object. */ protected void handleInsufficientInfo(InsufficientInformationException e) { LOG.info(e.getMessage()); }
/** * Ensures the given event has an interface * * @param e * the event * @throws org.opennms.netmgt.capsd.InsufficientInformationException * if an interface is not available */ static public void checkInterface(Event e) throws InsufficientInformationException { if (e == null) { throw new NullPointerException("Event is null"); } else if (e.getInterface() == null) { throw new InsufficientInformationException("ipaddr for event is unavailable"); } }
@Override protected void handleInsufficientInfo(InsufficientInformationException e) { Assert.fail("Invalid event received: "+ e.getMessage()); } };
/** * Ensures that the given Event has a node id * * @param e * the event * @throws org.opennms.netmgt.capsd.InsufficientInformationException * if a node id is not available */ static public void checkNodeId(Event e) throws InsufficientInformationException { if (e == null) { throw new NullPointerException("e is null"); } else if (!e.hasNodeid()) { throw new InsufficientInformationException("nodeid for event is unavailable"); } }
@Override protected void handleInsufficientInfo(InsufficientInformationException e) { fail("Invalid event received: "+e.getMessage()); }
/** * Ensures that the given event has a service parameter * * @param e * the event to check * @throws org.opennms.netmgt.capsd.InsufficientInformationException * if the event does not have a service */ public static void checkService(Event e) throws InsufficientInformationException { if (e == null) { throw new NullPointerException("e is null"); } else if (e.getService() == null || e.getService().length() == 0) { throw new InsufficientInformationException("service for event is unavailable"); } }
/** * {@inheritDoc} * * Event listener Interface required implementation */ @Override public void onEvent(Event e) { try { if (EventConstants.TROUBLETICKET_CANCEL_UEI.equals(e.getUei())) { handleCancelTicket(e); } else if (EventConstants.TROUBLETICKET_CLOSE_UEI.equals(e.getUei())) { handleCloseTicket(e); } else if (EventConstants.TROUBLETICKET_CREATE_UEI.equals(e.getUei())) { handleCreateTicket(e); } else if (EventConstants.TROUBLETICKET_UPDATE_UEI.equals(e.getUei())) { handleUpdateTicket(e); } else if (isReloadConfigEvent(e)) { handleTicketerReload(e); } } catch (InsufficientInformationException ex) { LOG.warn("Unable to create trouble ticket due to lack of information: {}", ex.getMessage()); } catch (Throwable t) { LOG.error("Error occurred during trouble ticket processing!", t); } }
/** * Throw an exception if an event does have the required parameter * * @param e * the event the parameter must reside on * @throws org.opennms.netmgt.capsd.InsufficientInformationException * if the paramter is not set on the event or if its value has * no content * @param parmName a {@link java.lang.String} object. */ public static void requireParm(Event e, String parmName) throws InsufficientInformationException { for (Parm parm : e.getParmCollection()) { if (parmName.equals(parm.getParmName())) { if (parm.getValue() != null && parm.getValue().getContent() != null) { // we found a matching parm return; } else { throw new InsufficientInformationException("parameter " + parmName + " required but only null valued parms available"); } } } throw new InsufficientInformationException("parameter " + parmName + " required but was not available"); }
/** * {@inheritDoc} * * Event listener Interface required implementation */ @Override public void onEvent(Event e) { try { if (EventConstants.TROUBLETICKET_CANCEL_UEI.equals(e.getUei())) { handleCancelTicket(e); } else if (EventConstants.TROUBLETICKET_CLOSE_UEI.equals(e.getUei())) { handleCloseTicket(e); } else if (EventConstants.TROUBLETICKET_CREATE_UEI.equals(e.getUei())) { handleCreateTicket(e); } else if (EventConstants.TROUBLETICKET_UPDATE_UEI.equals(e.getUei())) { handleUpdateTicket(e); } else if (isReloadConfigEvent(e)) { handleTicketerReload(e); } } catch (InsufficientInformationException ex) { LOG.warn("Unable to create trouble ticket due to lack of information: {}", ex.getMessage()); } catch (Throwable t) { LOG.error("Error occurred during trouble ticket processing!", t); } }