mcconnell    2003/11/20 14:47:55

  Modified:    repository README.TXT maven.xml project.xml
               repository/spi/src/java/org/apache/avalon/repository
                        RepositoryFactory.java
  Added:       repository/impl maven.xml
  Log:
  Add checks for plugin installation.
  
  Revision  Changes    Path
  1.3       +66 -24    avalon-sandbox/repository/README.TXT
  
  Index: README.TXT
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/repository/README.TXT,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- README.TXT        17 Nov 2003 14:46:20 -0000      1.2
  +++ README.TXT        20 Nov 2003 22:47:55 -0000      1.3
  @@ -14,48 +14,90 @@
   Build instructions
   ------------------
   
  -Before attempting to build the sandbox repository project you must
  -to a CVS update of the Avalon Meta project and regenerate you version
  -of the Avalon Meta plugin:
  +Dependencies: Maven beta10 or later.
   
  -  $ cd /avalon/meta/plugin
  -  $ maven plugin:install
  +Prerequisites:
   
  -After updating the plugin you can build the sandbox repository using
  -the following goal:
  +Some recent version of the avalon meta plugin included content 
  +that has been moved to the repository plugin. To ensure that 
  +you do not have any conflicts you can updated the avalon/meta 
  +project from cvs and invoke avalon:setup from the avalon/meta 
  +root directory to update the meta plugin.
  +
  +Before building the repository project you need to install the 
  +avalon-repository plugin.  A convinience goal is provided:
  +
  +  $ maven avalon:setup
  +
  +The following goal builds the repository project:
   
     $ maven avalon:build
   
  -An additional utility goal is available:
  +An additional utility goal is available to clean all repository
  +subprojects.
   
     $ maven avalon:clean
   
  -
   Structure
   ---------
   
  -The repository facility is structured into 5 build subprojects.
  +The repository facility is structured into 7 build subprojects.
   
  -* api  -- the client API
  -* spi  -- interfaces and imutable classes required by a repository
  -          implementation (in addition to the api)
  -* impl -- the default implementation
  -* main -- creates a single bootstrap jar file
  -* test -- repository test project
  +* api    -- the client API
  +* impl   -- the default implementation
  +* main   -- the bootstrap deliverable
  +* plugin -- maven plugin supporting artifact metadata generation
  +* spi    -- interfaces and imutable classes required by a repository
  +            implementation (in addition to the api)
  +* test   -- test project
  +* util   -- implementation utilities shared by the default impl and main
   
   Usage
   -----
   
  -   RepositoryFactory factory = new InitialRepositoryFactory( urls );
  -   RepositoryContext context = factory.getDefaultContext();
  -   Repository repository = factory.create( context );
  +Simple setup:
  +
  +   String[] bootstrap = new String[]{ "http://dpml.net"; };
  +   RepositoryFactory factory = new InitialRepositoryFactory( bootstrap );
  +   Repository repository = factory.create();
  +
  +Custom setup:
  +
  +   String[] bootstrap = new String[]{ "http://dpml.net"; };
  +   String[] hosts = new String[]{ "http://dpml.net";, "http://ibiblio.org/maven"; };
  +   RepositoryFactory factory = new InitialRepositoryFactory( hosts );
  +
  +   DefaultRepositoryContext context = 
  +      new DefaultRepositoryContext( factory.getDefaultContext() );
  +   context.setCacheDir( ".cache" );
  +   context.setRemoteRepositoryUrls( hosts ) ;
  +
  +   Repository repository = factory.create( context ) ;
  +
  +Example retrival of a artifact:
  +
  +   Artifact artifact = 
  +     MavenArtifactFactory.createJarArtifact( 
  +       "avalon-framework", "avalon-framework-api", "4.1.5" );
  +   URL local = repository.getResource( artifact );
  +
  +Example creation of a classloader:
  +
  +   Artifact artifact = 
  +     MavenArtifactFactory.createJarArtifact( 
  +       "merlin", "merlin-kernel-impl", "3.2.1" );
  +   ClassLoader loader = repository.getClassLoader( artifact );
  +
  +The Bootstrapper class is not complete at this time, however the 
  +ability to invoke classloader creation from the command line is 
  +supported.  For example:
  +
  +  java -jar avalon-repository-main-1.2-dev.jar \
  +    -artifact merlin:merlin-kernel-impl;3.2.1-dev
  +
   
   Status
   ------
   
  -Build is working and tests are passing.  Some review needed on the 
  -getClassLoader operation and assumptions about applications 
  -directives versus jar file descriptors.  Basically its not down to
  -sorting out details - making sure the API are clean and well doumented, 
  -and imporving test coverage.
  +Javadocs, unit tests, general documetation, and tutorials pending.
   
  
  
  
  1.8       +81 -8     avalon-sandbox/repository/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/repository/maven.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- maven.xml 17 Nov 2003 16:51:53 -0000      1.7
  +++ maven.xml 20 Nov 2003 22:47:55 -0000      1.8
  @@ -1,14 +1,20 @@
   <project default="avalon:build" xmlns:maven="jelly:maven" xmlns:j="jelly:core" 
