* @return A url to the file or null of not exists
*/
public List<ConfigBeanDefaultValue> getDefaultConfigurations(Class configBeanClass, String runtimeType) {
//Determine if it is DAS or instance
CustomConfiguration c = (CustomConfiguration) configBeanClass.getAnnotation(CustomConfiguration.class);
List<ConfigBeanDefaultValue> defaults = Collections.emptyList();
if (c.usesOnTheFlyConfigGeneration()) {
Method m = getGetDefaultValuesMethod(configBeanClass);
if (m != null) {
try {
defaults = (List<ConfigBeanDefaultValue>) m.invoke(null, runtimeType);
} catch (Exception e) {
LogHelper.log(LOG, Level.INFO, cannotGetDefaultConfig, e,configBeanClass.getName());
}
}
} else {
//TODO properly handle the exceptions
LocalStringManager localStrings =
new LocalStringManagerImpl(configBeanClass);
ModuleXMLConfigurationFileParser parser = new ModuleXMLConfigurationFileParser(localStrings);
try {
defaults = parser.parseServiceConfiguration(getConfigurationFileUrl(configBeanClass, c.baseConfigurationFileName(), runtimeType).openStream());
} catch (XMLStreamException e) {
LOG.log(Level.SEVERE, cannotParseDefaultDefaultConfig, e);
} catch (IOException e) {
LOG.log(Level.SEVERE, cannotParseDefaultDefaultConfig, e);
}