1 16 17 package org.springframework.jmx.export.metadata; 18 19 import javax.management.modelmbean.ModelMBeanNotificationInfo ; 20 21 import org.springframework.util.StringUtils; 22 23 30 public abstract class JmxMetadataUtils { 31 32 36 public static ModelMBeanNotificationInfo convertToModelMBeanNotificationInfo(ManagedNotification notificationInfo) { 37 String name = notificationInfo.getName(); 38 if (!StringUtils.hasText(name)) { 39 throw new IllegalArgumentException ("Must specify notification name"); 40 } 41 42 String [] notifTypes = notificationInfo.getNotificationTypes(); 43 if (notifTypes == null || notifTypes.length == 0) { 44 throw new IllegalArgumentException ("Must specify at least one notification type"); 45 } 46 47 String description = notificationInfo.getDescription(); 48 return new ModelMBeanNotificationInfo (notifTypes, name, description); 49 } 50 51 } 52 | Popular Tags |