View Javadoc

1   ////////////////////////////////////////////////////////////////////////////////
2   // MillScript: an Open Spice interpreter and batch website creation tool
3   // Copyright (C) 2005 Kevin Rogers
4   //
5   // This file is part of MillScript.
6   //
7   // MillScript is free software; you can redistribute it and/or modify it under
8   // the terms of the GNU General Public License as published by the Free
9   // Software Foundation; either version 2 of the License, or (at your option)
10  // any later version.
11  //
12  // MillScript is distributed in the hope that it will be useful, but WITHOUT
13  // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15  // more details.
16  //
17  // You should have received a copy of the GNU General Public License along with
18  // MillScript; if not, write to the Free Software Foundation, Inc., 59 Temple
19  // Place, Suite 330, Boston, MA  02111-1307  USA
20  ////////////////////////////////////////////////////////////////////////////////
21  package org.millscript.commons.vfs.protocols;
22  
23  import org.millscript.commons.vfs.VFS;
24  import org.millscript.commons.vfs.VFile;
25  import org.millscript.commons.vfs.VFolder;
26  import org.millscript.commons.vfs.VVolume;
27  
28  import java.net.URI;
29  
30  /**
31   * This interface specifies a virtual filesystem URI scheme handler, for
32   * resolving a specified URI into a new virtual filesystem object.
33   */
34  public interface URISchemeHandler {
35  
36      /**
37       * Returns the parent VFS, that which created this URI scheme handler. The
38       * parent VFS is maintained through to each volume, so that we can use it
39       * for configuration.
40       *
41       * @return
42       */
43      VFS getParentVFS();
44  
45      /**
46       * Resolves the specified URI to a virtual file in a new virtual
47       * filesystem. The returned virtual file will belong to a virtual volume
48       * and possibly some virtual folders as well. The virtual volume will be
49       * located at the root of the URI's path.
50       *
51       * @param uri   the URI of the file to get a virtual file for
52       * @return  a VFile for the specified file URI
53       */
54      VFile resolveAsFile( final URI uri );
55  
56      /**
57       * Resolves the specified URI to a virtual fole in a new virtual
58       * filesystem. The returned virtual fiolder will belong to a virtual volume
59       * and possibly some virtual folders as well. The virtual volume will be
60       * located at the root of the URI's path.
61       *
62       * @param uri   the URI of the folder to get a virtual folder for
63       * @return  a VFile for the specified folder URI
64       */
65      VFolder resolveAsFolder( final URI uri );
66  
67      /**
68       * Resolves the specified URI to a new virtual filesystem volume. The root
69       * of the virtual volume will be the specified URI's path.
70       *
71       * @param uri   the URI of the file to get a virtual file for
72       * @return  a VFile for the specified file URI
73       */
74      VVolume resolveAsVolume( final URI uri );
75  
76  }