1 23 package com.sun.enterprise.admin.wsmgmt.lifecycle; 24 25 import com.sun.appserv.server.ServerLifecycle; 26 import com.sun.appserv.server.ServerLifecycleImpl; 27 import com.sun.appserv.server.ServerLifecycleException; 28 import com.sun.enterprise.server.ServerContext; 29 import com.sun.enterprise.deployment.backend.DeploymentEventManager; 30 import com.sun.enterprise.admin.wsmgmt.repository.impl.cache.AppServDELImpl; 31 import com.sun.enterprise.admin.wsmgmt.agent.ListenerManager; 32 import com.sun.enterprise.admin.wsmgmt.msg.MessageTraceMgr; 33 import com.sun.enterprise.admin.event.AdminEventListenerRegistry; 34 import com.sun.enterprise.admin.event.wsmgmt.WebServiceEndpointEvent; 35 import com.sun.enterprise.admin.event.wsmgmt.TransformationRuleEvent; 36 import com.sun.enterprise.admin.event.wsmgmt.RegistryLocationEvent; 37 import com.sun.enterprise.admin.wsmgmt.lifecycle.reconfig.WebServiceEndpointEventListenerImpl; 38 import com.sun.enterprise.admin.wsmgmt.lifecycle.reconfig.TransformationRuleEventListenerImpl; 39 import com.sun.enterprise.admin.wsmgmt.lifecycle.reconfig.RegistryLocationEventListenerImpl; 40 41 import com.sun.enterprise.admin.monitor.registry.MonitoringLevel; 42 43 49 public class AppServWSMgmtAdminLifeCycle extends ServerLifecycleImpl { 50 51 54 public static final byte STATUS_NOT_STARTED = 0; 55 56 59 public static final byte STATUS_SHUTDOWN = 1; 60 61 64 public static final byte STATUS_INITED = 2; 65 66 69 public static final byte STATUS_STARTED = 4; 70 71 74 public static final byte STATUS_READY = 8; 75 76 79 public static final byte STATUS_TERMINATED = 0; 80 81 private byte serverStatus; 82 83 86 public AppServWSMgmtAdminLifeCycle() { 87 serverStatus = STATUS_NOT_STARTED; 88 } 89 90 101 public void onInitialization(ServerContext sc) 102 throws ServerLifecycleException { 103 104 if ((serverStatus & STATUS_INITED) == STATUS_INITED) { 105 throw new IllegalStateException ( 106 "WS Mgmt Admin is already initialized"); 107 } 108 DeploymentEventManager.addListener(new AppServDELImpl()); 109 110 AdminEventListenerRegistry.addEventListener( 112 WebServiceEndpointEvent.eventType, 113 new WebServiceEndpointEventListenerImpl()); 114 115 AdminEventListenerRegistry.addEventListener( 116 TransformationRuleEvent.eventType, 117 new TransformationRuleEventListenerImpl()); 118 119 AdminEventListenerRegistry.addEventListener( 120 RegistryLocationEvent.eventType, 121 new RegistryLocationEventListenerImpl()); 122 123 124 serverStatus = STATUS_INITED; 125 } 126 127 135 public void onStartup(ServerContext sc) throws ServerLifecycleException { 136 serverStatus |= STATUS_STARTED; 137 138 MessageTraceMgr msgTraceMgr = MessageTraceMgr.getInstance(); 140 if ( msgTraceMgr != null) { 141 msgTraceMgr.init(); 142 } 143 } 144 145 153 public void onReady(ServerContext sc) throws ServerLifecycleException { 154 serverStatus |= STATUS_READY; 155 156 ListenerManager.getInstance().register(); 158 159 } 160 161 167 public void onShutdown() throws ServerLifecycleException { 168 serverStatus |= STATUS_SHUTDOWN; 169 170 MessageTraceMgr msgTraceMgr = MessageTraceMgr.getInstance(); 172 if ( msgTraceMgr != null) { 173 msgTraceMgr.stop(); 174 } 175 } 176 177 186 public void onTermination() throws ServerLifecycleException { 187 serverStatus = STATUS_TERMINATED; 188 } 189 } 190 | Popular Tags |