1 23 24 31 package com.sun.enterprise.admin.event; 32 33 import com.sun.enterprise.admin.event.AdminEvent; 34 35 import com.sun.enterprise.util.i18n.StringManager; 37 38 46 public class BaseDeployEvent extends AdminEvent implements Cloneable { 47 48 51 public static final String APPLICATION = "application"; 52 53 56 public static final String MODULE = "module"; 57 58 61 public static final String RESOURCE = "resource"; 62 63 66 public static final String DEPLOY = "deploy"; 67 68 71 public static final String UNDEPLOY = "undeploy"; 72 73 76 public static final String REDEPLOY = "redeploy"; 77 78 81 public static final String ENABLE = "enable"; 82 83 86 public static final String DISABLE = "disable"; 87 88 91 public static final String ADD_REFERENCE = "reference-added"; 92 93 96 public static final String REMOVE_REFERENCE = "reference-removed"; 97 98 101 public static final int APPLICATION_DEPLOYED = 1; 102 103 106 public static final int APPLICATION_UNDEPLOYED = 2; 107 108 111 public static final int APPLICATION_REDEPLOYED = 3; 112 113 116 public static final int MODULE_DEPLOYED = 4; 117 118 121 public static final int MODULE_UNDEPLOYED = 5; 122 123 126 public static final int MODULE_REDEPLOYED = 6; 127 128 131 public static final int MODULE_ENABLE = 7; 132 133 136 public static final int MODULE_DISABLE = 8; 137 138 141 public static final int APPLICATION_ENABLE = 9; 142 143 146 public static final int APPLICATION_DISABLE = 10; 147 148 151 public static final int APPLICATION_REFERENCED = 11; 152 public static final int APPLICATION_UNREFERENCED = 12; 153 154 157 static final String eventType = BaseDeployEvent.class.getName(); 158 159 protected String j2eeComponentType; 160 protected String j2eeComponentName; 161 protected String actionName; 162 protected boolean cascade = false; 163 164 private static StringManager localStrings = 166 StringManager.getManager( BaseDeployEvent.class ); 167 168 183 public BaseDeployEvent(String instance, String componentType, 184 String componentName, String action) { 185 this(eventType, instance, componentType, componentName, action); 186 } 187 188 204 public BaseDeployEvent(String type, String instance, String componentType, 205 String componentName, String action) { 206 this(type, instance, componentType, componentName, action, false); 207 } 208 209 public BaseDeployEvent(String type, String instance, String componentType, 210 String componentName, String action, boolean cascade) { 211 super(type, instance); 212 j2eeComponentType = componentType; 213 j2eeComponentName = componentName; 214 setAction(action); 215 setCascade(cascade); 216 } 217 218 public BaseDeployEvent(String type, Object source, 219 long seqNumber,long time) { 220 super(type, source, seqNumber, time); 221 } 222 223 228 public String getJ2EEComponentType() { 229 return j2eeComponentType; 230 } 231 232 236 public String getJ2EEComponentName() { 237 return j2eeComponentName; 238 } 239 240 243 public String getAction() { 244 return actionName; 245 } 246 247 252 protected void setAction(String action) { 253 boolean valid = false; 254 if (DEPLOY.equals(action) || UNDEPLOY.equals(action) 255 || REDEPLOY.equals(action) || ENABLE.equals(action) 256 || DISABLE.equals(action) || ADD_REFERENCE.equals(action) 257 || REMOVE_REFERENCE.equals(action)) { 258 valid = true; 259 } 260 if (!valid) { 261 String msg = localStrings.getString( "admin.event.invalid_action", action ); 262 throw new IllegalArgumentException ( msg ); 263 } 264 this.actionName = action; 265 } 266 267 270 public boolean getCascade() { 271 return cascade; 272 } 273 274 277 public void setCascade(boolean cascade) { 278 this.cascade = cascade; 279 } 280 281 public Object clone() throws CloneNotSupportedException { 282 return super.clone(); 283 } 284 } 285 | Popular Tags |