throw new Exception("Unable to parse: doesn't seem to be a valid Expression");
} else if (expr.type != Expr.RECORD) {
throw new Exception("Unable to parse: the parsed expression is not a ClassAd");
}
RecordExpr jdlExpr = (RecordExpr) expr;
String type = null;
expr = jdlExpr.lookup(TYPE);
if (expr == null) {
type = "Job";
} else if (!expr.isConstant()) {
throw new Exception(TYPE + " \"" + expr.stringValue() + "\" not allowed");
} else {
type = expr.stringValue();
}
if (type.equalsIgnoreCase("Job")) {
String jobType = null;
expr = jdlExpr.lookup(JOBTYPE);
if (expr == null) {
jobType = "Normal";
} else {
jobType = expr.stringValue();
}
if (!jobType.equalsIgnoreCase("Normal")) {
throw new Exception(JOBTYPE + " \"" + jobType + "\" not allowed");
}
@SuppressWarnings("unchecked")
Iterator<AttrName> it = (Iterator<AttrName>) jdlExpr.attributes();
String key = null;
// String value = null;
final char[] notAllowed = { ' ', ':', '#', '@', '[', ']', '+', '*', '$', '%', '!', '?', '~' };
while (it.hasNext()) {
key = it.next().toString().toLowerCase();
for (int i = 0; i < notAllowed.length; i++) {
if (key.indexOf(notAllowed[i]) != -1) {
throw new Exception(key + ": Not allowed char '" + notAllowed[i] + "' found");
}
expr = jdlExpr.lookup(key);
if (expr == null) {
throw new Exception(key + ": none expression found");
} /*else if (!expr.isConstant()) {
throw new Exception(key + ": not constant expression found");