Skip to main content

Source code file content

Revision: 162

Added tag truezip-7.7.3 for changeset aa266d47404e
» Project Revision History

» Checkout URL

web / migration.html

Size: 18876 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 - Migrating TrueZIP 6 Applications to TrueZIP 7</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="20130719"/>
    <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.3</span>
                  |                         <a href="index.html" title="TrueZIP">TrueZIP</a>
      &raquo;
        Migrating TrueZIP 6 Applications to TrueZIP 7
              </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">
                          <a href="concepts.html" title="Basic Concepts">Basic Concepts</a>
            </li>
                  <li class="none">
                          <a href="glossary.html" title="Glossary">Glossary</a>
            </li>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  <li class="expanded">
                          <a href="6/index.html" title="TrueZIP 6 (Obsolete)">TrueZIP 6 (Obsolete)</a>
                    <ul>
                      <li class="none">
            <strong>Migration</strong>
          </li>
                      <li class="none">
                          <a href="6/tutorial.html" title="Tutorial">Tutorial</a>
            </li>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                  <li class="collapsed">
                          <a href="6/news/index.html" title="News Archive">News Archive</a>
                  </li>
                                                                                                                                                                                                                                                            <li class="collapsed">
                          <a href="6/relnotes/index.html" title="Release Notes Archive">Release Notes Archive</a>
                  </li>
              </ul>
        </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>Migrating TrueZIP 6 Applications to TrueZIP 7<a name="Migrating_TrueZIP_6_Applications_to_TrueZIP_7"></a></h2>
