[ https://issues.apache.org/jira/browse/VFS-621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15415705#comment-15415705 ]
Bernd Eckenfels commented on VFS-621: ------------------------------------- Hello Gary, I do not oppose the setter, but I think in context of OSGi and App Servers nobody should use a global default file system manger with VFS anyway. So instead of setting a correctly configured manager, you can just use it without using VFS.getManager() ever. This avoids things like closed managers when one component implements a lifecycle and a other uses the same manager by accident. Gruss Bernd > Add API VFS.setManager(FileSystemManager) > ----------------------------------------- > > Key: VFS-621 > URL: https://issues.apache.org/jira/browse/VFS-621 > Project: Commons VFS > Issue Type: New Feature > Reporter: Gary Gregory > Assignee: Gary Gregory > Fix For: 2.2 > > > Add API {{VFS.setManager(FileSystemManager)}}. > Initialize VFS with the right class loader for OSGi types of scenarios to > work. Must be called before any VFS APIs are called. > Instead of: > {code:java} > final StandardFileSystemManager fsm = new StandardFileSystemManager(); > final ClassLoader classLoader = fsm.getClass().getClassLoader(); > fsm.setClassLoader(classLoader); > try { > FieldUtils.writeDeclaredStaticField(VFS.class, "instance", fsm, > true); > fsm.init(); > } catch (final FileSystemException | IllegalAccessException e) { > ... > } > {code} > do: > {code:java} > final StandardFileSystemManager fsm = new StandardFileSystemManager(); > final ClassLoader classLoader = fsm.getClass().getClassLoader(); > fsm.setClassLoader(classLoader); > VFS.setManager(fsm); > fsm.init(); > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)