Skip to main content

Source code file content

Revision: 164

Added tag truezip-7.7.4 for changeset d9bd78f409e2
» Project Revision History

» Checkout URL

web / concepts.html

Size: 18523 bytes, 1 line
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <link href="./css/prettify.css" type="text/css" rel="stylesheet"/>
    <script src="./js/prettify.js" type="text/javascript"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>TrueZIP - Basic Concepts</title>
    <style type="text/css" media="all">
      @import url("./css/site.css");
    </style>
    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print"/>
    <meta name="author" content="Christian Schlichtherle"/>
    <meta name="Date-Revision-yyyymmdd" content="20130928"/>
    <meta http-equiv="Content-Language" content="en"/>
          <script type="text/javascript">
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'UA-25500668-1']);
      _gaq.push(['_trackPageview']);
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    </script>
                  <script>
        (function() {
          var cx = '003580521944097984334:0t01zxsxy6y';
          var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
          gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
              '//www.google.com/cse/cse.js?cx=' + cx;
          var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
        })();
      </script>
                                                          
<link title="The TrueZIP Blog - Announcements Feed" rel="alternate" type="application/rss+xml" href="http://truezip.schlichtherle.de/category/announcements/feed/"/>
                      
  </head>
  <body class="composite" onload="prettyPrint()">
    <div id="banner">
                    <div id="bannerLeft">
                TrueZIP
                </div>
                                <div id="gcse-search-form" class="gcse-searchbox-only"></div>
            <div class="clear"><hr/></div>
    </div>
    <div id="breadcrumbs">
            
                                  <div class="xleft">
        <span id="projectVersion">Version: 7.7.4</span>
                  |                         <a href="index.html" title="TrueZIP">TrueZIP</a>
      &raquo;
        Basic Concepts
              </div>
            <div class="xright">        
                        </div>
      <div class="clear"><hr/></div>
    </div>
    <div id="leftColumn">
      <div id="navcolumn">
              
                                                   <h5>Documentation</h5>
                  <ul>
                  <li class="none">
                          <a href="index.html" title="About">About</a>
            </li>
                  <li class="none">
                          <a href="features.html" title="Key Features">Key Features</a>
            </li>
                                                                                                                                            <li class="collapsed">
                          <a href="usecases/index.html" title="Use Cases">Use Cases</a>
                  </li>
                                                                                                                                            <li class="collapsed">
                          <a href="kick-start/index.html" title="Getting Started">Getting Started</a>
                  </li>
                                                                                                                          <li class="collapsed">
                          <a href="help.html" title="Getting Help">Getting Help</a>
                  </li>
                  <li class="none">
            <strong>Basic Concepts</strong>
          </li>
                  <li class="none">
                          <a href="glossary.html" title="Glossary">Glossary</a>
            </li>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <li class="collapsed">
                          <a href="6/index.html" title="TrueZIP 6 (Obsolete)">TrueZIP 6 (Obsolete)</a>
                  </li>
          </ul>
                       <h5>External Resources</h5>
                  <ul>
                  <li class="none">
                          <a href="http://java.net/jira/browse/TRUEZIP#selectedTab=com.atlassian.jira.plugin.system.project:roadmap-panel" class="externalLink" title="Road Map">Road Map</a>
            </li>
                  <li class="none">
                          <a href="http://java.net/jira/browse/TRUEZIP#selectedTab=com.atlassian.jira.plugin.system.project:changelog-panel" class="externalLink" title="Change Log">Change Log</a>
            </li>
                  <li class="none">
                          <a href="http://truezip.schlichtherle.de" class="externalLink" title="The TrueZIP Blog">The TrueZIP Blog</a>
            </li>
                  <li class="none">
                          <a href="http://java.net/projects/truezip" class="externalLink" title="Developer Site">Developer Site</a>
            </li>
          </ul>
                       <h5>Parent Module</h5>
                                 <h5>Sub-Modules</h5>
                  <ul>
                  <li class="none">
                          <a href="truezip-archetype/index.html" title="TrueZIP Archetype">TrueZIP Archetype</a>
            </li>
                  <li class="none">
                          <a href="truezip-driver/index.html" title="TrueZIP Driver">TrueZIP Driver</a>
            </li>
                  <li class="none">
                          <a href="truezip-extension/index.html" title="TrueZIP Extension">TrueZIP Extension</a>
            </li>
                  <li class="none">
                          <a href="truezip-file/index.html" title="TrueZIP File*">TrueZIP File*</a>
            </li>
                  <li class="none">
                          <a href="truezip-kernel/index.html" title="TrueZIP Kernel">TrueZIP Kernel</a>
            </li>
                  <li class="none">
                          <a href="truezip-samples/index.html" title="TrueZIP Samples">TrueZIP Samples</a>
            </li>
                  <li class="none">
                          <a href="truezip-swing/index.html" title="TrueZIP Swing">TrueZIP Swing</a>
            </li>
                  <li class="none">
                          <a href="truezip-path/index.html" title="TrueZIP Path">TrueZIP Path</a>
            </li>
          </ul>
                       <h5>Reports</h5>
                  <ul>
                                                                                                                                                                                                                                                                                                                                                  <li class="collapsed">
                          <a href="project-info.html" title="Project Information">Project Information</a>
                  </li>
                                                                                      <li class="collapsed">
                          <a href="project-reports.html" title="Project Reports">Project Reports</a>
                  </li>
          </ul>
                     
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
  <div class="paypalButton">
    <input name="cmd" value="_s-xclick" type="hidden"/>
    <input name="hosted_button_id" value="2QSQY9ECYES9E" type="hidden"/>
    <input style="border: 0" alt="PayPal - The safer, easier way to pay online!" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" type="image"/>
  </div>
