1 23 package com.sun.enterprise.jbi.serviceengine.bridge; 24 25 import com.sun.appserv.server.ServerLifecycle; 26 import com.sun.appserv.server.ServerLifecycleException; 27 import com.sun.enterprise.server.ServerContext; 28 import com.sun.enterprise.jbi.serviceengine.install.Installer; 29 import com.sun.logging.LogDomains; 30 import com.sun.enterprise.server.ApplicationServer; 31 import com.sun.enterprise.jbi.serviceengine.install.ServiceEngineObjectFactoryImpl; 32 import com.sun.enterprise.server.event.ApplicationLoaderEventNotifier; 33 import com.sun.enterprise.webservice.ServiceEngineUtil; 34 import java.net.InetAddress ; 35 import java.io.File ; 36 import java.util.logging.Level ; 37 import java.util.logging.Logger ; 38 39 43 public class JavaEEServiceEngineLifeCycle implements ServerLifecycle { 44 45 46 private static Logger logger = LogDomains.getLogger(LogDomains.ADMIN_LOGGER); 47 public String DEFAULT_COMPONENT_NAME ="JavaEEServiceEngine"; 48 49 50 51 public JavaEEServiceEngineLifeCycle() { 52 } 53 54 67 public void onInitialization(ServerContext sc) 68 throws ServerLifecycleException { 69 logger.log(Level.FINEST, "se_lifecycle_initializing"); 70 72 73 } 74 75 83 public void onStartup(ServerContext sc) 84 throws ServerLifecycleException { 85 logger.log(Level.FINEST, "se_lifecycle_starting"); 86 } 87 95 public void onReady(ServerContext sc) throws ServerLifecycleException { 96 97 98 99 Installer installer = 100 ServiceEngineObjectFactoryImpl.getInstance(). 101 createInstaller(); 102 if(installer.isJBIInstalled()) { 103 installer.setComponentName(DEFAULT_COMPONENT_NAME); 104 try { 105 boolean installedFlag = installer.isComponentInstalled(); 106 logger.log(Level.FINE, "Is Java EE Service Engine installed " + installedFlag); 107 108 if(ServiceEngineUtil.isServiceEngineEnabled()) { 109 if(!installedFlag) { 112 installer.install(null); 113 installer.start(); 114 } 115 }else { 116 logger.log(Level.FINEST, "Java EE Service Engine is disabled"); 117 if(installedFlag) { 118 try { 120 installer.stop(); 121 } catch(Exception e) { 122 } 123 } 124 } 125 } catch (Throwable e) { 126 e.printStackTrace(); 127 } 128 } 129 } 130 136 public void onShutdown() 137 throws ServerLifecycleException { 138 } 139 148 public void onTermination() 149 throws ServerLifecycleException { 150 151 } 152 } 153 | Popular Tags |