private boolean jarIsAccepted(final File file) { if (configurer == null) { return true; } try { if (!configurer.accept(file.toURI().toURL())) { LOGGER.warning( "jar '" + file.getAbsolutePath() + "' is excluded: " + file.getName() + ". It will be ignored."); return false; } } catch (final MalformedURLException e) { // no-op } return true; }
// embeddeding implementation of sthg (JPA, JSF) can lead to classloading issues if we don't // enrich the webapp // with our integration jars // typically the class will try to be loaded by the common classloader // but the interface implemented or the parent class // will be in the webapp @Override public void start() throws LifecycleException { super.start(); // do it first otherwise we can't use this as classloader // mainly for tomee-maven-plugin initAdditionalRepos(); if (additionalRepos != null && !additionalRepos.isEmpty()) { for (final File f : additionalRepos) { final DirResourceSet webResourceSet = new PremptiveDirResourceSet(resources, "/", f.getAbsolutePath(), "/"); resources.addPreResources(webResourceSet); } resources.setCachingAllowed(false); } // add configurer enrichments if (configurer != null) { // add now we removed all we wanted final URL[] enrichment = configurer.additionalURLs(); for (final URL url : enrichment) { super.addURL(url); } } // add internal enrichments for (final URL url : SystemInstance.get().getComponent(WebAppEnricher.class).enrichment(this)) { super.addURL(url); } // WEB-INF/jars.xml final File war = Contexts.warPath(CONTEXT.get()); final File jarsXml = new File(war, "WEB-INF/" + QuickJarsTxtParser.FILE_NAME); final ClassLoaderConfigurer configurerTxt = QuickJarsTxtParser.parse(jarsXml); if (configurerTxt != null) { configurer = new CompositeClassLoaderConfigurer(configurer, configurerTxt); } stopped = false; }
public void addURL(final URL url) { if (configurer == null || configurer.accept(url)) { super.addURL(url); } }