public static File get() { return jarLocation(JarLocation.class); }
public static File get() { return jarLocation(JarLocation.class); }
public static File get() { return jarLocation(JarLocation.class); }
private static URL findJar(final String s, final String api) { try { final File tomEELibJar = PATHS.findTomEELibJar(s); return (tomEELibJar == null ? jarLocation(TomEETldScanner.class.getClassLoader().loadClass(api)) : tomEELibJar).toURI().toURL(); } catch (final Throwable e) { // no-op } return null; } // used to dump container ones when nothing is in apps
private CustomizableURLClassLoader createCustomizableURLClassLoader(final ClassLoader systemClassLoader) { final CustomizableURLClassLoader customizableURLClassLoader = new CustomizableURLClassLoader(systemClassLoader); try { customizableURLClassLoader.add(jarLocation(SystemClassPath.class).toURI().toURL()); } catch (final MalformedURLException e) { // no-op } return customizableURLClassLoader; }
@Override public File findTomEELibJar(final String prefix) { File jar = findJar(getCatalinaLibDir(), prefix); if (jar == null) { // maybe tomcat/openejb integration final String tomeeWar = System.getProperty("tomee.war"); if (tomeeWar != null) { jar = findJar(new File(tomeeWar, "lib"), prefix); } if ((jar == null || !jar.exists()) && prefix.equals("openejb-jpa-integration")) { jar = JarLocation.jarLocation(MakeTxLookup.class); } } return jar; }
final File l1 = jarLocation(c1); final File l2 = jarLocation(c2); if (l1 == null) { return 1;
url = JarLocation.jarLocation(loadedClass).toURI().toURL().toExternalForm(); } catch (final MalformedURLException e) { url = classLocation(loadedClass).toExternalForm();
url = JarLocation.jarLocation(loadedClass).toURI().toURL().toExternalForm(); } catch (final MalformedURLException e) { url = classLocation(loadedClass).toExternalForm();
private URLClassLoader buildCassandraClassloader() { final File achilles = new File(configuration.getAchillesLibraries() == null ? new File(System.getProperty("openejb.base"), "achilles").getAbsolutePath() : configuration.getAchillesLibraries()); if (!achilles.exists()) { throw new IllegalStateException("No achillesLibraries lib directory configured, " + configuration.getAchillesLibraries() + " doesn't exist"); } final File[] files = achilles.listFiles((dir, name) -> { return name.endsWith(".jar") && !name.startsWith("achilles-model-") /*in container*/; }); if (files == null || files.length == 0) { throw new IllegalStateException("No achilles libraries in " + configuration.getAchillesLibraries()); } final Collection<URL> urls = new ArrayList<>(); try { // tribestream-achilles first, since it is an URLClassLoader using an URLClassPath loading is "sorted" and we can patch in this jar chilles urls.add(jarLocation(Role.class).toURI().toURL()); } catch (final MalformedURLException e) { throw new IllegalArgumentException(e); } addFilesAsUrls(files, urls); return new IsolatedClassLoader( urls, ParentClassLoaderFinder.Helper.get(), this::isIsolated, name -> name.startsWith("com.tomitribe.tribestream.") || (name.startsWith("info.archinnov.") && isAchillesModel(name))); }
} else { final Iterator<Class<?>> descriptors = new AnnotationFinder(new FileArchive(Thread.currentThread().getContextClassLoader(), jarLocation(marker)), false) .findAnnotatedClasses(Application.class).iterator(); if (!descriptors.hasNext()) {
final Class<?> aClass = module.getClassLoader().loadClass(clazz); loaded.add(aClass); final URL jar = jarLocation(aClass).toURI().toURL(); List<String> list = map.get(jar); if (list == null) {
thisJar = jarLocation(testClass); try { webModule.getAltDDs().putAll(DeploymentLoader.mapDescriptors(new ResourceFinder("", webModule.getClassLoader(), thisJar.toURI().toURL())));
final File jpaIntegrationFile = JarLocation.jarLocation(MakeTxLookup.class); final URL url = jpaIntegrationFile.toURI().toURL(); if (!jars.contains(url)) { // could have been done before (webapp enrichment or manually for instance)
final File jpaIntegrationFile = JarLocation.jarLocation(MakeTxLookup.class); final URL url = jpaIntegrationFile.toURI().toURL(); if (!jars.contains(url)) { // could have been done before (webapp enrichment or manually for instance)
final File jar = JarLocation.jarLocation(Container.class); try (final URLClassLoader scanningLoader = new URLClassLoader(new URL[]{jar.toURI().toURL()}, loader)) { final AnnotationFinder finder = new AnnotationFinder(
(files == null ? files = new LinkedList<>() : files).add(jarLocation(testClass)); (files == null ? files = new LinkedList<>() : files).add(jarLocation(testClass)); (files == null ? files = new LinkedList<>() : files).add(jarLocation(testClass)); (files == null ? files = new LinkedList<>() : files).add(jarLocation(testClass)); (files == null ? files = new LinkedList<>() : files).add(jarLocation(testClass));
private AppModule createTribestreamNotificationCoreModule() { final ClassLoader loader = ParentClassLoaderFinder.Helper.get(); final EjbModule module = new EjbModule(new EjbJar(moduleName), new OpenejbJar()); // activate CDI final Beans beans = new Beans(); beans.addManagedClass(AlterPersisterObserver.class); module.setBeans(beans); // find all from current jar final File jar = JarLocation.jarLocation(Installer.class); try { module.setFinder(new AnnotationFinder( new FilteredArchive( jar.isDirectory() ? new FileArchive(loader, jar) : new JarArchive(loader, jar.toURI().toURL()), Filters.packages("com.tomitribe.tribestream.notifications.core"))) .link()); } catch (final MalformedURLException e) { throw new IllegalStateException(e); } // add unit for persistence final PersistenceUnit unit = new PersistenceUnit(unitName); unit.setJtaDataSource(dataSourceName); unit.setNonJtaDataSource(dataSourceName + "NonJta"); unit.addClass(Alert.class); unit.setExcludeUnlistedClasses(true); unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)"); // here we are, assemble eveything final AppModule appModule = new AppModule(module); appModule.addPersistenceModule(new PersistenceModule("", new Persistence(unit))); return appModule; }
private AppModule createTribestreamCoreModule() { final ClassLoader loader = ParentClassLoaderFinder.Helper.get(); final EjbModule module = new EjbModule(new EjbJar(moduleName), new OpenejbJar()); // activate CDI final Beans beans = new Beans(); module.setBeans(beans); // find all from current jar final File jar = JarLocation.jarLocation(SignaturesService.class); try { module.setFinder(new AnnotationFinder( new FilteredArchive( jar.isDirectory() ? new FileArchive(loader, jar) : new JarArchive(loader, jar.toURI().toURL()), Filters.packages("com.tomitribe.tribestream.security.signatures"))) .link()); } catch (final MalformedURLException e) { throw new IllegalStateException(e); } // add unit for persistence final PersistenceUnit unit = new PersistenceUnit(unitName); unit.setJtaDataSource(dataSourceName); unit.setNonJtaDataSource(dataSourceName + "NonJta"); unit.addClass(KeyId.class); unit.addClass(Key.class); unit.setExcludeUnlistedClasses(true); unit.setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)"); // here we are, assemble everything final AppModule appModule = new AppModule(module); appModule.addPersistenceModule(new PersistenceModule("", new Persistence(unit))); return appModule; }