public static String downloadTimestampVersion(String artifact, String metadataSrc) throws IOException, XPathExpressionException { final URL url = new URL(metadataSrc); final URLConnection connection = MavenSettings.getSettings().openConnection(url); boolean message = Boolean.getBoolean("maven.download.message"); try (InputStream is = connection.getInputStream()) { if (message) { LOGGER.trace("Downloading maven-metadata.xml for " + artifact); } return snapshotVersionXpath.evaluate(new InputSource(is)); } }
public static void downloadFile(String artifact, String src, File dest) throws IOException { if (dest.exists()) { return; } final URL url = new URL(src); final URLConnection connection = MavenSettings.getSettings().openConnection(url); boolean message = Boolean.getBoolean("maven.download.message"); try (InputStream bis = connection.getInputStream()) { dest.getParentFile().mkdirs(); if (message) { LOGGER.trace("Downloading " + artifact); } Files.copy(bis, dest.toPath(), StandardCopyOption.REPLACE_EXISTING); } }
protected void handleWildFlySwarmBootstrapConf(ModuleSpec.Builder builder) throws IOException { if (LOG.isTraceEnabled()) { LOG.trace("Loading conf from " + WildFlySwarmBootstrapConf.CLASSPATH_LOCATION); } InputStream bootstrapTxt = getClass().getClassLoader().getResourceAsStream(WildFlySwarmBootstrapConf.CLASSPATH_LOCATION); if (bootstrapTxt != null) { WildFlySwarmBootstrapConf conf = new WildFlySwarmBootstrapConf(bootstrapTxt); conf.apply(builder); } } }
void apply(ModuleSpec.Builder builder, MavenArtifactDescriptor entry) throws IOException { File artifact = MavenResolvers.get().resolveJarArtifact(entry.mscCoordinates()); if (artifact == null) { throw new IOException("Unable to locate artifact: " + entry.mscGav()); } if (LOG.isTraceEnabled()) { LOG.trace("adding bootstrap artifact: " + artifact.getAbsolutePath()); } builder.addResourceRoot( ResourceLoaderSpec.createResourceLoaderSpec( ResourceLoaders.createJarResourceLoader(artifact.getName(), new JarFile(artifact)) ) ); }
LOG.trace("attempt:" + identifier); ClassLoader cl = ApplicationEnvironment.get().getBootstrapClassLoader(); if (LOG.isTraceEnabled()) { LOG.trace("classloader: " + cl); LOG.trace("path: " + path); LOG.trace("not found: " + identifier); LOG.trace("base of " + identifier + ": " + base); LOG.trace("Loaded ModuleSpec: " + moduleSpec.getName());
LOG.trace("Loading module");
@Override public void buildModule(ModuleSpec.Builder builder, ModuleLoader delegateLoader) throws ModuleLoadException { if (LOG.isTraceEnabled()) { LOG.trace("Loading module"); } try { if (Layout.getInstance().isUberJar()) { handleWildFlySwarmBootstrapConf(builder); } builder.addDependency(DependencySpec.createLocalDependencySpec()); builder.addDependency(DependencySpec.createModuleDependencySpec(ModuleIdentifier.create("org.jboss.modules"))); builder.addDependency(DependencySpec.createModuleDependencySpec(ModuleIdentifier.create("org.jboss.msc"))); builder.addDependency(DependencySpec.createModuleDependencySpec(ModuleIdentifier.create("org.jboss.shrinkwrap"))); builder.addDependency(DependencySpec.createModuleDependencySpec(ModuleIdentifier.create("javax.api"))); HashSet<String> paths = new HashSet<String>(); paths.add("org/wildfly/swarm/bootstrap/logging"); paths.add("org/wildfly/swarm/bootstrap/util"); paths.add("org/wildfly/swarm/bootstrap/modules"); builder.addDependency(DependencySpec.createSystemDependencySpec(paths, true)); } catch (IOException e) { throw new ModuleLoadException(e); } catch (URISyntaxException e) { throw new ModuleLoadException(e); } }