1 19 24 25 package org.netbeans.modules.j2ee.sun.share.configbean; 26 27 import java.math.BigDecimal ; 28 import java.math.BigInteger ; 29 30 import org.netbeans.modules.j2ee.sun.dd.api.app.SunApplication; 31 import org.netbeans.modules.j2ee.sun.dd.api.client.SunApplicationClient; 32 import org.netbeans.modules.j2ee.sun.dd.api.ejb.SunEjbJar; 33 import org.netbeans.modules.j2ee.sun.dd.api.web.SunWebApp; 34 35 40 public final class ASDDVersion { 41 42 44 public static final ASDDVersion SUN_APPSERVER_7_0 = new ASDDVersion( 45 "7.0", 70, DTDRegistryLink.SUN_WEBAPP_230_DTD_PUBLIC_ID, 47 DTDRegistryLink.SUN_WEBAPP_230_DTD_SYSTEM_ID, 48 SunWebApp.VERSION_2_3_0, 49 230, 50 DTDRegistryLink.SUN_EJBJAR_200_DTD_PUBLIC_ID, 51 DTDRegistryLink.SUN_EJBJAR_200_DTD_SYSTEM_ID, 52 SunEjbJar.VERSION_2_0_0, 53 200, 54 DTDRegistryLink.SUN_CMP_MAPPING_700_DTD_PUBLIC_ID, 55 DTDRegistryLink.SUN_CMP_MAPPING_700_DTD_SYSTEM_ID, 56 "1.0", 57 100, 58 DTDRegistryLink.SUN_APPLICATION_130_DTD_PUBLIC_ID, 59 DTDRegistryLink.SUN_APPLICATION_130_DTD_SYSTEM_ID, 60 SunApplication.VERSION_1_3_0, 61 130, 62 DTDRegistryLink.SUN_APPCLIENT_130_DTD_PUBLIC_ID, 63 DTDRegistryLink.SUN_APPCLIENT_130_DTD_SYSTEM_ID, 64 SunApplicationClient.VERSION_1_3_0, 65 130, 66 "SunONE Application Server 7.0" ); 68 69 71 97 99 public static final ASDDVersion SUN_APPSERVER_8_0 = new ASDDVersion( 100 "8.0", 80, DTDRegistryLink.SUN_WEBAPP_240_DTD_PUBLIC_ID, 102 DTDRegistryLink.SUN_WEBAPP_240_DTD_SYSTEM_ID, 103 SunWebApp.VERSION_2_4_0, 104 240, 105 DTDRegistryLink.SUN_EJBJAR_210_DTD_PUBLIC_ID, 106 DTDRegistryLink.SUN_EJBJAR_210_DTD_SYSTEM_ID, 107 SunEjbJar.VERSION_2_1_0, 108 210, 109 DTDRegistryLink.SUN_CMP_MAPPING_800_DTD_PUBLIC_ID, 110 DTDRegistryLink.SUN_CMP_MAPPING_800_DTD_SYSTEM_ID, 111 "1.1", 112 110, 113 DTDRegistryLink.SUN_APPLICATION_140_DTD_PUBLIC_ID, 114 DTDRegistryLink.SUN_APPLICATION_140_DTD_SYSTEM_ID, 115 SunApplication.VERSION_1_4_0, 116 140, 117 DTDRegistryLink.SUN_APPCLIENT_140_DTD_PUBLIC_ID, 118 DTDRegistryLink.SUN_APPCLIENT_140_DTD_SYSTEM_ID, 119 SunApplicationClient.VERSION_1_4_0, 120 140, 121 "Sun Java System Application Server 8.0" ); 123 124 125 127 public static final ASDDVersion SUN_APPSERVER_8_1 = new ASDDVersion( 128 "8.1", 81, DTDRegistryLink.SUN_WEBAPP_241_DTD_PUBLIC_ID, 130 DTDRegistryLink.SUN_WEBAPP_241_DTD_SYSTEM_ID, 131 SunWebApp.VERSION_2_4_1, 132 241, 133 DTDRegistryLink.SUN_EJBJAR_211_DTD_PUBLIC_ID, 134 DTDRegistryLink.SUN_EJBJAR_211_DTD_SYSTEM_ID, 135 SunEjbJar.VERSION_2_1_1, 136 211, 137 DTDRegistryLink.SUN_CMP_MAPPING_810_DTD_PUBLIC_ID, 138 DTDRegistryLink.SUN_CMP_MAPPING_810_DTD_SYSTEM_ID, 139 "1.2", 140 120, 141 DTDRegistryLink.SUN_APPLICATION_140_DTD_PUBLIC_ID, 142 DTDRegistryLink.SUN_APPLICATION_140_DTD_SYSTEM_ID, 143 SunApplication.VERSION_1_4_0, 144 140, 145 DTDRegistryLink.SUN_APPCLIENT_141_DTD_PUBLIC_ID, 146 DTDRegistryLink.SUN_APPCLIENT_141_DTD_SYSTEM_ID, 147 SunApplicationClient.VERSION_1_4_1, 148 141, 149 "Sun Java System Application Server 8.1" ); 151 152 154 public static final ASDDVersion SUN_APPSERVER_9_0 = new ASDDVersion( 155 "9.0", 90, DTDRegistryLink.SUN_WEBAPP_250_DTD_PUBLIC_ID, 157 DTDRegistryLink.SUN_WEBAPP_250_DTD_SYSTEM_ID, 158 SunWebApp.VERSION_2_5_0, 159 250, 160 DTDRegistryLink.SUN_EJBJAR_300_DTD_PUBLIC_ID, 161 DTDRegistryLink.SUN_EJBJAR_300_DTD_SYSTEM_ID, 162 SunEjbJar.VERSION_3_0_0, 163 300, 164 DTDRegistryLink.SUN_CMP_MAPPING_810_DTD_PUBLIC_ID, 165 DTDRegistryLink.SUN_CMP_MAPPING_810_DTD_SYSTEM_ID, 166 "1.2", 167 120, 168 DTDRegistryLink.SUN_APPLICATION_500_DTD_PUBLIC_ID, 169 DTDRegistryLink.SUN_APPLICATION_500_DTD_SYSTEM_ID, 170 SunApplication.VERSION_5_0_0, 171 500, 172 DTDRegistryLink.SUN_APPCLIENT_500_DTD_PUBLIC_ID, 173 DTDRegistryLink.SUN_APPCLIENT_500_DTD_SYSTEM_ID, 174 SunApplicationClient.VERSION_5_0_0, 175 500, 176 "Sun Java System Application Server 9.0" ); 178 179 181 public static final ASDDVersion SUN_WEBSERVER_7_0 = new ASDDVersion( 182 "8.1", 81, DTDRegistryLink.SUN_WEBAPP_241_DTD_PUBLIC_ID, 184 DTDRegistryLink.SUN_WEBAPP_241_DTD_SYSTEM_ID, 185 SunWebApp.VERSION_2_4_1, 186 241, 187 "Sun Java System Web Server 7.0" ); 189 190 192 public static final ASDDVersion asDDVersions[] = { 193 SUN_APPSERVER_7_0, 194 SUN_APPSERVER_8_0, 196 SUN_APPSERVER_8_1, 197 SUN_APPSERVER_9_0 198 }; 199 200 202 public static final ASDDVersion webServerDDVersions[] = { 203 SUN_WEBSERVER_7_0 204 }; 205 206 207 210 211 private final String version; 212 private final BigDecimal numericVersion; 213 214 private final String webAppPublicId; 215 private final String webAppSystemId; 216 private final String servletVersionString; 217 private final BigDecimal servletVersion; 218 219 private final String ejbJarPublicId; 220 private final String ejbJarSystemId; 221 private final String ejbVersionString; 222 private final BigDecimal ejbVersion; 223 224 private final String cmpMappingsPublicId; 225 private final String cmpMappingsSystemId; 226 private final String cmpMappingsVersionString; 227 private final BigDecimal cmpMappingsVersion; 228 229 private final String appPublicId; 230 private final String appSystemId; 231 private final String appVersionString; 232 private final BigDecimal appVersion; 233 234 private final String appClientPublicId; 235 private final String appClientSystemId; 236 private final String appClientVersionString; 237 private final BigDecimal appClientVersion; 238 239 private final String displayName; 240 241 242 244 private ASDDVersion(String v, int nv, 245 String wapi, String wasi, String svs, int sv, 246 String dn) { 247 this(v, nv, 248 wapi, wasi, svs, sv, 249 "", "", "", 0, 250 "", "", "", 0, 251 "", "", "", 0, 252 "", "", "", 0, 253 dn); 254 } 255 256 258 private ASDDVersion(String v, int nv, 259 String wapi, String wasi, String svs, int sv, 260 String ejpi, String ejsi, String ejbvs, int ejbv, 261 String cmpi, String cmsi, String cmpvs, int cmpv, 262 String api, String asi, String appvs, int appv, 263 String acpi, String acsi, String acvs, int acpv, 264 String dn) { 265 version = v; 266 numericVersion = new BigDecimal (BigInteger.valueOf(nv), 2); 267 268 webAppPublicId = wapi; 269 webAppSystemId = wasi; 270 servletVersionString = svs; 271 servletVersion = new BigDecimal (BigInteger.valueOf(sv), 2); 272 273 ejbJarPublicId = ejpi; 274 ejbJarSystemId = ejsi; 275 ejbVersionString = ejbvs; 276 ejbVersion = new BigDecimal (BigInteger.valueOf(ejbv), 2); 277 278 cmpMappingsPublicId = cmpi; 279 cmpMappingsSystemId = cmsi; 280 cmpMappingsVersionString = cmpvs; 281 cmpMappingsVersion = new BigDecimal (BigInteger.valueOf(cmpv), 2); 282 283 appPublicId = api; 284 appSystemId = asi; 285 appVersionString = appvs; 286 appVersion = new BigDecimal (BigInteger.valueOf(appv), 2); 287 288 appClientPublicId = acpi; 289 appClientSystemId = acsi; 290 appClientVersionString = acvs; 291 appClientVersion = new BigDecimal (BigInteger.valueOf(acpv), 2); 292 293 displayName = dn; 294 } 295 296 298 public String toString() { 299 return displayName; 300 } 301 302 309 public int compareTo(Object obj) { 310 ASDDVersion target = (ASDDVersion) obj; 311 return numericVersion.compareTo(target.numericVersion); 312 } 313 314 316 public static final ASDDVersion getASDDVersion(String version) { 317 ASDDVersion result = null; 318 319 if(SUN_APPSERVER_7_0.toString().equals(version)) { 320 result = SUN_APPSERVER_7_0; 321 } else if(SUN_APPSERVER_8_0.toString().equals(version)) { 324 result = SUN_APPSERVER_8_0; 325 } else if(SUN_APPSERVER_8_1.toString().equals(version)) { 326 result = SUN_APPSERVER_8_1; 327 } else if(SUN_APPSERVER_9_0.toString().equals(version)) { 328 result = SUN_APPSERVER_9_0; 329 } 330 331 return result; 332 } 333 334 336 public static final ASDDVersion getASDDVersion(BigDecimal version) { 337 ASDDVersion result = null; 338 339 if(SUN_APPSERVER_7_0.toString().compareTo(version) == 0) { 340 result = SUN_APPSERVER_7_0; 341 } else if(SUN_APPSERVER_8_0.toString().compareTo(version) == 0) { 344 result = SUN_APPSERVER_8_0; 345 } else if(SUN_APPSERVER_8_1.toString().compareTo(version) == 0) { 346 result = SUN_APPSERVER_8_1; 347 } else if(SUN_APPSERVER_9_0.toString().compareTo(version) == 0) { 348 result = SUN_APPSERVER_9_0; 349 } 350 351 return result; 352 } 353 354 356 public static final ASDDVersion getASDDVersionFromServletVersion(BigDecimal version) { 357 ASDDVersion result = null; 358 359 if(SUN_APPSERVER_7_0.getNumericWebAppVersion().compareTo(version) == 0) { 360 result = SUN_APPSERVER_7_0; 361 } else if(SUN_APPSERVER_8_0.getNumericWebAppVersion().compareTo(version) == 0) { 364 result = SUN_APPSERVER_8_0; 365 } else if(SUN_APPSERVER_8_1.getNumericWebAppVersion().compareTo(version) == 0) { 366 result = SUN_APPSERVER_8_1; 367 } else if(SUN_APPSERVER_9_0.getNumericWebAppVersion().compareTo(version) == 0) { 368 result = SUN_APPSERVER_9_0; 369 } 370 371 return result; 372 } 373 374 376 public static final ASDDVersion getASDDVersionFromEjbVersion(BigDecimal version) { 377 ASDDVersion result = null; 378 379 if(SUN_APPSERVER_7_0.getNumericEjbJarVersion().compareTo(version) == 0) { 380 result = SUN_APPSERVER_7_0; 381 } else if(SUN_APPSERVER_8_0.getNumericEjbJarVersion().compareTo(version) == 0) { 384 result = SUN_APPSERVER_8_0; 385 } else if(SUN_APPSERVER_8_1.getNumericEjbJarVersion().compareTo(version) == 0) { 386 result = SUN_APPSERVER_8_1; 387 } else if(SUN_APPSERVER_9_0.getNumericEjbJarVersion().compareTo(version) == 0) { 388 result = SUN_APPSERVER_9_0; 389 } 390 391 return result; 392 } 393 394 396 public static final ASDDVersion getASDDVersionFromAppVersion(BigDecimal version) { 397 ASDDVersion result = null; 398 399 if(SUN_APPSERVER_7_0.getNumericApplicationVersion().compareTo(version) == 0) { 400 result = SUN_APPSERVER_7_0; 401 } else if(SUN_APPSERVER_8_1.getNumericApplicationVersion().compareTo(version) == 0) { 408 result = SUN_APPSERVER_8_1; 409 } else if(SUN_APPSERVER_9_0.getNumericApplicationVersion().compareTo(version) == 0) { 410 result = SUN_APPSERVER_9_0; 411 } 412 413 return result; 414 } 415 416 418 public static final ASDDVersion getASDDVersionFromAppClientVersion(BigDecimal version) { 419 ASDDVersion result = null; 420 if(SUN_APPSERVER_7_0.getNumericAppClientVersion().compareTo(version) == 0) { 421 result = SUN_APPSERVER_7_0; 422 } else if(SUN_APPSERVER_8_0.getNumericAppClientVersion().compareTo(version) == 0) { 425 result = SUN_APPSERVER_8_0; 426 } else if(SUN_APPSERVER_8_1.getNumericAppClientVersion().compareTo(version) == 0) { 427 result = SUN_APPSERVER_8_1; 428 } else if(SUN_APPSERVER_9_0.getNumericAppClientVersion().compareTo(version) == 0) { 429 result = SUN_APPSERVER_9_0; 430 } 431 return result; 432 } 433 434 436 public final String getWebAppVersionAsString() { 437 return servletVersionString; 438 } 439 440 442 public final String getEjbJarVersionAsString() { 443 return ejbVersionString; 444 } 445 446 448 public final String getCmpMappingsVersionAsString() { 449 return cmpMappingsVersionString; 450 } 451 452 454 public final String getApplicationVersionAsString() { 455 return appVersionString; 456 } 457 458 460 public final String getAppClientVersionAsString() { 461 return appClientVersionString; 462 } 463 464 466 public final BigDecimal getNumericServerVersion() { 467 return numericVersion; 468 } 469 470 472 public final BigDecimal getNumericWebAppVersion() { 473 return servletVersion; 474 } 475 476 478 public final BigDecimal getNumericEjbJarVersion() { 479 return ejbVersion; 480 } 481 482 484 public final BigDecimal getNumericCmpMappingsVersion() { 485 return cmpMappingsVersion; 486 } 487 488 490 public final BigDecimal getNumericApplicationVersion() { 491 return appVersion; 492 } 493 494 496 public final BigDecimal getNumericAppClientVersion() { 497 return appClientVersion; 498 } 499 500 502 public final String getSunWebAppPublicId() { 503 return webAppPublicId; 504 } 505 506 508 public final String getSunWebAppSystemId() { 509 return webAppSystemId; 510 } 511 512 514 public final String getSunEjbJarPublicId() { 515 return ejbJarPublicId; 516 } 517 518 520 public final String getSunEjbJarSystemId() { 521 return ejbJarSystemId; 522 } 523 524 526 public final String getSunCmpMappingsPublicId() { 527 return cmpMappingsPublicId; 528 } 529 530 532 public final String getSunCmpMappingsSystemId() { 533 return cmpMappingsSystemId; 534 } 535 536 538 public final String getSunApplicationPublicId() { 539 return appPublicId; 540 } 541 542 544 public final String getSunApplicationSystemId() { 545 return appSystemId; 546 } 547 548 550 public final String getSunAppClientPublicId() { 551 return appClientPublicId; 552 } 553 554 556 public final String getSunAppClientSystemId() { 557 return appClientSystemId; 558 } 559 560 562 public final StorageBeanFactory getStorageFactory() { 563 return StorageBeanFactory.getStorageBeanFactory(this); 564 } 565 } 566 | Popular Tags |