donaldp 02/05/15 06:00:57
Modified: src/java/org/apache/avalon/phoenix/components/deployer/installer
Installer.java Resources.properties
Log:
Remove Feature: Old .sar packaging format
Deprecated since: 2001/10/22
The .sar format previously allowed all blocks to be stored in
blocks/*.bar and libraries to be stored in lib/*.zip, lib/*.jar. This has been
changed so that all jars/libraries are stored in SAR-INF/lib/*.jar and also
allows class files in SAR-INF/classes. The configuration files have also
moved into SAR-INF/*.xml
Revision Changes Path
1.8 +2 -171
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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Installer.java 15 May 2002 12:48:59 -0000 1.7
+++ Installer.java 15 May 2002 13:00:57 -0000 1.8
@@ -24,7 +24,6 @@
import java.util.zip.ZipFile;
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
-import org.apache.avalon.excalibur.io.ExtensionFileFilter;
import org.apache.avalon.excalibur.io.FileUtil;
import org.apache.avalon.excalibur.io.IOUtil;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
@@ -34,7 +33,7 @@
* and installing it as appropriate.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
- * @version $Revision: 1.7 $ $Date: 2002/05/15 12:48:59 $
+ * @version $Revision: 1.8 $ $Date: 2002/05/15 13:00:57 $
*/
public class Installer
extends AbstractLogEnabled
@@ -42,13 +41,6 @@
private static final Resources REZ =
ResourceManager.getPackageResources( Installer.class );
- private static final String OLD_ASSEMBLY_XML = "conf" + File.separator +
"assembly.xml";
-
- private static final String OLD_CONFIG_XML = "conf" + File.separator +
"config.xml";
- private static final String OLD_SERVER_XML = "conf" + File.separator +
"server.xml";
- private static final String OLD_BLOCKS = "blocks";
- private static final String OLD_LIB = "lib";
-
private static final String META_INF = "META-INF";
private static final String SAR_INF = "SAR-INF";
private static final String LIB = "SAR-INF/lib";
@@ -176,18 +168,7 @@
//Get Zipfile representing .sar file
final ZipFile zipFile = new ZipFile( file );
- if( isDeprecated( zipFile ) )
- {
- final String message =
- REZ.getString( "deprecated-sar-format", url );
- System.err.println( message );
- getLogger().warn( message );
- return installDeprecated( url, file, zipFile );
- }
- else
- {
- return install( name, url, file, zipFile );
- }
+ return install( name, url, file, zipFile );
}
catch( final IOException ioe )
{
@@ -227,56 +208,6 @@
}
/**
- * Check if zipfile represents the deprecated sar format or
- * whether it conforms to new format of using "SAR-INF/".
- *
- * @param zipFile the zipfile
- * @return true if old format, else false
- */
- private boolean isDeprecated( final ZipFile zipFile )
- throws InstallationException
- {
- boolean oldStyle = false;
- boolean newStyle = false;
-
- final Enumeration entries = zipFile.entries();
- while( entries.hasMoreElements() )
- {
- final ZipEntry entry = (ZipEntry)entries.nextElement();
- final String name = fixName( entry.getName() );
-
- if( name.startsWith( OLD_BLOCKS ) ||
- name.startsWith( OLD_LIB ) ||
- name.equals( "conf/assembly.xml" ) ||
- name.equals( "conf/config.xml" ) ||
- name.equals( "conf/server.xml" ) )
- {
- oldStyle = true;
- }
-
- if( name.startsWith( SAR_INF ) )
- {
- newStyle = true;
- }
- }
-
- if( oldStyle && newStyle )
- {
- final String message = REZ.getString( "mixed-sar" );
- throw new InstallationException( message );
- }
- else if( !oldStyle && !newStyle )
- {
- final String message = REZ.getString( "invalid-sar" );
- throw new InstallationException( message );
- }
- else
- {
- return oldStyle;
- }
- }
-
- /**
* Utility method to lock repository to disallow other installers to
access it.
* Currently a no-op.
*/
@@ -556,58 +487,6 @@
}
/**
- * Create an Installation from a Sar in deprecated format.
- *
- * @param file the file designating the sar
- * @param zipFile the ZipFile object for sar
- * @return the Installaiton
- */
- private Installation installDeprecated( final URL url,
- final File file,
- final ZipFile zipFile )
- throws InstallationException
- {
- final ArrayList digests = new ArrayList();
- final File directory = getDestinationFor( file );
-
- final Enumeration entries = zipFile.entries();
- while( entries.hasMoreElements() )
- {
- final ZipEntry entry = (ZipEntry)entries.nextElement();
- if( entry.isDirectory() ) continue;
-
- final String name = fixName( entry.getName() );
-
- //Expand the file if not in META-INF directory
- if( !name.startsWith( META_INF ) )
- {
- final File destination = new File( directory, name );
- if( !destination.exists() )
- {
- expandFile( zipFile, entry, destination );
- calculateDigest( entry, destination, digests );
- }
- else
- {
- final String message = REZ.getString( "file-in-the-way",
url, name, directory );
- getLogger().warn( message );
- }
- }
- }
-
- final String[] classPath = getClassPathForDirectory( directory );
- final String config = getURLAsString( new File( directory,
OLD_CONFIG_XML ) );
- final String assembly = getURLAsString( new File( directory,
OLD_ASSEMBLY_XML ) );
- final String server = getURLAsString( new File( directory,
OLD_SERVER_XML ) );
- final FileDigest[] fileDigests = (FileDigest[])digests.toArray( new
FileDigest[ 0 ] );
- final long timestamp = System.currentTimeMillis();
-
- return new Installation( file, directory, directory,
- config, assembly, server,
- classPath, fileDigests, timestamp );
- }
-
- /**
* Get File object for URL.
* Currently it assumes that URL is a file URL but in the
* future it will allow downloading of remote URLs thus enabling
@@ -685,54 +564,6 @@
{
IOUtil.shutdownStream( input );
IOUtil.shutdownStream( output );
- }
- }
-
- /**
- * Get destination that .sar should be expanded to.
- *
- * @param file the file object representing .sar archive
- * @return the destination to expand archive
- */
- private File getDestinationFor( final File file )
- {
- final String base =
- FileUtil.removeExtension( FileUtil.removePath( file.getName() )
);
-
- return ( new File( m_baseDirectory, base ) ).getAbsoluteFile();
- }
-
- /**
- * Get Classpath for application.
- *
- * @return the list of URLs in ClassPath
- */
- private String[] getClassPathForDirectory( final File directory )
- {
- final File blockDir = new File( directory, "blocks" );
- final File libDir = new File( directory, "lib" );
-
- final ArrayList urls = new ArrayList();
- getURLsAsStrings( urls, blockDir, new String[]{".bar"} );
- getURLsAsStrings( urls, libDir, new String[]{".jar", ".zip"} );
- return (String[])urls.toArray( new String[ 0 ] );
- }
-
- /**
- * Add all matching files in directory to url list.
- *
- * @param urls the url list
- * @param directory the directory to scan
- * @param extensions the list of extensions to match
- */
- private void getURLsAsStrings( final ArrayList urls, final File
directory, final String[] extensions )
- {
- final ExtensionFileFilter filter = new ExtensionFileFilter(
extensions );
- final File[] files = directory.listFiles( filter );
- if( null == files ) return;
- for( int i = 0; i < files.length; i++ )
- {
- urls.add( getURLAsString( files[ i ] ) );
}
}
1.3 +0 -4
jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/installer/Resources.properties
Index: Resources.properties
===================================================================
RCS file:
/home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/installer/Resources.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Resources.properties 15 May 2002 12:48:59 -0000 1.2
+++ Resources.properties 15 May 2002 13:00:57 -0000 1.3
@@ -4,15 +4,11 @@
install-nourl=Could not find Sar at {0}.
uninstall-failure=Failed to cleanup directory {0}
require-sar=Current implementation requires that Server Applications be
stored in .sar files. Installation specified by {0} does not represent a .sar
file.
-deprecated-sar-format=Application {0} uses a deprecated packaging format.
file-in-the-way=The file {1} can not be extracted from the Sar "{0}" into
directory {2} because there is a file in the way.
bad-zip-file=Specified url {0} does not refer to a valid Sar (or Zip)
archive.
failed-to-expand=Failed to expand entry named "{0}" to file {1}. (Reason:
{2})
-mixed-sar=Sar file contains elements of new style deployment format (with
SAR-INF/) and old style deployment format. This is invalid. Only one style is
supported at a time.
-invalid-sar=Sar does not contain elements required to construct a valid
application (such as configuration data and code archives).
skip-removal=Skip removal for modified file {0}.
checksum-failure=Failed to compute checksum for {0} file.
-deprecated-environment-xml=The .sar at "{0}" uses a deprecated format to
refer to environment information. Environment information should not be stored
in "SAR-INF/server.xml" but in "SAR-INF/environment.xml".
nodelete-workdir.error=Error deleting Work Directory "{0}". (Reason: {1})
install.sar-isa-dir.error=While attempting to install aplication named "{0}"
via URL {1}. The URL resolved to a directory.
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>