avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon/repository/cli .cvsignore maven.xml project.properties project.xml
Date Sat, 31 Jan 2004 13:29:50 GMT
mcconnell    2004/01/31 05:29:50

  Modified:    repository .cvsignore LICENSE.txt README.TXT maven.xml
                        project.xml
               repository/main/src/java/org/apache/avalon/repository/main
                        AbstractBuilder.java DefaultBuilder.java
                        DefaultInitialContext.java
               repository/spi/src/java/org/apache/avalon/repository/provider
                        Builder.java InitialContext.java
  Added:       repository/cli .cvsignore maven.xml project.properties
                        project.xml
  Log:
  Update build procedure to include:
    1. consitent deliverable naming convention
    2. automation of MD5 and ASC file creation for jar and distribution artifacts
  System changes encompassing:
    1. updates to the InitialContext and Builder interface and implementation to support target
class retrival and bar exansion
    2. addition of a commandline interface supporting bar file retrival
    3. implementation of bar expansion via the InitialContext
  Admin updates include ASL 2.0 in main license file
  
  Revision  Changes    Path
  1.2       +2 -1      avalon/repository/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  RCS file: /home/cvs/avalon/repository/.cvsignore,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- .cvsignore	4 Dec 2003 22:02:38 -0000	1.1
  +++ .cvsignore	31 Jan 2004 13:29:49 -0000	1.2
  @@ -3,4 +3,5 @@
   target
   .classpath
   .project
  -build.xml
  \ No newline at end of file
  +build.xml
  +build.properties
  \ No newline at end of file
  
  
  
  1.3       +176 -16   avalon/repository/LICENSE.txt
  
  Index: LICENSE.txt
  ===================================================================
  RCS file: /home/cvs/avalon/repository/LICENSE.txt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LICENSE.txt	24 Jan 2004 23:20:03 -0000	1.2
  +++ LICENSE.txt	31 Jan 2004 13:29:49 -0000	1.3
  @@ -1,16 +1,176 @@
  -/* 
  - * Copyright 2004 Apache Software Foundation
  - * Licensed  under the  Apache License,  Version 2.0  (the "License");
  - * you may not use  this file  except in  compliance with the License.
  - * You may obtain a copy of the License at 
  - * 
  - *   http://www.apache.org/licenses/LICENSE-2.0
  - * 
  - * Unless required by applicable law or agreed to in writing, software
  - * distributed  under the  License is distributed on an "AS IS" BASIS,
  - * WITHOUT  WARRANTIES OR CONDITIONS  OF ANY KIND, either  express  or
  - * implied.
  - * 
  - * See the License for the specific language governing permissions and
  - * limitations under the License.
  - */
  +
  +                                 Apache License
  +                           Version 2.0, January 2004
  +                        http://www.apache.org/licenses/
  +
  +   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
  +
  +   1. Definitions.
  +
  +      "License" shall mean the terms and conditions for use, reproduction,
  +      and distribution as defined by Sections 1 through 9 of this document.
  +
  +      "Licensor" shall mean the copyright owner or entity authorized by
  +      the copyright owner that is granting the License.
  +
  +      "Legal Entity" shall mean the union of the acting entity and all
  +      other entities that control, are controlled by, or are under common
  +      control with that entity. For the purposes of this definition,
  +      "control" means (i) the power, direct or indirect, to cause the
  +      direction or management of such entity, whether by contract or
  +      otherwise, or (ii) ownership of fifty percent (50%) or more of the
  +      outstanding shares, or (iii) beneficial ownership of such entity.
  +
  +      "You" (or "Your") shall mean an individual or Legal Entity
  +      exercising permissions granted by this License.
  +
  +      "Source" form shall mean the preferred form for making modifications,
  +      including but not limited to software source code, documentation
  +      source, and configuration files.
  +
  +      "Object" form shall mean any form resulting from mechanical
  +      transformation or translation of a Source form, including but
  +      not limited to compiled object code, generated documentation,
  +      and conversions to other media types.
  +
  +      "Work" shall mean the work of authorship, whether in Source or
  +      Object form, made available under the License, as indicated by a
  +      copyright notice that is included in or attached to the work
  +      (an example is provided in the Appendix below).
  +
  +      "Derivative Works" shall mean any work, whether in Source or Object
  +      form, that is based on (or derived from) the Work and for which the
  +      editorial revisions, annotations, elaborations, or other modifications
  +      represent, as a whole, an original work of authorship. For the purposes
  +      of this License, Derivative Works shall not include works that remain
  +      separable from, or merely link (or bind by name) to the interfaces of,
  +      the Work and Derivative Works thereof.
  +
  +      "Contribution" shall mean any work of authorship, including
  +      the original version of the Work and any modifications or additions
  +      to that Work or Derivative Works thereof, that is intentionally
  +      submitted to Licensor for inclusion in the Work by the copyright owner
  +      or by an individual or Legal Entity authorized to submit on behalf of
  +      the copyright owner. For the purposes of this definition, "submitted"
  +      means any form of electronic, verbal, or written communication sent
  +      to the Licensor or its representatives, including but not limited to
  +      communication on electronic mailing lists, source code control systems,
  +      and issue tracking systems that are managed by, or on behalf of, the
  +      Licensor for the purpose of discussing and improving the Work, but
  +      excluding communication that is conspicuously marked or otherwise
  +      designated in writing by the copyright owner as "Not a Contribution."
  +
  +      "Contributor" shall mean Licensor and any individual or Legal Entity
  +      on behalf of whom a Contribution has been received by Licensor and
  +      subsequently incorporated within the Work.
  +
  +   2. Grant of Copyright License. Subject to the terms and conditions of
  +      this License, each Contributor hereby grants to You a perpetual,
  +      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  +      copyright license to reproduce, prepare Derivative Works of,
  +      publicly display, publicly perform, sublicense, and distribute the
  +      Work and such Derivative Works in Source or Object form.
  +
  +   3. Grant of Patent License. Subject to the terms and conditions of
  +      this License, each Contributor hereby grants to You a perpetual,
  +      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
  +      (except as stated in this section) patent license to make, have made,
  +      use, offer to sell, sell, import, and otherwise transfer the Work,
  +      where such license applies only to those patent claims licensable
  +      by such Contributor that are necessarily infringed by their
  +      Contribution(s) alone or by combination of their Contribution(s)
  +      with the Work to which such Contribution(s) was submitted. If You
  +      institute patent litigation against any entity (including a
  +      cross-claim or counterclaim in a lawsuit) alleging that the Work
  +      or a Contribution incorporated within the Work constitutes direct
  +      or contributory patent infringement, then any patent licenses
  +      granted to You under this License for that Work shall terminate
  +      as of the date such litigation is filed.
  +
  +   4. Redistribution. You may reproduce and distribute copies of the
  +      Work or Derivative Works thereof in any medium, with or without
  +      modifications, and in Source or Object form, provided that You
  +      meet the following conditions:
  +
  +      (a) You must give any other recipients of the Work or
  +          Derivative Works a copy of this License; and
  +
  +      (b) You must cause any modified files to carry prominent notices
  +          stating that You changed the files; and
  +
  +      (c) You must retain, in the Source form of any Derivative Works
  +          that You distribute, all copyright, patent, trademark, and
  +          attribution notices from the Source form of the Work,
  +          excluding those notices that do not pertain to any part of
  +          the Derivative Works; and
  +
  +      (d) If the Work includes a "NOTICE" text file as part of its
  +          distribution, then any Derivative Works that You distribute must
  +          include a readable copy of the attribution notices contained
  +          within such NOTICE file, excluding those notices that do not
  +          pertain to any part of the Derivative Works, in at least one
  +          of the following places: within a NOTICE text file distributed
  +          as part of the Derivative Works; within the Source form or
  +          documentation, if provided along with the Derivative Works; or,
  +          within a display generated by the Derivative Works, if and
  +          wherever such third-party notices normally appear. The contents
  +          of the NOTICE file are for informational purposes only and
  +          do not modify the License. You may add Your own attribution
  +          notices within Derivative Works that You distribute, alongside
  +          or as an addendum to the NOTICE text from the Work, provided
  +          that such additional attribution notices cannot be construed
  +          as modifying the License.
  +
  +      You may add Your own copyright statement to Your modifications and
  +      may provide additional or different license terms and conditions
  +      for use, reproduction, or distribution of Your modifications, or
  +      for any such Derivative Works as a whole, provided Your use,
  +      reproduction, and distribution of the Work otherwise complies with
  +      the conditions stated in this License.
  +
  +   5. Submission of Contributions. Unless You explicitly state otherwise,
  +      any Contribution intentionally submitted for inclusion in the Work
  +      by You to the Licensor shall be under the terms and conditions of
  +      this License, without any additional terms or conditions.
  +      Notwithstanding the above, nothing herein shall supersede or modify
  +      the terms of any separate license agreement you may have executed
  +      with Licensor regarding such Contributions.
  +
  +   6. Trademarks. This License does not grant permission to use the trade
  +      names, trademarks, service marks, or product names of the Licensor,
  +      except as required for reasonable and customary use in describing the
  +      origin of the Work and reproducing the content of the NOTICE file.
  +
  +   7. Disclaimer of Warranty. Unless required by applicable law or
  +      agreed to in writing, Licensor provides the Work (and each
  +      Contributor provides its Contributions) on an "AS IS" BASIS,
  +      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
  +      implied, including, without limitation, any warranties or conditions
  +      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
  +      PARTICULAR PURPOSE. You are solely responsible for determining the
  +      appropriateness of using or redistributing the Work and assume any
  +      risks associated with Your exercise of permissions under this License.
  +
  +   8. Limitation of Liability. In no event and under no legal theory,
  +      whether in tort (including negligence), contract, or otherwise,
  +      unless required by applicable law (such as deliberate and grossly
  +      negligent acts) or agreed to in writing, shall any Contributor be
  +      liable to You for damages, including any direct, indirect, special,
  +      incidental, or consequential damages of any character arising as a
  +      result of this License or out of the use or inability to use the
  +      Work (including but not limited to damages for loss of goodwill,
  +      work stoppage, computer failure or malfunction, or any and all
  +      other commercial damages or losses), even if such Contributor
  +      has been advised of the possibility of such damages.
  +
  +   9. Accepting Warranty or Additional Liability. While redistributing
  +      the Work or Derivative Works thereof, You may choose to offer,
  +      and charge a fee for, acceptance of support, warranty, indemnity,
  +      or other liability obligations and/or rights consistent with this
  +      License. However, in accepting such obligations, You may act only
  +      on Your own behalf and on Your sole responsibility, not on behalf
  +      of any other Contributor, and only if You agree to indemnify,
  +      defend, and hold each Contributor harmless for any liability
  +      incurred by, or claims asserted against, such Contributor by reason
  +      of your accepting any such warranty or additional liability.
  +
  
  
  
  1.3       +22 -4     avalon/repository/README.TXT
  
  Index: README.TXT
  ===================================================================
  RCS file: /home/cvs/avalon/repository/README.TXT,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- README.TXT	8 Dec 2003 12:48:48 -0000	1.2
  +++ README.TXT	31 Jan 2004 13:29:49 -0000	1.3
  @@ -11,8 +11,26 @@
   container facilities that serves at the overal bootstrapping
   platform.
   
  -Build instructions
  -------------------
  +Binary Installation Procedure
  +-----------------------------
  +
  +After downloading and unpacking the distribution you should copy
  +or move the directory 'avalon-VERSION' to a convinient location and
  +then declare an environment variable AVALON_HOME to reference this 
  +directory.  You should also include AVALON_HOME/bin in you system
  +PATH.  To verify your installation - invoke the following command 
  +from a new command window:
  +
  +  repository -info
  +
  +This will list information about the default cache directory, hosts
  +and working directory.  For additional command options use:
  +
  +  repository -help
  +
  +
  +CVS Build instructions
  +----------------------
   
   Build Dependencies: Maven beta10 or later.
   
  @@ -34,12 +52,12 @@
   Structure
   ---------
   
  -The repository facility is structured into 7 build subprojects.
  +The repository facility is structured into 8 build subprojects.
   
   * api    -- the client API
  +* cli    -- the command line tools
   * impl   -- the default implementation
   * main   -- the bootstrap deliverable
  -* plugin -- maven plugin supporting artifact metadata generation
   * site   -- site documentation
   * spi    -- interfaces and imutable classes required by a repository
               implementation (in addition to the api)
  
  
  
  1.9       +139 -26   avalon/repository/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/avalon/repository/maven.xml,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- maven.xml	25 Dec 2003 00:56:39 -0000	1.8
  +++ maven.xml	31 Jan 2004 13:29:49 -0000	1.9
  @@ -1,9 +1,26 @@
   <project default="avalon:build" xmlns:maven="jelly:maven" xmlns:j="jelly:core" xmlns:util="jelly:util"
