+ public synchronized static void loadModels() throws FileNotFoundException {
+
+ ClassLoader cl = OxmModelLoader.class.getClassLoader();
+ ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(cl);
+ Resource[] resources;
+ try {
+ resources = resolver.getResources("classpath*:/oxm/aai_oxm*.xml");
+ } catch (IOException ex) {
+ logger.error(DataRouterMsgs.LOAD_OXM_ERROR, ex.getMessage());
+ throw new FileNotFoundException("Unable to load OXM models from schema path : /oxm/aai_oxm*.xml");
+ }
+
+ if (resources.length == 0) {
+ logger.error(DataRouterMsgs.LOAD_OXM_ERROR, "No OXM schema files found on classpath");
+ throw new FileNotFoundException("Unable to load OXM models from schema path : /oxm/aai_oxm*.xml");
+ }
+
+ for (Resource resource : resources) {
+ Matcher matcher = p.matcher(resource.getFilename());
+
+ if (matcher.matches()) {
+ try {
+ OxmModelLoader.loadModel(matcher.group(1), resource.getFilename(),resource.getInputStream());
+ } catch (Exception e) {
+ logger.error(DataRouterMsgs.LOAD_OXM_ERROR, "Failed to load " + resource.getFilename()
+ + ": " + e.getMessage());
+ }
+ }
+ }
+