You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2002/09/15 04:38:25 UTC
cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/installer Installation.java Installer.java FileDigest.java
donaldp 2002/09/14 19:38:25
Modified: src/java/org/apache/avalon/phoenix/components/deployer/installer
Installation.java Installer.java
Removed: src/java/org/apache/avalon/phoenix/components/deployer/installer
FileDigest.java
Log:
iRemove the notion of FileDigests as they were never really integrated properly.
Revision Changes Path
1.3 +1 -15 jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/installer/Installation.java
Index: Installation.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/installer/Installation.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Installation.java 6 Aug 2002 11:57:40 -0000 1.2
+++ Installation.java 15 Sep 2002 02:38:25 -0000 1.3
@@ -41,9 +41,6 @@
///ClassPath for application
private final String[] m_classPath;
- ///Info for expanded files
- private final FileDigest[] m_digests;
-
///Installation timestamp
private final long m_timestamp;
@@ -54,7 +51,6 @@
final String assembly,
final String environment,
final String[] classPath,
- final FileDigest[] digests,
final long timestamp )
{
m_source = source;
@@ -64,7 +60,6 @@
m_assembly = assembly;
m_environment = environment;
m_classPath = classPath;
- m_digests = digests;
m_timestamp = timestamp;
}
@@ -138,15 +133,6 @@
public String[] getClassPath()
{
return m_classPath;
- }
-
- /** Retrieve file digests.
- *
- * @return the file digest list.
- */
- public FileDigest[] getFileDigests()
- {
- return m_digests;
}
/** Retrieve the timestamp.
1.14 +4 -93 jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/installer/Installer.java
Index: Installer.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/installer/Installer.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- Installer.java 6 Aug 2002 11:57:40 -0000 1.13
+++ Installer.java 15 Sep 2002 02:38:25 -0000 1.14
@@ -8,7 +8,6 @@
package org.apache.avalon.phoenix.components.deployer.installer;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -17,9 +16,6 @@
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
-import java.util.zip.CRC32;
-import java.util.zip.CheckedInputStream;
-import java.util.zip.Checksum;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import org.apache.avalon.excalibur.i18n.ResourceManager;
@@ -98,43 +94,6 @@
public void uninstall( final Installation installation )
throws InstallationException
{
- final FileDigest[] infos = installation.getFileDigests();
- final Checksum checksum = new CRC32();
-
- if( infos != null )
- {
- for( int i = 0; i < infos.length; i++ )
- {
- final File file = infos[ i ].getFile();
- final File parent = file.getParentFile();
-
- final String message = REZ.getString( "skip-removal", file );
-
- if( file.exists() )
- {
- if( file.lastModified() <= installation.getTimestamp() )
- {
- getLogger().debug( message );
- continue;
- }
-
- checksum( file, checksum );
-
- if( checksum.getValue() != infos[ i ].getChecksum() )
- {
- getLogger().debug( message );
- continue;
- }
-
- file.delete();
- if( 0 == parent.list().length )
- {
- parent.delete();
- }
- }
- }
- }
-
deleteWorkDir( installation.getWorkDirectory() );
}
@@ -208,32 +167,6 @@
}
/**
- * Utility method to compute the checksum for a given file.
- * @param file the computed file.
- * @param checksum the checksum algorithm.
- */
- private void checksum( final File file, final Checksum checksum )
- {
- checksum.reset();
-
- InputStream input = null;
- try
- {
- input = new CheckedInputStream( new FileInputStream( file ), checksum );
- IOUtil.toByteArray( input );
- }
- catch( final IOException ioe )
- {
- final String message = REZ.getString( "checksum-failure", file );
- getLogger().warn( message );
- }
- finally
- {
- IOUtil.shutdownStream( input );
- }
- }
-
- /**
* Utility method to lock repository to disallow other installers to access it.
* Currently a no-op.
*/
@@ -270,7 +203,6 @@
//this directory is created?
directory.mkdirs();
- final ArrayList digests = new ArrayList();
final ArrayList jars = new ArrayList();
final File workDir =
@@ -278,7 +210,7 @@
boolean success = false;
try
{
- expandZipFile( zipFile, directory, workDir, jars, digests, url );
+ expandZipFile( zipFile, directory, workDir, jars, url );
//Retrieve name of environment file
//need to check existence to support backwards compatability
@@ -291,13 +223,12 @@
final String assembly = getURLAsString( new File( directory, FS_ASSEMBLY_XML ) );
final String config = getURLAsString( new File( directory, FS_CONFIG_XML ) );
final String environment = getURLAsString( envFile );
- final FileDigest[] fileDigests = (FileDigest[])digests.toArray( new FileDigest[ 0 ] );
final long timestamp = System.currentTimeMillis();
success = true;
return new Installation( file, directory, workDir,
config, assembly, environment,
- classPath, fileDigests, timestamp );
+ classPath, timestamp );
}
finally
{
@@ -316,7 +247,6 @@
* non-classes files
* @param workDir the directory to extract classes/jar files
* @param classpath the list to add classpath entries to
- * @param digests the list to add file digests to
* @param url the url of deployment (for error reporting purposes)
* @throws InstallationException if an error occurs extracting files
*/
@@ -324,7 +254,6 @@
final File directory,
final File workDir,
final ArrayList classpath,
- final ArrayList digests,
final URL url )
throws InstallationException
{
@@ -361,7 +290,7 @@
//Expand the file if necesasry and issue a warning
//if there is a file in the way
final File destination = new File( directory, name );
- handleFile( zipFile, entry, destination, digests, url );
+ handleFile( zipFile, entry, destination, url );
}
}
@@ -372,14 +301,12 @@
private void handleFile( final ZipFile zipFile,
final ZipEntry entry,
final File destination,
- final ArrayList digests,
final URL url )
throws InstallationException
{
if( !destination.exists() )
{
expandFile( zipFile, entry, destination );
- calculateDigest( entry, destination, digests );
}
else
{
@@ -552,22 +479,6 @@
}
return file;
- }
-
- /**
- * Calculate digest for specific entry.
- *
- * @param entry the entry
- * @param file the extracted file
- * @param digests the list of digests already
- * calculated
- */
- private void calculateDigest( final ZipEntry entry,
- final File file,
- final ArrayList digests )
- {
- final long checksum = entry.getCrc();
- digests.add( new FileDigest( file, checksum ) );
}
/**
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>