</form>
                                
                              </div>
    </div>
    <div id="bodyColumn" class="content">
      <div id="contentBox">
                                      <div class="section">
<h2>Basic Concepts<a name="Basic_Concepts"></a></h2>
<p>TrueZIP is a Java based plug-in framework for virtual file systems (VFS) which provides transparent access to archive files as if they were just plain directories.</p>
<div class="section">
<h3>Overall Architecture<a name="Overall_Architecture"></a></h3>
<p>TrueZIP applies the (in)famous three-tier architecture pattern:</p>
<ol style="list-style-type: decimal">
<li>The <i>Access Tier</i> is a facade for the Kernel Tier which provides convenient-to-use client APIs for TrueZIP applications. No file system state is managed by this tier, which enables a TrueZIP application to work with any client API concurrently. This tier consists of the modules <a href="./truezip-file/index.html">TrueZIP&#160;File*</a> and <a href="./truezip-path/index.html">TrueZIP&#160;Path</a> (since TrueZIP 7.2). In addition to the canonical term <i>access module</i>, each of these may also get referred to by the term <i>client API module</i> for better comprehensibility.</li>
<li>The <i>Kernel Tier</i> manages all virtual file system state. It also provides multiplexing, caching and buffering for multithreaded environments so that the driver tier does not need to take care of this. This tier solely consists of the module <a href="./truetip-kernel/index.html">TrueZIP&#160;Kernel</a>.</li>
<li>The <i>Driver Tier</i> implements the I/O operations for their respective (federated) file system type. This tier consists of all file system driver modules, e.g. <a href="./truezip-driver/truezip-driver-file/index.html">TrueZIP&#160;Driver&#160;FILE</a>, <a href="./truezip-driver/truezip-driver-zip/index.html">TrueZIP&#160;Driver&#160;ZIP</a> et al.</li></ol></div>
<div class="section">
<h3>Design Paradigms<a name="Design_Paradigms"></a></h3>
<p>The TrueZIP project employs several high level design paradigms which have proven to be beneficial. However, these are only guidelines - not rules - so they should get applied with some care.</p>
<div class="section">
<h4>Convention Over Configuration<a name="Convention_Over_Configuration"></a></h4>
<p>The decomposition of this framework into separate modules enables users to easily configure the initial setup of the application's archive detection by simply putting the JARs of the required file system driver modules on the run time class path. This will cause the application to automatically detect the canonical file extension for the archive files supported by the respective file system driver modules - no configuration file editing is required.</p>
<p>The application can simply accept this <a href="./apidocs/de/schlichtherle/truezip/file/TArchiveDetector.html#ALL">initial setup</a> of the <a href="./apidocs/de/schlichtherle/truezip/file/TConfig.html#getArchiveDetector">archive detection</a> in its <a href="./apidocs/de/schlichtherle/truezip/file/TConfig.html#get">current configuration</a> or it can <a href="./apidocs/de/schlichtherle/truezip/file/TConfig.html#setArchiveDetectorde.schlichtherle.truezip.file.TArchiveDetector">explicitly override</a> it. Check the <a href="./faq.html#file">FAQ</a> for the <a href="./truezip-file/index.html">TrueZIP File*</a> API for a discussion of some options to adapt the archive detection to your needs.</p></div>
<div class="section">
<h4>Service Location<a name="Service_Location"></a></h4>
<p>As an implication of the Convention Over Configuration design paradigm, the <a href="./truezip-kernel/index.html">TrueZIP Kernel</a> module provides service locator singletons for the <a href="./apidocs/de/schlichtherle/truezip/fs/sl/FsManagerLocator.html">file system manager</a>, the <a href="./apidocs/de/schlichtherle/truezip/fs/sl/FsDriverLocator.html">file system drivers</a> and the <a href="./apidocs/de/schlichtherle/truezip/socket/sl/IOPoolLocator.html">temporary I/O buffer pool</a>.</p>
<p>File system drivers may add additional service locators singletons. For example, the <a href="./truezip-driver/truezip-driver-tzp/index.html">TrueZIP Driver ZIP.RAES (TZP)</a> module adds another service locator singleton for the <a href="./apidocs/de/schlichtherle/truezip/key/sl/KeyManagerLocator.html">key manager</a> which obtains passwords or key files required to encrypt and decrypt RAES encrypted ZIP files.</p></div>
<div class="section">
<h4>Dependency Injection<a name="Dependency_Injection"></a></h4>
<p>Although the service locator singletons are provided by the TrueZIP Kernel module, it does not actually use them. To the contrary, the TrueZIP Kernel module fully relies on the Dependency Injection design paradigm. This enables TrueVFS modules and TrueVFS applications to inject custom implementations or simply the service locator singletons as a dependency into the TrueVFS Kernel.</p>
<p>For example, the file system manager service locator singleton and the file system driver service locator singleton are used by the APIs of the TrueZIP File* and <a href="./truezip-path/index.html">TrueZIP Path</a> modules in order to implement the Convention Over Configuration design paradigm. Likewise, the temporary I/O entry pool service locator singleton is used by the file system driver modules.</p>
<p>No Dependency Injection framework is used in order to reduce TrueZIP's dependency on third party projects.</p>
<p>Constructor injection is favored wherever possible in order to enable immutable objects.</p></div>
<div class="section">
<h4>Immutable Classes<a name="Immutable_Classes"></a></h4>
<p>Immutable classes are favored wherever possible because they inherently provide support for multithreading, which is a key requirement for most TrueZIP Kernel classes.</p>
<p>For example, the classes <a href="./apidocs/de/schlichtherle/truezip/fs/FsPath.html"><tt>FsPath</tt></a>, <a href="./apidocs/de/schlichtherle/truezip/fs/FsMountPoint.html"><tt>FsMountPoint</tt></a> and <a href="./apidocs/de/schlichtherle/truezip/fs/FsEntryName.html"><tt>FsEntryName</tt></a> are immutable so that their instances can get safely shared among many objects and threads.</p></div>
<div class="section">
<h4>Loose Coupling<a name="Loose_Coupling"></a></h4>
<p>Programming against interfaces or abstract classes is preferred over implementation classes in order to ease exchanging implementation classes.</p>
<p>For example, the abstract classes <a href="./apidocs/de/schlichtherle/truezip/fs/FsModel.html"><tt>FsModel</tt></a> and <a href="./apidocs/de/schlichtherle/truezip/fs/FsController.html"><tt>FsController</tt></a> participate in a variant of the MVC design pattern which is known as the Front Controller design pattern. The numerous implementation classes participate in the different file system driver modules in order to accommodate to the different contexts of non-federated and federated file system types and implement their specific behavior.</p></div>
<div class="section">
<h4>Open For Extension, Closed For Modification<a name="Open_For_Extension_Closed_For_Modification"></a></h4>
<p>Abstract classes are favored over interfaces wherever the future addition of more methods is anticipated in order to enable binary backwards compatibility.</p>
<p>Wherever reasonable, classes, methods and fields are declared (package) private and/or final in order to inhibit undesirable inheritance, enhance maintainability and/or enable true immutability.</p>
<p>For example, the abstract classes <tt>FsModel</tt> and <tt>FsController</tt> provide final implementations for <tt>Object.equals(Object)</tt>, <tt>Object.hashCode()</tt> and <tt>Object.toString()</tt> because there is exactly only one reasonable implementation for any implementation class.</p></div>
<div class="section">
<h4>Separation Of Concerns<a name="Separation_Of_Concerns"></a></h4>
<p>The design of interfaces and abstract classes aims for strong cohesion in order to ease implementation classes and enhance their extensibility and reusability. Where conflicts arise, the Law Of Demeter is sacrificed for strong cohesion.</p>
<p>The set of overridable public methods of abstract classes and interfaces is reduced as much as reasonable in order to ease implementation classes.</p>
<p>For example, the abstract class <a href="./apidocs/de/schlichtherle/truezip/fs/FsDriver.html"><tt>FsDriver</tt></a> consists of only one abstract method <a href="./apidocs/de/schlichtherle/truezip/fs/FsDriver.html#newControllerde.schlichtherle.fs.FsModelde.schlichtherle.fs.FsController"><tt>FsDriver.newController(FsModel, FsController)</tt></a> which needs to get implemented in any file system driver module. </p></div>
<div class="section">
<h4>Composition Over Inheritance<a name="Composition_Over_Inheritance"></a></h4>
<p>The declaration of classes or methods as final forces the use of composition rather than inheritance which in turn enables dependency resolution at run time and thus enhances the overall extensibility of the architecture.</p></div></div></div>
              </div>
    </div>
    <div class="clear"><hr/></div>
    <div id="footer">
      <div class="xright">
              Copyright &#169;                    2005-2013
                        <a href="http://schlichtherle.de">Schlichtherle IT Services</a>.
            All Rights Reserved.      
                                   <span id="publishDate">Last Published: 2013-09-28</span>
                        </div>
      <div class="clear"><hr/></div>
    </div>
  </body>
</html>
 
 
Close
loading
Please Confirm
Close