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/main/src/java/org/apache/avalon/repository/main DefaultInitialContext.java
Date Mon, 02 Feb 2004 00:41:24 GMT
mcconnell    2004/02/01 16:41:24

  Modified:    repository maven.xml
               repository/api/src/java/org/apache/avalon/repository
                        Artifact.java
               repository/cli/src/java/org/apache/avalon/repository/cli
                        Main.java
               repository/impl project.properties
               repository/impl/src/java/org/apache/avalon/repository/impl
                        DefaultCacheManager.java
               repository/main/src/java/org/apache/avalon/repository/main
                        DefaultInitialContext.java
  Added:       repository/impl/src/java/org/apache/avalon/repository/impl
                        DefaultCacheManagerMBean.java
  Log:
  Some very initial updates dealing with the introduction of JMX into the repository package.
  
  Revision  Changes    Path
  1.10      +98 -10    avalon/repository/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/avalon/repository/maven.xml,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- maven.xml	31 Jan 2004 13:29:49 -0000	1.9
  +++ maven.xml	2 Feb 2004 00:41:23 -0000	1.10
  @@ -15,6 +15,13 @@
     -->
   
     <ant:property name="avalon.cli.version" value="1.3-SNAPSHOT"/>
  +  <ant:property name="plugin.jar" value="avalon-util-plugin-1.0-SNAPSHOT"/>
  +
  +  <ant:property name="plugin.groupId" value="avalon-util"/>
  +  <ant:property name="plugin.artifactId" value="avalon-util"/>
  +  <ant:property name="plugin.version" value="1.0-SNAPSHOT"/>
  +  <ant:property name="plugin.jar" 
  +    value="${plugin.artifactId}-${plugin.version}.jar"/>
   
     <!--
     ==============================================================================
  @@ -99,6 +106,12 @@
       </j:forEach>
     </goal>
   
  +  <!--
  +  ==============================================================================
  +  clean all subprojects
  +  ==============================================================================
  +  -->
  +
     <goal name="avalon:clean" prereqs="clean" description="Clean all subprojects.">
       <maven:reactor
         basedir="${basedir}"
  @@ -109,6 +122,12 @@
         ignoreFailures="true"/>
     </goal>
   
  +  <!--
  +  ==============================================================================
  +  build the site documentation
  +  ==============================================================================
  +  -->
  +
     <goal name="avalon:site">
       <maven:reactor basedir="${basedir}"
         includes="platform.xml"
  @@ -117,8 +136,13 @@
         ignoreFailures="false"/>
     </goal>
   
  -  <goal name="avalon:dist" prereqs="avalon:build,avalon:site,xdist">
  -  </goal>
  +  <!--
  +  ==============================================================================
  +  build a formal distribution
  +  ==============================================================================
  +  -->
  +
  +  <goal name="avalon:dist" prereqs="avalon:build,avalon:site,xdist"/>
   
     <goal name="xdist"
       prereqs="xdist:build"
  @@ -328,6 +352,7 @@
           <sourcepath path="${basedir}/impl/src/java"/>
           <sourcepath path="${basedir}/util/src/java"/>
           <sourcepath path="${basedir}/main/src/java"/>
  +        <sourcepath path="${basedir}/cli/src/java"/>
           <classpath>
             <path refid="maven.dependency.classpath"/>
   	  </classpath>
  @@ -335,22 +360,85 @@
       </ant:javadoc>
     </goal>
   
  -  <postGoal name="java:prepare-filesystem">
  -    <ant:available file="${maven.home}/plugins/${repo.plugin.jar}"
  +  <!--
  +  ==============================================================================
  +  checks
  +  ==============================================================================
  +  -->
  +
  +  <goal name="validate">
  +    <ant:available file="${maven.home}/plugins/${plugin.jar}"
         property="repoPluginPresent"/>
  -    <j:if test="${repoPluginPresent != 'true'}">
  -      <ant:echo>
  +    <j:choose>
  +      <j:when test="${repoPluginPresent}">
  +        <echo>OK</echo>
  +      </j:when>
  +      <j:otherwise>
  +        <ant:echo>
   #####################################################################
   #                                                                   #
   #   WARNING:                                                        #
  -#   You do not have the required version of the avalon-repository   #
  -#   plugin installed on your system.                                #
  +#   You do not have the required version of the avalon-util-plugin  #
  +#   installed on your system.                                       #
   #   Please invoke the following command                             #
   #                                                                   #
   #     $ maven avalon:setup                                          #
   #                                                                   #
   #####################################################################</ant:echo>
  -    </j:if>
  -  </postGoal>
  +      </j:otherwise>
  +    </j:choose>
  +  </goal>
  +
  +  <goal name="avalon:setup">
  +    <echo>
  +Initiating download and installation of the Avalon Util Plugin.
  +${plugin.artifactId}-${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/${plugin.artifactId}-${plugin.version}.jar"
/> 
  +      <j:if test="${!localPlugin.exists()}"> 
  +        <j:set var="remoteFile" value="${repo}/${plugin.groupId}/plugins/${plugin.artifactId}-${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="${plugin.artifactId}-*.jar" /> 
  +          <exclude name="${plugin.artifactId}-${plugin.version}.jar" /> 
  +        </fileset> 
  +      </delete> 
  +      <delete includeEmptyDirs="true" verbose="false"> 
  +        <fileset dir="${maven.plugin.unpacked.dir}"> 
  +          <include name="*.cache"/> 
  +          <include name="**/.processed" /> 
  +          <include name="${plugin.artifactId}-*/**" /> 
  +        </fileset>
  +      </delete>
  +      <ant:move file="tmp.jar" toFile="${localPlugin}"/>
  +    </j:if> 
  +  </goal>
   
   </project>
  
  
  
  1.4       +3 -2      avalon/repository/api/src/java/org/apache/avalon/repository/Artifact.java
  
  Index: Artifact.java
  ===================================================================
  RCS file: /home/cvs/avalon/repository/api/src/java/org/apache/avalon/repository/Artifact.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Artifact.java	24 Jan 2004 23:20:04 -0000	1.3
  +++ Artifact.java	2 Feb 2004 00:41:23 -0000	1.4
  @@ -55,7 +55,8 @@
               try
               {
                   URL url = new URL( null, spec, new ArtifactHandler() );
  -                return (Artifact) url.getContent();
  +                Artifact artifact = (Artifact) url.getContent();
  +                return artifact;
               }
               catch( IOException e )
               {
  
  
  
  1.2       +3 -2      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Main.java	31 Jan 2004 13:29:50 -0000	1.1
  +++ Main.java	2 Feb 2004 00:41:23 -0000	1.2
  @@ -326,7 +326,8 @@
           StringTokenizer tokenizer = new StringTokenizer( arg, "," );
           while( tokenizer.hasMoreTokens() )
           {
  -            list.add( tokenizer.nextToken() );
  +            String next = tokenizer.nextToken();
  +            list.add( next );
           }
           return (String[]) list.toArray( new String[0] );
       }
  
  
  
  1.2       +4 -1      avalon/repository/impl/project.properties
  
  Index: project.properties
  ===================================================================
  RCS file: /home/cvs/avalon/repository/impl/project.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- project.properties	4 Dec 2003 19:34:30 -0000	1.1
  +++ project.properties	2 Feb 2004 00:41:23 -0000	1.2
  @@ -3,4 +3,7 @@
   #
   avalon.artifact.factory = org.apache.avalon.repository.impl.DefaultFactory
   
  -
  +#
  +# service export
  +#
  +avalon.artifact.export = org.apache.avalon.repository.provider.CacheManager
  
  
  
  1.5       +2 -2      avalon/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultCacheManager.java
  
  Index: DefaultCacheManager.java
  ===================================================================
  RCS file: /home/cvs/avalon/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultCacheManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultCacheManager.java	24 Jan 2004 23:20:04 -0000	1.4
  +++ DefaultCacheManager.java	2 Feb 2004 00:41:24 -0000	1.5
  @@ -51,7 +51,7 @@
    * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
    * @version $Revision$ $Date$
    */
  -public class DefaultCacheManager implements CacheManager
  +public class DefaultCacheManager implements CacheManager, DefaultCacheManagerMBean
   {
       //------------------------------------------------------------------
       // immutable state 
  
  
  
  1.1                  avalon/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultCacheManagerMBean.java
  
  Index: DefaultCacheManagerMBean.java
  ===================================================================
  /* 
   * 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.
   */
  
  package org.apache.avalon.repository.impl;
  
  import java.io.File;
  
  /**
   * A service that provides write access to a cache and support
   * for repository creation.
   *
   * @author <a href="mailto:mcconnell@osm.net">Stephen McConnell</a>
   * @version $Revision: 1.1 $ $Date: 2004/02/02 00:41:24 $
   */
  public interface DefaultCacheManagerMBean
  {        
      /**
       * Return cache root directory.
       * 
       * @return the cache directory
       */
      File getCacheDirectory();
  
  }
  
  
  
  1.17      +5 -5      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.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DefaultInitialContext.java	31 Jan 2004 13:29:50 -0000	1.16
  +++ DefaultInitialContext.java	2 Feb 2004 00:41:24 -0000	1.17
  @@ -144,9 +144,9 @@
       //------------------------------------------------------------------
           
      /** 
  -    * the instantiated delegate repository factory
  +    * The instantiated delegate repository factory.
       */
  -    private final Factory m_delegate;
  +    private final Factory m_factory;
   
      /**
       * The initial cache directory.
  @@ -310,7 +310,7 @@
   
           try
           {
  -            m_delegate = createDelegate( classloader, clazz, this );
  +            m_factory = createDelegate( classloader, clazz, this );
           }
           catch( Throwable e )
           {
  @@ -366,7 +366,7 @@
       */
       public Factory getInitialFactory()
       {
  -        return m_delegate;
  +        return m_factory;
       }
   
      /**
  
  
  

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


Mime
View raw message