You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2004/02/17 12:06:16 UTC

cvs commit: avalon/repository/main maven.xml project.properties project.xml

mcconnell    2004/02/17 03:06:16

  Modified:    repository/cli maven.xml
               repository/cli/src/java/org/apache/avalon/repository/cli
                        Main.java Resources.properties
               repository/main maven.xml project.properties project.xml
  Log:
  Add support for an initial context factory that exposes the application root directory. This provides sufficent info for dealing with properties management with an IDE.
  
  Revision  Changes    Path
  1.2       +12 -0     avalon/repository/cli/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/avalon/repository/cli/maven.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- maven.xml	31 Jan 2004 13:29:50 -0000	1.1
  +++ maven.xml	17 Feb 2004 11:06:16 -0000	1.2
  @@ -13,4 +13,16 @@
       </j:forEach>
     </preGoal>
   
  +  <ant:property environment="env"/>
  +  <ant:property name="merlinEnvironment" value="${env.MERLIN_HOME}"/>
  +  <j:if test="${merlinEnvironment != ''}">
  +    <ant:property name="merlin.home" value="${merlinEnvironment}"/>
  +  </j:if>
  +  <ant:property name="merlin.home" value="${user.home}/.merlin"/>
  +
  +  <goal name="update" prereqs="jar:install">
  +    <copy file="${maven.build.dir}/${pom.artifactId}-${pom.currentVersion}.jar"
  +      toDir="${merlin.home}/system/${pom.groupId}/jars"/>
  +  </goal>
  +
   </project>
  
  
  
  1.3       +56 -21    avalon/repository/cli/src/java/org/apache/avalon/repository/cli/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/avalon/repository/cli/src/java/org/apache/avalon/repository/cli/Main.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Main.java	2 Feb 2004 00:41:23 -0000	1.2
  +++ Main.java	17 Feb 2004 11:06:16 -0000	1.3
  @@ -90,6 +90,10 @@
              "help",
              REZ.getString( "cli-help-description" ) );
   
  +        Option verify = new Option(
  +           "verify",
  +           REZ.getString( "cli-verify-description" ) );
  +
           Option version = new Option(
              "version",
              REZ.getString( "cli-version-description" ) );
  @@ -143,6 +147,7 @@
           options.addOption( home );
           options.addOption( cache );
           options.addOption( hosts );
  +        options.addOption( verify );
           return options;
       }
   
  @@ -174,22 +179,7 @@
               }
               else if( line.hasOption( "help" ) )
               {
  -                if( line.hasOption( "lang" ) )
  -                {
  -                    ResourceManager.clearResourceCache();
  -                    String language = line.getOptionValue( "lang" );
  -                    Locale locale = new Locale( language, "" );
  -                    Locale.setDefault( locale );
  -                    REZ = ResourceManager.getPackageResources( Main.class );
  -                }
  -
  -                HelpFormatter formatter = new HelpFormatter();
  -                formatter.printHelp( 
  -                  "repository [artifact]", 
  -                  " ", 
  -                  buildCommandLineOptions(), 
  -                  "", 
  -                  true );
  +                doHelp( line );
                   return;
               }
               else
  @@ -221,6 +211,26 @@
           }
       }
   
  +    private static void doHelp( CommandLine line )
  +    {
  +        if( line.hasOption( "lang" ) )
  +        {
  +            ResourceManager.clearResourceCache();
  +            String language = line.getOptionValue( "lang" );
  +            Locale locale = new Locale( language, "" );
  +            Locale.setDefault( locale );
  +            REZ = ResourceManager.getPackageResources( Main.class );
  +        }
  +
  +        HelpFormatter formatter = new HelpFormatter();
  +        formatter.printHelp( 
  +          "repository [artifact]", 
  +          " ", 
  +          buildCommandLineOptions(), 
  +          "", 
  +          true );
  +    }
  +
       //----------------------------------------------------------
       // constructor
       //----------------------------------------------------------
  @@ -228,7 +238,6 @@
      /**
       * Creation of a new kernel cli handler.
       * @param context the repository inital context
  -    * @param artifact the merlin implementation artifact
       * @param line the command line construct
       * @exception Exception if an error occurs
       */
  @@ -250,6 +259,14 @@
           {
               doInstall( context, line );
           }
  +        else if( line.hasOption( "verify" ) )
  +        {
  +            doVerify( context );
  +        }
  +        else
  +        {
  +            doHelp( line );
  +        }
       }
   
       private void prepareInfoListing( StringBuffer buffer, InitialContext context )
  @@ -285,6 +302,15 @@
           }
       }
   
  +    private void doVerify( InitialContext context ) 
  +      throws Exception
  +    {
  +        RepositoryVerifier verifier = 
  +          new RepositoryVerifier( context );
  +        verifier.verify();
  +    }
  +
  +
       //----------------------------------------------------------
       // implementation
       //----------------------------------------------------------
  @@ -430,20 +456,29 @@
       }
   
      /**
  -    * Return the merlin home directory path.
  +    * Return the installation directory path.
       * @return the merlin install directory path
       */
       private static String getAvalonHomePath()
       {
  +        return getHomePath( "AVALON_HOME", ".avalon" ); 
  +    }
  +
  +   /**
  +    * Return the merlin home directory path.
  +    * @return the merlin install directory path
  +    */
  +    private static String getHomePath( final String var, final String dir )
  +    {
           try
           {
               String avalon = 
                 System.getProperty( 
                   "avalon.home", 
  -                Env.getEnvVariable( "AVALON_HOME" ) );
  +                Env.getEnvVariable( var ) );
               if( null != avalon ) return avalon;
               return System.getProperty( "user.home" ) 
  -              + File.separator + ".avalon";
  +              + File.separator + dir;
           }
           catch( Throwable e )
           {
  
  
  
  1.2       +2 -0      avalon/repository/cli/src/java/org/apache/avalon/repository/cli/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/avalon/repository/cli/src/java/org/apache/avalon/repository/cli/Resources.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Resources.properties	31 Jan 2004 13:29:50 -0000	1.1
  +++ Resources.properties	17 Feb 2004 11:06:16 -0000	1.2
  @@ -26,3 +26,5 @@
   cli-hosts-description=A comma seperated sequence of host urls each referring to a remote repository.
   
   cli-install-description=Install a block archive into the local repository.
  +
  +cli-verify-description=Verifies the contents of the repository.
  
  
  
  1.6       +25 -25    avalon/repository/main/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/avalon/repository/main/maven.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- maven.xml	14 Dec 2003 17:01:46 -0000	1.5
  +++ maven.xml	17 Feb 2004 11:06:16 -0000	1.6
  @@ -1,41 +1,41 @@
   <project default="jar:install" xmlns:maven="jelly:maven" xmlns:j="jelly:core" xmlns:util="jelly:util" xmlns:ant="jelly:ant">
   
  -  <preGoal name="jar:jar">
  -    <j:forEach var="dep" items="${pom.dependencies}">
  -      <j:if test="${dep.getType()=='jar'}">
  -        <j:if test="${dep.getId() != 'avalon-repository:avalon-repository-impl'}">
  -          <unzip src="${pom.getDependencyPath( dep.getId() )}" 
  -            dest="${maven.build.dir}/classes">
  -            <patternset>
  -              <exclude name="META-INF/**"/>
  -              <exclude name="*.meta"/>
  -            </patternset>
  -          </unzip>
  -        </j:if>
  -      </j:if>
  -    </j:forEach>
  -  </preGoal>
  -
     <!--
  -  ###########################################################################
  -  # Create the avalon.implementation metadata.                              #
  -  # This contains the information used by the factory to identify the       #
  -  # the implementation artifact classpath, factory, and whatever else       #
  -  # we need to include this jar as the implementation strategy.             #
  -  ###########################################################################
  +  ==============================================================================
  +  Create the avalon.implementation metadata.                             
  +  This contains the information used by the factory to identify the      
  +  the implementation artifact classpath, factory, and whatever else      
  +  we need to include this jar as the implementation strategy.            
  +  ==============================================================================
     -->
   
     <postGoal name="java:compile">
   
  -    <j:set var="impl" value="${pom.getDependency('avalon-repository:avalon-repository-impl')}"/>
  -
  +    <j:set var="impl" 
  +      value="${pom.getDependency('avalon-repository:avalon-repository-impl')}"/>
       <ant:echo file="${maven.build.dir}/classes/avalon.properties">
   #===================================================================#
   # Default repository implementation artifact identifier.            #
   #===================================================================#
   
  -avalon.repository.implementation = ${impl.groupId}:${impl.artifactId};${impl.version}
  +avalon.repository.implementation = ${avalon.repository.implementation}
  +avalon.repository.hosts = ${avalon.repository.hosts}
  +
   </ant:echo>
     </postGoal>
  +
  +  <preGoal name="jar:jar">
  +    <j:forEach var="dep" items="${pom.dependencies}">
  +      <j:if test="${dep.getType()=='jar'}">
  +        <unzip src="${pom.getDependencyPath( dep.getId() )}" 
  +          dest="${maven.build.dir}/classes">
  +          <patternset>
  +            <exclude name="META-INF/**"/>
  +            <exclude name="*.meta"/>
  +          </patternset>
  +        </unzip>
  +      </j:if>
  +    </j:forEach>
  +  </preGoal>
   
   </project>
  
  
  
  1.3       +3 -0      avalon/repository/main/project.properties
  
  Index: project.properties
  ===================================================================
  RCS file: /home/cvs/avalon/repository/main/project.properties,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- project.properties	18 Dec 2003 01:10:14 -0000	1.2
  +++ project.properties	17 Feb 2004 11:06:16 -0000	1.3
  @@ -1 +1,4 @@
   
  +avalon.repository.implementation = artifact:avalon-repository/avalon-repository-impl#1.3-SNAPSHOT
  +avalon.repository.hosts = http://dpml.net,http://ibiblio.org/maven
  +
  
  
  
  1.6       +5 -5      avalon/repository/main/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon/repository/main/project.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- project.xml	24 Jan 2004 23:20:05 -0000	1.5
  +++ project.xml	17 Feb 2004 11:06:16 -0000	1.6
  @@ -27,11 +27,6 @@
       </dependency>
       <dependency>
         <groupId>avalon-repository</groupId>
  -      <artifactId>avalon-repository-impl</artifactId>
  -      <version>1.3-SNAPSHOT</version>
  -    </dependency>
  -    <dependency>
  -      <groupId>avalon-repository</groupId>
         <artifactId>avalon-repository-util</artifactId>
         <version>1.2</version>
       </dependency>
  @@ -49,6 +44,11 @@
         <groupId>avalon-util</groupId>
         <artifactId>avalon-util-criteria</artifactId>
         <version>1.1-SNAPSHOT</version>
  +    </dependency>
  +    <dependency>
  +      <groupId>avalon-util</groupId>
  +      <artifactId>avalon-util-defaults</artifactId>
  +      <version>1.2-SNAPSHOT</version>
       </dependency>
     </dependencies>
   
  
  
  

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