KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > vfs > impl > DefaultFileSystemManager


1 /*
2  * Copyright 2002-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.vfs.impl;
17
18 import org.apache.commons.logging.Log;
19 import org.apache.commons.vfs.FileContentInfoFactory;
20 import org.apache.commons.vfs.FileName;
21 import org.apache.commons.vfs.FileObject;
22 import org.apache.commons.vfs.FileSystem;
23 import org.apache.commons.vfs.FileSystemConfigBuilder;
24 import org.apache.commons.vfs.FileSystemException;
25 import org.apache.commons.vfs.FileSystemManager;
26 import org.apache.commons.vfs.FileSystemOptions;
27 import org.apache.commons.vfs.FileType;
28 import org.apache.commons.vfs.FilesCache;
29 import org.apache.commons.vfs.NameScope;
30 import org.apache.commons.vfs.VFS;
31 import org.apache.commons.vfs.cache.SoftRefFilesCache;
32 import org.apache.commons.vfs.provider.AbstractFileName;
33 import org.apache.commons.vfs.provider.AbstractFileProvider;
34 import org.apache.commons.vfs.provider.DefaultURLStreamHandler;
35 import org.apache.commons.vfs.provider.FileProvider;
36 import org.apache.commons.vfs.provider.FileReplicator;
37 import org.apache.commons.vfs.provider.LocalFileProvider;
38 import org.apache.commons.vfs.provider.TemporaryFileStore;
39 import org.apache.commons.vfs.provider.UriParser;
40 import org.apache.commons.vfs.provider.VfsComponent;
41
42 import java.io.File JavaDoc;
43 import java.net.URLStreamHandler JavaDoc;
44 import java.net.URLStreamHandlerFactory JavaDoc;
45 import java.util.ArrayList JavaDoc;
46 import java.util.Collection JavaDoc;
47 import java.util.HashMap JavaDoc;
48 import java.util.Iterator JavaDoc;
49 import java.util.Map JavaDoc;
50
51 /**
52  * A default file system manager implementation.
53  *
54  * @author <a HREF="mailto:adammurdoch@apache.org">Adam Murdoch</a>
55  */

