1 23 24 25 package com.sun.enterprise.tools.verifier; 26 27 import com.sun.enterprise.util.LocalStringManagerImpl; 28 29 34 public class SpecVersionMapper { 35 36 private static LocalStringManagerImpl smh = 37 StringManagerHelper.getLocalStringsManager(); 38 39 public static final String JavaEEVersion_1_2 = "1.2"; 41 public static final String JavaEEVersion_1_3 = "1.3"; 43 public static final String JavaEEVersion_1_4 = "1.4"; 45 public static final String JavaEEVersion_5 = "5"; 47 private static String [][] PlatformVersionToEJBVersionMap = { 48 {JavaEEVersion_1_2, "1.1"}, {JavaEEVersion_1_3, "2.0"}, {JavaEEVersion_1_4, "2.1"}, {JavaEEVersion_5, "3.0"} }; 53 54 private static String [][] PlatformVersionToAppClientVersionMap = { 55 {JavaEEVersion_1_2, "1.2"}, {JavaEEVersion_1_3, "1.3"}, {JavaEEVersion_1_4, "1.4"}, {JavaEEVersion_5, "5"} }; 60 61 private static String [][] PlatformVersionToJCAVersionMap = { 62 {JavaEEVersion_1_3, "1.0"}, {JavaEEVersion_1_4, "1.5"}, {JavaEEVersion_5, "1.5"} }; 66 67 private static String [][] PlatformVersionToWebAppVersionMap = { 68 {JavaEEVersion_1_2, "2.2"}, {JavaEEVersion_1_3, "2.3"}, {JavaEEVersion_1_4, "2.4"}, {JavaEEVersion_5, "2.5"} }; 73 74 private static String [][] PlatformVersionToWebServiceVersionMap = { 75 {JavaEEVersion_1_4, "1.1"}, {JavaEEVersion_5, "1.2"} }; 78 79 private static String [][] PlatformVersionToWebServiceClientVersionMap = { 80 {JavaEEVersion_1_4, "1.1"}, {JavaEEVersion_5, "1.2"} }; 83 84 private static String throwException (String platformVersion) 85 throws IllegalArgumentException { 86 throw new IllegalArgumentException ( 87 smh.getLocalString("com.sun.enterprise.tools.verifier.SpecVersionMapper.exception", "Not able to map platform version [ {0} ] component version.", new Object [] {platformVersion})); 90 } 91 92 public static String getEJBVersion(String platformVersion) 93 throws IllegalArgumentException { 94 for (String [] row : PlatformVersionToEJBVersionMap) { 95 if (row[0].equals(platformVersion)) { 96 return row[1]; 97 } 98 } 99 return throwException(platformVersion); 100 } 101 102 public static String getJCAVersion(String platformVersion) 103 throws IllegalArgumentException { 104 for (String [] row : PlatformVersionToJCAVersionMap) { 105 if (row[0].equals(platformVersion)) { 106 return row[1]; 107 } 108 } 109 return throwException(platformVersion); 110 } 111 112 public static String getWebAppVersion(String platformVersion) 113 throws IllegalArgumentException { 114 for (String [] row : PlatformVersionToWebAppVersionMap) { 115 if (row[0].equals(platformVersion)) { 116 return row[1]; 117 } 118 } 119 return throwException(platformVersion); 120 } 121 122 public static String getAppClientVersion(String platformVersion) 123 throws IllegalArgumentException { 124 for (String [] row : PlatformVersionToAppClientVersionMap) { 125 if (row[0].equals(platformVersion)) { 126 return row[1]; 127 } 128 } 129 return throwException(platformVersion); 130 } 131 132 public static String getWebServiceVersion(String platformVersion) 133 throws IllegalArgumentException { 134 for (String [] row : PlatformVersionToWebServiceVersionMap) { 135 if (row[0].equals(platformVersion)) { 136 return row[1]; 137 } 138 } 139 return throwException(platformVersion); 140 } 141 142 public static String getWebServiceClientVersion(String platformVersion) { 143 for (String [] row : PlatformVersionToWebServiceClientVersionMap) { 144 if (row[0].equals(platformVersion)) { 145 return row[1]; 146 } 147 } 148 return throwException(platformVersion); 149 } 150 } 151 | Popular Tags |