You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by og...@apache.org on 2008/11/14 05:10:34 UTC
svn commit: r713915 - in /maven/mercury/trunk:
mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/version/
mercury-external/src/main/java/org/apache/maven/mercury/builder/api/
mercury-maven/ mercury-maven/mercury-compare-maven-plugin/src/...
Author: ogusakov
Date: Thu Nov 13 20:10:32 2008
New Revision: 713915
URL: http://svn.apache.org/viewvc?rev=713915&view=rev
Log:
first fixes from running comparisson tools
Added:
maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/DependencyProcessorException.java
maven/mercury/trunk/mercury-maven/maven-antrun-plugin-1.2.pom
maven/mercury/trunk/mercury-maven/results-no-mem-cache.html
maven/mercury/trunk/mercury-maven/results.html
Modified:
maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/version/MavenVersionRange.java
maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/DependencyProcessor.java
maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/MetadataReaderException.java
maven/mercury/trunk/mercury-maven/mercury-compare-maven-plugin/src/main/java/org/sonatype/maven/plugins/mercury/compare/maven/MercuryDepsMojo.java
maven/mercury/trunk/mercury-maven/mercury-compare-mdo/src/main/java/org/apache/maven/mercury/compare/DataBuilder.java
maven/mercury/trunk/mercury-maven/mercury-compare-mdo/src/main/java/org/apache/maven/mercury/compare/IDepResolver.java
maven/mercury/trunk/mercury-maven/mercury-compare-mercury/src/main/java/org/sonatype/maven/plugins/mercury/compare/MercuryResolve.java
maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java
maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryMetadataCache.java
maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/src/main/java/org/apache/maven/mercury/repository/cache/fs/MetadataCacheFs.java
maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java
maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryReaderM2.java
Modified: maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/version/MavenVersionRange.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/version/MavenVersionRange.java?rev=713915&r1=713914&r2=713915&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/version/MavenVersionRange.java (original)
+++ maven/mercury/trunk/mercury-artifact/src/main/java/org/apache/maven/mercury/artifact/version/MavenVersionRange.java Thu Nov 13 20:10:32 2008
@@ -13,7 +13,7 @@
* [1.2.3, 4.5.6] 1.2.3 <= x <= 4.5.6
* (1.2.3, 4.5.6) 1.2.3 < x < 4.5.6
* (1.2.3, 4.5.6] 1.2.3 < x <= 4.5.6
- * 1.2.3 1.2.3 <= x - this one is configurable
+ * 1.2.3 1.2.3 <= x - this one is configurable nowadays
*
* @author Oleg Gusakov
* @version $Id$
Modified: maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/DependencyProcessor.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/DependencyProcessor.java?rev=713915&r1=713914&r2=713915&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/DependencyProcessor.java (original)
+++ maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/DependencyProcessor.java Thu Nov 13 20:10:32 2008
@@ -11,17 +11,17 @@
public static final DependencyProcessor NULL_PROCESSOR =
new DependencyProcessor() {
public List<ArtifactBasicMetadata> getDependencies(
- ArtifactBasicMetadata bmd
- , MetadataReader mdReader
- , Map env
- , Map sysProps
+ ArtifactBasicMetadata bmd
+ , MetadataReader mdReader
+ , Map env
+ , Map sysProps
)
- throws MetadataReaderException
+ throws MetadataReaderException, DependencyProcessorException
{
return null;
}
};
public List<ArtifactBasicMetadata> getDependencies( ArtifactBasicMetadata bmd, MetadataReader mdReader, Map env, Map sysProps )
- throws MetadataReaderException;
+ throws MetadataReaderException, DependencyProcessorException;
}
Added: maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/DependencyProcessorException.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/DependencyProcessorException.java?rev=713915&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/DependencyProcessorException.java (added)
+++ maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/DependencyProcessorException.java Thu Nov 13 20:10:32 2008
@@ -0,0 +1,46 @@
+package org.apache.maven.mercury.builder.api;
+
+/**
+ *
+ *
+ * @author Oleg Gusakov
+ * @version $Id$
+ *
+ */
+public class DependencyProcessorException
+extends Exception
+{
+
+ /**
+ *
+ */
+ public DependencyProcessorException()
+ {
+ }
+
+ /**
+ * @param message
+ */
+ public DependencyProcessorException( String message )
+ {
+ super( message );
+ }
+
+ /**
+ * @param cause
+ */
+ public DependencyProcessorException( Throwable cause )
+ {
+ super( cause );
+ }
+
+ /**
+ * @param message
+ * @param cause
+ */
+ public DependencyProcessorException( String message, Throwable cause )
+ {
+ super( message, cause );
+ }
+
+}
Modified: maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/MetadataReaderException.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/MetadataReaderException.java?rev=713915&r1=713914&r2=713915&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/MetadataReaderException.java (original)
+++ maven/mercury/trunk/mercury-external/src/main/java/org/apache/maven/mercury/builder/api/MetadataReaderException.java Thu Nov 13 20:10:32 2008
@@ -16,39 +16,31 @@
*/
public MetadataReaderException()
{
- // TODO Auto-generated constructor stub
}
/**
* @param message
*/
- public MetadataReaderException(
- String message )
+ public MetadataReaderException( String message )
{
super( message );
- // TODO Auto-generated constructor stub
}
/**
* @param cause
*/
- public MetadataReaderException(
- Throwable cause )
+ public MetadataReaderException( Throwable cause )
{
super( cause );
- // TODO Auto-generated constructor stub
}
/**
* @param message
* @param cause
*/
- public MetadataReaderException(
- String message,
- Throwable cause )
+ public MetadataReaderException( String message, Throwable cause )
{
super( message, cause );
- // TODO Auto-generated constructor stub
}
}
Added: maven/mercury/trunk/mercury-maven/maven-antrun-plugin-1.2.pom
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-maven/maven-antrun-plugin-1.2.pom?rev=713915&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-maven/maven-antrun-plugin-1.2.pom (added)
+++ maven/mercury/trunk/mercury-maven/maven-antrun-plugin-1.2.pom Thu Nov 13 20:10:32 2008
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <artifactId>maven-plugins</artifactId>
+ <groupId>org.apache.maven.plugins</groupId>
+ <version>11</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <name>Maven AntRun Plugin</name>
+ <version>1.2</version>
+ <description>Runs Ant scripts embedded in the POM</description>
+ <prerequisites>
+ <maven>2.0.1</maven>
+ </prerequisites>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>http://jira.codehaus.org/browse/MANTRUN</url>
+ </issueManagement>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugins/tags/maven-antrun-plugin-1.2</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-antrun-plugin-1.2</developerConnection>
+ <url>http://svn.apache.org/viewvc/maven/plugins/tags/maven-antrun-plugin-1.2</url>
+ </scm>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <!-- TODO: remove when maven-plugins parent pom 12 is released -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>2.4.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>2.0-beta-7</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant-launcher</artifactId>
+ <version>1.6.5</version>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.6.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-embedder</artifactId>
+ <version>2.0.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <profiles>
+ <profile>
+ <id>integration-tests</id>
+ <activation>
+ <property>
+ <name>skipTests</name>
+ <value>!true</value>
+ </property>
+ </activation>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-invoker-plugin</artifactId>
+ <version>1.1</version>
+ <configuration>
+ <debug>true</debug>
+ <projectsDirectory>src/it</projectsDirectory>
+ <pomIncludes>
+ <pomInclude>**/pom.xml</pomInclude>
+ </pomIncludes>
+ <pomExcludes>
+ <pomExclude>pom.xml</pomExclude>
+ <pomExclude>test1/pom.xml</pomExclude>
+ <pomExclude>test3/pom.xml</pomExclude>
+ </pomExcludes>
+ </configuration>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
Modified: maven/mercury/trunk/mercury-maven/mercury-compare-maven-plugin/src/main/java/org/sonatype/maven/plugins/mercury/compare/maven/MercuryDepsMojo.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-maven/mercury-compare-maven-plugin/src/main/java/org/sonatype/maven/plugins/mercury/compare/maven/MercuryDepsMojo.java?rev=713915&r1=713914&r2=713915&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-maven/mercury-compare-maven-plugin/src/main/java/org/sonatype/maven/plugins/mercury/compare/maven/MercuryDepsMojo.java (original)
+++ maven/mercury/trunk/mercury-maven/mercury-compare-maven-plugin/src/main/java/org/sonatype/maven/plugins/mercury/compare/maven/MercuryDepsMojo.java Thu Nov 13 20:10:32 2008
@@ -1,8 +1,6 @@
package org.sonatype.maven.plugins.mercury.compare.maven;
-import java.io.BufferedWriter;
import java.io.File;
-import java.io.FileWriter;
import java.util.List;
import java.util.Set;
@@ -14,7 +12,6 @@
import org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.execution.MavenSession;
-import org.apache.maven.mercury.artifact.ArtifactMetadata;
import org.apache.maven.mercury.compare.DataBuilder;
import org.apache.maven.mercury.compare.IDepResolver;
import org.apache.maven.mercury.compare.mdo.Dependencies;
@@ -188,6 +185,11 @@
for( Artifact am : dl )
{
+ String sc = am.getScope();
+
+ if( "test".equals( sc ) || "provided".equals( sc ) )
+ continue;
+
Dependency dep = new Dependency();
dep.setGroupId( am.getGroupId() );
dep.setArtifactId( am.getArtifactId() );
@@ -203,4 +205,17 @@
}
//-----------------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------------
+ /* (non-Javadoc)
+ * @see org.apache.maven.mercury.compare.IDepResolver#visit(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void visit(
+ String groupI,
+ String artifactId,
+ String version,
+ String type )
+ throws Exception
+ {
+ // TODO Auto-generated method stub
+
+ }
}
Modified: maven/mercury/trunk/mercury-maven/mercury-compare-mdo/src/main/java/org/apache/maven/mercury/compare/DataBuilder.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-maven/mercury-compare-mdo/src/main/java/org/apache/maven/mercury/compare/DataBuilder.java?rev=713915&r1=713914&r2=713915&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-maven/mercury-compare-mdo/src/main/java/org/apache/maven/mercury/compare/DataBuilder.java (original)
+++ maven/mercury/trunk/mercury-maven/mercury-compare-mdo/src/main/java/org/apache/maven/mercury/compare/DataBuilder.java Thu Nov 13 20:10:32 2008
@@ -148,4 +148,45 @@
}
}
}
+
+ public static final void compareDeps( File deps, IDepResolver resolver )
+ throws Exception
+ {
+ if( !deps.exists() )
+ throw new Exception( "list file "+deps.getCanonicalPath()+" does not exist" );
+
+ BufferedReader r = new BufferedReader( new FileReader(deps) );
+
+ for( String line = r.readLine(); line != null; line = r.readLine() )
+ {
+ if( line.charAt( 0 ) == '#' )
+ continue;
+
+ StringTokenizer st = new StringTokenizer( line, " :" );
+
+ int count = st.countTokens();
+
+ if( count < 3 || count > 4 )
+ {
+ System.out.println( "Cannot parse line: "+line );
+ continue;
+ }
+
+ int i = 0;
+
+ String [] gav = new String[4];
+
+ while( st.hasMoreTokens() )
+ gav[i++ ] = st.nextToken();
+
+ try
+ {
+ resolver.visit( gav[0], gav[1], gav[2], count == 4 ? gav[3] : "jar" );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+ }
}
Modified: maven/mercury/trunk/mercury-maven/mercury-compare-mdo/src/main/java/org/apache/maven/mercury/compare/IDepResolver.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-maven/mercury-compare-mdo/src/main/java/org/apache/maven/mercury/compare/IDepResolver.java?rev=713915&r1=713914&r2=713915&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-maven/mercury-compare-mdo/src/main/java/org/apache/maven/mercury/compare/IDepResolver.java (original)
+++ maven/mercury/trunk/mercury-maven/mercury-compare-mdo/src/main/java/org/apache/maven/mercury/compare/IDepResolver.java Thu Nov 13 20:10:32 2008
@@ -12,4 +12,7 @@
void resolve( String groupI, String artifactId, String version, String type )
throws Exception;
+ void visit( String groupI, String artifactId, String version, String type )
+ throws Exception;
+
}
Modified: maven/mercury/trunk/mercury-maven/mercury-compare-mercury/src/main/java/org/sonatype/maven/plugins/mercury/compare/MercuryResolve.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-maven/mercury-compare-mercury/src/main/java/org/sonatype/maven/plugins/mercury/compare/MercuryResolve.java?rev=713915&r1=713914&r2=713915&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-maven/mercury-compare-mercury/src/main/java/org/sonatype/maven/plugins/mercury/compare/MercuryResolve.java (original)
+++ maven/mercury/trunk/mercury-maven/mercury-compare-mercury/src/main/java/org/sonatype/maven/plugins/mercury/compare/MercuryResolve.java Thu Nov 13 20:10:32 2008
@@ -1,15 +1,17 @@
package org.sonatype.maven.plugins.mercury.compare;
+import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
+import java.io.FileWriter;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.List;
import java.util.Properties;
import org.apache.maven.mercury.artifact.ArtifactBasicMetadata;
import org.apache.maven.mercury.artifact.ArtifactMetadata;
+import org.apache.maven.mercury.artifact.ArtifactScopeEnum;
import org.apache.maven.mercury.compare.DataBuilder;
import org.apache.maven.mercury.compare.IDepResolver;
import org.apache.maven.mercury.compare.mdo.Dependencies;
@@ -18,6 +20,7 @@
import org.apache.maven.mercury.metadata.DependencyBuilderFactory;
import org.apache.maven.mercury.metadata.MetadataTreeNode;
import org.apache.maven.mercury.repository.api.Repository;
+import org.apache.maven.mercury.repository.api.RepositoryUpdateIntervalPolicy;
import org.apache.maven.mercury.repository.local.m2.LocalRepositoryM2;
import org.apache.maven.mercury.repository.remote.m2.RemoteRepositoryM2;
import org.apache.maven.mercury.transport.api.Server;
@@ -32,20 +35,24 @@
public class MercuryResolve
implements IDepResolver
{
- static final String SYSTEM_PROPERTY_LOCAL_REPO="localRepo";
+ static final String SYSTEM_PROPERTY_LOCAL_REPO = "localRepo";
static final String localRepoDir = System.getProperty( SYSTEM_PROPERTY_LOCAL_REPO, "../localRepoMercury" );
// static final String localRepoDir = System.getProperty( SYSTEM_PROPERTY_LOCAL_REPO, "../localRepoMaven" );
static final File localRepoDirFile = new File( localRepoDir );
- static final String SYSTEM_PROPERTY_LIST_FILE="list";
+ static final String SYSTEM_PROPERTY_LIST_FILE = "list";
static final String list = System.getProperty( SYSTEM_PROPERTY_LIST_FILE, "../list.txt" );
static final File listFile = new File( list );
- static final String SYSTEM_PROPERTY_REPOS_FILE="repoList";
+ static final String SYSTEM_PROPERTY_RESULTS_FILE = "results";
+ static final String results = System.getProperty( SYSTEM_PROPERTY_RESULTS_FILE, "../results.html" );
+ static final File resultsFile = new File( results );
+
+ static final String SYSTEM_PROPERTY_REPOS_FILE = "repoList";
static final String repoList = System.getProperty( SYSTEM_PROPERTY_REPOS_FILE, "../repositories.properties" );
static final File repoListFile = new File( repoList );
- static final String SYSTEM_PROPERTY_TARGET_DIR="targetDir";
+ static final String SYSTEM_PROPERTY_TARGET_DIR = "targetDir";
static final String targetDir = System.getProperty( SYSTEM_PROPERTY_TARGET_DIR, "../deps" );
static final File targetDirFile = new File( targetDir );
@@ -54,6 +61,9 @@
static LocalRepositoryM2 lRepo;
static DependencyBuilder depBuilder;
+
+ static BufferedWriter bw;
+
//----------------------------------------------------------------
public static void main( String [] av )
@@ -74,25 +84,46 @@
lRepo = new LocalRepositoryM2( "localMercury", new File(localRepoDir) );
repos.add( lRepo );
-
- Properties rep = new Properties();
- rep.load( new FileInputStream(repoListFile) );
-
- for( Object key : rep.keySet() )
- {
- Server server = new Server( (String)key, new URL(rep.getProperty( (String)key )) );
- RemoteRepositoryM2 repo = new RemoteRepositoryM2( server );
-
- repos.add( repo );
- }
-
- depBuilder = DependencyBuilderFactory.create( DependencyBuilderFactory.JAVA_DEPENDENCY_MODEL, repos, null, null, null );
MercuryResolve mc = new MercuryResolve();
if( av == null || av.length < 1 )
+ {
+ Properties rep = new Properties();
+ rep.load( new FileInputStream(repoListFile) );
+
+ for( Object key : rep.keySet() )
+ {
+ Server server = new Server( (String)key, new URL(rep.getProperty( (String)key )) );
+ RemoteRepositoryM2 repo = new RemoteRepositoryM2( server );
+ repo.setUpdatePolicy( RepositoryUpdateIntervalPolicy.UPDATE_POLICY_NEVER );
+
+ repos.add( repo );
+ }
+
+ depBuilder = DependencyBuilderFactory.create( DependencyBuilderFactory.JAVA_DEPENDENCY_MODEL, repos, null, null, null );
+
+
DataBuilder.visitDeps( listFile, mc );
-
+ }
+ else
+ {
+ try
+ {
+ bw = new BufferedWriter( new FileWriter(resultsFile) );
+
+ bw.write( "<html><body>" );
+
+ DataBuilder.compareDeps( listFile, mc );
+
+ bw.write( "</body></html>" );
+ }
+ finally
+ {
+ if( bw != null )
+ try { bw.flush(); bw.close(); } catch( Exception e ){}
+ }
+ }
}
//------------------------------------------------------------------------
@@ -107,7 +138,10 @@
ArtifactBasicMetadata bmd = new ArtifactBasicMetadata( ac );
- MetadataTreeNode root = depBuilder.buildTree( bmd, null );
+ MetadataTreeNode root = depBuilder.buildTree( bmd, ArtifactScopeEnum.runtime );
+
+ showNode( root, 0 );
+
long ll = System.currentTimeMillis();
System.out.println("BuildTree: " + (ll - start) );
@@ -155,9 +189,102 @@
}
- private void compare( Collection<ArtifactBasicMetadata> r1, Collection<ArtifactBasicMetadata> r2 )
+ public void visit( String groupId, String artifactId, String version, String type )
+ throws Exception
+ {
+ String ac = groupId+":"+artifactId+":"+version+"::"+type;
+
+ System.out.println("\n-------> "+ac);
+
+ ArtifactBasicMetadata bmd = new ArtifactBasicMetadata( ac );
+
+ File df = DataBuilder.getFile( targetDirFile, bmd.getGroupId(), bmd.getArtifactId(), bmd.getVersion(), bmd.getType() );
+
+ if( ! df.exists() )
+ return;
+
+ System.out.println( df.getCanonicalPath() );
+
+ Dependencies deps = null;
+
+ deps = DataBuilder.read( df );
+
+ if( deps.getMercuryMillis() == 0L || deps.getMavenMillis() == 0L )
+ return;
+
+ List<Dependency> mavenDeps = deps.getMaven();
+ List<Dependency> mercuryDeps = deps.getMercury();
+
+ if( mavenDeps.size() < 2 || mercuryDeps.size() < 2 )
+ return;
+
+ bw.write( "<table border='1'><tr><th colspan='2'>"+bmd.toString()+"</th></tr>\n" );
+
+ bw.write( "\n<tr><th>Maven: "+mavenDeps.size()+" deps in "+deps.getMavenMillis()+" millis</th>"
+ + "<th>Mercury: "+mercuryDeps.size()+" deps in "+deps.getMercuryMillis()+" millis</th></tr><tr>\n"
+ );
+
+ bw.write( "\n<td>\n" );
+ for( Dependency d : mavenDeps )
+ {
+ if( contains( d, mercuryDeps ) )
+ continue;
+
+ String bad = d.getGroupId()+":"+d.getArtifactId()+":"+d.getVersion()+"::"+d.getType()+":"+d.getScope();
+
+ System.out.println(" Maven, not mercury: "+ bad );
+
+ bw.write( bad+"<br/>\n" );
+ }
+ bw.write( "\n</td>\n" );
+
+ bw.write( "\n<td>\n" );
+ for( Dependency d : mercuryDeps )
+ {
+ if( contains( d, mavenDeps ) )
+ continue;
+
+ String bad = d.getGroupId()+":"+d.getArtifactId()+":"+d.getVersion()+"::"+d.getType()+":"+d.getScope();
+
+ System.out.println(" Mercury, not maven: "+ bad );
+
+ bw.write( bad+"<br/>\n" );
+ }
+ bw.write( "\n</td>\n" );
+
+ bw.write( "\n</tr></table><br/><br/><br/><br/>\n" );
+ }
+
+ private static boolean contains( Dependency dep, List<Dependency> dl )
+ {
+ for( Dependency d : dl )
+ {
+ if(
+ d.getGroupId().equals( dep.getGroupId() )
+ && d.getArtifactId().equals( dep.getArtifactId() )
+ && d.getVersion().equals( dep.getVersion() )
+// && Util.nvlS( d.getScope(), "compile" ).equals( Util.nvlS( dep.getScope(), "compile" ) )
+ )
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+ //----------------------------------------------------------------
+ private static final void showNode( MetadataTreeNode n, int level )
{
+ for( int i=0; i<level; i++ )
+ System.out.print(" ");
+
+ System.out.println( level+"."+n.getMd() );
+
+ if( n.hasChildren() )
+ {
+ for( MetadataTreeNode kid : n.getChildren() )
+ showNode( kid, level+1 );
+ }
}
- //----------------------------------------------------------------
+ //----------------------------------------------------------------
//----------------------------------------------------------------
}
Added: maven/mercury/trunk/mercury-maven/results-no-mem-cache.html
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-maven/results-no-mem-cache.html?rev=713915&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-maven/results-no-mem-cache.html (added)
+++ maven/mercury/trunk/mercury-maven/results-no-mem-cache.html Thu Nov 13 20:10:32 2008
@@ -0,0 +1,178 @@
+<html><body><table border='1'><tr><th colspan='2'>asm:asm-xml:3.0::jar</th></tr>
+
+<tr><th>Maven: 23</th><th>Mercury: 417</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-antrun-plugin:1.2::jar</th></tr>
+
+<tr><th>Maven: 338</th><th>Mercury: 366</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+xerces:xercesImpl:2.6.2::jar:compile<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-clean-plugin:2.2::jar</th></tr>
+
+<tr><th>Maven: 221</th><th>Mercury: 462</th></tr><tr>
+
+<td>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-8::jar:compile<br/>
+org.apache.maven.wagon:wagon-provider-api:1.0-alpha-5::jar:compile<br/>
+
+</td>
+
+<td>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-9::jar:runtime<br/>
+org.apache.maven.wagon:wagon-provider-api:1.0-alpha-6::jar:runtime<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-compiler-plugin:2.0.2::jar</th></tr>
+
+<tr><th>Maven: 70</th><th>Mercury: 123</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-ear-plugin:2.3.1::jar</th></tr>
+
+<tr><th>Maven: 50</th><th>Mercury: 384</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-eclipse-plugin:2.4::jar</th></tr>
+
+<tr><th>Maven: 107</th><th>Mercury: 708</th></tr><tr>
+
+<td>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-8::jar:compile<br/>
+
+</td>
+
+<td>
+org.apache.maven:maven-settings:2.0.6::jar:compile<br/>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1::jar:runtime<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-ejb-plugin:2.1::jar</th></tr>
+
+<tr><th>Maven: 24</th><th>Mercury: 207</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-install-plugin:2.2::jar</th></tr>
+
+<tr><th>Maven: 29</th><th>Mercury: 448</th></tr><tr>
+
+<td>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1::jar:compile<br/>
+
+</td>
+
+<td>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-8::jar:compile<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-rar-plugin:2.2::jar</th></tr>
+
+<tr><th>Maven: 48</th><th>Mercury: 236</th></tr><tr>
+
+<td>
+org.codehaus.plexus:plexus-utils:1.0.4::jar:compile<br/>
+
+</td>
+
+<td>
+org.codehaus.plexus:plexus-utils:1.1::jar:compile<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-shade-plugin:1.1::jar</th></tr>
+
+<tr><th>Maven: 13</th><th>Mercury: 971</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+xml-apis:xml-apis:1.0.b2::jar:compile<br/>
+saxpath:saxpath:1.0-FCS::jar:compile<br/>
+jaxen:jaxen:1.0-FCS::jar:compile<br/>
+junit:junit:3.8.1::jar:runtime<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-source-plugin:2.0.4::jar</th></tr>
+
+<tr><th>Maven: 13</th><th>Mercury: 225</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+junit:junit:3.8.1::jar:compile<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-surefire-report-plugin:2.4.3::jar</th></tr>
+
+<tr><th>Maven: 49</th><th>Mercury: 243</th></tr><tr>
+
+<td>
+org.codehaus.plexus:plexus-utils:1.1::jar:compile<br/>
+
+</td>
+
+<td>
+plexus:plexus-utils:1.0.2::jar:compile<br/>
+org.codehaus.plexus:plexus-utils:1.0.4::jar:compile<br/>
+junit:junit:3.8.1::jar:runtime<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+</body></html>
\ No newline at end of file
Added: maven/mercury/trunk/mercury-maven/results.html
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-maven/results.html?rev=713915&view=auto
==============================================================================
--- maven/mercury/trunk/mercury-maven/results.html (added)
+++ maven/mercury/trunk/mercury-maven/results.html Thu Nov 13 20:10:32 2008
@@ -0,0 +1,213 @@
+<html><body><table border='1'><tr><th colspan='2'>asm:asm-xml:3.0::jar</th></tr>
+
+<tr><th>Maven: 4 deps in 55 millis</th><th>Mercury: 4 deps in 564 millis</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-antrun-plugin:1.2::jar</th></tr>
+
+<tr><th>Maven: 15 deps in 200 millis</th><th>Mercury: 16 deps in 452 millis</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+xerces:xercesImpl:2.6.2::jar:compile<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-checkstyle-plugin:2.1::jar</th></tr>
+
+<tr><th>Maven: 29 deps in 49 millis</th><th>Mercury: 32 deps in 442 millis</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+plexus:plexus-utils:1.0.2::jar:compile<br/>
+log4j:log4j:1.2.6::jar:runtime<br/>
+logkit:logkit:1.0.1::jar:runtime<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-clean-plugin:2.2::jar</th></tr>
+
+<tr><th>Maven: 15 deps in 80 millis</th><th>Mercury: 15 deps in 436 millis</th></tr><tr>
+
+<td>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-8::jar:compile<br/>
+org.apache.maven.wagon:wagon-provider-api:1.0-alpha-5::jar:compile<br/>
+
+</td>
+
+<td>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-9::jar:runtime<br/>
+org.apache.maven.wagon:wagon-provider-api:1.0-alpha-6::jar:runtime<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-compiler-plugin:2.0.2::jar</th></tr>
+
+<tr><th>Maven: 10 deps in 35 millis</th><th>Mercury: 10 deps in 136 millis</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-ear-plugin:2.3.1::jar</th></tr>
+
+<tr><th>Maven: 16 deps in 47 millis</th><th>Mercury: 16 deps in 467 millis</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-eclipse-plugin:2.4::jar</th></tr>
+
+<tr><th>Maven: 20 deps in 64 millis</th><th>Mercury: 21 deps in 793 millis</th></tr><tr>
+
+<td>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-8::jar:compile<br/>
+
+</td>
+
+<td>
+org.apache.maven:maven-settings:2.0.6::jar:compile<br/>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1::jar:runtime<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-ejb-plugin:2.1::jar</th></tr>
+
+<tr><th>Maven: 15 deps in 14 millis</th><th>Mercury: 15 deps in 214 millis</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-install-plugin:2.2::jar</th></tr>
+
+<tr><th>Maven: 16 deps in 23 millis</th><th>Mercury: 16 deps in 487 millis</th></tr><tr>
+
+<td>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1::jar:compile<br/>
+
+</td>
+
+<td>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-8::jar:compile<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-jar-plugin:2.2::jar</th></tr>
+
+<tr><th>Maven: 19 deps in 208 millis</th><th>Mercury: 21 deps in 824 millis</th></tr><tr>
+
+<td>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-9-stable-1::jar:compile<br/>
+
+</td>
+
+<td>
+org.codehaus.plexus:plexus-classworlds:1.2-alpha-7::jar:runtime<br/>
+org.codehaus.plexus:plexus-component-api:1.0-alpha-16::jar:runtime<br/>
+org.codehaus.plexus:plexus-container-default:1.0-alpha-15::jar:runtime<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-rar-plugin:2.2::jar</th></tr>
+
+<tr><th>Maven: 15 deps in 11 millis</th><th>Mercury: 15 deps in 224 millis</th></tr><tr>
+
+<td>
+org.codehaus.plexus:plexus-utils:1.0.4::jar:compile<br/>
+
+</td>
+
+<td>
+org.codehaus.plexus:plexus-utils:1.1::jar:compile<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-shade-plugin:1.1::jar</th></tr>
+
+<tr><th>Maven: 20 deps in 19 millis</th><th>Mercury: 26 deps in 1054 millis</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+xml-apis:xml-apis:1.0.b2::jar:compile<br/>
+xerces:xercesImpl:2.6.0::jar:compile<br/>
+saxpath:saxpath:1.0-FCS::jar:compile<br/>
+xalan:xalan:2.5.0::jar:compile<br/>
+jaxen:jaxen:1.0-FCS::jar:compile<br/>
+junit:junit:3.8.1::jar:runtime<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-source-plugin:2.0.4::jar</th></tr>
+
+<tr><th>Maven: 13 deps in 12 millis</th><th>Mercury: 14 deps in 221 millis</th></tr><tr>
+
+<td>
+
+</td>
+
+<td>
+junit:junit:3.8.1::jar:compile<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+<table border='1'><tr><th colspan='2'>org.apache.maven.plugins:maven-surefire-report-plugin:2.4.3::jar</th></tr>
+
+<tr><th>Maven: 18 deps in 17 millis</th><th>Mercury: 20 deps in 262 millis</th></tr><tr>
+
+<td>
+org.codehaus.plexus:plexus-utils:1.1::jar:compile<br/>
+
+</td>
+
+<td>
+plexus:plexus-utils:1.0.2::jar:compile<br/>
+org.codehaus.plexus:plexus-utils:1.0.4::jar:compile<br/>
+junit:junit:3.8.1::jar:runtime<br/>
+
+</td>
+
+</tr></table><br/><br/><br/><br/>
+</body></html>
\ No newline at end of file
Modified: maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java?rev=713915&r1=713914&r2=713915&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java (original)
+++ maven/mercury/trunk/mercury-md/mercury-md-sat/src/main/java/org/apache/maven/mercury/metadata/DependencyTreeBuilder.java Thu Nov 13 20:10:32 2008
@@ -100,7 +100,7 @@
throw new MetadataTreeException(e);
}
- existingNodes = new HashMap<String, MetadataTreeNode>(128);
+ existingNodes = new HashMap<String, MetadataTreeNode>(256);
MetadataTreeNode root = createNode( startMD, null, startMD, treeScope );
Modified: maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryMetadataCache.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryMetadataCache.java?rev=713915&r1=713914&r2=713915&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryMetadataCache.java (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-api/src/main/java/org/apache/maven/mercury/repository/api/RepositoryMetadataCache.java Thu Nov 13 20:10:32 2008
@@ -59,7 +59,7 @@
/**
* find cached raw data. Raw data is different from metadata in a sense
- * that it does not expire does not expire, so it's either found or not.
+ * that it does not expire, so it's either found or not.
* This call is crafted for caching POMs and thus ignores classifier
*
* @param bmd
@@ -71,7 +71,7 @@
/**
* cache raw data. Raw data is different from metadata in a sense
- * that it does not expire does not expire, so it's either found or not
+ * that it does not expire, so it's either found or not
* This call is crafted for caching POMs and thus ignores classifier
*
* @param bmd
Modified: maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/src/main/java/org/apache/maven/mercury/repository/cache/fs/MetadataCacheFs.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/src/main/java/org/apache/maven/mercury/repository/cache/fs/MetadataCacheFs.java?rev=713915&r1=713914&r2=713915&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/src/main/java/org/apache/maven/mercury/repository/cache/fs/MetadataCacheFs.java (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-cache-fs/src/main/java/org/apache/maven/mercury/repository/cache/fs/MetadataCacheFs.java Thu Nov 13 20:10:32 2008
@@ -38,8 +38,15 @@
static volatile Map<String, MetadataCacheFs> fsCaches = Collections.synchronizedMap( new HashMap<String, MetadataCacheFs>(2) );
- volatile HashMap<String, RepositoryGAMetadata> gaCache;
- volatile HashMap<String, RepositoryGAVMetadata> gavCache;
+ // store resolved cached data in memory
+ private volatile Map<String, RepositoryGAMetadata> gaCache
+ = (Map<String, RepositoryGAMetadata>)Collections.synchronizedMap( new HashMap<String, RepositoryGAMetadata>(512) );
+
+ private volatile Map<String, RepositoryGAVMetadata> gavCache
+ = (Map<String, RepositoryGAVMetadata>)Collections.synchronizedMap( new HashMap<String, RepositoryGAVMetadata>(1024) );
+
+ private volatile Map<String, byte []> rawCache
+ = (Map<String, byte []>)Collections.synchronizedMap( new HashMap<String, byte []>(1024) );
private File root;
@@ -84,6 +91,13 @@
{
try
{
+ String gaKey = getGAKey(coord);
+
+ RepositoryGAMetadata inMem = gaCache.get( gaKey );
+
+ if( inMem != null )
+ return inMem;
+
File gaDir = getGADir(coord);
File gamF = getGAFile( gaDir, repoGuid );
@@ -102,6 +116,8 @@
}
}
+ gaCache.put( gaKey, md );
+
return md;
}
catch( Exception e )
@@ -116,6 +132,13 @@
FileLockBundle lock = null;
try
{
+ String gavKey = getGAVKey(coord);
+
+ RepositoryGAVMetadata inMem = gavCache.get( gavKey );
+
+ if( inMem != null )
+ return inMem;
+
File gavDir = getGAVDir( coord );
lock = FileUtil.lockDir( gavDir.getCanonicalPath(), 500L, 5L );
@@ -132,6 +155,8 @@
md.setExpired( true );
}
+ gavCache.put( gavKey, md );
+
return md;
}
catch( Exception e )
@@ -150,6 +175,8 @@
FileLockBundle lock = null;
try
{
+ String gaKey = getGAKey( gam.getGA() );
+
File gaDir = getGADir( gam.getGA() );
lock = FileUtil.lockDir( gaDir.getCanonicalPath(), 500L, 5L );
@@ -159,6 +186,8 @@
CachedGAMetadata md = new CachedGAMetadata( gam );
md.cm.save( gamF );
+
+ gaCache.put( gaKey, md );
}
catch( Exception e )
{
@@ -178,6 +207,8 @@
{
try
{
+ String gavKey = getGAKey( gavm.getGAV() );
+
File gavDir = getGAVDir( gavm.getGAV() );
File gavmF = getGAVFile( gavDir, repoGuid );
@@ -185,6 +216,8 @@
CachedGAVMetadata md = new CachedGAVMetadata( gavm );
md.cm.save( gavmF );
+
+ gavCache.put( gavKey, md );
}
catch( Exception e )
{
@@ -197,6 +230,13 @@
{
try
{
+ String rawKey = bmd.getGAV();
+
+ byte [] res = rawCache.get( rawKey );
+
+ if( res != null )
+ return res;
+
// locking is provided by underlying OS, don't waste the effort
File f = new File( getGAVDir( bmd.getEffectiveCoordinates() )
, bmd.getArtifactId()+FileUtil.DASH+bmd.getVersion()+"."+bmd.getType()
@@ -205,7 +245,11 @@
if( ! f.exists() )
return null;
- return FileUtil.readRawData( f );
+ res = FileUtil.readRawData( f );
+
+ rawCache.put( rawKey, res );
+
+ return res;
}
catch( IOException e )
{
@@ -219,6 +263,10 @@
// locking is provided by underlying OS, don't waste the effort
try
{
+ String rawKey = bmd.getGAV();
+
+ rawCache.put( rawKey, rawBytes );
+
File f = new File( getGAVDir( bmd.getEffectiveCoordinates() )
, bmd.getArtifactId()+FileUtil.DASH+bmd.getVersion()+"."+bmd.getType()
);
@@ -230,7 +278,17 @@
throw new MetadataCacheException( e.getMessage() );
}
}
+ //---------------------------------------------------------------------------------------
+ private String getGAKey( ArtifactCoordinates coord )
+ {
+ return coord.getGroupId()+":"+coord.getArtifactId();
+ }
+ private String getGAVKey( ArtifactCoordinates coord )
+ {
+ return coord.getGroupId()+":"+coord.getArtifactId()+":"+coord.getVersion();
+ }
+
private File getGADir( ArtifactCoordinates coord )
{
File dir = new File( root, coord.getGroupId()+FileUtil.SEP+coord.getArtifactId() );
Modified: maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java?rev=713915&r1=713914&r2=713915&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-local-m2/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java Thu Nov 13 20:10:32 2008
@@ -362,7 +362,7 @@
//}
ror = ArtifactBasicResults.add( ror, bmd, deps );
}
- catch( MetadataReaderException e )
+ catch( Exception e )
{
_log.warn( "error reading "+bmd.toString()+" dependencies", e );
continue;
Modified: maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryReaderM2.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryReaderM2.java?rev=713915&r1=713914&r2=713915&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryReaderM2.java (original)
+++ maven/mercury/trunk/mercury-repo/mercury-repo-remote-m2/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryReaderM2.java Thu Nov 13 20:10:32 2008
@@ -403,7 +403,7 @@
);
ror.add( bmd, deps );
}
- catch( MetadataReaderException e )
+ catch( Exception e )
{
_log.warn( "error reading "+bmd.toString()+" dependencies", e );
continue;
@@ -438,6 +438,9 @@
_log.error( _lang.getMessage( "cached.data.problem", e.getMessage(), bmd.toString() ) );
}
}
+
+ if( _log.isDebugEnabled() )
+ _log.debug( _repo.getId()+": did not find in the cache - go out for "+bmd );
// no cached data, or it has expired - read from repository
byte[] mavenMetadata = readRawData( loc.getGaPath()+FileUtil.SEP+_repo.getMetadataName() );
@@ -474,8 +477,7 @@
* direct metadata search, no redirects, first attempt
*/
public ArtifactBasicResults readVersions( Collection<ArtifactBasicMetadata> query )
- throws RepositoryException,
- IllegalArgumentException
+ throws RepositoryException
{
if( query == null || query.size() < 1 )
return null;