56 public class DefaultFileSystemManager
57     implements FileSystemManager
58 {
59     /**
60      * The provider for local files.
61      */

62     private LocalFileProvider localFileProvider;
63
64     /**
65      * The default provider.
66      */

67     private FileProvider defaultProvider;
68
69     /**
70      * The file replicator to use.
71      */

72     private FileReplicator fileReplicator;
73
74     /**
75      * Mapping from URI scheme to FileProvider.
76      */

77     private final Map JavaDoc providers = new HashMap JavaDoc();
78
79     /**
80      * All components used by this manager.
81      */

82     private final ArrayList JavaDoc components = new ArrayList JavaDoc();
83
84     /**
85      * The base file to use for relative URI.
86      */

87     private FileObject baseFile;
88
89     /**
90      * The files cache
91      */

92     private FilesCache filesCache;
93
94     /**
95      * The class to use to determine the content-type (mime-type)
96      */

97     private FileContentInfoFactory fileContentInfoFactory;
98
99     /**
100      * The logger to use.
101      */

102     private Log log;
103
104     /**
105      * The context to pass to providers.
106      */

107     private final DefaultVfsComponentContext context =
108         new DefaultVfsComponentContext(this);
109
110     private TemporaryFileStore tempFileStore;
111     private final FileTypeMap map = new FileTypeMap();
112     private final VirtualFileProvider vfsProvider = new VirtualFileProvider();
113     private boolean init;
114
115     /**
116      * Returns the logger used by this manager.
117      */

118     protected Log getLogger()
119     {
120         return log;
121     }
122
123     /**
124      * Registers a file system provider. The manager takes care of all
125      * lifecycle management. A provider may be registered multiple times.
126      *
127      * @param urlScheme The scheme the provider will handle.
128      * @param provider The provider.
129      */

130     public void addProvider(final String JavaDoc urlScheme,
131                             final FileProvider provider)
132         throws FileSystemException
133     {
134         addProvider(new String JavaDoc[]{urlScheme}, provider);
135     }
136
137     /**
138      * Registers a file system provider. The manager takes care of all
139      * lifecycle management. A provider may be registered multiple times.
140      *
141      * @param urlSchemes The schemes the provider will handle.
142      * @param provider The provider.
143      */

144     public void addProvider(final String JavaDoc[] urlSchemes,
145                             final FileProvider provider)
146         throws FileSystemException
147     {
148         // Warn about duplicate providers
149
for (int i = 0; i < urlSchemes.length; i++)
150         {
151             final String JavaDoc scheme = urlSchemes[i];
152             if (providers.containsKey(scheme))
153             {
154                 throw new FileSystemException("vfs.impl/multiple-providers-for-scheme.error", scheme);
155             }
156         }
157
158         // Contextualise the component (if not already)
159
setupComponent(provider);
160
161         // Add to map
162
for (int i = 0; i < urlSchemes.length; i++)
163         {
164             final String JavaDoc scheme = urlSchemes[i];
165             providers.put(scheme, provider);
166         }
167
168         if (provider instanceof LocalFileProvider)
169         {
170             localFileProvider = (LocalFileProvider) provider;
171         }
172     }
173
174     /**
175      * Returns true if this manager has a provider for a particular scheme.
176      */

177     public boolean hasProvider(final String JavaDoc scheme)
178     {
179         return providers.containsKey(scheme);
180     }
181
182     /**
183      * Adds an filename extension mapping.
184      *
185      * @param extension The file name extension.
186      * @param scheme The scheme to use for files with this extension.
187      */

188     public void addExtensionMap(final String JavaDoc extension, final String JavaDoc scheme)
189     {
190         map.addExtension(extension, scheme);
191     }
192
193     /**
194      * Adds a mime type mapping.
195      *
196      * @param mimeType The mime type.
197      * @param scheme The scheme to use for files with this mime type.
198      */

199     public void addMimeTypeMap(final String JavaDoc mimeType, final String JavaDoc scheme)
200     {
201         map.addMimeType(mimeType, scheme);
202     }
203
204     /**
205      * Sets the default provider. This is the provider that will handle URI
206      * with unknown schemes. The manager takes care of all lifecycle
207      * management.
208      */

209     public void setDefaultProvider(final FileProvider provider)
210         throws FileSystemException
211     {
212         setupComponent(provider);
213         defaultProvider = provider;
214     }
215
216     /**
217      * Returns the filesCache implementation used to cache files
218      */

219     public FilesCache getFilesCache()
220     {
221         return filesCache;
222     }
223
224     /**
225      * Sets the filesCache implementation used to cache files
226      */

227     public void setFilesCache(FilesCache filesCache) throws FileSystemException
228     {
229         if (init)
230         {
231             throw new FileSystemException("vfs.impl/already-inited.error");
232         }
233
234         this.filesCache = filesCache;
235     }
236
237     /**
238      * get the fileContentInfoFactory used to determine the infos of a file content.
239      */

240     public FileContentInfoFactory getFileContentInfoFactory()
241     {
242         return fileContentInfoFactory;
243     }
244
245     /**
246      * set the fileContentInfoFactory used to determine the infos of a file content.
247      */

248     public void setFileContentInfoFactory(FileContentInfoFactory fileContentInfoFactory) throws FileSystemException
249     {
250         if (init)
251         {
252             throw new FileSystemException("vfs.impl/already-inited.error");
253         }
254
255         this.fileContentInfoFactory = fileContentInfoFactory;
256     }
257
258     /**
259      * Sets the file replicator to use. The manager takes care of all
260      * lifecycle management.
261      */

262     public void setReplicator(final FileReplicator replicator)
263         throws FileSystemException
264     {
265         setupComponent(replicator);
266         fileReplicator = replicator;
267     }
268
269     /**
270      * Sets the temporary file store to use. The manager takes care of all
271      * lifecycle management.
272      */

273     public void setTemporaryFileStore(final TemporaryFileStore tempFileStore)
274         throws FileSystemException
275     {
276         setupComponent(tempFileStore);
277         this.tempFileStore = tempFileStore;
278     }
279
280     /**
281      * Sets the logger to use.
282      */

283     public void setLogger(final Log log)
284     {
285         this.log = log;
286     }
287
288     /**
289      * Initialises a component, if it has not already been initialised.
290      */

291     private void setupComponent(final Object JavaDoc component)
292         throws FileSystemException
293     {
294         if (!components.contains(component))
295         {
296             if (component instanceof VfsComponent)
297             {
298                 final VfsComponent vfsComponent = (VfsComponent) component;
299                 vfsComponent.setLogger(getLogger());
300                 vfsComponent.setContext(context);
301                 vfsComponent.init();
302             }
303             components.add(component);
304         }
305     }
306
307     /**
308      * Closes a component, if it has not already been closed.
309      */

310     private void closeComponent(final Object JavaDoc component)
311     {
312         if (component != null && components.contains(component))
313         {
314             if (component instanceof VfsComponent)
315             {
316                 final VfsComponent vfsComponent = (VfsComponent) component;
317                 vfsComponent.close();
318             }
319             components.remove(component);
320         }
321     }
322
323     /**
324      * Returns the file replicator.
325      *
326      * @return The file replicator. Never returns null.
327      */

328     public FileReplicator getReplicator()
329         throws FileSystemException
330     {
331         if (fileReplicator == null)
332         {
333             throw new FileSystemException("vfs.impl/no-replicator.error");
334         }
335         return fileReplicator;
336     }
337
338     /**
339      * Returns the temporary file store.
340      *
341      * @return The file store. Never returns null.
342      */

343     public TemporaryFileStore getTemporaryFileStore()
344         throws FileSystemException
345     {
346         if (tempFileStore == null)
347         {
348             throw new FileSystemException("vfs.impl/no-temp-file-store.error");
349         }
350         return tempFileStore;
351     }
352
353     /**
354      * Initialises this manager.
355      */

356     public void init() throws FileSystemException
357     {
358         if (filesCache == null)
359         {
360             // filesCache = new DefaultFilesCache();
361
filesCache = new SoftRefFilesCache();
362         }
363         if (fileContentInfoFactory == null)
364         {
365             fileContentInfoFactory = new FileContentInfoFilenameFactory();
366         }
367
368         setupComponent(filesCache);
369         setupComponent(vfsProvider);
370
371         init = true;
372     }
373
374     /**
375      * Closes all files created by this manager, and cleans up any temporary
376      * files. Also closes all providers and the replicator.
377      */

378     public void close()
379     {
380         if (!init)
381         {
382             return;
383         }
384
385         // Close the providers.
386
for (Iterator JavaDoc iterator = providers.values().iterator(); iterator.hasNext();)
387         {
388             final Object JavaDoc provider = iterator.next();
389             closeComponent(provider);
390         }
391
392         // Close the other components
393
closeComponent(defaultProvider);
394         closeComponent(fileReplicator);
395         closeComponent(tempFileStore);
396
397         components.clear();
398         providers.clear();
399         filesCache.close();
400         localFileProvider = null;
401         defaultProvider = null;
402         fileReplicator = null;
403         tempFileStore = null;
404         init = false;
405     }
406
407     /**
408      * Free all resources used by unused filesystems created by this manager.
409      */

410     public void freeUnusedResources()
411     {
412         if (!init)
413         {
414             return;
415         }
416
417         // Close the providers.
418
for (Iterator JavaDoc iterator = providers.values().iterator(); iterator.hasNext();)
419         {
420             final AbstractFileProvider provider = (AbstractFileProvider) iterator.next();
421             provider.freeUnusedResources();
422         }
423     }
424
425     /**
426      * Sets the base file to use when resolving relative URI.
427      */

428     // public void setBaseFile(final FileObject baseFile)
429
public void setBaseFile(final FileObject baseFile)
430         throws FileSystemException
431     {
432         this.baseFile = baseFile;
433     }
434
435     /**
436      * Sets the base file to use when resolving relative URI.
437      */

438     public void setBaseFile(final File JavaDoc baseFile) throws FileSystemException
439     {
440         this.baseFile = getLocalFileProvider().findLocalFile(baseFile);
441     }
442
443     /**
444      * Returns the base file used to resolve relative URI.
445      */

446     public FileObject getBaseFile() throws FileSystemException
447     {
448         return baseFile;
449     }
450
451     /**
452      * Locates a file by URI.
453      */

454     public FileObject resolveFile(final String JavaDoc uri) throws FileSystemException
455     {
456         // return resolveFile(baseFile, uri);
457
return resolveFile(getBaseFile(), uri);
458     }
459
460     /**
461      * Locate a file by URI, use the FileSystemOptions for file-system creation
462      */

463
464     public FileObject resolveFile(final String JavaDoc uri, final FileSystemOptions fileSystemOptions) throws FileSystemException
465     {
466         // return resolveFile(baseFile, uri, fileSystemOptions);
467
return resolveFile(getBaseFile(), uri, fileSystemOptions);
468     }
469
470     /**
471      * Locates a file by URI.
472      */

473     public FileObject resolveFile(final File JavaDoc baseFile, final String JavaDoc uri)
474         throws FileSystemException
475     {
476         final FileObject baseFileObj =
477             getLocalFileProvider().findLocalFile(baseFile);
478         return resolveFile(baseFileObj, uri);
479     }
480
481     /**
482      * Resolves a URI, relative to a base file.
483      */

484     public FileObject resolveFile(final FileObject baseFile, final String JavaDoc uri)
485         throws FileSystemException
486     {
487         return resolveFile(baseFile, uri, baseFile == null ? null : baseFile.getFileSystem().getFileSystemOptions());
488     }
489
490     /**
491      * Resolves a URI, realtive to a base file with specified FileSystem configuration
492      */

493     public FileObject resolveFile(final FileObject baseFile, final String JavaDoc uri, final FileSystemOptions fileSystemOptions)
494         throws FileSystemException
495     {
496         final FileObject realBaseFile;
497         if (baseFile != null && VFS.isUriStyle() && baseFile.getName().getType() == FileType.FILE)
498         {
499             realBaseFile = baseFile.getParent();
500         }
501         else
502         {
503             realBaseFile = baseFile;
504         }
505         // TODO: use resolveName and use this name to resolve the fileObject
506

507
508         UriParser.checkUriEncoding(uri);
509
510         if (uri == null)
511         {
512             throw new IllegalArgumentException JavaDoc();
513         }
514
515 // Extract the scheme
516
final String JavaDoc scheme = UriParser.extractScheme(uri);
517         if (scheme != null)
518         {
519 // An absolute URI - locate the provider
520
final FileProvider provider = (FileProvider) providers.get(scheme);
521             if (provider != null)
522             {
523                 return provider.findFile(realBaseFile, uri, fileSystemOptions);
524             }
525 // Otherwise, assume a local file
526
}
527
528 // Handle absolute file names
529
if (localFileProvider != null
530             && localFileProvider.isAbsoluteLocalName(uri))
531         {
532             return localFileProvider.findLocalFile(uri);
533         }
534
535         if (scheme != null)
536         {
537 // An unknown scheme - hand it to the default provider
538
if (defaultProvider == null)
539             {
540                 throw new FileSystemException("vfs.impl/unknown-scheme.error", new Object JavaDoc[]{scheme, uri});
541             }
542             return defaultProvider.findFile(realBaseFile, uri, fileSystemOptions);
543         }
544
545 // Assume a relative name - use the supplied base file
546
if (realBaseFile == null)
547         {
548             throw new FileSystemException("vfs.impl/find-rel-file.error", uri);
549         }
550
551         return realBaseFile.resolveFile(uri);
552     }
553
554     /**
555      * Resolves a name, relative to the file. If the supplied name is an
556      * absolute path, then it is resolved relative to the root of the
557      * file system that the file belongs to. If a relative name is supplied,
558      * then it is resolved relative to this file name.
559      */

560     public FileName resolveName(final FileName root, final String JavaDoc path) throws FileSystemException
561     {
562         return resolveName(root, path, NameScope.FILE_SYSTEM);
563     }
564
565     /**
566      * Resolves a name, relative to the root.
567      *
568      * @param base the base filename
569      * @param name the name
570      * @param scope the {@link NameScope}
571      * @return
572      * @throws FileSystemException
573      */

574     public FileName resolveName(final FileName base,
575                                 final String JavaDoc name,
576                                 final NameScope scope)
577         throws FileSystemException
578     {
579         final FileName realBase;
580         if (base != null && VFS.isUriStyle() && base.getType() == FileType.FILE)
581         {
582             realBase = base.getParent();
583         }
584         else
585         {
586             realBase = base;
587         }
588
589         final StringBuffer JavaDoc buffer = new StringBuffer JavaDoc(name);
590
591         // Adjust separators
592
UriParser.fixSeparators(buffer);
593
594         // Determine whether to prepend the base path
595
if (name.length() == 0 || name.charAt(0) != FileName.SEPARATOR_CHAR)
596         {
597             // Supplied path is not absolute
598
if (!VFS.isUriStyle())
599             {
600                 // when using uris the parent already do have the trailing "/"
601
buffer.insert(0, FileName.SEPARATOR_CHAR);
602             }
603             buffer.insert(0, realBase.getPath());
604         }
605
606         //// UriParser.canonicalizePath(buffer, 0, name.length());
607

608         // Normalise the path
609
FileType fileType = UriParser.normalisePath(buffer);
610
611         // Check the name is ok
612
final String JavaDoc resolvedPath = buffer.toString();
613         if (!AbstractFileName.checkName(realBase.getPath(), resolvedPath, scope))
614         {
615             throw new FileSystemException("vfs.provider/invalid-descendent-name.error", name);
616         }
617
618         String JavaDoc scheme = realBase.getScheme();
619         String JavaDoc fullPath = realBase.getRootURI() + resolvedPath;
620         final FileProvider provider = (FileProvider) providers.get(scheme);
621         if (provider != null)
622         {
623             // todo: extend the filename parser to be able to parse
624
// only a pathname and take the missing informations from
625
// the base. Then we can get rid of the string operation.
626
//// String fullPath = base.getRootURI() + resolvedPath.substring(1);
627

628             return provider.parseUri(realBase, fullPath);
629         }
630
631         if (scheme != null)
632         {
633 // An unknown scheme - hand it to the default provider - if possible
634
if (defaultProvider != null)
635             {
636                 return defaultProvider.parseUri(realBase, fullPath);
637             }
638         }
639
640         // todo: avoid fallback to this point
641
// this happens if we have a virtual filesystem (no provider for scheme)
642
return ((AbstractFileName) realBase).createName(resolvedPath, fileType);
643     }
644
645     /**
646      * resolve the uri to a filename
647      *
648      * @throws FileSystemException
649      */

650     public FileName resolveURI(String JavaDoc uri) throws FileSystemException
651     {
652         UriParser.checkUriEncoding(uri);
653
654         if (uri == null)
655         {
656             throw new IllegalArgumentException JavaDoc();
657         }
658
659 // Extract the scheme
660
final String JavaDoc scheme = UriParser.extractScheme(uri);
661         if (scheme != null)
662         {
663 // An absolute URI - locate the provider
664
final FileProvider provider = (FileProvider) providers.get(scheme);
665             if (provider != null)
666             {
667                 return provider.parseUri(null, uri);
668             }
669
670 // Otherwise, assume a local file
671
}
672
673 // Handle absolute file names
674
if (localFileProvider != null
675             && localFileProvider.isAbsoluteLocalName(uri))
676         {
677             return localFileProvider.parseUri(null, uri);
678         }
679
680         if (scheme != null)
681         {
682 // An unknown scheme - hand it to the default provider
683
if (defaultProvider == null)
684             {
685                 throw new FileSystemException("vfs.impl/unknown-scheme.error", new Object JavaDoc[]{scheme, uri});
686             }
687             return defaultProvider.parseUri(null, uri);
688         }
689
690 // Assume a relative name - use the supplied base file
691
if (baseFile == null)
692         {
693             throw new FileSystemException("vfs.impl/find-rel-file.error", uri);
694         }
695
696         return resolveName(baseFile.getName(), uri, NameScope.FILE_SYSTEM);
697     }
698
699     /**
700      * Converts a local file into a {@link FileObject}.
701      */

702     public FileObject toFileObject(final File JavaDoc file)
703         throws FileSystemException
704     {
705         return getLocalFileProvider().findLocalFile(file);
706     }
707
708     /**
709      * Creates a layered file system.
710      */

711     public FileObject createFileSystem(final String JavaDoc scheme,
712                                        final FileObject file)
713         throws FileSystemException
714     {
715         final FileProvider provider = (FileProvider) providers.get(scheme);
716         if (provider == null)
717         {
718             throw new FileSystemException("vfs.impl/unknown-provider.error", new Object JavaDoc[]{scheme, file});
719         }
720         return provider.createFileSystem(scheme, file, file.getFileSystem().getFileSystemOptions());
721     }
722
723     /**
724      * Creates a layered file system.
725      */

726     public FileObject createFileSystem(final FileObject file)
727         throws FileSystemException
728     {
729         final String JavaDoc scheme = map.getScheme(file);
730         if (scheme == null)
731         {
732             throw new FileSystemException("vfs.impl/no-provider-for-file.error", file);
733         }
734
735         return createFileSystem(scheme, file);
736     }
737
738     /**
739      * Determines if a layered file system can be created for a given file.
740      *
741      * @param file The file to check for.
742      */

743     public boolean canCreateFileSystem(final FileObject file) throws FileSystemException
744     {
745         return (map.getScheme(file) != null);
746     }
747
748     /**
749      * Creates a virtual file system.
750      */

751     public FileObject createVirtualFileSystem(final FileObject rootFile)
752         throws FileSystemException
753     {
754         return vfsProvider.createFileSystem(rootFile);
755     }
756
757     /**
758      * Creates an empty virtual file system.
759      */

760     public FileObject createVirtualFileSystem(final String JavaDoc rootUri)
761         throws FileSystemException
762     {
763         return vfsProvider.createFileSystem(rootUri);
764     }
765
766     /**
767      * Locates the local file provider.
768      */

769     private LocalFileProvider getLocalFileProvider()
770         throws FileSystemException
771     {
772         if (localFileProvider == null)
773         {
774             throw new FileSystemException("vfs.impl/no-local-file-provider.error");
775         }
776         return localFileProvider;
777     }
778
779     /**
780      * Get the URLStreamHandlerFactory.
781      */

782     public URLStreamHandlerFactory JavaDoc getURLStreamHandlerFactory()
783     {
784         return new VfsStreamHandlerFactory();
785     }
786
787     public void closeFileSystem(FileSystem filesystem)
788     {
789         FileProvider provider = (FileProvider) providers.get(filesystem.getRootName().getScheme());
790         if (provider != null)
791         {
792             ((AbstractFileProvider) provider).closeFileSystem(filesystem);
793         }
794     }
795
796     /**
797      * This is an internal class because it needs access to the private
798      * member providers.
799      */

800     final class VfsStreamHandlerFactory implements URLStreamHandlerFactory JavaDoc
801     {
802         public URLStreamHandler createURLStreamHandler(final String JavaDoc protocol)
803         {
804             FileProvider provider = (FileProvider) providers.get(protocol);
805             if (provider != null)
806             {
807                 return new DefaultURLStreamHandler(context);
808             }
809
810             //Route all other calls to the default URLStreamHandlerFactory
811
return new URLStreamHandlerProxy();
812         }
813     }
814
815     /**
816      * Get the schemes currently available.
817      */

818     public String JavaDoc[] getSchemes()
819     {
820         String JavaDoc schemes[] = new String JavaDoc[providers.size()];
821         providers.keySet().toArray(schemes);
822         return schemes;
823     }
824
825     /**
826      * Get the capabilities for a given scheme.
827      *
828      * @throws FileSystemException if the given scheme is not konwn
829      */

830     public Collection JavaDoc getProviderCapabilities(final String JavaDoc scheme) throws FileSystemException
831     {
832         FileProvider provider = (FileProvider) providers.get(scheme);
833         if (provider == null)
834         {
835             throw new FileSystemException("vfs.impl/unknown-scheme.error", new Object JavaDoc[]{scheme});
836         }
837
838         return provider.getCapabilities();
839     }
840
841     /**
842      * Get the configuration builder for the given scheme
843      *
844      * @throws FileSystemException if the given scheme is not konwn
845      */

846     public FileSystemConfigBuilder getFileSystemConfigBuilder(final String JavaDoc scheme) throws FileSystemException
847     {
848         FileProvider provider = (FileProvider) providers.get(scheme);
849         if (provider == null)
850         {
851             throw new FileSystemException("vfs.impl/unknown-scheme.error", new Object JavaDoc[]{scheme});
852         }
853
854         return provider.getConfigBuilder();
855     }
856 }
857
Popular Tags