//
// ----- Set the main attributes, pattern '*' -----
//
for (Iterator itConfig = configParameter.iterator(); itConfig.hasNext();) {
Parameter par = (Parameter) itConfig.next();
if (par.getName().indexOf(".") > 0) {
// this is a *.* parameter for later use
specialParameter.add(par);
} else {
useParameter(par);
}
}
configParameter = new Vector();
//
// ----- Instantiate the interfaces -----
//
String className = null;
String pkg = "org.apache.tools.ant.types.selectors.cacheselector";
// the algorithm
if (algorithm == null) {
if ("hashvalue".equals(algoName.getValue())) {
className = pkg + ".HashvalueAlgorithm";
} else if ("digest".equals(algoName.getValue())) {
className = pkg + ".DigestAlgorithm";
}
if (className != null) {
try {
// load the specified Algorithm, save the reference and configure it
algorithm = (Algorithm) Class.forName(className).newInstance();
} catch (Exception e) {
e.printStackTrace();
}
}
}
// the cache
if (cache == null) {
if ("propertyfile".equals(cacheName.getValue())) {
className = pkg + ".PropertiesfileCache";
}
if (className != null) {
try {
// load the specified Cache, save the reference and configure it
cache = (Cache) Class.forName(className).newInstance();
} catch (Exception e) {
e.printStackTrace();
}
}
}
// the comparator
if (comparator == null) {
if ("equal".equals(compName.getValue())) {
className = pkg + ".EqualComparator";
} else if ("role".equals(compName.getValue())) {
className = "java.text.RuleBasedCollator";
}
if (className != null) {
try {
// load the specified Cache, save the reference and configure it
comparator = (Comparator) Class.forName(className).newInstance();
} catch (Exception e) {
e.printStackTrace();
}
}
}
//
// ----- Set the special attributes, pattern '*.*' -----
//
for (Iterator itSpecial = specialParameter.iterator(); itSpecial.hasNext();) {
Parameter par = (Parameter) itSpecial.next();
useParameter(par);
}
specialParameter = new Vector();
}