+ Session session = null;
+ try {
+ session = login();
+ // register namespaces
+ if (namespaces.size() > 0) {
+ NamespaceHelper namespaceHelper = new NamespaceHelper(session);
+ namespaceHelper.registerNamespaces(namespaces);
+ }
+ // load CND files from classpath or as URL
+ for (String resUrl : cndFiles) {
+ boolean classpath;
+ // if (resUrl.startsWith("classpath:")) {
+ // // resUrl = resUrl.substring("classpath:".length());
+ // classpath = true;
+ // } else if (resUrl.indexOf(':') < 0) {
+ // if (!resUrl.startsWith("/")) {
+ // resUrl = "/" + resUrl;
+ // log.warn("Classpath should start with '/'");
+ // }
+ // resUrl = "classpath:" + resUrl;
+ // classpath = true;
+ // } else {
+ // classpath = false;
+ // }
+
+ if (resUrl.startsWith("classpath:")) {
+ resUrl = resUrl.substring("classpath:".length());
+ classpath = true;
+ } else if (resUrl.indexOf(':') < 0) {
+ if (!resUrl.startsWith("/")) {
+ resUrl = "/" + resUrl;
+ log.warn("Classpath should start with '/'");
+ }
+ // resUrl = "classpath:" + resUrl;
+ classpath = true;
+ } else {
+ classpath = false;
+ }
+
+ // Resource resource =
+ // resourceLoader.getResource(resUrl);
+
+ // = classpath ? new ClassPathResource(resUrl) : new
+ // UrlResource(resUrl);
+
+ URL url;
+ Bundle dataModelBundle = null;
+ if (classpath) {
+ if (bundleContext != null) {
+ Bundle currentBundle = bundleContext.getBundle();
+ url = currentBundle.getResource(resUrl);
+ if (url != null) {// found
+ dataModelBundle = findDataModelBundle(resUrl);
+ }
+ } else {
+ url = getClass().getClassLoader().getResource(resUrl);
+ }
+ if (url == null)
+ throw new ArgeoException("No " + resUrl
+ + " in the classpath,"
+ + " make sure the containing"
+ + " package is visible.");
+
+ } else {
+ url = new URL(resUrl);
+ }
+