try {
hibernateMappingFilesClass = getClass().getClassLoader().loadClass(hibernateMappingFilesClassName);
} catch (ClassNotFoundException e) {
throw new OpenGammaRuntimeException("Could not find Hibernate mapping files implementation " + hibernateMappingFilesClassName, e);
}
HibernateMappingFiles hibernateMappingFiles;
try {
hibernateMappingFiles = (HibernateMappingFiles) hibernateMappingFilesClass.newInstance();
} catch (InstantiationException e) {
throw new OpenGammaRuntimeException("Could not instantiate Hibernate mapping files implementation " + hibernateMappingFilesClassName, e);
} catch (IllegalAccessException e) {
throw new OpenGammaRuntimeException("Could not access Hibernate mapping files implementation " + hibernateMappingFilesClassName, e);
}
Set<String> config = new HashSet<String>();
for (Class<?> cls : hibernateMappingFiles.getHibernateMappingFiles()) {
String hbm = cls.getName().replace('.', '/') + ".hbm.xml";
config.add(hbm);
}
return (String[]) config.toArray(new String[config.size()]);
}