donaldp 01/11/10 12:39:43 Modified: src/java/org/apache/avalon/phoenix/tools/installer Installation.java Installer.java Resources.properties src/java/org/apache/avalon/phoenix/components/deployer DefaultDeployer.java PersistentDeploymentRecorder.java Log: Update to use SAR-INF/environment.xml rather than SAR-INF/server.xml if SAR-INF/environment.xml is present in .sar. If environment.xml does not exist then a warning is issued and server.xml is used. Revision Changes Path 1.7 +7 -7 jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/installer/Installation.java Index: Installation.java =================================================================== RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/installer/Installation.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- Installation.java 2001/11/02 02:16:07 1.6 +++ Installation.java 2001/11/10 20:39:42 1.7 @@ -32,7 +32,7 @@ private final String m_assembly; ///URL to application configuration data - private final String m_server; + private final String m_environment; ///ClassPath for application private final String[] m_classPath; @@ -47,7 +47,7 @@ final File directory, final String config, final String assembly, - final String server, + final String environment, final String[] classPath, final FileDigest[] digests, final long timestamp ) @@ -56,7 +56,7 @@ m_directory = directory; m_config = config; m_assembly = assembly; - m_server = server; + m_environment = environment; m_classPath = classPath; m_digests = digests; m_timestamp = timestamp; @@ -104,13 +104,13 @@ } /** - * Retrieve location of applications server.xml file. + * Retrieve location of applications environment.xml file. * - * @return url to server.xml file + * @return url to environment.xml file */ - public String getServer() + public String getEnvironment() { - return m_server; + return m_environment; } /** 1.19 +17 -2 jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/installer/Installer.java Index: Installer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/installer/Installer.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- Installer.java 2001/11/09 21:14:31 1.18 +++ Installer.java 2001/11/10 20:39:42 1.19 @@ -56,10 +56,12 @@ private static final String ASSEMBLY_XML = "SAR-INF/assembly.xml"; private static final String CONFIG_XML = "SAR-INF/config.xml"; private static final String SERVER_XML = "SAR-INF/server.xml"; + private static final String ENV_XML = "SAR-INF/environment.xml"; //The names on the native filesystem private static final String FS_CONFIG_XML = "SAR-INF" + File.separator + "config.xml"; private static final String FS_SERVER_XML = "SAR-INF" + File.separator + "server.xml"; + private static final String FS_ENV_XML = "SAR-INF" + File.separator + "environment.xml"; /** * Uninstall the Sar designated installation. @@ -286,6 +288,7 @@ //as a special case atm. if( name.startsWith( SAR_INF ) && !name.equals( SERVER_XML ) && + !name.equals( ENV_XML ) && !name.equals( CONFIG_XML ) ) { expand = false; @@ -331,16 +334,28 @@ } } + //Retrieve name of environment file + //need to check existence to support backwards compatability + File envFile = new File( directory, FS_ENV_XML ); + if( !envFile.exists() ) + { + final String message = REZ.getString( "deprecated-environment-xml", url ); + System.err.println( message ); + getLogger().warn( message ); + envFile = new File( directory, FS_SERVER_XML ); + } + //Prepare and create Installation final String[] classPath = (String[])jars.toArray( new String[ 0 ] ); final String assembly = "jar:" + getURLAsString( file ) + "!/" + ASSEMBLY_XML; final String config = getURLAsString( new File( directory, FS_CONFIG_XML ) ); - final String server = getURLAsString( new File( directory, FS_SERVER_XML ) ); + final String environment = getURLAsString( envFile ); final FileDigest[] fileDigests = (FileDigest[])digests.toArray( new FileDigest[0] ); final long timestamp = System.currentTimeMillis(); - return new Installation( file, directory, config, assembly, server, classPath, fileDigests, timestamp ); + return new Installation( file, directory, config, assembly, environment, + classPath, fileDigests, timestamp ); } /** 1.8 +1 -0 jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/installer/Resources.properties Index: Resources.properties =================================================================== RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/installer/Resources.properties,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Resources.properties 2001/10/23 23:13:25 1.7 +++ Resources.properties 2001/11/10 20:39:42 1.8 @@ -12,3 +12,4 @@ 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". \ No newline at end of file 1.12 +1 -1 jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/DefaultDeployer.java Index: DefaultDeployer.java =================================================================== RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/DefaultDeployer.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- DefaultDeployer.java 2001/11/09 21:14:30 1.11 +++ DefaultDeployer.java 2001/11/10 20:39:43 1.12 @@ -142,7 +142,7 @@ } final Configuration config = getConfigurationFor( installation.getConfig() ); - final Configuration server = getConfigurationFor( installation.getServer() ); + final Configuration server = getConfigurationFor( installation.getEnvironment() ); final Configuration assembly = getConfigurationFor( installation.getAssembly() ); final File directory = installation.getDirectory(); 1.3 +5 -4 jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/PersistentDeploymentRecorder.java Index: PersistentDeploymentRecorder.java =================================================================== RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer/PersistentDeploymentRecorder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- PersistentDeploymentRecorder.java 2001/11/09 21:14:30 1.2 +++ PersistentDeploymentRecorder.java 2001/11/10 20:39:43 1.3 @@ -40,7 +40,7 @@ private final static String DIRECTORY = "directory"; private final static String CONFIG = "config"; private final static String ASSEMBLY = "assembly"; - private final static String SERVER = "server"; + private final static String ENVIRONMENT = "environment"; private final static String CLASSPATH = "classpath"; private final static String PATH = "path"; private final static String URL = "url"; @@ -72,7 +72,7 @@ configuration.setAttribute( DIRECTORY, installation.getDirectory().getCanonicalPath() ); configuration.setAttribute( CONFIG, installation.getConfig() ); configuration.setAttribute( ASSEMBLY, installation.getAssembly() ); - configuration.setAttribute( SERVER, installation.getServer() ); + configuration.setAttribute( ENVIRONMENT, installation.getEnvironment() ); configuration.setAttribute( TIMESTAMP, Long.toString( installation.getTimestamp() ) ); final DefaultConfiguration classpath = new DefaultConfiguration( CLASSPATH, null ); @@ -130,7 +130,7 @@ final File directory = new File( configuration.getAttribute( DIRECTORY ) ); final String config = configuration.getAttribute( CONFIG ); final String assembly = configuration.getAttribute( ASSEMBLY ); - final String server = configuration.getAttribute( SERVER ); + final String environment = configuration.getAttribute( ENVIRONMENT ); final long timestamp = configuration.getAttributeAsLong( TIMESTAMP ); final Configuration[] paths = configuration.getChild( CLASSPATH, true).getChildren( PATH ); @@ -153,7 +153,8 @@ REZ.getString( "recorder.notice.rebuild.successful", name, file ); getLogger().debug( message ); - return new Installation( source, directory, config, assembly, server, classPath, fileDigests, timestamp ); + return new Installation( source, directory, config, assembly, environment, + classPath, fileDigests, timestamp ); } catch ( Exception e ) {
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>