/** * Resolves classpath urls. * * @param definition the physical classpath definition * @return the resolved classpath urls * @throws ClassLoaderBuilderException if an error occurs resolving a url */ private URL[] resolveClasspath(PhysicalClassLoaderDefinition definition) throws ClassLoaderBuilderException { URI uri = definition.getUri(); try { // resolve the remote contributions and cache them locally URL resolvedUrl = resolver.resolve(uri); // introspect and expand if necessary List<URL> classpath = new ArrayList<URL>(); List<Library> libraries = definition.getLibraries(); List<URL> archiveClasspath = classpathProcessorRegistry.process(resolvedUrl, libraries); classpath.addAll(archiveClasspath); return classpath.toArray(new URL[classpath.size()]); } catch (ResolutionException e) { throw new ClassLoaderBuilderException("Error resolving artifact: " + uri.toString(), e); } catch (IOException e) { throw new ClassLoaderBuilderException("Error processing: " + uri.toString(), e); } }
List<URL> locations = resolver.resolveAllLocations(uri);
public void destroy(URI uri) throws ClassLoaderBuilderException { ClassLoader classLoader = classLoaderRegistry.getClassLoader(uri); int val = tracker.decrement(classLoader); if (val == 0 && metaDataStore.find(uri) == null) { // Note the MetaDataStore is used to determine if a contribution classloader must be tracked. If a contribution is registered in the // store, it is installed as an extension of the base runtime distribution and should only be uninstalled explicitly. try { classLoaderRegistry.unregister(uri); // release the previously resolved contribution resolver.release(uri); } catch (ResolutionException e) { throw new ClassLoaderBuilderException("Error releasing artifact: " + uri.toString(), e); } for (ClassLoaderListener listener : listeners) { listener.onUndeploy(classLoader); } } else if (val == 0) { // single VM, do not remove the classloader since it is used by the installed contribution. Just notify listeners for (ClassLoaderListener listener : listeners) { listener.onUndeploy(classLoader); } } }
List<URL> locations = resolver.resolveAllLocations(uri);
resolver.release(uri); } catch (ResolutionException e) { throw new ExecutionException(e);
try { URL resolved = resolver.resolve(uri); ClassLoader parentClassLoader = createParentClassLoader(parentClassLoaderId, uri); StandardContext context = createContext(contextPath, resolved.getFile(), parentClassLoader, injectors);
public void execute(ProvisionExtensionsCommand command) throws ExecutionException { try { List<URI> stored = new ArrayList<URI>(); for (URI uri : command.getExtensionUris()) { if (contributionService.exists(uri)) { // extension already provisioned continue; } URL url = resolver.resolve(uri); ContributionSource source = new FileContributionSource(uri, url, 0, true); contributionService.store(source); stored.add(uri); tracker.increment(uri); } if (stored.isEmpty()) { return; } contributionService.install(stored); domain.include(stored); } catch (ResolutionException e) { throw new ExecutionException(e); } catch (ContributionException e) { throw new ExecutionException(e); } catch (DeploymentException e) { throw new ExecutionException(e); } }