1 23 24 31 package com.sun.enterprise.admin.event; 32 33 import com.sun.enterprise.admin.event.BaseDeployEvent; 34 35 import com.sun.enterprise.util.i18n.StringManager; 37 38 42 public class ModuleDeployEvent extends BaseDeployEvent { 43 44 47 public static final String TYPE_WEBMODULE = "web"; 48 49 52 public static final String TYPE_EJBMODULE = "ejb"; 53 54 57 public static final String TYPE_CONNECTOR = "connector"; 58 59 60 63 public static final String TYPE_APPCLIENT = "appclient"; 64 65 68 public static final int TYPE_WEBMODULE_CODE = 1; 69 70 73 public static final int TYPE_EJBMODULE_CODE = 2; 74 75 78 public static final int TYPE_CONNECTOR_CODE = 3; 79 80 83 public static final int TYPE_APPCLIENT_CODE = 4; 84 85 88 static final String eventType = ModuleDeployEvent.class.getName(); 89 90 93 private String moduleType; 94 95 98 private int moduleTypeCode; 99 100 103 private boolean forceDeploy = false; 104 105 private static StringManager localStrings = 107 StringManager.getManager( ModuleDeployEvent.class ); 108 109 125 public ModuleDeployEvent(String instance, String moduleName, 126 String moduleType, String actionCode) { 127 super(eventType, instance, BaseDeployEvent.MODULE, moduleName, actionCode); 128 setModuleType(moduleType); 129 } 130 131 135 public ModuleDeployEvent(String instance, String moduleName, 136 String moduleType, String actionCode, boolean cascade) { 137 super(eventType, instance, BaseDeployEvent.MODULE, moduleName, actionCode, cascade); 138 setModuleType(moduleType); 139 } 140 141 146 public ModuleDeployEvent(String instance, String moduleName, 147 String moduleType, String actionCode, 148 boolean cascade, boolean forceDeploy) { 149 super(eventType, instance, BaseDeployEvent.MODULE, moduleName, actionCode, cascade); 150 setModuleType(moduleType); 151 setForceDeploy(forceDeploy); 152 } 153 154 public void setForceDeploy(boolean forceDeploy) { 155 this.forceDeploy = forceDeploy; 156 } 157 158 public boolean getForceDeploy(){ 159 return this.forceDeploy; 160 } 161 162 165 public String getModuleName() { 166 return getJ2EEComponentName(); 167 } 168 169 173 public String getModuleType() { 174 return moduleType; 175 } 176 177 181 public int getModuleTypeCode() { 182 return moduleTypeCode; 183 } 184 185 188 private void setModuleType(String modType) { 189 boolean valid = true; 190 int modTypeCode = 0; 191 if (TYPE_WEBMODULE.equals(modType)) { 192 modTypeCode = TYPE_WEBMODULE_CODE; 193 } else if (TYPE_EJBMODULE.equals(modType)) { 194 modTypeCode = TYPE_EJBMODULE_CODE; 195 } else if (TYPE_CONNECTOR.equals(modType)) { 196 modTypeCode = TYPE_CONNECTOR_CODE; 197 } else if (TYPE_APPCLIENT.equals(modType)) { 198 modTypeCode = TYPE_APPCLIENT_CODE; 199 } else { 200 valid = false; 201 } 202 if (!valid) { 203 String msg = localStrings.getString( "admin.event.invalid_module_type", modType ); 204 throw new IllegalArgumentException ( msg ); 205 } 206 this.moduleType = modType; 207 this.moduleTypeCode = modTypeCode; 208 } 209 210 213 public String toString() { 214 return "ModuleDeployEvent -- " + getAction() + " " + moduleType + "/" + getModuleName(); 215 } 216 } 217 | Popular Tags |