1 22 package org.jboss.management.j2ee; 23 24 import org.jboss.logging.Logger; 25 26 import javax.management.MBeanServer ; 27 import javax.management.MalformedObjectNameException ; 28 import javax.management.ObjectName ; 29 import java.util.Hashtable ; 30 31 37 public class JCAManagedConnectionFactory extends J2EEManagedObject 38 implements JCAManagedConnectionFactoryMBean 39 { 40 private static Logger log = Logger.getLogger(JCAManagedConnectionFactory.class); 42 43 45 47 public static ObjectName create(MBeanServer mbeanServer, String resName, 48 ObjectName jsr77ParentName) 49 { 50 ObjectName jsr77Name = null; 51 try 52 { 53 JCAManagedConnectionFactory mcf = new JCAManagedConnectionFactory(resName, 54 jsr77ParentName); 55 jsr77Name = mcf.getObjectName(); 56 mbeanServer.registerMBean(mcf, jsr77Name); 57 } 58 catch (Exception e) 59 { 60 log.debug("Could not create JSR-77 JCAManagedConnectionFactory: " + resName, e); 61 } 62 return jsr77Name; 63 } 64 65 public static void destroy(MBeanServer mbeanServer, String resName) 66 { 67 try 68 { 69 String mcfName = J2EEDomain.getDomainName() + ":" + 71 J2EEManagedObject.TYPE + "=" + J2EETypeConstants.JCAManagedConnectionFactory 72 + ",name=" + resName + ",*"; 73 J2EEManagedObject.removeObject(mbeanServer, mcfName); 74 } 75 catch (Exception e) 76 { 77 log.debug("Could not destroy JSR-77 JCAManagedConnectionFactory: " + resName, e); 78 } 79 } 80 81 83 85 public JCAManagedConnectionFactory(String resName, ObjectName jsr77ParentName) 86 throws MalformedObjectNameException , InvalidParentException 87 { 88 super(J2EETypeConstants.JCAManagedConnectionFactory, resName, jsr77ParentName); 89 } 90 91 93 95 public String toString() 96 { 97 return "JCAManagedConnectionFactory { " + super.toString() + " } [ " + 98 " ]"; 99 } 100 101 104 protected Hashtable getParentKeys(ObjectName parentName) 105 { 106 Hashtable keys = new Hashtable (); 107 Hashtable nameProps = parentName.getKeyPropertyList(); 108 String serverName = (String ) nameProps.get(J2EETypeConstants.J2EEServer); 109 keys.put(J2EETypeConstants.J2EEServer, serverName); 110 return keys; 111 } 112 113 } 114 | Popular Tags |