Fields Summary |
---|
public static final String | ADD |
public static final String | DELETE |
public static final String | UPDATE |
public static final String | SET |
public static final String | VALIDATE |
public static boolean | fileCheck |
public static boolean | classPathCheck |
public static boolean | javaHomeCheck |
private static Pattern | token_pattern |
public static final String | DAS_CONFIG_NAMEName of config reserved for DAS server |
public static final String | CONFIG_TEMPLATE_NAMEName of config used as a template |
Methods Summary |
---|
private static boolean | allAscii(java.lang.String s)
//s is already checked for nullness.
// leveraging the JDK 1.6 java.net.IDN.isASCII(String)
boolean isASCII = true;
for (int i = 0; i < s.length(); i++) {
int c = s.charAt(i);
if (c > 0x7F) {
isASCII = false;
break;
}
}
return isASCII;
|
public static void | checkIPAddress(java.lang.String addr)Check the IP address syntax of the given address. If its
invalid throw UnknownHostException. Ignore the address if
its a token
if (valueContainsTokenExpression (addr) || validSymbolicAddress(addr)) {
return;
/* Several problems because of DNS lookup. It's generally not a good idea
to validate this. Hence, I am commenting the else clause out, km@dev.java.net, 07/25/2007
/*} else {
InetAddress.getByName(addr);
*/}
if (!allAscii(addr)) {
throw new IllegalArgumentException("dummy message");
}
|
public static com.sun.enterprise.config.serverbeans.Config | getConfig(com.sun.enterprise.config.ConfigContext context)
Config mConfig=null;
try {
mConfig = ServerBeansFactory.getConfigBean(context);
} catch(Exception e) {
}
return mConfig;
|
public static boolean | isClassPathValid(java.lang.String path)
boolean flag = true;
StringTokenizer token = new StringTokenizer(path, File.pathSeparator);
while(token.hasMoreTokens()) {
File f = new File(token.nextToken());
// User requires to validate the file path check for existence, else blank check
if(classPathCheck) {
if(!f.exists()) {
flag = false;
break;
}
}
}
return flag;
|
public static boolean | isIdInList(java.lang.String list, java.lang.String poolId)
return null != poolId && tokens(list+"").contains(poolId);
|
public static boolean | isJavaHomeValid(java.lang.String path)Verifies that the given path is a valid java-home path.
boolean flag = true;
if(javaHomeCheck) {
String jdkPath = path + File.separator + "bin" + File.separatorChar;
if(System.getProperty("os.name").startsWith("Win")) {
jdkPath = jdkPath + "java.exe";
} else {
jdkPath = jdkPath + "java";
}
StringTokenizer token = new StringTokenizer(path, File.pathSeparator);
while(token.hasMoreTokens()) {
File f = new File(token.nextToken());
// User requires to validate the file path check for existence, else blank check
if(!f.exists()) {
flag = false;
break;
}
}
}
return flag;
|
public static boolean | isOptionsValid(java.lang.String options)
boolean flag = true;
StringTokenizer token = new StringTokenizer(options," ");
while(token.hasMoreTokens()) {
if(!token.nextToken().startsWith("-")) {
flag = false;
break;
}
}
return flag;
|
static void | setJavaHomeCheck(boolean check)
javaHomeCheck = true;
|
public static java.util.Vector | tokens(java.lang.String value)
StringTokenizer token = new StringTokenizer(value,",");
Vector test = new Vector();
while(token.hasMoreTokens())
test.add(token.nextToken().trim());
return test;
|
private static boolean | validSymbolicAddress(java.lang.String address)Indicate if the given address is a symbolic
address. i.e. is "any", "inaddr_any" or "localhost", in any case.
return address.equalsIgnoreCase("ANY") ||
address.equalsIgnoreCase("INADDR_ANY") ||
address.equalsIgnoreCase("localhost");
|
public static boolean | valueContainsTokenExpression(java.lang.Object value)
return null != value && value instanceof String && token_pattern.matcher((String) value).lookingAt();
|