1 23 24 37 package com.sun.enterprise.server.event; 38 39 import com.sun.enterprise.deployment.Application; 40 41 71 72 public class ApplicationEvent { 73 74 public static final int BEFORE_APPLICATION_LOAD = 0; 75 public static final int AFTER_APPLICATION_LOAD = 1; 76 public static final int BEFORE_APPLICATION_UNLOAD = 2; 77 public static final int AFTER_APPLICATION_UNLOAD = 3; 78 79 private int eventType; 80 private Application application; 81 private ClassLoader loader; 82 83 public ApplicationEvent(int eventType, Application application, 84 ClassLoader loader) 85 { 86 this.eventType = eventType; 87 this.application = application; 88 this.loader = loader; 89 } 90 91 public int getEventType() { 92 return this.eventType; 93 } 94 95 public Application getApplication() { 96 return this.application; 97 } 98 99 public ClassLoader getClassLoader() { 100 return this.loader; 101 } 102 103 public String toString() { 104 StringBuffer sbuf = new StringBuffer ("AppEvent: "); 105 return toString(sbuf); 106 } 107 108 113 protected String toString(StringBuffer sbuf) { 114 switch (eventType) { 115 case BEFORE_APPLICATION_LOAD: 116 sbuf.append("BEFORE_LOAD -> "); 117 break; 118 case AFTER_APPLICATION_LOAD: 119 sbuf.append("AFTER_LOAD -> "); 120 break; 121 case BEFORE_APPLICATION_UNLOAD: 122 sbuf.append("BEFORE_UNLOAD -> "); 123 break; 124 case AFTER_APPLICATION_UNLOAD: 125 sbuf.append("AFTER_UNLOAD -> "); 126 break; 127 default: 128 } 130 131 if (application != null) { 132 sbuf.append(application.getRegistrationName()); 133 } 134 return sbuf.toString(); 135 } 136 137 } 138 | Popular Tags |