xmlns:util="jelly:util" xmlns:ant="jelly:ant">
   
  +  <ant:property name="repo.plugin.groupId" value="avalon-repository"/>   
  +  <ant:property name="repo.plugin.artifactId" value="avalon-repository-plugin"/>   
  +  <ant:property name="repo.plugin.version" value="1.2.1-dev"/>
  +  <ant:property name="repo.plugin.jar" 
  +    value="${repo.plugin.artifactId}-${repo.plugin.version}.jar"/>   
  +
     <ant:property name="pom.organization.identifier" value="ASF"/>
     <ant:property name="pom.specificationVersion" value="1.2"/>
   
     <goal name="avalon:build" description="Build the Repository.">
       <maven:reactor basedir="${basedir}"
         includes="**/project.xml"
  -      excludes="target/**,project.xml"
  -      goals="jar:install"
  -      banner="Installing:"
  +      excludes="**/target/**,project.xml"
  +      goals=""
  +      banner="Building:"
         ignoreFailures="false" />
     </goal>
   
  @@ -16,16 +22,12 @@
       <maven:reactor
         basedir="${basedir}"
         includes="**/project.xml"
  -      excludes="project.xml"
  +      excludes="project.xml,**/target/**"
         goals="clean:clean"
         banner="Cleaning subproject:"
         ignoreFailures="false"/>
     </goal>
   
  -  <preGoal name="java:compile">
  -    <attainGoal name="avalon:artifact"/>
  -  </preGoal>
  -
     <postGoal name="jar:install">
       <ant:copy toDir="${maven.repo.local}/${pom.groupId}/jars">
         <fileset dir="${maven.build.dir}">
  @@ -33,5 +35,76 @@
         </fileset>
       </ant:copy>
     </postGoal>
  +
  +  <postGoal name="java:prepare-filesystem">
  +    <ant:available file="${maven.home}/plugins/${repo.plugin.jar}"
  +      property="repoPluginPresent"/>
  +    <j:if test="${repoPluginPresent != 'true'}">
  +      <ant:echo>
  +#####################################################################
  +#                                                                   #
  +#   WARNING:                                                        #
  +#   You do not have the required version of the avalon-repository   #
  +#   plugin installed on your system.                                #
  +#   Please invoke the following command                             #
  +#                                                                   #
  +#     $ maven avalon:setup                                          #
  +#                                                                   #
  +#####################################################################</ant:echo>
  +      <attainGoal name="avalon:repo-plugin-install"/>
  +    </j:if>
  +  </postGoal>
  +
  +  <goal name="avalon:setup">
  +    <echo>
  +Initiating download and installation of the Avalon Repository Plugin.
  +${repo.plugin.artifactId}-${repo.plugin.version}.jar</echo>
  +    <j:set var="repoList">${maven.repo.remote}</j:set> 
  +    <util:tokenize var="repos" delim=",">${repoList.trim()}</util:tokenize> 
  +    <j:forEach var="repo" items="${repos}"> 
  +      <echo>repository '${repo}'</echo> 
  +      <util:file var="localPlugin" 
name="${maven.home}/plugins/${repo.plugin.artifactId}-${repo.plugin.version}.jar" /> 
  +      <j:if test="${!localPlugin.exists()}"> 
  +        <j:set var="remoteFile" 