<p>This guide outlines the required steps to migrate a TrueZIP 6 application to TrueZIP 7. This guide is <i>not</i> complete - additional steps may or may not be required by you!</p>
<div class="section">
<h3>Backup Project<a name="Backup_Project"></a></h3>
<p>First, <b>make a backup of your project files</b> or check them into your SCM system: Chances are that you'll screw up your project - you've been warned!</p></div>
<div class="section">
<h3>Initiate Sources<a name="Initiate_Sources"></a></h3>
<p>As the primary option - if you haven't done so already - <a href="./kick-start/file/shell.html">initiate a Maven project</a> and integrate your sources into its directory tree or - as a secondary option - <a class="externalLink" href="http://truezip.schlichtherle.de/2011/05/13/no-maven/">download the all-in-one JAR-with-dependencies</a> for the module TrueZIP Samples and put it wherever your build script expects it.</p></div>
<div class="section">
<h3>Setup Class Path<a name="Setup_Class_Path"></a></h3>
<p>While TrueZIP 6 consists of a single monolithic module, TrueZIP 7 is a multi-module project in order to reduce application dependencies and enable them to apply the convention-over-configuration paradigm for the initial set up of the detectable archive file types.</p></div>
<div class="section">
<h3>Search And Replace<a name="Search_And_Replace"></a></h3>
<p>Next, you'll have to do a couple of search-and-replace operations on all Java files of your project in order to substitute the phrases in the following tables in order. When searching, do it case sensitive, but do <i>not</i> limit it to whole words and do <i>not</i> use regular expressions!</p>
<div class="section">
<h4>Package Names<a name="Package_Names"></a></h4>
<p>Perform the following search-and-replace operations according to the guidelines explained above.</p>
<table border="1" class="bodyTable">
<tr class="a">
<th align="center">#</th>
<th align="center">Search</th>
<th align="center">Replace</th></tr>
<tr class="b">
<td align="left">1.</td>
<td align="left"><tt>de.schlichtherle.io</tt></td>
<td align="left"><tt>de.schlichtherle.truezip.file</tt></td></tr>
<tr class="a">
<td align="left">2.</td>
<td align="left"><tt>de.schlichtherle.util.zip</tt></td>
<td align="left"><tt>de.schlichtherle.truezip.zip</tt></td></tr></table>
<p>Do not yet fix compilation errors.</p></div>
<div class="section">
<h4>Class Names<a name="Class_Names"></a></h4>
<p>Perform the following search-and-replace operations according to the guidelines explained above.</p>
<table border="1" class="bodyTable">
<tr class="a">
<th align="center">#</th>
<th align="center">Search</th>
<th align="center">Replace</th></tr>
<tr class="b">
<td align="left">1.</td>
<td align="left"><tt>DefaultArchiveDetector</tt></td>
<td align="left"><tt>TArchiveDetector</tt></td></tr>
<tr class="a">
<td align="left">2.</td>
<td align="left"><tt>ArchiveDetector</tt></td>
<td align="left"><tt>TArchiveDetector</tt></td></tr>
<tr class="b">
<td align="left">3.</td>
<td align="left"><tt>File</tt></td>
<td align="left"><tt>TFile</tt></td></tr>
<tr class="a">
<td align="left">4.</td>
<td align="left"><tt>ArchiveWarningException</tt></td>
<td align="left"><tt>FsSyncWarningException</tt></td></tr>
<tr class="b">
<td align="left">5.</td>
<td align="left"><tt>ArchiveException</tt></td>
<td align="left"><tt>FsSyncException</tt></td></tr></table>
<p>Do not yet fix compilation errors.</p>
<p>The substitution of <tt>File</tt> with <tt>TFile</tt> will intentionally pick up all uses of <tt>(java.io.)?File*</tt>, e.g. <tt>FileWriter</tt> or <tt>java.io.FileInputStream</tt>. This should be OK - let it happen for now. Once you've configured the archive detection as described <a href="#Archive_Detection">below</a>, your application should be fine with this.</p></div>
<div class="section">
<h4>Method Names<a name="Method_Names"></a></h4>
<p>Perform the following search-and-replace operations according to the guidelines explained above.</p>
<table border="1" class="bodyTable">
<tr class="a">
<th align="center">#</th>
<th align="center">Search</th>
<th align="center">Replace</th></tr>
<tr class="b">
<td align="left">1.</td>
<td align="left"><tt>archiveCopyAll</tt></td>
<td align="left"><tt>cp_rp</tt></td></tr>
<tr class="a">
<td align="left">2.</td>
<td align="left"><tt>archiveCopy</tt></td>
<td align="left"><tt>cp_p</tt></td></tr>
<tr class="b">
<td align="left">3.</td>
<td align="left"><tt>copyAll</tt></td>
<td align="left"><tt>cp_r</tt></td></tr>
<tr class="a">
<td align="left">4.</td>
<td align="left"><tt>copy</tt></td>
<td align="left"><tt>cp</tt></td></tr>
<tr class="b">
<td align="left">5.</td>
<td align="left"><tt>catFrom</tt></td>
<td align="left"><tt>input</tt></td></tr>
<tr class="a">
<td align="left">6.</td>
<td align="left"><tt>catTo</tt></td>
<td align="left"><tt>output</tt></td></tr>
<tr class="b">
<td align="left">7.</td>
<td align="left"><tt>renameTo</tt></td>
<td align="left"><tt>mv</tt></td></tr>
<tr class="a">
<td align="left">8.</td>
<td align="left"><tt>deleteAll</tt></td>
<td align="left"><tt>rm_r</tt></td></tr>
<tr class="b">
<td align="left">9.</td>
<td align="left"><tt>delete</tt></td>
<td align="left"><tt>rm</tt></td></tr></table>
<p>Note that replacing <tt>renameTo</tt> and <tt>delete</tt> is just optional, but beneficial - see next.</p></div></div>
<div class="section">
<h3>Fix Compilation Errors<a name="Fix_Compilation_Errors"></a></h3>
<p>Now fix compilation errors.</p>
<p>Mind that the signature of the bulk I/O methods has changed: In TrueZIP 6, bulk I/O methods like <tt>archiveCopyAll</tt> etc. return a boolean value to indicate success or failure. In TrueZIP 7, their substitutes throw an <tt>IOException</tt> on failure instead and return <tt>void</tt> or <tt>this</tt> in order to enable a fluent coding style.</p>
<p>The exception class hierarchy has been significantly changed, too. There is no one-to-one mapping for this, so your best option is to catch or declare to throw only <tt>IOException</tt> objects.</p>
<p>In case your application is using RAES encrypted ZIP files (alias ZIP.RAES alias TZP) and programmatically sets authentication passwords, you need to migrate the key management part of your application, too. In the documentation of the module TrueZIP Samples, there's an article about <a href="./truezip-driver/truezip-driver-tzp/key-management.html">key management</a> which demonstrates this.</p>
<div class="section">
<h4>Optional: Configure <a name="Archive_Detection">Archive Detection</a><a name="Optional:_Configure_Archive_Detection"></a></h4>
<p>Once you've set up your run time class path correctly, it should not be necessary to configure archive detection because TrueZIP 7 supports the convention-over-configuration paradigm.</p>
<p>One notable exception is if you need to detect custom archive file formats. There's a use case article for <a href="./usecases/aff.html">application file formats</a> which demonstrates this. As you can see in this article, you simply need to pass the <a href="./apidocs/de/schlichtherle/truezip/socket/sl/IOPoolLocator.html#SINGLETON"><tt>IOPoolLocator.SINGLETON</tt></a> to the archive driver constructors now in order to obtain their usual behaviour.</p></div></div>
<div class="section">
<h3>Build Project<a name="Build_Project"></a></h3>
<p>Now cross fingers and build your project. If it compiles, chances are that it will work straight away because the semantics of the classes and methods of the TrueZIP File* API haven't really changed between TrueZIP 6 and 7: After all, a recursive archive copy operation (once <tt>archiveCopyAll</tt>) is still a recursive archive copy operation (now <tt>cp_rp</tt>).</p></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-07-19</span>
                        </div>
      <div class="clear"><hr/></div>
    </div>
  </body>
</html>
 
 
Close
loading
Please Confirm
Close