@Override public String getAbsolutePath() { return getWrapped().getAbsolutePath(); } }
@Override public String getName() { return getWrapped().getName(); }
private List<ComponentDeclaration> getDeclaredComponents(LocalExtensionFile jarFile) throws IOException { InputStream is = jarFile.openStream(); try { return this.jarLoader.getDeclaredComponentsFromJAR(is); } finally { is.close(); } }
private static URL getExtensionURL(LocalExtension localExtension) throws MalformedURLException { return new File(localExtension.getFile().getAbsolutePath()).toURI().toURL(); }
private void unloadComponents(LocalExtensionFile jarFile, NamespaceURLClassLoader classLoader, String namespace) throws IOException { List<ComponentDeclaration> componentDeclarations = getDeclaredComponents(jarFile); if (componentDeclarations == null) { this.logger.debug("[{}] does not contain any component", jarFile.getName()); return; } this.jarLoader.unregister(this.componentManagerManager.getComponentManager(namespace, false), classLoader, componentDeclarations); } }
/** * @param extension the jar extension * @return the component descriptor to use to register/unregister the translation bundle * @throws MalformedURLException failed to create URL for the extension file */ private ComponentDescriptor<TranslationBundle> createComponentDescriptor(InstalledExtension extension) throws MalformedURLException { File jarFile = new File(extension.getFile().getAbsolutePath()); return createComponentDescriptor(jarFile.toURI().toURL()); }
this.logger.debug("[{}] does not contain any components to load", jarFile.getName()); return;
/** * @param extension the uninstalled extension * @param namespace the namespace from where the extension has been uninstalled */ private void extensionAdded(InstalledExtension extension, String namespace) { try { File jarFile = new File(extension.getFile().getAbsolutePath()); ComponentManager componentManager = this.componentManagerManager.getComponentManager(namespace, false); if (componentManager == null) { componentManager = this.rootComponentManager; } JARFileTranslationBundle bundle = new JARFileTranslationBundle(jarFile, componentManager, this.translationParser); ComponentDescriptor<TranslationBundle> descriptor = createComponentDescriptor(jarFile.toURI().toURL()); componentManager.registerComponent(descriptor, bundle); } catch (Exception e) { this.logger.error("Failed to register a TranslationBundle component for extension [{}] on namespace [{}]", extension, namespace, e); } } }