avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/deployer DefaultDeployer.java
Date Wed, 15 May 2002 09:34:36 GMT
donaldp     02/05/15 02:34:36

  Modified:    src/java/org/apache/avalon/phoenix/frontends CLISetup.java
               src/java/org/apache/avalon/phoenix/components/embeddor
                        DefaultEmbeddor.java
               src/java/org/apache/avalon/phoenix/components/deployer/installer
                        Installer.java
               src/java/org/apache/avalon/phoenix/components/deployer
                        DefaultDeployer.java
  Log:
  Refactor deployment properties to make it easier to move to deploying based on name rather
than by name of file containing application.
  
  Revision  Changes    Path
  1.15      +1 -1      jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/frontends/CLISetup.java
  
  Index: CLISetup.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/frontends/CLISetup.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- CLISetup.java	27 Mar 2002 11:19:40 -0000	1.14
  +++ CLISetup.java	15 May 2002 09:34:36 -0000	1.15
  @@ -169,7 +169,7 @@
                       break;
   
                   case APPS_PATH_OPT:
  -                    m_parameters.setParameter( "applications-directory", option.getArgument()
);
  +                    m_parameters.setParameter( "phoenix.apps.dir", option.getArgument()
);
                       break;
   
                   case REMOTE_MANAGER_OPT:
  
  
  
  1.63      +20 -5     jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/embeddor/DefaultEmbeddor.java
  
  Index: DefaultEmbeddor.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/embeddor/DefaultEmbeddor.java,v
  retrieving revision 1.62
  retrieving revision 1.63
  diff -u -r1.62 -r1.63
  --- DefaultEmbeddor.java	11 May 2002 06:35:26 -0000	1.62
  +++ DefaultEmbeddor.java	15 May 2002 09:34:36 -0000	1.63
  @@ -91,6 +91,11 @@
       private long m_startTime;
   
       /**
  +     * The default directory in which applications are deployed from.
  +     */
  +    private String m_appDir;
  +
  +    /**
        * Pass the Context to the embeddor.
        * It is expected that the following will be entrys in context;
        * <ul>
  @@ -158,6 +163,8 @@
           m_parameters = parameters;
           m_phoenixHome = m_parameters.getParameter( "phoenix.home", ".." );
           m_persistent = m_parameters.getParameterAsBoolean( "persistent", false );
  +        m_appDir = m_parameters.getParameter( "phoenix.apps.dir",
  +                                               m_phoenixHome + DEFAULT_APPS_PATH );
       }
   
       public void configure( final Configuration configuration )
  @@ -433,16 +440,16 @@
           throws Exception
       {
           //Name of optional application specified on CLI
  -        final String application = m_parameters.getParameter( "application-location", null
);
  +        final String application =
  +            m_parameters.getParameter( "application-location", null );
           if( null != application )
           {
               final File file = new File( application );
               deployFile( file );
           }
  -        final String defaultAppsLocation = m_parameters.getParameter( "applications-directory",
m_phoenixHome + DEFAULT_APPS_PATH );
  -        if( null != defaultAppsLocation )
  +        if( null != m_appDir )
           {
  -            final File directory = new File( defaultAppsLocation );
  +            final File directory = new File( m_appDir );
               final ExtensionFileFilter filter = new ExtensionFileFilter( ".sar" );
               final File[] files = directory.listFiles( filter );
               if( null != files )
  @@ -507,10 +514,18 @@
           ContainerUtil.logEnable( object, childLogger );
           ContainerUtil.contextualize( object, m_context );
           ContainerUtil.service( object, getServiceManager() );
  -        ContainerUtil.parameterize( object, m_parameters );
  +        ContainerUtil.parameterize( object, createChildParameters() );
           ContainerUtil.configure( object, config );
           ContainerUtil.initialize( object );
           ContainerUtil.start( object );
  +    }
  +
  +    private Parameters createChildParameters()
  +    {
  +        final Parameters parameters = new Parameters();
  +        parameters.merge( m_parameters );
  +        parameters.setParameter( "phoenix.apps.dir", m_appDir );
  +        return parameters;
       }
   
       private void shutdownComponents()
  
  
  
  1.3       +35 -7     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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Installer.java	13 May 2002 21:09:31 -0000	1.2
  +++ Installer.java	15 May 2002 09:34:36 -0000	1.3
  @@ -34,7 +34,7 @@
    * and installing it as appropriate.
    *
    * @author <a href="mailto:peter@apache.org">Peter Donald</a>
  - * @version $Revision: 1.2 $ $Date: 2002/05/13 21:09:31 $
  + * @version $Revision: 1.3 $ $Date: 2002/05/15 09:34:36 $
    */
   public class Installer
       extends AbstractLogEnabled
  @@ -63,13 +63,42 @@
           "SAR-INF" + File.separator + "classes" + File.separator;
   
       /**
  +     * Base directory in which to install extracted application.
  +     */
  +    private File m_baseDirectory;
  +
  +    /**
  +     * Base directory in which to install temporary/work files.
  +     */
  +    private File m_baseWorkDirectory;
  +
  +    /**
  +     * Set the baseDirectory in which to install applications.
  +     *
  +     * @param baseDirectory the baseDirectory in which to install applications.
  +     */
  +    public void setBaseDirectory( File baseDirectory )
  +    {
  +        m_baseDirectory = baseDirectory;
  +    }
  +
  +    /**
  +     * Set the baseDirectory in which to install applications temporary Data.
  +     *
  +     * @param baseWorkDirectory the baseDirectory in which to install applications temporary
Data.
  +     */
  +    public void setBaseWorkDirectory( File baseWorkDirectory )
  +    {
  +        m_baseWorkDirectory = baseWorkDirectory;
  +    }
  +
  +    /**
        * Uninstall the Sar designated installation.
        *
        * @param installation the installation
        * @throws InstallationException if an error occurs
        */
  -    public void uninstall( final Installation installation,
  -                           final File workDir )
  +    public void uninstall( final Installation installation )
           throws InstallationException
       {
           final FileDigest[] infos = installation.getFileDigests();
  @@ -129,8 +158,7 @@
        * @param url the url of instalation
        * @throws InstallationException if an error occurs
        */
  -    public Installation install( final URL url,
  -                                 final File workDir )
  +    public Installation install( final URL url )
           throws InstallationException
       {
           lock();
  @@ -161,7 +189,7 @@
               }
               else
               {
  -                return install( url, file, zipFile, workDir );
  +                return install( url, file, zipFile, m_baseWorkDirectory );
               }
           }
           catch( final IOException ioe )
  @@ -703,7 +731,7 @@
           final String base =
               FileUtil.removeExtension( FileUtil.removePath( file.getName() ) );
   
  -        return ( new File( file.getParentFile(), base ) ).getAbsoluteFile();
  +        return ( new File( m_baseDirectory, base ) ).getAbsoluteFile();
       }
   
       /**
  
  
  
  1.29      +25 -5     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.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- DefaultDeployer.java	13 May 2002 21:29:28 -0000	1.28
  +++ DefaultDeployer.java	15 May 2002 09:34:36 -0000	1.29
  @@ -77,6 +77,11 @@
       private File m_baseWorkDirectory;
   
       /**
  +     * The base directory in which applications are deployed.
  +     */
  +    private File m_baseDirectory;
  +
  +    /**
        * Retrieve parameter that specifies work directory.
        *
        * @param parameters the parameters to read
  @@ -87,17 +92,30 @@
       {
           final String phoenixHome = parameters.getParameter( "phoenix.home" );
           final String defaultWorkDir = phoenixHome + File.separator + "work";
  +        final String defaultAppsDir = phoenixHome + File.separator + "apps";
           final String rawWorkDir =
               parameters.getParameter( "phoenix.work.dir", defaultWorkDir );
  +        final String rawAppsDir =
  +            parameters.getParameter( "phoenix.apps.dir", defaultAppsDir );
  +
  +        final File workDir = new File( rawWorkDir );
  +        try
  +        {
  +            m_baseWorkDirectory = workDir.getCanonicalFile();
  +        }
  +        catch( final IOException ioe )
  +        {
  +            m_baseWorkDirectory = workDir.getAbsoluteFile();
  +        }
   
  -        final File dir = new File( rawWorkDir );
  +        final File appsDir = new File( rawAppsDir );
           try
           {
  -            m_baseWorkDirectory = dir.getCanonicalFile();
  +            m_baseDirectory = appsDir.getCanonicalFile();
           }
           catch( final IOException ioe )
           {
  -            m_baseWorkDirectory = dir.getAbsoluteFile();
  +            m_baseDirectory = appsDir.getAbsoluteFile();
           }
       }
   
  @@ -124,6 +142,8 @@
           setupLogger( m_installer );
           setupLogger( m_assembler );
           setupLogger( m_verifier );
  +        m_installer.setBaseDirectory( m_baseDirectory );
  +        m_installer.setBaseWorkDirectory( m_baseWorkDirectory );
       }
   
       /**
  @@ -183,7 +203,7 @@
                   m_repository.storeConfiguration( name, blocks[ i ], null );
               }
   
  -            m_installer.uninstall( installation, m_baseWorkDirectory );
  +            m_installer.uninstall( installation );
           }
           catch( final Exception e )
           {
  @@ -232,7 +252,7 @@
           {
               //m_baseWorkDirectory
               final Installation installation =
  -                m_installer.install( location, m_baseWorkDirectory );
  +                m_installer.install( location );
   
               final Configuration config = getConfigurationFor( installation.getConfig()
);
               final Configuration environment = getConfigurationFor( installation.getEnvironment()
);
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message