value="${repo}/${repo.plugin.groupId}/plugins/${repo.plugin.artifactId}-${repo.plugin.version}.jar"
 /> 
  +        <echo>trying to download ${remoteFile}</echo> 
  +        <j:catch var="ex"> 
  +        <j:invokeStatic var="dummy" method="getFile" 
className="org.apache.maven.util.HttpUtils"> 
  +          <j:arg type="java.lang.String" value="${remoteFile}" /> 
  +          <j:arg type="java.io.File" value="${localPlugin}"/> 
  +          <j:arg type="boolean" value="false"/> 
  +          <j:arg type="boolean" value="true"/> 
  +          <j:arg type="java.lang.String" value="${maven.proxy.host}" /> 
  +          <j:arg type="java.lang.String" value="${maven.proxy.port}" /> 
  +          <j:arg type="java.lang.String" value="${maven.proxy.username}" /> 
  +          <j:arg type="java.lang.String" value="${maven.proxy.password}" /> 
  +          <j:arg type="boolean" value="false"/> 
  +        </j:invokeStatic> 
  +        </j:catch> 
  +      </j:if> 
  +      <j:break test="${localPlugin.exists()}"/> 
  +    </j:forEach>
  +    <j:set var="downloaded" value="${localPlugin.exists()}"/> 
  +    <j:if test="${!downloaded}"> 
  +      <ant:fail message="Unable to find plug-in" /> 
  +    </j:if> 
  +    <j:if test="${downloaded}">
  +      <ant:move file="${localPlugin}" toFile="tmp.jar"/>
  +      <echo>Plugin downloaded, removing other versions</echo> 
  +      <delete verbose="false"> 
  +        <fileset dir="${maven.home}/plugins">
  +          <include name="${repo.plugin.artifactId}-*.jar" /> 
  +          <exclude name="${repo.plugin.artifactId}-${repo.plugin.version}.jar" /> 
  +        </fileset> 
  +      </delete> 
  +      <delete includeEmptyDirs="true" verbose="false"> 
  +        <fileset dir="${maven.plugin.unpacked.dir}"> 
  +          <include name="*.cache"/> 
  +          <include name="**/.processed" /> 
  +          <include name="${repo.plugin.artifactId}-*/**" /> 
  +        </fileset>
  +      </delete>
  +      <ant:move file="tmp.jar" toFile="${localPlugin}"/>
  +    </j:if> 
  +  </goal>
   
   </project>
  
  
  
  1.4       +11 -0     avalon-sandbox/repository/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/repository/project.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- project.xml       17 Nov 2003 08:46:07 -0000      1.3
  +++ project.xml       20 Nov 2003 22:47:55 -0000      1.4
  @@ -65,6 +65,17 @@
       </developer>
     </developers>
   
  +  <!--
  +  <dependencies>
  +    <dependency>
  +      <groupId>avalon-repository</groupId>
  +      <artifactId>avalon-repository-plugin</artifactId>
  +      <version>1.2.1-dev</version>
  +      <type>plugin</type>
  +    </dependency>
  +  </dependencies>
  +  -->
  +
     <build>
   
       <nagEmailAddress>[EMAIL PROTECTED]</nagEmailAddress>
  
  
  
  1.5       +4 -3      avalon-sandbox/repository/impl/maven.xml
  
  
  
  
  1.5       +9 -1      
avalon-sandbox/repository/spi/src/java/org/apache/avalon/repository/RepositoryFactory.java
  
  Index: RepositoryFactory.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/repository/spi/src/java/org/apache/avalon/repository/RepositoryFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RepositoryFactory.java    17 Nov 2003 08:19:51 -0000      1.4
  +++ RepositoryFactory.java    20 Nov 2003 22:47:55 -0000      1.5
  @@ -69,6 +69,14 @@
       RepositoryContext getDefaultContext() throws RepositoryException ;
   
       /**
  +     * Creates a new Repository using a defaults. 
  +     * 
  +     * @return the newly created Repository
  +     * @throws RepositoryException if there is a problem creating the Repository
  +     */
  +    Repository create() throws RepositoryException ;
  +
  +    /**
        * Creates a new Repository using a configuration bean. 
        * 
        * @param context the Repository creation context
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to