private Archive toArchive(final String module, final OriginalId originalId, final ConfigurableClassLoader loader) { final File file = of(new File(module)).filter(File::exists).orElseGet(() -> container.resolve(module)); if (file.exists()) { try { return ClasspathArchive.archive(loader, file.toURI().toURL()); } catch (final MalformedURLException e) { throw new IllegalArgumentException(e); } } info(module + " is not a file, will try to look it up from a nested maven repository"); final InputStream nestedJar = loader.getParent().getResourceAsStream(ConfigurableClassLoader.NESTED_MAVEN_REPOSITORY + module); if (nestedJar != null) { final JarInputStream jarStream; try { jarStream = new JarInputStream(nestedJar); log.debug("Found a nested resource for " + module); return new NestedJarArchive(jarStream, loader); } catch (final IOException e) { try { nestedJar.close(); } catch (final IOException e1) { // no-op } } } throw new IllegalArgumentException("Module error: check that the module exist and is a jar or a directory. " + ofNullable(originalId.getValue()).orElse(module)); }
private Consumer<Container> createContainerCustomizer(final String originalId) { return c -> { c.set(OriginalId.class, new OriginalId(originalId)); transformers.forEach(c::registerTransformer); }; }
public void undeploy(final String pluginGAV) { if (pluginGAV == null || pluginGAV.isEmpty()) { throw new IllegalArgumentException("plugin maven GAV are required to undeploy a plugin"); } String pluginID = instance .find(c -> pluginGAV.equals(c.get(ComponentManager.OriginalId.class).getValue()) ? Stream.of(c.getId()) : empty()) .findFirst() .orElseThrow(() -> new IllegalArgumentException("No plugin found using maven GAV: " + pluginGAV)); instance.removePlugin(pluginID); }