ClientPropertiesKey clientkey, String prefix, String subDir, String name, String suffix,
boolean reverseOrder, boolean single, boolean returnKey, String key, boolean returnStrings,
boolean ignoreMissing) {
List matches = new ArrayList();
String contentType = clientkey.getContentType();
Theme theme = clientkey.getTheme();
UserAgent browser = clientkey.getUserAgent();
List<String> locales = LocaleUtils.getLocaleSuffixList(clientkey.getLocale());
String path;
// check first the local web application directory
for (String localeSuffix : locales) {
if (production) {
path = makePath(name, MINIMIZE_SUFFIX, localeSuffix, suffix, key);
boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
if (found && (single || !returnStrings)) {
return matches;
}
if (!found) {
path = makePath(name, null, localeSuffix, suffix, key);
found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
if (found && (single || !returnStrings)) {
return matches;
}
}
} else {
path = makePath(name, null, localeSuffix, suffix, key);
boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
if (found && (single || !returnStrings)) {
return matches;
}
}
}
// after that check the whole resources tree
// e.g. 1. application, 2. library or renderkit
for (Theme themeName : theme.getFallbackList()) { // theme loop
for (String resourceDirectory : tobagoConfig.getResourceDirs()) {
for (String browserType : browser.getFallbackList()) { // browser loop
for (String localeSuffix : locales) { // locale loop
if (production) {
path = makePath(resourceDirectory, contentType, themeName, browserType, subDir, name, MINIMIZE_SUFFIX,
localeSuffix, suffix, key);
boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
if (found && (single || !returnStrings)) {
return matches;
}
if (!found) {
path = makePath(resourceDirectory, contentType, themeName, browserType, subDir, name, null,
localeSuffix, suffix, key);
found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
if (found && (single || !returnStrings)) {
return matches;
}
}
} else {
path = makePath(resourceDirectory, contentType, themeName, browserType, subDir, name, null,
localeSuffix, suffix, key);
boolean found = checkPath(prefix, reverseOrder, returnKey, returnStrings, matches, path);
if (found && (single || !returnStrings)) {
return matches;
}
}
}
}
}
}
if (matches.isEmpty()) {
if (!ignoreMissing) {
LOG.error("Path not found, and no fallback. Using empty string.\n"
+ "resourceDirs = '" + tobagoConfig.getResourceDirs()
+ "' contentType = '" + contentType
+ "' theme = '" + theme.getName()
+ "' browser = '" + browser
+ "' subDir = '" + subDir
+ "' name = '" + name
+ "' suffix = '" + suffix
+ "' key = '" + key