1 23 24 31 package com.sun.enterprise.admin.server.core; 32 33 import com.sun.appserv.server.ServerLifecycle; 34 import com.sun.appserv.server.ServerLifecycleImpl; 35 import com.sun.appserv.server.ServerLifecycleException; 36 37 import com.sun.enterprise.server.ServerContext; 38 39 40 43 public class AdminServiceLifeCycle extends ServerLifecycleImpl { 44 45 48 public static final byte STATUS_NOT_STARTED = 0; 49 50 53 public static final byte STATUS_SHUTDOWN = 1; 54 55 58 public static final byte STATUS_INITED = 2; 59 60 63 public static final byte STATUS_STARTED = 4; 64 65 68 public static final byte STATUS_READY = 8; 69 70 73 public static final byte STATUS_TERMINATED = 0; 74 75 private byte serverStatus; 76 77 80 public AdminServiceLifeCycle() { 81 serverStatus = STATUS_NOT_STARTED; 82 } 83 84 97 public void onInitialization(ServerContext sc) 98 throws ServerLifecycleException { 99 if ((serverStatus & STATUS_INITED) == STATUS_INITED) { 100 throw new IllegalStateException ("Admin Server already initialized"); 101 } 102 AdminService srv = AdminService.createAdminService(sc); 103 srv.init(); 104 serverStatus = STATUS_INITED; 105 } 106 107 115 public void onStartup(ServerContext sc) 116 throws ServerLifecycleException { 117 AdminService.getAdminService().start(); 118 serverStatus |= STATUS_STARTED; 119 } 120 121 129 public void onReady(ServerContext sc) throws ServerLifecycleException { 130 AdminService.getAdminService().ready(); 131 serverStatus |= STATUS_READY; 132 } 133 134 140 public void onShutdown() throws ServerLifecycleException { 141 serverStatus |= STATUS_SHUTDOWN; 142 AdminService.getAdminService().stop(); 143 } 144 145 154 public void onTermination() throws ServerLifecycleException { 155 AdminService.getAdminService().destroy(); 156 serverStatus = STATUS_TERMINATED; 157 } 158 159 } 160 | Popular Tags |