private static String implicitRootUrl() { final ResourceFinder finder = new ResourceFinder("", Thread.currentThread().getContextClassLoader()); try { final URL url = DeploymentLoader.altDDSources(DeploymentLoader.mapDescriptors(finder), false).get("persistence.xml"); if (url == null) { return ""; } final File file = URLs.toFile(url); if (file.getName().endsWith("persistence.xml")) { final String parent = file.getParentFile().getName(); if (parent.equalsIgnoreCase("META-INF")) { return file.getParentFile().getParentFile().getAbsolutePath(); } return file.getParentFile().getAbsolutePath(); } return url.toExternalForm(); } catch (final IOException e) { return ""; } }
private Map<String, URL> getDescriptors(final ClassLoader classLoader, final URL pathToScanDescriptors) throws IOException { final ResourceFinder finder = new ResourceFinder("", classLoader, pathToScanDescriptors); return altDDSources(mapDescriptors(finder), false); }
private Map<String, URL> getDescriptors(final ClassLoader classLoader, final URL pathToScanDescriptors) throws IOException { final ResourceFinder finder = new ResourceFinder("", classLoader, pathToScanDescriptors); return altDDSources(mapDescriptors(finder), false); }
private static Map<String, URL> getDescriptors(final ResourceFinder finder, final boolean log) throws OpenEJBException { try { return altDDSources(mapDescriptors(finder), log); } catch (final IOException e) { throw new OpenEJBException("Unable to determine descriptors in jar.", e); } }
private static Map<String, URL> getDescriptors(final ResourceFinder finder, final boolean log) throws OpenEJBException { try { return altDDSources(mapDescriptors(finder), log); } catch (final IOException e) { throw new OpenEJBException("Unable to determine descriptors in jar.", e); } }
private static String implicitRootUrl(final PersistenceRootUrl annotation) { if (annotation != null) { return annotation.value(); } final ResourceFinder finder = new ResourceFinder("", Thread.currentThread().getContextClassLoader()); try { final URL url = DeploymentLoader.altDDSources(DeploymentLoader.mapDescriptors(finder), false).get("persistence.xml"); if (url == null) { return ""; } final File file = URLs.toFile(url); final String filename = file.getName(); if (filename.endsWith("persistence.xml")) { final String parent = file.getParentFile().getName(); if (parent.equalsIgnoreCase("META-INF")) { return file.getParentFile().getParentFile().getAbsolutePath(); } return file.getParentFile().getAbsolutePath(); } else if (filename.endsWith(".jar")) { return file.toURI().toURL().toExternalForm(); } return url.toExternalForm(); } catch (final IOException e) { return ""; } }
thisJar = jarLocation(testClass); try { webModule.getAltDDs().putAll(DeploymentLoader.mapDescriptors(new ResourceFinder("", webModule.getClassLoader(), thisJar.toURI().toURL()))); webModule.getAltDDs().putAll(DeploymentLoader.getWebDescriptors(new File(thisJar.getParentFile().getParentFile(), "src/main/webapp"))); } catch (final IOException e) {