1 23 24 29 30 package com.sun.enterprise.server; 31 32 import com.sun.enterprise.config.ConfigException; 33 import com.sun.enterprise.instance.InstanceFactory; 34 import com.sun.enterprise.instance.InstanceEnvironment; 35 import com.sun.enterprise.instance.AppsManager; 36 import com.sun.enterprise.instance.EjbModulesManager; 37 import com.sun.enterprise.instance.WebModulesManager; 38 import com.sun.enterprise.instance.ConnectorModulesManager; 39 import com.sun.enterprise.instance.AppclientModulesManager; 40 import com.sun.appserv.server.util.PreprocessorUtil; 41 42 import java.util.logging.Level ; 43 import java.util.logging.Logger ; 44 import com.sun.logging.LogDomains; 45 46 47 48 52 public class ManagerFactory { 53 54 55 private static ApplicationManager applicationManager; 56 57 private static StandAloneConnectorModulesManager saConnectorManager; 58 59 private static DummyWebModuleManager saWebManager; 60 61 private static StandAloneEJBModulesManager saEJBManager; 62 63 private static StandAloneAppClientModulesManager saACManager; 64 65 private static InstanceEnvironment iEnv; 66 67 private static ClassLoader sharedCL; 68 69 70 static Logger _logger = LogDomains.getLogger(LogDomains.CORE_LOGGER); 71 72 76 public static ApplicationManager getApplicationManager() throws ConfigException{ 77 if(applicationManager == null) { 78 AppsManager appsManager = 79 InstanceFactory.createAppsManager(getInstanceEnvironment(), false); 80 try { 81 if (appsManager.isByteCodePreprocessingEnabled()){ 82 PreprocessorUtil.init 86 (appsManager.getBytecodeProcessorClassNames()); 87 } 88 } catch (ConfigException confEx) { 89 _logger.log(Level.WARNING, 90 "bytecodepreprocessor.config_ex", 91 confEx); 92 _logger.log(Level.WARNING, 93 "bytecodepreprocessor.disabled"); 94 } 95 96 applicationManager = new ApplicationManager(appsManager,getSharedClassLoader()); 98 } 99 return applicationManager; 100 } 101 102 106 public static StandAloneConnectorModulesManager getSAConnectorModulesManager() throws ConfigException { 107 if(saConnectorManager == null) { 108 ConnectorModulesManager connModuleManager = 110 InstanceFactory.createConnectorModuleManager(getInstanceEnvironment(), false); 111 112 saConnectorManager = new StandAloneConnectorModulesManager( 114 connModuleManager, getSharedClassLoader()); 115 } 116 return saConnectorManager; 117 } 118 119 124 public static DummyWebModuleManager getSAWebModulesManager() throws ConfigException { 125 if(saWebManager == null) { 126 WebModulesManager webModuleManager = new WebModulesManager(getInstanceEnvironment()); 128 saWebManager = new WebModuleDeployEventListener(webModuleManager, getSharedClassLoader()); 129 } 130 131 return saWebManager; 132 } 133 134 138 public static StandAloneEJBModulesManager getSAEJBModulesManager() throws ConfigException { 139 if(saEJBManager == null) { 140 EjbModulesManager ejbModuleManager = 142 InstanceFactory.createEjbModuleManager(getInstanceEnvironment(), false); 143 144 saEJBManager = new StandAloneEJBModulesManager(ejbModuleManager, getSharedClassLoader()); 146 } 147 return saEJBManager; 148 } 149 150 154 public static StandAloneAppClientModulesManager getSAACModulesManager() 155 throws ConfigException { 156 157 if(saACManager == null) { 158 159 AppclientModulesManager acModuleManager = 161 InstanceFactory.createAppclientModulesManager(getInstanceEnvironment()); 162 163 saACManager = new StandAloneAppClientModulesManager( 165 acModuleManager, getSharedClassLoader()); 166 } 167 return saACManager; 168 } 169 170 174 private static InstanceEnvironment getInstanceEnvironment() { 175 if(iEnv == null) { 176 ServerContext sc = ApplicationServer.getServerContext(); 177 iEnv = sc.getInstanceEnvironment(); 178 } 179 return iEnv; 180 } 181 182 186 private static ClassLoader getSharedClassLoader() { 187 if(sharedCL == null) { 188 ServerContext sc = ApplicationServer.getServerContext(); 189 sharedCL = sc.getSharedClassLoader(); 190 } 191 return sharedCL; 192 } 193 194 195 } 196 | Popular Tags |