1 22 package org.jboss.management.j2ee.factory; 23 24 import org.jboss.deployment.DeploymentInfo; 25 import org.jboss.logging.Logger; 26 import org.jboss.management.j2ee.J2EEApplication; 27 28 import javax.management.MBeanServer ; 29 import javax.management.ObjectName ; 30 import java.util.HashMap ; 31 32 38 public class EARModuleFactory 39 implements ManagedObjectFactory 40 { 41 private static Logger log = Logger.getLogger(EARModuleFactory.class); 42 43 private HashMap deploymentToModuleNameMap = new HashMap (); 44 45 51 public ObjectName create(MBeanServer server, Object data) 52 { 53 if ((data instanceof DeploymentInfo) == false) 54 return null; 55 56 DeploymentInfo di = (DeploymentInfo) data; 57 String moduleName = di.shortName; 58 ObjectName jsr77Name = J2EEApplication.create(server, moduleName, di.localUrl); 59 deploymentToModuleNameMap.put(di, jsr77Name); 60 if (jsr77Name != null) 61 { 62 log.debug("Created J2EEApplication: " + jsr77Name); 63 } 64 65 return jsr77Name; 66 } 67 68 74 public void destroy(MBeanServer server, Object data) 75 { 76 if ((data instanceof DeploymentInfo) == false) 77 return; 78 79 DeploymentInfo di = (DeploymentInfo) data; 80 ObjectName jsr77Name = (ObjectName ) deploymentToModuleNameMap.remove(di); 81 if (jsr77Name != null) 83 { 84 J2EEApplication.destroy(server, jsr77Name); 85 log.debug("Removed J2EEApplication: " + jsr77Name); 86 } 87 } 88 } 89 | Popular Tags |