xmlns:ant="jelly:ant">
   
  -  <ant:property name="pom.organization.identifier" value="ASF"/>
  -  <ant:property name="pom.specificationVersion" value="1.2"/>
  -  <ant:property name="maven.docs.src" value="${basedir}/site/xdocs"/>
  -  <ant:property file="project.properties"/>
  +  <!--
  +  ==============================================================================
  +  switches 
  +  ==============================================================================
  +  -->
  +
  +  <ant:property name="avalon.snapshot" value="true"/>
  +
  +  <!--
  +  ==============================================================================
  +  dependent properties 
  +  ==============================================================================
  +  -->
  +
  +  <ant:property name="avalon.cli.version" value="1.3-SNAPSHOT"/>
  +
  +  <!--
  +  ==============================================================================
  +  derived properties 
  +  ==============================================================================
  +  -->
   
     <ant:property name="maven.dist.assembly.dir"
       value="${maven.build.dir}/temp"/>
  @@ -12,12 +29,29 @@
     <ant:property name="maven.dist.src.archive.dir"
       value="${maven.dist.assembly.dir}/src"/>
     <ant:property name="maven.dist.bin.assembly.dir"
  -    value="${maven.dist.assembly.dir}/bin/${pom.artifactId}"/>
  +    value="${maven.dist.assembly.dir}/bin/avalon-${pom.currentVersion}"/>
     <ant:property name="maven.dist.src.assembly.dir"
       value="${maven.dist.assembly.dir}/src/${pom.artifactId}"/>
     <ant:property name="maven.dist.dir"
       value="${maven.build.dir}/distributions"/>
   
  +  <!--
  +  ==============================================================================
  +  structural properties 
  +  ==============================================================================
  +  -->
  +
  +  <ant:property name="pom.specificationVersion" value="1.2"/>
  +  <ant:property name="pom.organization.identifier" value="ASF"/>
  +  <ant:property name="maven.docs.src" value="${basedir}/site/xdocs"/>
  +  <ant:property file="project.properties"/>
  +
  +  <!--
  +  ==============================================================================
  +  build the repository package
  +  ==============================================================================
  +  -->
  +
     <goal name="avalon:build" description="Build the Repository.">
   
       <maven:reactor basedir="${basedir}"
  @@ -28,7 +62,7 @@
         ignoreFailures="false"
         postProcessing="true" />
   
  -    <ant:copy todir="${maven.build.dir}">
  +    <ant:copy todir="${maven.build.dir}/jars">
         <j:forEach var="child" items="${reactorProjects}">
           <ant:fileset dir="${child.file.parentFile}/target">
             <ant:include name="${child.artifactId}-${child.currentVersion}.jar"/>
  @@ -36,7 +70,33 @@
           </ant:fileset>
         </j:forEach>
       </ant:copy>
  -
  +    <j:forEach var="child" items="${reactorProjects}">
  +      <j:set var="path" value="${child.artifactId}-${child.currentVersion}"/>
  +      <util:file var="jarFile" name="${maven.build.dir}/jars/${path}.jar"/>
  +      <j:if test="${jarFile.exists()}">
  +        <checksum file="${jarFile}"/>
  +        <j:if test="${maven.gpg.exe != ''}">
  +          <ant:exec executable="${maven.gpg.exec}">
  +            <ant:arg value="--armour"/>
  +            <ant:arg value="--yes"/>
  +            <ant:arg value="-b"/>
  +            <ant:arg value="${jarFile}"/>
  +          </ant:exec>
  +        </j:if>
  +      </j:if>
  +      <util:file var="metaFile" name="${maven.build.dir}/jars/${path}.jar.meta"/>
  +      <j:if test="${metaFile.exists()}">
  +        <checksum file="${metaFile}"/>
  +        <j:if test="${maven.gpg.exe != ''}">
  +          <ant:exec executable="${maven.gpg.exec}">
  +            <ant:arg value="--armour"/>
  +            <ant:arg value="--yes"/>
  +            <ant:arg value="-b"/>
  +            <ant:arg value="${metaFile}"/>
  +          </ant:exec>
  +        </j:if>
  +      </j:if>
  +    </j:forEach>
     </goal>
   
     <goal name="avalon:clean" prereqs="clean" description="Clean all subprojects.">
  @@ -67,7 +127,7 @@
           
     <goal
       name="xdist:build"
  -    prereqs="xdist:build-bin,xdist:build-src"
  +    prereqs="xdist:build-setup,xdist:build-bin,xdist:build-src"
       description="Build a complete distribution.">
     </goal>
   
  @@ -76,54 +136,89 @@
       description="Set up directories for a distribution build">
       <ant:delete dir="${maven.dist.dir}"/>
       <ant:mkdir dir="${maven.dist.dir}"/>
  -  </goal>
   
  +    <j:choose>
  +      <j:when test="${avalon.snapshot}">
  +        <maven:snapshot project="${pom}"/>
  +        <j:set var="timestamp" value="${snapshotSignature.substring(18)}"/>
  +        <j:set var="binary.name" value="${maven.final.name}-${timestamp}-dist"/>
  +        <j:set var="source.name" value="${maven.final.name}-${timestamp}-src"/>
  +        <echo>Snapshot Packaging: ${timestamp}</echo>
  +      </j:when>
  +      <j:otherwise>
  +        <j:set var="binary.name" value="${maven.final.name}-dist"/>
  +        <j:set var="source.name" value="${maven.final.name}-src"/>
  +        <echo>Release Packaging: ${pom.currentVersion}</echo>
  +      </j:otherwise>
  +    </j:choose>
  +
  +  </goal>
   
     <goal
       name="xdist:build-bin" 
  -    prereqs="xdist:build-setup,xdist:prepare-bin-filesystem"
  +    prereqs="xdist:prepare-bin-filesystem"
       description="Build the binary distribution.">
   
       <!-- Create a tar.gz file -->
  -    <ant:tar longfile="gnu" tarfile="${maven.dist.dir}/${maven.final.name}.tar">
  +    <ant:tar longfile="gnu" tarfile="${maven.dist.dir}/${binary.name}.tar">
         <ant:tarfileset dir="${maven.dist.bin.archive.dir}"/>
       </ant:tar>
   
       <ant:gzip 
  -      zipfile="${maven.dist.dir}/${maven.final.name}.tar.gz"
  -      src="${maven.dist.dir}/${maven.final.name}.tar"
  +      zipfile="${maven.dist.dir}/${binary.name}.tar.gz"
  +      src="${maven.dist.dir}/${binary.name}.tar"
       />
  -    <checksum file="${maven.dist.dir}/${maven.final.name}.tar.gz"/>
  -    <ant:delete file="${maven.dist.dir}/${maven.final.name}.tar"/>
  +    <ant:delete file="${maven.dist.dir}/${binary.name}.tar"/>
  +    <checksum file="${maven.dist.dir}/${binary.name}.tar.gz"/>
  +    <ant:exec executable="${maven.gpg.exec}">
  +      <ant:arg value="--armour"/>
  +      <ant:arg value="-b"/>
  +      <ant:arg value="${maven.dist.dir}/${binary.name}.tar.gz"/>
  +    </ant:exec>
   
       <!-- Create a zip file -->
  -    <ant:zip zipfile="${maven.dist.dir}/${maven.final.name}.zip">
  +    <ant:zip zipfile="${maven.dist.dir}/${binary.name}.zip">
         <ant:zipfileset dir="${maven.dist.bin.archive.dir}"/>
       </ant:zip>
  -    <checksum file="${maven.dist.dir}/${maven.final.name}.zip"/>
  +    <checksum file="${maven.dist.dir}/${binary.name}.zip"/>
  +    <ant:exec executable="${maven.gpg.exec}">
  +      <ant:arg value="--armour"/>
  +      <ant:arg value="-b"/>
  +      <ant:arg value="${maven.dist.dir}/${binary.name}.zip"/>
  +    </ant:exec>
     </goal>
   
     <goal
       name="xdist:build-src"
  -    prereqs="xdist:build-setup,xdist:prepare-src-filesystem"
  +    prereqs="xdist:prepare-src-filesystem"
       description="Build the source distribution.">
    
       <!-- Create a tar.gz file -->
  -    <ant:tar longfile="gnu" tarfile="${maven.dist.dir}/${maven.final.name}-src.tar">
  +    <ant:tar longfile="gnu" tarfile="${maven.dist.dir}/${source.name}.tar">
         <ant:tarfileset dir="${maven.dist.src.archive.dir}"/>
       </ant:tar>
       <ant:gzip 
  -      zipfile="${maven.dist.dir}/${maven.final.name}-src.tar.gz" 
  -      src="${maven.dist.dir}/${maven.final.name}-src.tar"
  +      zipfile="${maven.dist.dir}/${source.name}.tar.gz" 
  +      src="${maven.dist.dir}/${source.name}.tar"
       />
  -    <checksum file="${maven.dist.dir}/${maven.final.name}-src.tar.gz"/>
  -    <ant:delete file="${maven.dist.dir}/${maven.final.name}-src.tar"/>
  +    <ant:delete file="${maven.dist.dir}/${source.name}.tar"/>
  +    <checksum file="${maven.dist.dir}/${source.name}.tar.gz"/>
  +    <ant:exec executable="${maven.gpg.exec}">
  +      <ant:arg value="--armour"/>
  +      <ant:arg value="-b"/>
  +      <ant:arg value="${maven.dist.dir}/${source.name}.tar.gz"/>
  +    </ant:exec>
   
       <!-- Create a zip file -->
  -    <ant:zip zipfile="${maven.dist.dir}/${maven.final.name}-src.zip">
  +    <ant:zip zipfile="${maven.dist.dir}/${source.name}.zip">
         <ant:zipfileset dir="${maven.dist.src.archive.dir}"/>
       </ant:zip>
  -    <checksum file="${maven.dist.dir}/${maven.final.name}-src.zip"/>
  +    <checksum file="${maven.dist.dir}/${source.name}.zip"/>
  +    <ant:exec executable="${maven.gpg.exec}">
  +      <ant:arg value="--armour"/>
  +      <ant:arg value="-b"/>
  +      <ant:arg value="${maven.dist.dir}/${source.name}.zip"/>
  +    </ant:exec>
     </goal>
   
     <goal
  @@ -140,16 +235,34 @@
       <ant:copy todir="${maven.dist.bin.assembly.dir}">
         <ant:fileset dir=".">
           <ant:include name="LICENSE*"/>
  +        <ant:include name="README*"/>
         </ant:fileset>
       </ant:copy>
   
       <!-- Copy Jars -->
  +    <ant:copy todir="${maven.dist.bin.assembly.dir}/repository/avalon-repository">
  +      <ant:fileset dir="${maven.build.dir}">
  +        <ant:include name="jars/*.*"/>
  +      </ant:fileset>
  +    </ant:copy>
  +
  +    <!-- Copy Docs -->
       <ant:copy todir="${maven.dist.bin.assembly.dir}">
         <ant:fileset dir="${maven.build.dir}">
  -        <ant:include name="*.jar"/>
           <ant:include name="docs/**"/>
         </ant:fileset>
       </ant:copy>
  +
  +    <!-- Copy Bin -->
  +    <ant:copy todir="${maven.dist.bin.assembly.dir}/bin">
  +      <ant:fileset dir="${basedir}/cli/bin">
  +        <ant:include name="**"/>
  +      </ant:fileset>
  +      <filterset>
  +        <filter token="AVALON_CLI_VERSION" value="${avalon.cli.version}"/>
  +      </filterset>
  +    </ant:copy>
  +
     </goal>
   
     <goal
  
  
  
  1.12      +1 -1      avalon/repository/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon/repository/project.xml,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- project.xml	26 Dec 2003 09:22:38 -0000	1.11
  +++ project.xml	31 Jan 2004 13:29:49 -0000	1.12
  @@ -6,7 +6,7 @@
     <groupId>avalon</groupId>
     <id>avalon-repository</id>
     <name>Avalon Repository</name>
  -  <currentVersion>1.2</currentVersion>
  +  <currentVersion>1.3</currentVersion>
   
     <organization>
       <name>Apache Software Foundation</name>
  
  
  
  1.6       +3 -6      avalon/repository/main/src/java/org/apache/avalon/repository/main/AbstractBuilder.java
  
  Index: AbstractBuilder.java
  ===================================================================
  RCS file: /home/cvs/avalon/repository/main/src/java/org/apache/avalon/repository/main/AbstractBuilder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractBuilder.java	24 Jan 2004 23:20:05 -0000	1.5
  +++ AbstractBuilder.java	31 Jan 2004 13:29:50 -0000	1.6
  @@ -92,15 +92,12 @@
       * @exception RepositoryException if a factory creation error occurs
       */
       protected Factory createDelegate( 
  -      ClassLoader classloader, String factory, InitialContext context ) 
  +      ClassLoader classloader, Class clazz, InitialContext context ) 
         throws RepositoryException
       {
  -
           if( null == classloader ) throw new NullPointerException( "classloader" );
  -        if( null == factory ) throw new NullPointerException( "factory" );
  +        if( null == clazz ) throw new NullPointerException( "clazz" );
           if( null == context ) throw new NullPointerException( "context" );
  -
  -        Class clazz = loadFactoryClass( classloader, factory );
   
           try
           {
  
  
  
  1.12      +52 -24    avalon/repository/main/src/java/org/apache/avalon/repository/main/DefaultBuilder.java
  
  Index: DefaultBuilder.java
  ===================================================================
  RCS file: /home/cvs/avalon/repository/main/src/java/org/apache/avalon/repository/main/DefaultBuilder.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DefaultBuilder.java	24 Jan 2004 23:20:05 -0000	1.11
  +++ DefaultBuilder.java	31 Jan 2004 13:29:50 -0000	1.12
  @@ -198,9 +198,12 @@
       private final InitialContext m_context;
       
      /**
  -    * The application factory established by the loader to which 
  -    * requests for default criteria and instance creation are 
  -    * delegated.
  +    * The factory class established by the builder.
  +    */
  +    private final Class m_class;
  +
  +   /**
  +    * The factory instance.
       */
       private final Factory m_delegate;
   
  @@ -218,11 +221,7 @@
       public DefaultBuilder( InitialContext context, Artifact artifact )
           throws Exception
       {
  -        this( 
  -          context, 
  -          //Thread.currentThread().getContextClassLoader(),
  -          null,
  -          artifact );
  +        this( context, null, artifact );
       }
       
      /**
  @@ -269,24 +268,31 @@
           }
   
           m_classloader = m_repository.getClassLoader( parent, artifact );
  -        Class clazz = loadFactoryClass( m_classloader, classname );
  +        m_class = loadFactoryClass( m_classloader, classname );
   
  -        try
  +        if( Factory.class.isAssignableFrom( m_class ) )
           {
  -            m_delegate = createDelegate( m_classloader, classname, m_context );
  +            try
  +            {
  +                m_delegate = createDelegate( m_classloader, m_class, m_context );
  +            }
  +            catch( Throwable e )
  +            {
  +                final String error = 
  +                  "Unable to establish a factory for the supplied artifact:";
  +                StringBuffer buffer = new StringBuffer( error );
  +                buffer.append( "\n artifact: " + artifact );
  +                buffer.append( "\n build: " + descriptor.getBuild() );
  +                buffer.append( "\n factory: " + descriptor.getFactory() );
  +                buffer.append( "\n source: " 
  +                  + m_class.getProtectionDomain().getCodeSource().getLocation() );
  +                buffer.append( "\n repository: " + m_repository );
  +                throw new RepositoryException( buffer.toString(), e );
  +            }
           }
  -        catch( Throwable e )
  +        else
           {
  -            final String error = 
  -              "Unable to establish a factory for the supplied artifact:";
  -            StringBuffer buffer = new StringBuffer( error );
  -            buffer.append( "\n artifact: " + artifact );
  -            buffer.append( "\n build: " + descriptor.getBuild() );
  -            buffer.append( "\n factory: " + descriptor.getFactory() );
  -            buffer.append( "\n source: " 
  -              + clazz.getProtectionDomain().getCodeSource().getLocation() );
  -            buffer.append( "\n repository: " + m_repository );
  -            throw new RepositoryException( buffer.toString(), e );
  +            m_delegate = null;
           }
       }
   
  @@ -295,12 +301,34 @@
       //-----------------------------------------------------------
   
      /**
  +    * Return the primary class established by the builder.
  +    * @return the main class
  +    */
  +    public Class getFactoryClass()
  +    {
  +        return m_class;
  +    }
  +
  +   /**
       * Return the factory established by the loader.
       * @return the delegate factory
  +    * @exception RepositoryRuntimeException if the declared class does 
  +    *    not implement the factory interface
  +    * @see getFactoryClass
       */
       public Factory getFactory()
       {
  -        return m_delegate;
  +        if( null != m_delegate )
  +        {
  +            return m_delegate;
  +        }
  +        else
  +        {
  +            final String error = 
  +              "Supplied class [" + m_class.getName() 
  +              + "] does not implement the Factory interface.";
  +            throw new RepositoryRuntimeException( error );
  +        }
       }
   
       /**
  
  
  
  1.16      +167 -10   avalon/repository/main/src/java/org/apache/avalon/repository/main/DefaultInitialContext.java
  
  Index: DefaultInitialContext.java
  ===================================================================
  RCS file: /home/cvs/avalon/repository/main/src/java/org/apache/avalon/repository/main/DefaultInitialContext.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DefaultInitialContext.java	25 Jan 2004 13:17:50 -0000	1.15
  +++ DefaultInitialContext.java	31 Jan 2004 13:29:50 -0000	1.16
  @@ -23,21 +23,23 @@
   import java.io.InputStream;
   import java.io.FileInputStream;
   import java.io.FileOutputStream;
  -
   import java.lang.reflect.Constructor;
   import java.lang.NoSuchMethodException;
  -
  -import java.util.ArrayList;
  -import java.util.Map;
  -import java.util.Properties;
  -import java.text.ParseException;
  -import java.util.StringTokenizer;
  -
   import java.net.URL;
   import java.net.URLConnection;
   import java.net.URLClassLoader;
   import java.net.HttpURLConnection;
   import java.net.MalformedURLException;
  +import java.net.JarURLConnection;
  +import java.util.ArrayList;
  +import java.util.Enumeration;
  +import java.util.Map;
  +import java.util.Properties;
  +import java.text.ParseException;
  +import java.util.StringTokenizer;
  +import java.util.jar.Manifest;
  +import java.util.jar.JarFile;
  +import java.util.zip.ZipEntry;
   
   import javax.naming.NamingException;
   import javax.naming.NamingEnumeration;
  @@ -75,6 +77,11 @@
       //------------------------------------------------------------------
   
      /**
  +    * Group identifier manifest key.
  +    */
  +    public static final String BLOCK_GROUP_KEY = "Block-Group";
  +
  +   /**
       * The name of the properties file to be searched for confiuration
       * properties.  Seaches will be conducted on the current directory and 
       * the user's home directory.
  @@ -303,7 +310,7 @@
   
           try
           {
  -            m_delegate = createDelegate( classloader, factory, this );
  +            m_delegate = createDelegate( classloader, clazz, this );
           }
           catch( Throwable e )
           {
  @@ -387,9 +394,159 @@
           return new DefaultBuilder( this, classloader, artifact );
       }
   
  +   /**
  +    * Install a block archive into the repository.
  +    * @param url the block archive url
  +    * @return the block manifest
  +    */
  +    public Manifest install( URL url ) throws RepositoryException
  +    {
  +        String path = url.getFile();
  +
  +        try
  +        {
  +            File temp = File.createTempFile( "avalon-", "-bar" );
  +            temp.delete();
  +            LoaderUtils.getResource( url.toString(), temp, true );
  +            temp.deleteOnExit();
  +            StringBuffer buffer = new StringBuffer();
  +            Manifest manifest = expand( temp.toURL(), buffer );
  +
  +            //
  +            // need a logging solution
  +            //
  +
  +            System.out.println( buffer.toString() );
  +            return manifest;
  +        }
  +        catch( RepositoryException e )
  +        {
  +            throw e;
  +        }
  +        catch( Throwable e )
  +        {
  +            final String error = 
  +              "Cannot install target: " + url;
  +            throw new RepositoryException( error, e );
  +        }
  +    }
  +
       // ------------------------------------------------------------------------
       // implementation
       // ------------------------------------------------------------------------
  +
  +   /**
  +    * Expand a block archive into the repository.
  +    * @param url the block archive url
  +    * @param buffer a string buffer against which messages may be logged
  +    * @return the block manifest
  +    */
  +    private Manifest expand( URL url, StringBuffer buffer ) throws RepositoryException
  +    {
  +        try
  +        {
  +            URL jurl = new URL( "jar:" + url.toString() + "!/" );
  +            JarURLConnection connection = (JarURLConnection) jurl.openConnection();
  +            Manifest manifest = connection.getManifest();
  +
  +            final String group = getBlockGroup( manifest );
  +
  +            buffer.append( "\nBlock Group: " + group );
  +            final File root = new File( m_cache, group );
  +            buffer.append( "\nLocal target: " + root );
  +            JarFile jar = connection.getJarFile();
  +            Enumeration entries = jar.entries();
  +            while( entries.hasMoreElements() )
  +            {
  +                ZipEntry entry = (ZipEntry) entries.nextElement();
  +                if( !entry.getName().startsWith( "META-INF" ) )
  +                {
  +                    installEntry( buffer, root, jar, entry );
  +                }
  +            }
  +            buffer.append( "\nInstall successful." );
  +            return manifest;
  +        }
  +        catch( Throwable e )
  +        {
  +            final String error = 
  +              "Could not install block: " + url;
  +            throw new RepositoryException( error, e );
  +        }
  +    }
  +
  +    private String getBlockGroup( Manifest manifest )
  +    {
  +        return (String) manifest.getMainAttributes().getValue( BLOCK_GROUP_KEY );
  +    }
  +
  +   /**
  +    * Internal utility to install a entry from a jar file into the local repository.
  +    * @param buffer the buffer to log messages to
  +    * @param root the root directory corresponding to the bar group
  +    * @param jar the block archive
  +    * @param entry the entry from the archive to install
  +    */
  +    private void installEntry( 
  +      StringBuffer buffer, File root, JarFile jar, ZipEntry entry ) throws Exception
  +    {
  +        if( entry.isDirectory() ) return;
  +        
  +        final String name = entry.getName();
  +        File file = new File( root, name );
  +
  +        long timestamp = entry.getTime();
  +        if( file.exists() )
  +        {
  +            if( file.lastModified() == timestamp )
  +            {
  +                buffer.append( "\nEntry: " + name + " (already exists)" );
  +                return;
  +            }
  +            else if( file.lastModified() > timestamp )
  +            {
  +                buffer.append( "\nEntry: " + name + " (local version is more recent)" );
  +                return;
  +            }
  +            else
  +            {
  +                buffer.append( "\nEntry: " + name + " (updating local version)" );
  +            }
  +        }
  +        else
  +        {
  +            buffer.append( "\nEntry: " + name );
  +        }
  +
  +        InputStream is = jar.getInputStream( entry );
  +        if ( is == null )
  +        {
  +            final String error = 
  +              "Entry returned a null input stream: " + name;
  +            buffer.append( "\n  " + error );
  +            throw new IOException( error );
  +        }
  +
  +        file.getParentFile().mkdirs();
  +        FileOutputStream fos = new FileOutputStream( file );
  +        byte[] buf = new byte[100 * 1024];
  +        int length;
  +        while ( ( length = is.read( buf ) ) >= 0 )
  +        {
  +            fos.write( buf, 0, length );
  +        }
  +        fos.close();
  +        is.close();
  +
  +        if ( timestamp < 0 )
  +        {
  +            file.setLastModified( System.currentTimeMillis() );
  +        }
  +        else
  +        {
  +            file.setLastModified( timestamp );
  +        }
  +    }
   
       private Attributes loadAttributes( File cache, String[] hosts, Artifact artifact )
         throws RepositoryException
  
  
  
  1.5       +8 -2      avalon/repository/spi/src/java/org/apache/avalon/repository/provider/Builder.java
  
  Index: Builder.java
  ===================================================================
  RCS file: /home/cvs/avalon/repository/spi/src/java/org/apache/avalon/repository/provider/Builder.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Builder.java	24 Jan 2004 23:20:05 -0000	1.4
  +++ Builder.java	31 Jan 2004 13:29:50 -0000	1.5
  @@ -24,7 +24,13 @@
    * @version $Revision$ $Date$
    */
   public interface Builder
  -{        
  +{       
  +   /**
  +    * Return the primary class established by the builder.
  +    * @return the class
  +    */
  +    Class getFactoryClass();
  + 
       /**
        * Return the factory established by the builder.
        * 
  
  
  
  1.7       +13 -1     avalon/repository/spi/src/java/org/apache/avalon/repository/provider/InitialContext.java
  
  Index: InitialContext.java
  ===================================================================
  RCS file: /home/cvs/avalon/repository/spi/src/java/org/apache/avalon/repository/provider/InitialContext.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- InitialContext.java	25 Jan 2004 13:17:51 -0000	1.6
  +++ InitialContext.java	31 Jan 2004 13:29:50 -0000	1.7
  @@ -17,7 +17,9 @@
   
   package org.apache.avalon.repository.provider;
   
  +import java.net.URL;
   import java.io.File;
  +import java.util.jar.Manifest;
   
   import org.apache.avalon.repository.Artifact;
   import org.apache.avalon.repository.RepositoryException;
  @@ -42,6 +44,9 @@
       */
       String HOSTS_KEY = "avalon.repository.hosts";
   
  +    String LINE = 
  +      "\n-----------------------------------------------------------";
  +
       /**
        * Return the base working directory.
        * 
  @@ -86,5 +91,12 @@
       */
       Builder newBuilder( ClassLoader classloader, Artifact artifact )
         throws Exception;
  +
  +   /**
  +    * Install a block archive into the repository.
  +    * @param url the block archive url
  +    * @return the block manifest
  +    */
  +    Manifest install( URL url ) throws RepositoryException;
   
   }
  
  
  
  1.1                  avalon/repository/cli/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  maven.log
  velocity.log
  target
  .classpath
  .project
  build.xml
  
  
  1.1                  avalon/repository/cli/maven.xml
  
  Index: maven.xml
  ===================================================================
  
  <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}">
          <unzip src="${pom.getDependencyPath( dep.getId() )}" 
            dest="${maven.build.dir}/classes">
            <patternset>
              <exclude name="META-INF/**"/>
              <exclude name="*.meta"/>
            </patternset>
          </unzip>
      </j:forEach>
    </preGoal>
  
  </project>
  
  
  
  1.1                  avalon/repository/cli/project.properties
  
  Index: project.properties
  ===================================================================
  
  #
  # main class
  # 
  maven.jar.mainclass = org.apache.avalon.repository.cli.Main
  
  
  
  
  1.1                  avalon/repository/cli/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <project>
  
    <extend>${basedir}/../project.xml</extend>
  
    <groupId>avalon-repository</groupId>
    <id>avalon-repository-cli</id>
    <name>Avalon Repository CLI</name>
    <currentVersion>1.3-SNAPSHOT</currentVersion>
  
    <package>org.apache.avalon.repository.cli</package>
  
    <inceptionYear>2002</inceptionYear>
    <shortDescription>Avalon Repository CLI</shortDescription>
    
    <dependencies>
      <dependency>
        <groupId>avalon-repository</groupId>
        <artifactId>avalon-repository-main</artifactId>
        <version>1.3-SNAPSHOT</version>
      </dependency>
      <dependency>
        <id>commons-cli</id>
        <version>1.0</version>
      </dependency>
      <dependency>
        <id>excalibur-i18n</id>
        <version>1.1</version>
      </dependency>
    </dependencies>
  
  </project>
  
  
  

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


Mime
View raw message