Constructs an instance by loading the standard property files,
any custom property files (struts.custom.properties
),
and any custom message resources ().
Since this constructor combines Settings from multiple resources,
it utilizes a {@link DelegatingSettings} instance,
and all API calls are handled by that instance.
ArrayList<Settings> list = new ArrayList<Settings>();
// stuts.properties, default.properties
try {
list.add(new PropertiesSettings("struts"));
} catch (Exception e) {
log.warn("DefaultSettings: Could not find or error in struts.properties", e);
}
Settings[] settings = new Settings[list.size()];
delegate = new DelegatingSettings(list.toArray(settings));
// struts.custom.properties
try {
StringTokenizer customProperties = new StringTokenizer(delegate.getImpl(StrutsConstants.STRUTS_CUSTOM_PROPERTIES), ",");
while (customProperties.hasMoreTokens()) {
String name = customProperties.nextToken();
try {
list.add(new PropertiesSettings(name));
} catch (Exception e) {
log.error("DefaultSettings: Could not find " + name + ".properties. Skipping.");
}
}
settings = new Settings[list.size()];
delegate = new DelegatingSettings(list.toArray(settings));
} catch (IllegalArgumentException e) {
// Assume it's OK, since IllegalArgumentException is thrown
// when Settings is unable to find a certain setting,
// like the struts.custom.properties, which is commented out
}