/** * Scans the classpath to find any droped plugin. * <p> * The plugin-description has to be in {@code /META-INF/vfs-providers.xml}. * * @throws FileSystemException if an error occurs. */ protected void configurePlugins() throws FileSystemException { Enumeration<URL> enumResources; try { enumResources = loadResources(PLUGIN_CONFIG_RESOURCE); } catch (final IOException e) { throw new FileSystemException(e); } while (enumResources.hasMoreElements()) { final URL url = enumResources.nextElement(); configure(url); } }
/** * Initializes this manager. Adds the providers and replicator. * * @throws FileSystemException if an error occurs. */ @Override public void init() throws FileSystemException { // Set the replicator and temporary file store (use the same component) final DefaultFileReplicator replicator = createDefaultFileReplicator(); setReplicator(new PrivilegedFileReplicator(replicator)); setTemporaryFileStore(replicator); if (configUri == null) { // Use default config final URL url = getClass().getResource(CONFIG_RESOURCE); FileSystemException.requireNonNull(url, "vfs.impl/find-config-file.error", CONFIG_RESOURCE); configUri = url; } configure(configUri); configurePlugins(); // Initialise super-class super.init(); }
/** * Initializes this manager. Adds the providers and replicator. * * @throws FileSystemException if an error occurs. */ @Override public void init() throws FileSystemException { // Set the replicator and temporary file store (use the same component) final DefaultFileReplicator replicator = createDefaultFileReplicator(); setReplicator(new PrivilegedFileReplicator(replicator)); setTemporaryFileStore(replicator); if (configUri == null) { // Use default config final URL url = getClass().getResource(CONFIG_RESOURCE); if (url == null) { throw new FileSystemException("vfs.impl/find-config-file.error", CONFIG_RESOURCE); } configUri = url; } configure(configUri); configurePlugins(); // Initialise super-class super.init(); }
/** * Configures this manager from an XML configuration file. * * @param configUri The URI of the configuration. * @param configStream An InputStream containing the configuration. * @throws FileSystemException if an error occurs. */ @SuppressWarnings("unused") private void configure(final String configUri, final InputStream configStream) throws FileSystemException { try { // Load up the config // TODO - validate final DocumentBuilder builder = createDocumentBuilder(); final Element config = builder.parse(configStream).getDocumentElement(); configure(config); } catch (final Exception e) { throw new FileSystemException("vfs.impl/load-config.error", configUri, e); } }
/** * Initializes this manager. Adds the providers and replicator. * * @throws FileSystemException if an error occurs. */ @Override public void init() throws FileSystemException { // Set the replicator and temporary file store (use the same component) final DefaultFileReplicator replicator = createDefaultFileReplicator(); setReplicator(new PrivilegedFileReplicator(replicator)); setTemporaryFileStore(replicator); if (configUri == null) { // Use default config final URL url = getClass().getResource(CONFIG_RESOURCE); if (url == null) { throw new FileSystemException("vfs.impl/find-config-file.error", CONFIG_RESOURCE); } configUri = url; } configure(configUri); configurePlugins(); // Initialise super-class super.init(); }
/** * Configures this manager from an XML configuration file. * * @param configUri The URI of the configuration. * @throws FileSystemException if an error occus. */ private void configure(final URL configUri) throws FileSystemException { InputStream configStream = null; try { // Load up the config // TODO - validate final DocumentBuilder builder = createDocumentBuilder(); configStream = configUri.openStream(); final Element config = builder.parse(configStream).getDocumentElement(); configure(config); } catch (final Exception e) { throw new FileSystemException("vfs.impl/load-config.error", configUri.toString(), e); } finally { if (configStream != null) { try { configStream.close(); } catch (final IOException e) { getLogger().warn(e.getLocalizedMessage(), e); } } } }
/** * Initializes this manager. Adds the providers and replicator. * * @throws FileSystemException if an error occurs. */ @Override public void init() throws FileSystemException { // Set the replicator and temporary file store (use the same component) final DefaultFileReplicator replicator = createDefaultFileReplicator(); setReplicator(new PrivilegedFileReplicator(replicator)); setTemporaryFileStore(replicator); if (configUri == null) { // Use default config final URL url = getClass().getResource(CONFIG_RESOURCE); if (url == null) { throw new FileSystemException("vfs.impl/find-config-file.error", CONFIG_RESOURCE); } configUri = url; } configure(configUri); configurePlugins(); // Initialise super-class super.init(); }
/** * Configures this manager from an XML configuration file. * * @param configUri The URI of the configuration. * @param configStream An InputStream containing the configuration. * @throws FileSystemException if an error occurs. */ @SuppressWarnings("unused") private void configure(final String configUri, final InputStream configStream) throws FileSystemException { try { // Load up the config // TODO - validate final DocumentBuilder builder = createDocumentBuilder(); final Element config = builder.parse(configStream).getDocumentElement(); configure(config); } catch (final Exception e) { throw new FileSystemException("vfs.impl/load-config.error", configUri, e); } }
/** * Scans the classpath to find any droped plugin. * <p> * The plugin-description has to be in {@code /META-INF/vfs-providers.xml}. * * @throws FileSystemException if an error occurs. */ protected void configurePlugins() throws FileSystemException { Enumeration<URL> enumResources; try { enumResources = loadResources(PLUGIN_CONFIG_RESOURCE); } catch (final IOException e) { throw new FileSystemException(e); } while (enumResources.hasMoreElements()) { final URL url = enumResources.nextElement(); configure(url); } }
/** * Configures this manager from an XML configuration file. * * @param configUri The URI of the configuration. * @param configStream An InputStream containing the configuration. * @throws FileSystemException if an error occurs. */ @SuppressWarnings("unused") private void configure(final String configUri, final InputStream configStream) throws FileSystemException { try { // Load up the config // TODO - validate final DocumentBuilder builder = createDocumentBuilder(); final Element config = builder.parse(configStream).getDocumentElement(); configure(config); } catch (final Exception e) { throw new FileSystemException("vfs.impl/load-config.error", configUri, e); } }
/** * Scans the classpath to find any droped plugin. * <p> * The plugin-description has to be in {@code /META-INF/vfs-providers.xml}. * * @throws FileSystemException if an error occurs. */ protected void configurePlugins() throws FileSystemException { Enumeration<URL> enumResources; try { enumResources = loadResources(PLUGIN_CONFIG_RESOURCE); } catch (final IOException e) { throw new FileSystemException(e); } while (enumResources.hasMoreElements()) { final URL url = enumResources.nextElement(); configure(url); } }
/** * Configures this manager from an XML configuration file. * * @param configUri The URI of the configuration. * @param configStream An InputStream containing the configuration. * @throws FileSystemException if an error occurs. */ @SuppressWarnings("unused") private void configure(final String configUri, final InputStream configStream) throws FileSystemException { try { // Load up the config // TODO - validate final DocumentBuilder builder = createDocumentBuilder(); final Element config = builder.parse(configStream).getDocumentElement(); configure(config); } catch (final Exception e) { throw new FileSystemException("vfs.impl/load-config.error", configUri, e); } }
/** * Scans the classpath to find any droped plugin. * <p> * The plugin-description has to be in {@code /META-INF/vfs-providers.xml}. * * @throws FileSystemException if an error occurs. */ protected void configurePlugins() throws FileSystemException { final ClassLoader cl = findClassLoader(); Enumeration<URL> enumResources; try { enumResources = cl.getResources(PLUGIN_CONFIG_RESOURCE); } catch (final IOException e) { throw new FileSystemException(e); } while (enumResources.hasMoreElements()) { final URL url = enumResources.nextElement(); configure(url); } }
/** * Configures this manager from an XML configuration file. * * @param configUri The URI of the configuration. * @throws FileSystemException if an error occus. */ private void configure(final URL configUri) throws FileSystemException { InputStream configStream = null; try { // Load up the config // TODO - validate final DocumentBuilder builder = createDocumentBuilder(); configStream = configUri.openStream(); final Element config = builder.parse(configStream).getDocumentElement(); configure(config); } catch (final Exception e) { throw new FileSystemException("vfs.impl/load-config.error", configUri.toString(), e); } finally { if (configStream != null) { try { configStream.close(); } catch (final IOException e) { getLogger().warn(e.getLocalizedMessage(), e); } } } }
/** * Configures this manager from an XML configuration file. * * @param configUri The URI of the configuration. * @throws FileSystemException if an error occus. */ private void configure(final URL configUri) throws FileSystemException { InputStream configStream = null; try { // Load up the config // TODO - validate final DocumentBuilder builder = createDocumentBuilder(); configStream = configUri.openStream(); final Element config = builder.parse(configStream).getDocumentElement(); configure(config); } catch (final Exception e) { throw new FileSystemException("vfs.impl/load-config.error", configUri.toString(), e); } finally { if (configStream != null) { try { configStream.close(); } catch (final IOException e) { getLogger().warn(e.getLocalizedMessage(), e); } } } }
final Element config = builder.parse(configStream).getDocumentElement(); configure(config);