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.mime;
22  
23  import org.millscript.commons.vfs.VFile;
24  import org.millscript.commons.vfs.VFolder;
25  import org.millscript.commons.vfs.VVolume;
26  
27  /**
28   * This interface specifies a virtual filesystem MIME type handler, for
29   * resolving a specified MIME type into a new virtual filesystem object.
30   */
31  public interface MIMETypeHandler {
32  
33      /**
34       * Resolves the specified VFile to a virtual file in a new virtual
35       * filesystem. The returned virtual file will belong to a virtual volume
36       * and possibly some virtual folders as well. This is achieved by decoding
37       * the file into a virtual file on a new volume.
38       *
39       * @param file  the VFile to make the root volume from
40       * @return  a VFile for the specified file URI
41       */
42      VFile resolveAsFile( final VFile file );
43  
44      /**
45       * Resolves the specified VFile to a virtual folder in a new virtual
46       * filesystem. The returned virtual fiolder will belong to a virtual volume
47       * and possibly some virtual folders as well. This is achieved by decoding
48       * the file into a new volume and returning the new volumes root folder.
49       *
50       * @param file  the VFile to make the folders root volume from
51       * @return  a VFolder for the specified file
52       */
53      VFolder resolveAsFolder( final VFile file );
54  
55      /**
56       * Resolves the specified VFile to a new virtual filesystem volume. This is
57       * achieved by decoding the file as an archive, as is appropriate for this
58       * MIME type handler. The root of the virtual volume will be the root of
59       * decoded archive.
60       *
61       * @param file  the VFile to make the root volume from
62       * @return  a VVolume for the specified file
63       */
64      VVolume resolveAsVolume( final VFile file );
65  
66  }