1 21 22 package org.opensubsystems.core.util; 23 24 36 public final class GlobalConstants 37 { 38 40 43 public static final Integer INTEGER_0 = new Integer (0); 44 45 48 public static final Integer INTEGER_1 = new Integer (1); 49 50 55 public static final boolean ERROR_CHECKING = true; 56 57 59 62 protected static ProductInfo s_currentProduct = null; 63 64 67 protected static String s_currentOS; 68 69 72 protected static String s_currentOSUpper; 73 74 77 protected static String s_lineSeparator; 78 79 82 protected static String s_fileSeparator; 83 84 87 protected static String s_strTempDirectory; 88 89 91 94 static 95 { 96 s_currentOS = System.getProperty("os.name"); 97 s_currentOSUpper = s_currentOS.toUpperCase(); 98 s_lineSeparator = System.getProperty("line.separator"); 99 s_fileSeparator = System.getProperty("file.separator"); 100 s_strTempDirectory = System.getProperty("java.io.tmpdir"); 101 if (!s_strTempDirectory.endsWith(s_fileSeparator)) 102 { 103 s_strTempDirectory = s_strTempDirectory + s_fileSeparator; 104 } 105 } 106 107 110 private GlobalConstants( 111 ) 112 { 113 } 115 116 118 121 public static ProductInfo getCurrentProduct() 122 { 123 return s_currentProduct; 124 } 125 126 129 public static void setCurrentProduct( 130 ProductInfo currentProduct 131 ) 132 { 133 if (ERROR_CHECKING) 134 { 135 assert s_currentProduct == null 136 : "Cannot change product information once it is set"; 137 } 138 s_currentProduct = currentProduct; 139 } 140 141 146 public static boolean isLinux( 147 ) 148 { 149 return s_currentOSUpper.indexOf("LINUX") >= 0; 150 } 151 152 157 public static boolean isWindows( 158 ) 159 { 160 return s_currentOSUpper.indexOf("WINDOWS") >= 0; 161 } 162 163 168 public static boolean isWindows9x( 169 ) 170 { 171 return (s_currentOSUpper.indexOf("WINDOWS 9") >= 0) 172 || s_currentOSUpper.indexOf("WINDOWS M") >= 0; 173 } 174 175 178 public static String getLineSeparator() 179 { 180 return s_lineSeparator; 181 } 182 183 186 public static String getFileSeparator() 187 { 188 return s_fileSeparator; 189 } 190 191 195 public static String getTempDirectory() 196 { 197 return s_strTempDirectory; 198 } 199 } 200 | Popular Tags |