1 23 24 package com.sun.enterprise.admin.server.core.mbean.config; 25 26 import com.sun.enterprise.config.ConfigException; 28 import com.sun.enterprise.config.serverbeans.ServerXPathHelper; 29 import com.sun.enterprise.config.serverbeans.J2eeApplication; 30 31 32 import com.sun.enterprise.admin.AdminContext; 34 import com.sun.enterprise.admin.common.ObjectNames; 35 import com.sun.enterprise.admin.common.exception.J2EEEjbJarModuleException; 36 import com.sun.enterprise.admin.common.constant.AdminConstants; 37 import com.sun.enterprise.admin.common.exception.MBeanConfigException; 38 import com.sun.enterprise.admin.server.core.mbean.config.naming.ConfigMBeanNamingInfo; 39 40 52 53 public class ManagedJ2EEEjbJarModule extends ConfigMBeanBase 54 { 55 private static final String [][] MAPLIST = null; 56 private static final String [] ATTRIBUTES = null; 57 private static final String [] OPERATIONS = 58 { 59 "getEnterpriseBeans(), INFO", 60 "getSessionEJBs(), INFO", 61 "getEntityEJBs(), INFO", 62 }; 63 64 67 public ManagedJ2EEEjbJarModule() throws MBeanConfigException 68 { 69 this.setDescriptions(MAPLIST, ATTRIBUTES, OPERATIONS); 70 } 71 72 public ManagedJ2EEEjbJarModule(String instanceName, String applicationName, String moduleName) 73 throws MBeanConfigException 74 { 75 this(instanceName, applicationName, moduleName, null); 76 } 77 78 public ManagedJ2EEEjbJarModule(String instanceName, String applicationName, String moduleName, AdminContext adminContext) 79 throws MBeanConfigException 80 { 81 this(); setAdminContext(adminContext); 83 initialize(ObjectNames.kEjbModule, new String []{instanceName, applicationName, moduleName}); 84 } 85 86 public String [] getEnterpriseBeans() throws J2EEEjbJarModuleException 87 { 88 return getBeansByType(ModulesXMLHelper.EJB_TYPE_ALL); 89 } 90 91 public String [] getSessionEJBs() throws J2EEEjbJarModuleException 92 { 93 return getBeansByType(ModulesXMLHelper.EJB_TYPE_SESSION); 94 } 95 96 public String [] getEntityEJBs() throws J2EEEjbJarModuleException 97 { 98 return getBeansByType(ModulesXMLHelper.EJB_TYPE_ENTITY); 99 } 100 101 private String [] getBeansByType(int ejbType) throws J2EEEjbJarModuleException 102 { 103 ConfigMBeanNamingInfo namingInfo = this.getConfigMBeanNamingInfo(); 104 String [] locParams = namingInfo.getLocationParams(); 105 String applicationName = locParams[1]; 106 String moduleName = locParams[2]; 107 108 109 try 110 { 111 J2eeApplication app = (J2eeApplication) this.getConfigBeanByXPath(ServerXPathHelper.getAppIdXpathExpression(applicationName)); 112 String location = app.getLocation(); 113 return ModulesXMLHelper.getEnterpriseBeansForEjbModule(location, moduleName, ejbType); 114 } 115 catch (Exception e) 116 { 117 sLogger.throwing(getClass().getName(), "getBeansByType", e); 118 throw new J2EEEjbJarModuleException(e.getMessage()); 119 } 120 } 121 122 public int getModuleType() 123 { 124 return ( AdminConstants.kTypeEjbModule ); 125 } 126 127 } 129 | Popular Tags |