1 23 24 37 package com.sun.enterprise.server; 38 39 import com.sun.enterprise.server.event.ApplicationClientEvent; 40 import com.sun.enterprise.server.event.ApplicationLoaderEventNotifier; 41 import java.net.URL ; 42 import java.util.Set ; 43 import com.sun.enterprise.loader.EJBClassPathUtils; 44 import com.sun.enterprise.config.ConfigException; 45 import com.sun.enterprise.instance.AppclientModulesManager; 46 47 import java.util.jar.Manifest ; 48 import java.util.logging.Level ; 49 import java.util.logging.Logger ; 50 import com.sun.logging.LogDomains; 51 import com.sun.enterprise.loader.EJBClassLoader; 52 53 import com.sun.enterprise.instance.InstanceEnvironment; 55 import com.sun.enterprise.deployment.ApplicationClientDescriptor; 56 import com.sun.enterprise.deployment.node.J2EEDocumentBuilder; 57 import com.sun.enterprise.deployment.Descriptor; 58 import com.sun.enterprise.deployment.EjbDescriptor; 59 import com.sun.enterprise.deployment.EjbBundleDescriptor; 60 import com.sun.enterprise.deployment.Application; 61 import java.util.Iterator ; 62 import javax.management.MBeanException ; 63 import com.sun.enterprise.Switch; 64 65 71 class ApplicationClientModuleLoader extends AbstractLoader { 72 73 private ApplicationClientDescriptor acDescriptor = null; 74 75 static Logger _logger=LogDomains.getLogger(LogDomains.LOADER_LOGGER); 76 77 private ApplicationLoaderEventNotifier appLoaderEventNotifier; 78 79 86 ApplicationClientModuleLoader(String modID, ClassLoader parentClassLoader, 87 AppclientModulesManager acModulesManager) { 88 89 super(modID, parentClassLoader, acModulesManager); 90 91 setDescriptor(); 92 93 try { 94 this.application = acModulesManager.getDescriptor(modID, parentClassLoader, false); 95 appLoaderEventNotifier = 96 ApplicationLoaderEventNotifier.getInstance(); 97 } catch (ConfigException ce) { 98 _logger.log(Level.SEVERE,"loader.error_while_loading_app_desc", 99 ce); 100 } 101 } 102 103 112 boolean load(boolean jsr77) { 113 notifyAppClientEvent(ApplicationClientEvent.BEFORE_APPLICATION_CLIENT_LOAD); 114 115 notifyAppClientEvent(ApplicationClientEvent.AFTER_APPLICATION_CLIENT_LOAD); 116 117 return true; 118 } 119 120 128 boolean unload(boolean jsr77) { 129 notifyAppClientEvent(ApplicationClientEvent.BEFORE_APPLICATION_CLIENT_UNLOAD); 130 131 configManager.unregisterDescriptor(id); 132 133 notifyAppClientEvent(ApplicationClientEvent.AFTER_APPLICATION_CLIENT_UNLOAD); 134 return true; 135 } 136 137 138 141 void createRootMBean() throws MBeanException { 142 143 try { 144 Switch.getSwitch().getManagementObjectManager().registerAppClient( 145 acDescriptor, 146 this.configManager.getInstanceEnvironment().getName(), 147 this.configManager.getLocation(this.id)); 148 } catch (Exception e) { 149 throw new MBeanException (e); 150 } 151 } 152 153 154 157 void deleteRootMBean() throws MBeanException { 158 159 Switch.getSwitch().getManagementObjectManager().unregisterAppClient( 160 acDescriptor, 161 this.configManager.getInstanceEnvironment().getName()); 162 } 163 164 165 168 void createLeafMBeans() throws MBeanException { 169 170 return; 171 } 172 173 174 177 void createLeafMBean(Descriptor descriptor) throws MBeanException { 178 179 return; 180 } 181 182 183 186 void deleteLeafMBeans() throws MBeanException { 187 188 return; 189 } 190 191 194 void deleteLeafMBean(Descriptor descriptor) throws MBeanException { 195 196 return; 197 } 198 199 200 203 void deleteLeafAndRootMBeans() throws MBeanException { 204 deleteLeafMBeans(); 205 deleteRootMBean(); 206 } 207 208 209 212 void setState(int state) throws MBeanException { 213 214 return; 215 } 216 217 private void setDescriptor() { 218 acDescriptor = getApplicationClientDescriptor(); 219 } 220 221 private ApplicationClientDescriptor getApplicationClientDescriptor() { 222 ApplicationClientDescriptor appCD = null; 223 try { 224 Application app = configManager.getDescriptor(this.id, null, false); 225 appCD = (ApplicationClientDescriptor) app.getStandaloneBundleDescriptor(); 226 } catch(ConfigException ex) { 227 _logger.log(Level.WARNING,"Failed to get the ApplicationClientDescriptor"); 228 } 229 return appCD; 230 } 231 232 236 protected void notifyAppClientEvent(int eventType) { 237 ApplicationClientEvent event = new ApplicationClientEvent(eventType, 238 getApplication(), getClassLoader()); 239 appLoaderEventNotifier.notifyListeners(event); 240 } 241 } 242 | Popular Tags |