log.info(" ** NAME: \t" + notifInfo[i].getName()); log.info(" DESCR: \t" + notifInfo[i].getDescription()); String notifTypes[] = notifInfo[i].getNotifTypes(); for (int j = 0; j < notifTypes.length; j++) { log.info(" TYPE: \t" + notifTypes[j]);
@Test public void testNotificationMetadata() throws Exception { ModelMBeanInfo info = (ModelMBeanInfo) getMBeanInfo(); MBeanNotificationInfo[] notifications = info.getNotifications(); assertEquals("Incorrect number of notifications", 1, notifications.length); assertEquals("Incorrect notification name", "My Notification", notifications[0].getName()); String[] notifTypes = notifications[0].getNotifTypes(); assertEquals("Incorrect number of notification types", 2, notifTypes.length); assertEquals("Notification type.foo not found", "type.foo", notifTypes[0]); assertEquals("Notification type.bar not found", "type.bar", notifTypes[1]); }
/** {@inheritDoc} */ @Override protected JSONObject extractData(MBeanInfo pMBeanInfo, String pNotification) { JSONObject notMap = new JSONObject(); for (MBeanNotificationInfo notInfo : pMBeanInfo.getNotifications()) { if (pNotification == null || notInfo.getName().equals(pNotification)) { JSONObject map = new JSONObject(); map.put(NAME.getKey(), notInfo.getName()); map.put(DESCRIPTION.getKey(), notInfo.getDescription()); String[] types = notInfo.getNotifTypes(); JSONArray tList = new JSONArray(); for (String type : types) { tList.add(type); } map.put(TYPES.getKey(), tList); } } return notMap; } }
@Override public boolean equals( final MBeanNotificationInfo a, final MBeanNotificationInfo b ) { return a == b || a.getName().equals( b.getName() ) && Arrays.equals( a.getNotifTypes(), b.getNotifTypes() ); } }
private void addNotifications(Map pMBeanMap,MBeanInfo pMBeanInfo) { Map notMap = new HashMap(); for (MBeanNotificationInfo notInfo : pMBeanInfo.getNotifications()) { Map map = new HashMap(); map.put(KEY_NAME,notInfo.getName()); map.put(KEY_DESCRIPTION,notInfo.getDescription()); map.put(KEY_TYPES,notInfo.getNotifTypes()); } if (notMap.size() > 0) { pMBeanMap.put(KEY_NOTIFICATION,notMap); } }
public String stringify(Object o) { final MBeanNotificationInfo notif = (MBeanNotificationInfo) o; String result = notif.getName() + ":"; final String[] notifTypes = notif.getNotifTypes(); result = result + ArrayStringifier.stringify(notifTypes, mOptions.mArrayDelimiter); if (mOptions.mIncludeDescription) { result = result + ",\"" + notif.getDescription() + "\""; } return (result); }
public String stringify(Object o) { final MBeanNotificationInfo notif = (MBeanNotificationInfo) o; String result = notif.getName() + ":"; final String[] notifTypes = notif.getNotifTypes(); result = result + ArrayStringifier.stringify(notifTypes, mOptions.mArrayDelimiter); if (mOptions.mIncludeDescription) { result = result + ",\"" + notif.getDescription() + "\""; } return (result); }
@Override protected void accept(final NotificationSupport connector) throws MBeanException { if (connector == null) throw new MBeanException(new NullPointerException("Managed resource doesn't support notifications")); for (final MBeanNotificationInfo notification : connector.getNotificationInfo()) if (ArrayUtils.contains(notification.getNotifTypes(), notificationType)) { metadata = DescriptorUtils.asDictionary(notification.getDescriptor()); return; } }
/** {@inheritDoc} */ @Override protected JSONObject extractData(MBeanInfo pMBeanInfo, String pNotification) { JSONObject notMap = new JSONObject(); for (MBeanNotificationInfo notInfo : pMBeanInfo.getNotifications()) { if (pNotification == null || notInfo.getName().equals(pNotification)) { JSONObject map = new JSONObject(); map.put(NAME.getKey(), notInfo.getName()); map.put(DESCRIPTION.getKey(), notInfo.getDescription()); String[] types = notInfo.getNotifTypes(); JSONArray tList = new JSONArray(); for (String type : types) { tList.add(type); } map.put(TYPES.getKey(), tList); } } return notMap; } }
/** {@inheritDoc} */ @Override protected JSONObject extractData(MBeanInfo pMBeanInfo, String pNotification) { JSONObject notMap = new JSONObject(); for (MBeanNotificationInfo notInfo : pMBeanInfo.getNotifications()) { if (pNotification == null || notInfo.getName().equals(pNotification)) { JSONObject map = new JSONObject(); map.put(NAME.getKey(), notInfo.getName()); map.put(DESCRIPTION.getKey(), notInfo.getDescription()); String[] types = notInfo.getNotifTypes(); JSONArray tList = new JSONArray(); for (String type : types) { tList.add(type); } map.put(TYPES.getKey(), tList); } } return notMap; } }
map.put("name", notInfo.getName()); map.put("desc", notInfo.getDescription()); String[] types = notInfo.getNotifTypes(); List<String> tList = new ArrayList<>(types.length); Collections.addAll(tList, types);
private void displayNotifications(MBeanInfo info) { Session session = getSession(); MBeanNotificationInfo[] notificationInfos = info.getNotifications(); if (notificationInfos.length == 0) { session.output.printMessage("there's no notifications"); return; } int index = 0; session.output.println(TEXT_NOTIFICATIONS); for (MBeanNotificationInfo notification : notificationInfos) { session.output.println(String.format(" %%%-3d - %s(%s)" + (showDescription ? ", %s" : ""), index++, notification.getName(), StringUtils.join(notification.getNotifTypes(), ","), notification.getDescription())); } }
private void displayNotifications( MBeanInfo info ) { Session session = getSession(); MBeanNotificationInfo[] notificationInfos = info.getNotifications(); if ( notificationInfos.length == 0 ) { session.output.printMessage( "there's no notifications" ); return; } int index = 0; session.output.println( TEXT_NOTIFICATIONS ); for ( MBeanNotificationInfo notification : notificationInfos ) { session.output.println( String.format( " %%%-3d - %s(%s)" + ( showDescription ? ", %s" : "" ), index++, notification.getName(), StringUtils.join( notification.getNotifTypes(), "," ), notification.getDescription() ) ); } }
notification.setAttribute("name", notifications[i].getName()); notification.setAttribute("description", notifications[i].getDescription()); String[] types = notifications[i].getNotifTypes(); for (int j=0;j<types.length;j++)
notification.setAttribute("name", notifications[i].getName()); notification.setAttribute("description", notifications[i].getDescription()); String[] types = notifications[i].getNotifTypes(); for (int j = 0; j < types.length; j++)
String[] types = notifInfo.getNotifTypes(); out.println(" <notification>"); out.println(" <description>" + notifInfo.getDescription() + "</description>");
public void serialize(QName name, Attributes attributes, Object value, SerializationContext context) throws IOException { MBeanNotificationInfo info = (MBeanNotificationInfo)value; context.startElement(name, attributes); context.serialize(NAME_QNAME, null, info.getName()); context.serialize(DESCRIPTION_QNAME, null, info.getDescription()); context.serialize(NOTIFICATION_TYPES_QNAME, null, info.getNotifTypes()); context.endElement(); }
mbeanNotInfo.getNotifTypes(), mbeanNotInfo.getName(), mbeanNotInfo.getDescription());
notifications[i].getNotifTypes(), notifications[i].getName(), notifications[i].getDescription()
notifications[i].getNotifTypes(), notifications[i].getName(), notifications[i].getDescription()