{
VFSContextFactory factory = VFSContextFactoryLocator.getFactory(rootURI);
if (factory == null)
throw new IOException("No context factory for " + rootURI);
VFSRegistry registry = VFSRegistry.getInstance();
VFSContext context = registry.getContext(rootURI);
if (context != null && createNew == false)
return context.getVFS();
if (context != null)
{
registry.removeContext(context);
context.cleanup();
}
context = factory.getVFS(rootURI); // create new
VFSRegistry.getInstance().addContext(context);