1 22 package org.jboss.management.j2ee.factory; 23 24 import org.jboss.management.j2ee.JavaMailResource; 25 26 import javax.management.MBeanServer ; 27 import javax.management.ObjectName ; 28 29 35 public class JavaMailResourceFactory 36 implements ManagedObjectFactory 37 { 38 45 public ObjectName create(MBeanServer server, Object data) 46 { 47 ObjectName serviceName = (ObjectName ) data; 48 String resName = serviceName.getKeyProperty("name"); 49 if (resName == null) 50 resName = "DefaultMail"; 51 ObjectName name = JavaMailResource.create(server, resName, serviceName); 52 return name; 53 } 54 55 62 public void destroy(MBeanServer server, Object data) 63 { 64 ObjectName serviceName = (ObjectName ) data; 65 String resName = serviceName.getKeyProperty("name"); 66 if (resName == null) 67 resName = "DefaultMail"; 68 JavaMailResource.destroy(server, resName); 69 } 70 } 71 | Popular Tags |