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 2009/04/28 01:12:32 UTC

svn commit: r769199 [6/19] - in /maven/mercury/trunk: mercury-ant-tasks/src/main/java/org/apache/maven/mercury/ant/tasks/ mercury-ant-tasks/src/test/java/org/apache/maven/mercury/ant/tasks/ mercury-core/src/main/java/org/apache/maven/mercury/artifact/ ...

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/cache/fs/CachedMetadata.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/cache/fs/CachedMetadata.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/cache/fs/CachedMetadata.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/cache/fs/CachedMetadata.java Mon Apr 27 23:12:25 2009
@@ -40,190 +40,189 @@
 
 /**
  * metadata serialization helper - saves/restores element/attribute xml.
- *
+ * 
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 class CachedMetadata
 {
-  private static final Language LANG = new DefaultLanguage( CachedMetadata.class );
-  
-  private CachedRawMetadata crm;
-  
-  private File mdFile;
-  
-  private static CachedRawMetadata readRawMetadata( File mdFile )
-  throws FileNotFoundException, IOException, XmlPullParserException
-  {
-    CachedMetadataXpp3Reader reader = new CachedMetadataXpp3Reader();
-    return reader.read( new FileReader(mdFile) );
-  }
-  
-  private static void writeRawMetadata( CachedRawMetadata cmd, File mdFile )
-  throws FileNotFoundException, IOException, XmlPullParserException
-  {
-    CachedMetadataXpp3Writer writer = new CachedMetadataXpp3Writer();
-    writer.write( new FileWriter(mdFile), cmd );
-  }
-
-  protected CachedMetadata()
-  {
-    crm = new CachedRawMetadata();
-  }
-
-  protected CachedMetadata( File mdFile )
-  throws FileNotFoundException, IOException, XmlPullParserException
-  {
-    if( mdFile.exists() )
-      crm = readRawMetadata( mdFile );
-    else
-      crm = new CachedRawMetadata();
-    
-    this.mdFile = mdFile;
-  }
-
-  public void save( File mdFile )
-  throws FileNotFoundException, IOException, XmlPullParserException
-  {
-    writeRawMetadata( crm, mdFile );
-  }
-  
-  protected Element findElement( String elem )
-  {
-    List<Element> el = crm.getElements();
-    if( Util.isEmpty( el ) )
-    {
-      el = new ArrayList<Element>();
-      crm.setElements( el );
-    }
-    
-    Element e = null;
-    
-    for( Element le : el )
-      if( le.getName().equals( elem ) )
-      {
-        e = le;
-        break;
-      }
-    
-    if( e == null )
-    {
-      e = new Element();
-      e.setName( elem );
-      el.add( e );
-    }
-    
-    return e;
-  }
-
-  protected void cleanAttribute( Element e, String attr  )
-  {
-    List<Attribute> al = e.getAttributes();
-
-    if( Util.isEmpty( al ))
-      return;
-
-    int sz = al.size();
-    
-    for( int i= (sz-1); i >= 0; i-- )
-    {
-      Attribute a = al.get( i );
-      if( a.getName().equals( attr ) )
-        al.remove( i );
-    }
-  }
-  
-  protected List<String> findAttributes( Element e, String attr  )
-  {
-    List<Attribute> al = e.getAttributes();
-
-    if( Util.isEmpty( al ))
-    {
-      al = new ArrayList<Attribute>();
-      e.setAttributes( al );
-      return null;
-    }
-    
-    List<String> a = null;
-    
-    for( Attribute la : al )
-      if( la.getName().equals( attr ) )
-      {
-        if( a == null )
-          a = new ArrayList<String>();
-        a.add( la.getValue() );
-      }
-    
-    return a;
-  }
-  
-  protected List<String> findAttributes( String elem, String attr  )
-  {
-    Element e = findElement( elem );
-    return findAttributes( e, attr );
-  }
-  
-  protected String getAttribute( String elem, String attr, boolean mandatory  )
-  throws MetadataCorruptionException
-  {
-    Element e = findElement( elem );
-    
-    List<String> a = findAttributes( e, attr );
-    
-    if( Util.isEmpty( a ) )
-      if( mandatory )
-        throw new MetadataCorruptionException(  LANG.getMessage( "no.mandatory.attribute", elem, attr ) );
-      else 
-        return null;
-    
-    return a.get( 0 );
-  }
-  
-  protected void addAttribute( Element e, String attr, String val )
-  {
-    List<Attribute> al = e.getAttributes();
-    if( al == null )
-    {
-      al = new ArrayList<Attribute>();
-      e.setAttributes( al );
-    }
-    
-    Attribute a = new Attribute();
-    a.setName( attr );
-    a.setValue( val );
-    
-    al.add( a );
-  }
-  
-  protected void setAttribute( String elem, String attr, String val)
-  {
-    Element e = findElement( elem );
-    cleanAttribute( e, attr );
-    addAttribute( e, attr, val );
-  }
-
-  protected void setAttribute( String elem, String attr, Collection<String> vals )
-  {
-    Element e = findElement( elem );
-    cleanAttribute( e, attr );
-    for( String val : vals )
-      addAttribute( e, attr, val );
-  }
-  
-  protected void setLastUpdate( String lastUpdated )
-  {
-    crm.setLastUpdated( lastUpdated );
-  }
-  
-  protected String getLastUpdate()
-  {
-    return crm.getLastUpdated();
-  }
-  
-  protected void clean()
-  {
-    crm.setElements( null );
-  }
+    private static final Language LANG = new DefaultLanguage( CachedMetadata.class );
+
+    private CachedRawMetadata crm;
+
+    private File mdFile;
+
+    private static CachedRawMetadata readRawMetadata( File mdFile )
+        throws FileNotFoundException, IOException, XmlPullParserException
+    {
+        CachedMetadataXpp3Reader reader = new CachedMetadataXpp3Reader();
+        return reader.read( new FileReader( mdFile ) );
+    }
+
+    private static void writeRawMetadata( CachedRawMetadata cmd, File mdFile )
+        throws FileNotFoundException, IOException, XmlPullParserException
+    {
+        CachedMetadataXpp3Writer writer = new CachedMetadataXpp3Writer();
+        writer.write( new FileWriter( mdFile ), cmd );
+    }
+
+    protected CachedMetadata()
+    {
+        crm = new CachedRawMetadata();
+    }
+
+    protected CachedMetadata( File mdFile )
+        throws FileNotFoundException, IOException, XmlPullParserException
+    {
+        if ( mdFile.exists() )
+            crm = readRawMetadata( mdFile );
+        else
+            crm = new CachedRawMetadata();
+
+        this.mdFile = mdFile;
+    }
+
+    public void save( File mdFile )
+        throws FileNotFoundException, IOException, XmlPullParserException
+    {
+        writeRawMetadata( crm, mdFile );
+    }
+
+    protected Element findElement( String elem )
+    {
+        List<Element> el = crm.getElements();
+        if ( Util.isEmpty( el ) )
+        {
+            el = new ArrayList<Element>();
+            crm.setElements( el );
+        }
+
+        Element e = null;
+
+        for ( Element le : el )
+            if ( le.getName().equals( elem ) )
+            {
+                e = le;
+                break;
+            }
+
+        if ( e == null )
+        {
+            e = new Element();
+            e.setName( elem );
+            el.add( e );
+        }
+
+        return e;
+    }
+
+    protected void cleanAttribute( Element e, String attr )
+    {
+        List<Attribute> al = e.getAttributes();
+
+        if ( Util.isEmpty( al ) )
+            return;
+
+        int sz = al.size();
+
+        for ( int i = ( sz - 1 ); i >= 0; i-- )
+        {
+            Attribute a = al.get( i );
+            if ( a.getName().equals( attr ) )
+                al.remove( i );
+        }
+    }
+
+    protected List<String> findAttributes( Element e, String attr )
+    {
+        List<Attribute> al = e.getAttributes();
+
+        if ( Util.isEmpty( al ) )
+        {
+            al = new ArrayList<Attribute>();
+            e.setAttributes( al );
+            return null;
+        }
+
+        List<String> a = null;
+
+        for ( Attribute la : al )
+            if ( la.getName().equals( attr ) )
+            {
+                if ( a == null )
+                    a = new ArrayList<String>();
+                a.add( la.getValue() );
+            }
+
+        return a;
+    }
+
+    protected List<String> findAttributes( String elem, String attr )
+    {
+        Element e = findElement( elem );
+        return findAttributes( e, attr );
+    }
+
+    protected String getAttribute( String elem, String attr, boolean mandatory )
+        throws MetadataCorruptionException
+    {
+        Element e = findElement( elem );
+
+        List<String> a = findAttributes( e, attr );
+
+        if ( Util.isEmpty( a ) )
+            if ( mandatory )
+                throw new MetadataCorruptionException( LANG.getMessage( "no.mandatory.attribute", elem, attr ) );
+            else
+                return null;
+
+        return a.get( 0 );
+    }
+
+    protected void addAttribute( Element e, String attr, String val )
+    {
+        List<Attribute> al = e.getAttributes();
+        if ( al == null )
+        {
+            al = new ArrayList<Attribute>();
+            e.setAttributes( al );
+        }
+
+        Attribute a = new Attribute();
+        a.setName( attr );
+        a.setValue( val );
+
+        al.add( a );
+    }
+
+    protected void setAttribute( String elem, String attr, String val )
+    {
+        Element e = findElement( elem );
+        cleanAttribute( e, attr );
+        addAttribute( e, attr, val );
+    }
+
+    protected void setAttribute( String elem, String attr, Collection<String> vals )
+    {
+        Element e = findElement( elem );
+        cleanAttribute( e, attr );
+        for ( String val : vals )
+            addAttribute( e, attr, val );
+    }
+
+    protected void setLastUpdate( String lastUpdated )
+    {
+        crm.setLastUpdated( lastUpdated );
+    }
+
+    protected String getLastUpdate()
+    {
+        return crm.getLastUpdated();
+    }
+
+    protected void clean()
+    {
+        crm.setElements( null );
+    }
 
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/cache/fs/MetadataCacheFs.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/cache/fs/MetadataCacheFs.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/cache/fs/MetadataCacheFs.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/cache/fs/MetadataCacheFs.java Mon Apr 27 23:12:25 2009
@@ -134,15 +134,10 @@
             if ( inMem != null )
             {
                 // im-memory never expires!
-/*                
-                long lastCheckMillis = inMem.getLastCheckMillis();
-
-                if ( up.timestampExpired( lastCheckMillis, null ) )
-                {
-                    inMem.setExpired( true );
-                    gaCache.put( gaKey, inMem );
-                }
-*/
+                /*
+                 * long lastCheckMillis = inMem.getLastCheckMillis(); if ( up.timestampExpired( lastCheckMillis, null )
+                 * ) { inMem.setExpired( true ); gaCache.put( gaKey, inMem ); }
+                 */
                 if ( _eventManager != null )
                     event.setResult( "found in memory, expired is " + inMem.isExpired() );
 
@@ -218,15 +213,10 @@
 
             if ( inMem != null )
             {
-/*
-                long lastCheckMillis = inMem.getLastCheckMillis();
-
-                if ( up.timestampExpired( lastCheckMillis, null ) )
-                {
-                    inMem.setExpired( true );
-                    gavCache.put( gavKey, inMem );
-                }
-*/                
+                /*
+                 * long lastCheckMillis = inMem.getLastCheckMillis(); if ( up.timestampExpired( lastCheckMillis, null )
+                 * ) { inMem.setExpired( true ); gavCache.put( gavKey, inMem ); }
+                 */
 
                 if ( _eventManager != null )
                     event.setResult( "found in memory, expired is " + inMem.isExpired() );

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/ArtifactLocation.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/ArtifactLocation.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/ArtifactLocation.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/ArtifactLocation.java Mon Apr 27 23:12:25 2009
@@ -23,157 +23,177 @@
 import org.apache.maven.mercury.util.FileUtil;
 
 /**
- * artifact relative location data object - used by repositories to hold on to intermediate path calculations 
- *
- *
+ * artifact relative location data object - used by repositories to hold on to intermediate path calculations
+ * 
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public class ArtifactLocation
 {
-  public static final String POM_EXT = ".pom";
+    public static final String POM_EXT = ".pom";
+
+    private String prefix;
+
+    private String gaPath;
+
+    private String versionDir;
+
+    private String baseName;
+
+    private String version;
+
+    private String classifier;
+
+    private String type;
+
+    private ArtifactMetadata bmd;
+
+    public ArtifactLocation( String prefix, ArtifactMetadata bmd )
+    {
+        if ( prefix == null || bmd == null || bmd.getGroupId() == null || bmd.getArtifactId() == null
+            || bmd.getVersion() == null )
+            return;
+
+        this.bmd = bmd;
+
+        this.prefix = prefix;
+        this.gaPath = bmd.getGroupId().replace( '.', FileUtil.SEP_CHAR ) + FileUtil.SEP + bmd.getArtifactId();
+        this.version = bmd.getVersion();
+        this.baseName = bmd.getArtifactId();
+        this.versionDir = this.version;
+        this.classifier = bmd.getClassifier();
+        this.type = bmd.getType();
+    }
+
+    public String getRelPath()
+    {
+        return gaPath + FileUtil.SEP + versionDir + FileUtil.SEP + baseName + FileUtil.DASH + version
+            + getDashedClassifier() + '.' + type;
+    }
+
+    public String getRelPomPath()
+    {
+        return gaPath + FileUtil.SEP + versionDir + FileUtil.SEP + baseName + FileUtil.DASH + version + POM_EXT;
+    }
+
+    public String getAbsPath()
+    {
+        if ( prefix == null )
+            return null;
+
+        return getSeparatedPrefix() + getRelPath();
+    }
+
+    public String getAbsPomPath()
+    {
+        if ( prefix == null )
+            return null;
+
+        return getSeparatedPrefix() + getRelPomPath();
+    }
+
+    public String getGavPath()
+    {
+        return getGaPath() + FileUtil.SEP + versionDir;
+    }
+
+    public String getBaseVersion()
+    {
+        if ( version == null )
+            return null;
+
+        DefaultArtifactVersion dav = new DefaultArtifactVersion( version );
+        return dav.getBase();
+    }
+
+    // ---------------------------------------------------------
+    public String getGaPath()
+    {
+        return gaPath;
+    }
+
+    public void setGaPath( String gaPath )
+    {
+        this.gaPath = gaPath;
+    }
+
+    public String getVersionDir()
+    {
+        return versionDir;
+    }
+
+    public void setVersionDir( String versionDir )
+    {
+        this.versionDir = versionDir;
+    }
+
+    public String getBaseName()
+    {
+        return baseName;
+    }
+
+    public void setBaseName( String baseName )
+    {
+        this.baseName = baseName;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
+    }
+
+    public String getClassifier()
+    {
+        return classifier;
+    }
+
+    public String getDashedClassifier()
+    {
+        return ( classifier == null || classifier.length() < 1 ) ? "" : FileUtil.DASH + classifier;
+    }
+
+    public void setClassifier( String classifier )
+    {
+        this.classifier = classifier;
+    }
+
+    public String getType()
+    {
+        return type;
+    }
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+    public String getPrefix()
+    {
+        return prefix;
+    }
+
+    public String getSeparatedPrefix()
+    {
+        if ( prefix == null )
+            return null;
+
+        return prefix + ( prefix.endsWith( FileUtil.SEP ) ? "" : FileUtil.SEP );
+    }
+
+    public void setPrefix( String prefix )
+    {
+        this.prefix = prefix;
+    }
+
+    @Override
+    public String toString()
+    {
+        return bmd == null ? "no ArtifactBasicMetadata" : bmd.toString();
+    }
 
-  private String prefix;
-  
-  private String gaPath;
-  private String versionDir;
-  private String baseName;
-  private String version;
-  private String classifier;
-  private String type;
-  
-  private ArtifactMetadata bmd;
-  
-  public ArtifactLocation( String prefix, ArtifactMetadata bmd )
-  {
-    if( prefix == null || bmd == null || bmd.getGroupId() == null || bmd.getArtifactId() == null || bmd.getVersion() == null )
-      return;
-    
-    this.bmd = bmd;
-
-    this.prefix     = prefix;
-    this.gaPath     = bmd.getGroupId().replace( '.', FileUtil.SEP_CHAR ) + FileUtil.SEP + bmd.getArtifactId();
-    this.version    = bmd.getVersion();
-    this.baseName   = bmd.getArtifactId();
-    this.versionDir = this.version;
-    this.classifier = bmd.getClassifier();
-    this.type       = bmd.getType();
-  }
-  
-  public String getRelPath()
-  {
-    return gaPath+FileUtil.SEP+versionDir+FileUtil.SEP+baseName+FileUtil.DASH+version+getDashedClassifier()+'.'+type;
-  }
-  
-  public String getRelPomPath()
-  {
-    return gaPath+FileUtil.SEP+versionDir+FileUtil.SEP+baseName+FileUtil.DASH+version+POM_EXT;
-  }
-  
-  public String getAbsPath()
-  {
-    if( prefix == null )
-      return null;
-
-    return getSeparatedPrefix() + getRelPath();
-  }
-  
-  public String getAbsPomPath()
-  {
-    if( prefix == null )
-      return null;
-
-    return getSeparatedPrefix() + getRelPomPath();
-  }
-  
-  public String getGavPath()
-  {
-    return getGaPath()+FileUtil.SEP+versionDir;
-  }
-  
-  public String getBaseVersion()
-  {
-    if( version == null )
-      return null;
-    
-    DefaultArtifactVersion dav = new DefaultArtifactVersion( version );
-    return dav.getBase();
-  }
-  
-  //---------------------------------------------------------
-  public String getGaPath()
-  {
-    return gaPath;
-  }
-  public void setGaPath( String gaPath )
-  {
-    this.gaPath = gaPath;
-  }
-  public String getVersionDir()
-  {
-    return versionDir;
-  }
-  public void setVersionDir( String versionDir )
-  {
-    this.versionDir = versionDir;
-  }
-  public String getBaseName()
-  {
-    return baseName;
-  }
-  public void setBaseName( String baseName )
-  {
-    this.baseName = baseName;
-  }
-  public String getVersion()
-  {
-    return version;
-  }
-  public void setVersion( String version )
-  {
-    this.version = version;
-  }
-  public String getClassifier()
-  {
-    return classifier;
-  }
-  public String getDashedClassifier()
-  {
-    return (classifier == null||classifier.length()<1) ? "" : FileUtil.DASH+classifier;
-  }
-  public void setClassifier( String classifier )
-  {
-    this.classifier = classifier;
-  }
-  public String getType()
-  {
-    return type;
-  }
-  public void setType( String type )
-  {
-    this.type = type;
-  }
-  public String getPrefix()
-  {
-    return prefix;
-  }
-  public String getSeparatedPrefix()
-  {
-    if( prefix == null )
-      return null;
-
-    return prefix+(prefix.endsWith( FileUtil.SEP ) ? "" : FileUtil.SEP);
-  }
-  public void setPrefix( String prefix )
-  {
-    this.prefix = prefix;
-  }
-
-  @Override
-  public String toString()
-  {
-    return bmd == null ? "no ArtifactBasicMetadata" : bmd.toString();
-  }
-  
 }
\ No newline at end of file

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/LocalRepositoryFlat.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/LocalRepositoryFlat.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/LocalRepositoryFlat.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/LocalRepositoryFlat.java Mon Apr 27 23:12:25 2009
@@ -28,31 +28,34 @@
 import org.apache.maven.mercury.repository.api.RepositoryWriter;
 
 public class LocalRepositoryFlat
-extends AbstractRepository
-implements LocalRepository
+    extends AbstractRepository
+    implements LocalRepository
 {
-  public static final String FLAT_REPOSITORY_TYPE = "flat";
-  
-  public static final String METADATA_FILE_NAME = "maven-metadata-local.xml";
-  
+    public static final String FLAT_REPOSITORY_TYPE = "flat";
+
+    public static final String METADATA_FILE_NAME = "maven-metadata-local.xml";
+
     private File directory;
-    
-    private boolean createPoms         = false;
+
+    private boolean createPoms = false;
+
     private boolean createGroupFolders = false;
 
-    //----------------------------------------------------------------------------------
+    // ----------------------------------------------------------------------------------
     public LocalRepositoryFlat( File directory )
-    throws IOException
+        throws IOException
     {
         this( directory, false, false );
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public LocalRepositoryFlat( File directory, boolean createGroupFolders, boolean createPoms )
-    throws IOException
+        throws IOException
     {
         this( directory.getCanonicalPath(), directory, createGroupFolders, createPoms );
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public LocalRepositoryFlat( String id, File directory, boolean createGroupFolders, boolean createPoms )
     {
         super( id, FLAT_REPOSITORY_TYPE );
@@ -60,73 +63,87 @@
         this.createGroupFolders = createGroupFolders;
         this.createPoms = createPoms;
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public File getDirectory()
     {
         return directory;
     }
-    //----------------------------------------------------------------------------------
-    public RepositoryReader getReader() 
+
+    // ----------------------------------------------------------------------------------
+    public RepositoryReader getReader()
     {
-      return RepositoryReader.NULL_READER;
+        return RepositoryReader.NULL_READER;
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public RepositoryReader getReader( String protocol )
     {
-       return RepositoryReader.NULL_READER;
+        return RepositoryReader.NULL_READER;
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public RepositoryWriter getWriter()
     {
-      return new LocalRepositoryWriterFlat(this);
+        return new LocalRepositoryWriterFlat( this );
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public RepositoryWriter getWriter( String protocol )
         throws NonExistentProtocolException
     {
-      return getWriter();
+        return getWriter();
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public boolean isLocal()
     {
-      return true;
+        return true;
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public boolean isReadable()
     {
-      return false;
+        return false;
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public boolean isWriteable()
     {
-      return true;
+        return true;
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public String getType()
     {
-      return DEFAULT_REPOSITORY_TYPE;
+        return DEFAULT_REPOSITORY_TYPE;
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public boolean isCreatePoms()
     {
-      return createPoms;
+        return createPoms;
     }
+
     public void setCreatePoms( boolean createPoms )
     {
-      this.createPoms = createPoms;
+        this.createPoms = createPoms;
     }
+
     public boolean isCreateGroupFolders()
     {
-      return createGroupFolders;
+        return createGroupFolders;
     }
+
     public void setCreateGroupFolders( boolean createGroupFolders )
     {
-      this.createGroupFolders = createGroupFolders;
+        this.createGroupFolders = createGroupFolders;
     }
+
     public String getMetadataName()
     {
-      return METADATA_FILE_NAME;
+        return METADATA_FILE_NAME;
     }
-    //----------------------------------------------------------------------------------
-    //----------------------------------------------------------------------------------
+    // ----------------------------------------------------------------------------------
+    // ----------------------------------------------------------------------------------
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/LocalRepositoryWriterFlat.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/LocalRepositoryWriterFlat.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/LocalRepositoryWriterFlat.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/LocalRepositoryWriterFlat.java Mon Apr 27 23:12:25 2009
@@ -46,235 +46,258 @@
 import org.codehaus.plexus.lang.Language;
 
 public class LocalRepositoryWriterFlat
-extends AbstractRepositoryWriter
-implements RepositoryWriter
+    extends AbstractRepositoryWriter
+    implements RepositoryWriter
 {
-  public static final String SYSTEM_PROPERTY_PARALLEL_WORKERS = "mercury.local.repo.workers";
-  public static final int  PARALLEL_WORKERS = Integer.parseInt( System.getProperty( SYSTEM_PROPERTY_PARALLEL_WORKERS, "4" ) );
-  
-  public static final long SLEEP_FOR_WORKERS_TICK = 20l;
-
-  public static final String SYSTEM_PROPERTY_SLEEP_FOR_LOCK = "mercury.local.lock.wait.millis";
-  public static final long SLEEP_FOR_LOCK = Long.parseLong(  System.getProperty( SYSTEM_PROPERTY_SLEEP_FOR_LOCK, "5000" ) );
-  
-  public static final long SLEEP_FOR_LOCK_TICK = 5l;
-
-  private static final IMercuryLogger LOG = MercuryLoggerManager.getLogger( LocalRepositoryWriterFlat.class ); 
-  private static final Language LANG = new DefaultLanguage( LocalRepositoryWriterFlat.class );
-  //---------------------------------------------------------------------------------------------------------------
-  private static final String [] _protocols = new String [] { "file" };
-  
-  private final LocalRepository _repo;
-  private final File _repoDir;
-  private final ArtifactQueue _aq;
-
-  private static final ArifactWriteData LAST_ARTIFACT = new ArifactWriteData( null, null );
-  
-  //---------------------------------------------------------------------------------------------------------------
-  public LocalRepositoryWriterFlat( LocalRepository repo )
-  {
-    if( repo == null )
-      throw new IllegalArgumentException("localRepo cannot be null");
-    
-    _repoDir = repo.getDirectory();
-    if( _repoDir == null )
-      throw new IllegalArgumentException("localRepo directory cannot be null");
-    
-    if( !_repoDir.exists() )
-      throw new IllegalArgumentException("localRepo directory \""+_repoDir.getAbsolutePath()+"\" should exist");
-
-    _repo = repo;
-    _aq = null;
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  private LocalRepositoryWriterFlat( LocalRepository repo, File repoDir, ArtifactQueue aq )
-  {
-    _repo = repo;
-    _repoDir = repoDir;
-    _aq = aq;
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public Repository getRepository()
-  {
-    return _repo;
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public boolean canHandle( String protocol )
-  {
-    return AbstractRepository.DEFAULT_LOCAL_READ_PROTOCOL.equals( protocol );
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public String[] getProtocols()
-  {
-    return _protocols;
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public void close()
-  {
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public void writeArtifacts( Collection<Artifact> artifacts )
-  throws RepositoryException
-  {
-    if( artifacts == null || artifacts.size() < 1 )
-      return;
-    
-    int nWorkers = PARALLEL_WORKERS;
-    if( artifacts.size() < nWorkers )
-      nWorkers = artifacts.size();
-    
-    ArtifactQueue aq = new ArtifactQueue();
-    LocalRepositoryWriterFlat [] workers = new LocalRepositoryWriterFlat[ nWorkers ];
-    
-    for( int i=0; i<nWorkers; i++ )
-      workers[ i ] = new LocalRepositoryWriterFlat( _repo, _repoDir, aq );
-    
-    for( Artifact artifact : artifacts )
-    {
-      Set<StreamVerifierFactory> vFacs = null;
-      Server server = _repo.getServer();
-      if( server != null && server.hasWriterStreamVerifierFactories() )
-        vFacs = server.getWriterStreamVerifierFactories();
-      
-      if( vFacs == null ) // let it be empty, but not null
-        vFacs = new HashSet<StreamVerifierFactory>(1);
-
-      aq.addArtifact( new ArifactWriteData( artifact, vFacs ) );
-    }
-    aq.addArtifact( LAST_ARTIFACT );
-
-    for( int i=0; i<nWorkers; i++ )
-      workers[ i ].start();
-    
-    boolean alive = true;
-    while( alive )
-    {
-      alive = false;
-      for( int i=0; i<nWorkers; i++ )
-        if( workers[ i ].isAlive() )
-        {
-          alive = true;
-          try { sleep( SLEEP_FOR_WORKERS_TICK ); } catch( InterruptedException ie ) {}
-        }
+    public static final String SYSTEM_PROPERTY_PARALLEL_WORKERS = "mercury.local.repo.workers";
+
+    public static final int PARALLEL_WORKERS =
+        Integer.parseInt( System.getProperty( SYSTEM_PROPERTY_PARALLEL_WORKERS, "4" ) );
+
+    public static final long SLEEP_FOR_WORKERS_TICK = 20l;
+
+    public static final String SYSTEM_PROPERTY_SLEEP_FOR_LOCK = "mercury.local.lock.wait.millis";
+
+    public static final long SLEEP_FOR_LOCK =
+        Long.parseLong( System.getProperty( SYSTEM_PROPERTY_SLEEP_FOR_LOCK, "5000" ) );
+
+    public static final long SLEEP_FOR_LOCK_TICK = 5l;
+
+    private static final IMercuryLogger LOG = MercuryLoggerManager.getLogger( LocalRepositoryWriterFlat.class );
+
+    private static final Language LANG = new DefaultLanguage( LocalRepositoryWriterFlat.class );
+
+    // ---------------------------------------------------------------------------------------------------------------
+    private static final String[] _protocols = new String[] { "file" };
+
+    private final LocalRepository _repo;
+
+    private final File _repoDir;
+
+    private final ArtifactQueue _aq;
+
+    private static final ArifactWriteData LAST_ARTIFACT = new ArifactWriteData( null, null );
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public LocalRepositoryWriterFlat( LocalRepository repo )
+    {
+        if ( repo == null )
+            throw new IllegalArgumentException( "localRepo cannot be null" );
+
+        _repoDir = repo.getDirectory();
+        if ( _repoDir == null )
+            throw new IllegalArgumentException( "localRepo directory cannot be null" );
+
+        if ( !_repoDir.exists() )
+            throw new IllegalArgumentException( "localRepo directory \"" + _repoDir.getAbsolutePath()
+                + "\" should exist" );
+
+        _repo = repo;
+        _aq = null;
+    }
+
+    // ---------------------------------------------------------------------------------------------------------------
+    private LocalRepositoryWriterFlat( LocalRepository repo, File repoDir, ArtifactQueue aq )
+    {
+        _repo = repo;
+        _repoDir = repoDir;
+        _aq = aq;
+    }
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public Repository getRepository()
+    {
+        return _repo;
+    }
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public boolean canHandle( String protocol )
+    {
+        return AbstractRepository.DEFAULT_LOCAL_READ_PROTOCOL.equals( protocol );
+    }
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public String[] getProtocols()
+    {
+        return _protocols;
     }
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  /* (non-Javadoc)
-   * @see java.lang.Thread#run()
-   */
-  @Override
-  public void run()
-  {
-    try
-    {
-      for(;;)
-      {
-        ArifactWriteData awd = _aq.getArtifact();
-
-        if( awd == null || awd.artifact == null )
-            break;
-        
-        writeArtifact( awd.artifact, awd.vFacs );
-      }
-    }
-    catch (InterruptedException e)
-    {
-    }
-    catch( RepositoryException e )
-    {
-      throw new RuntimeException(e);
-    }
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public void writeArtifact( final Artifact artifact, final Set<StreamVerifierFactory> vFacs )
-      throws RepositoryException
-  {
-    if( artifact == null )
-      return;
-    
-    boolean isPom = "pom".equals( artifact.getType() );
-    
-    byte [] pomBlob = artifact.getPomBlob();
-    boolean hasPomBlob = pomBlob != null && pomBlob.length > 0;
-    
-    InputStream in = artifact.getStream();
-    if( in == null )
-    {
-      File aFile = artifact.getFile();
-      if( aFile == null && !isPom )
-      {
-        throw new RepositoryException( LANG.getMessage( "artifact.no.stream", artifact.toString() ) );
-      }
-
-      try
-      {
-        in = new FileInputStream( aFile );
-      }
-      catch( FileNotFoundException e )
-      {
-        if( !isPom )
-          throw new RepositoryException( e );
-      }
-    }
-
-    String relGroupPath = ((LocalRepositoryFlat)_repo).isCreateGroupFolders() ? artifact.getGroupId() : "";
-    String versionPath = _repoDir.getAbsolutePath() + (Util.isEmpty( relGroupPath ) ? "" : "/"+relGroupPath);
-    
-    String lockDir = null;
-    FileLockBundle fLock = null;
-
-    try
-    {
-      
-      if( isPom )
-      {
-        if( in == null && !hasPomBlob )
-          throw new RepositoryException( LANG.getMessage( "pom.artifact.no.stream", artifact.toString() ) );
-        
-        if( in != null )
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public void close()
+    {
+    }
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public void writeArtifacts( Collection<Artifact> artifacts )
+        throws RepositoryException
+    {
+        if ( artifacts == null || artifacts.size() < 1 )
+            return;
+
+        int nWorkers = PARALLEL_WORKERS;
+        if ( artifacts.size() < nWorkers )
+            nWorkers = artifacts.size();
+
+        ArtifactQueue aq = new ArtifactQueue();
+        LocalRepositoryWriterFlat[] workers = new LocalRepositoryWriterFlat[nWorkers];
+
+        for ( int i = 0; i < nWorkers; i++ )
+            workers[i] = new LocalRepositoryWriterFlat( _repo, _repoDir, aq );
+
+        for ( Artifact artifact : artifacts )
         {
-          byte [] pomBlobBytes = FileUtil.readRawData( in );
-          hasPomBlob = pomBlobBytes != null && pomBlobBytes.length > 0;
-          if( hasPomBlob )
-            pomBlob = pomBlobBytes;
-        }
-      }
+            Set<StreamVerifierFactory> vFacs = null;
+            Server server = _repo.getServer();
+            if ( server != null && server.hasWriterStreamVerifierFactories() )
+                vFacs = server.getWriterStreamVerifierFactories();
+
+            if ( vFacs == null ) // let it be empty, but not null
+                vFacs = new HashSet<StreamVerifierFactory>( 1 );
 
-      // create folders
-      lockDir = versionPath;
+            aq.addArtifact( new ArifactWriteData( artifact, vFacs ) );
+        }
+        aq.addArtifact( LAST_ARTIFACT );
 
-      File gav = new File( lockDir );
-      gav.mkdirs();
+        for ( int i = 0; i < nWorkers; i++ )
+            workers[i].start();
 
-      fLock = FileUtil.lockDir( lockDir, SLEEP_FOR_LOCK, SLEEP_FOR_LOCK_TICK );
-      if( fLock == null )
-        throw new RepositoryException( LANG.getMessage( "cannot.lock.gav", lockDir, ""+SLEEP_FOR_LOCK ) );
-
-      String fName = versionPath+'/'+artifact.getBaseName()+'.'+artifact.getType();
-      
-      if( !isPom ) // first - take care of the binary
-        FileUtil.writeAndSign( fName, in, vFacs );
-
-      // if classier - nothing else to do :)
-      if( artifact.hasClassifier() )
-        return;
-      
-      if( ((LocalRepositoryFlat)_repo).isCreatePoms() && hasPomBlob )
-      {
-        FileUtil.writeAndSign( versionPath
-                              +'/'+artifact.getArtifactId()+'-'+artifact.getVersion()+".pom", pomBlob, vFacs
-                              );
-      }
-        
+        boolean alive = true;
+        while ( alive )
+        {
+            alive = false;
+            for ( int i = 0; i < nWorkers; i++ )
+                if ( workers[i].isAlive() )
+                {
+                    alive = true;
+                    try
+                    {
+                        sleep( SLEEP_FOR_WORKERS_TICK );
+                    }
+                    catch ( InterruptedException ie )
+                    {
+                    }
+                }
+        }
     }
-    catch( Exception e )
+
+    // ---------------------------------------------------------------------------------------------------------------
+    /*
+     * (non-Javadoc)
+     * @see java.lang.Thread#run()
+     */
+    @Override
+    public void run()
     {
-      throw new RepositoryException( e );
+        try
+        {
+            for ( ;; )
+            {
+                ArifactWriteData awd = _aq.getArtifact();
+
+                if ( awd == null || awd.artifact == null )
+                    break;
+
+                writeArtifact( awd.artifact, awd.vFacs );
+            }
+        }
+        catch ( InterruptedException e )
+        {
+        }
+        catch ( RepositoryException e )
+        {
+            throw new RuntimeException( e );
+        }
     }
-    finally
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public void writeArtifact( final Artifact artifact, final Set<StreamVerifierFactory> vFacs )
+        throws RepositoryException
     {
-      if( fLock != null )
-        fLock.release();
+        if ( artifact == null )
+            return;
+
+        boolean isPom = "pom".equals( artifact.getType() );
+
+        byte[] pomBlob = artifact.getPomBlob();
+        boolean hasPomBlob = pomBlob != null && pomBlob.length > 0;
+
+        InputStream in = artifact.getStream();
+        if ( in == null )
+        {
+            File aFile = artifact.getFile();
+            if ( aFile == null && !isPom )
+            {
+                throw new RepositoryException( LANG.getMessage( "artifact.no.stream", artifact.toString() ) );
+            }
+
+            try
+            {
+                in = new FileInputStream( aFile );
+            }
+            catch ( FileNotFoundException e )
+            {
+                if ( !isPom )
+                    throw new RepositoryException( e );
+            }
+        }
+
+        String relGroupPath = ( (LocalRepositoryFlat) _repo ).isCreateGroupFolders() ? artifact.getGroupId() : "";
+        String versionPath = _repoDir.getAbsolutePath() + ( Util.isEmpty( relGroupPath ) ? "" : "/" + relGroupPath );
+
+        String lockDir = null;
+        FileLockBundle fLock = null;
+
+        try
+        {
+
+            if ( isPom )
+            {
+                if ( in == null && !hasPomBlob )
+                    throw new RepositoryException( LANG.getMessage( "pom.artifact.no.stream", artifact.toString() ) );
+
+                if ( in != null )
+                {
+                    byte[] pomBlobBytes = FileUtil.readRawData( in );
+                    hasPomBlob = pomBlobBytes != null && pomBlobBytes.length > 0;
+                    if ( hasPomBlob )
+                        pomBlob = pomBlobBytes;
+                }
+            }
+
+            // create folders
+            lockDir = versionPath;
+
+            File gav = new File( lockDir );
+            gav.mkdirs();
+
+            fLock = FileUtil.lockDir( lockDir, SLEEP_FOR_LOCK, SLEEP_FOR_LOCK_TICK );
+            if ( fLock == null )
+                throw new RepositoryException( LANG.getMessage( "cannot.lock.gav", lockDir, "" + SLEEP_FOR_LOCK ) );
+
+            String fName = versionPath + '/' + artifact.getBaseName() + '.' + artifact.getType();
+
+            if ( !isPom ) // first - take care of the binary
+                FileUtil.writeAndSign( fName, in, vFacs );
+
+            // if classier - nothing else to do :)
+            if ( artifact.hasClassifier() )
+                return;
+
+            if ( ( (LocalRepositoryFlat) _repo ).isCreatePoms() && hasPomBlob )
+            {
+                FileUtil.writeAndSign( versionPath + '/' + artifact.getArtifactId() + '-' + artifact.getVersion()
+                    + ".pom", pomBlob, vFacs );
+            }
+
+        }
+        catch ( Exception e )
+        {
+            throw new RepositoryException( e );
+        }
+        finally
+        {
+            if ( fLock != null )
+                fLock.release();
             if ( in != null )
             {
                 try
@@ -286,55 +309,59 @@
                     // ignore, tried our best to clean up
                 }
             }
+        }
+
     }
-    
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  //---------------------------------------------------------------------------------------------------------------
+    // ---------------------------------------------------------------------------------------------------------------
+    // ---------------------------------------------------------------------------------------------------------------
 }
-//=================================================================================================================
+
+// =================================================================================================================
 class ArifactWriteData
 {
-  Artifact artifact;
-  Set<StreamVerifierFactory> vFacs;
-  
-  public ArifactWriteData(Artifact artifact, Set<StreamVerifierFactory> vFacs)
-  {
-    this.artifact = artifact;
-    this.vFacs = vFacs;
-  }
+    Artifact artifact;
+
+    Set<StreamVerifierFactory> vFacs;
+
+    public ArifactWriteData( Artifact artifact, Set<StreamVerifierFactory> vFacs )
+    {
+        this.artifact = artifact;
+        this.vFacs = vFacs;
+    }
 }
-//=================================================================================================================
+
+// =================================================================================================================
 class ArtifactQueue
 {
-  LinkedList<ArifactWriteData> queue = new LinkedList<ArifactWriteData>();
-  boolean empty = false;
-  
-  public synchronized void addArtifact( ArifactWriteData awd )
-  {
-    queue.addLast( awd );
-    empty = false;
-    notify();
-  }
-
-  public synchronized ArifactWriteData getArtifact()
-  throws InterruptedException
-  {
-    if( empty )
-      return null;
-
-    while( queue.isEmpty() )
-      wait();
-    
-    ArifactWriteData res = queue.removeFirst();
-    
-    if( res.artifact == null )
+    LinkedList<ArifactWriteData> queue = new LinkedList<ArifactWriteData>();
+
+    boolean empty = false;
+
+    public synchronized void addArtifact( ArifactWriteData awd )
     {
-      empty = true;
-      return null;
+        queue.addLast( awd );
+        empty = false;
+        notify();
     }
 
-    return res;
-  }
+    public synchronized ArifactWriteData getArtifact()
+        throws InterruptedException
+    {
+        if ( empty )
+            return null;
+
+        while ( queue.isEmpty() )
+            wait();
+
+        ArifactWriteData res = queue.removeFirst();
+
+        if ( res.artifact == null )
+        {
+            empty = true;
+            return null;
+        }
+
+        return res;
+    }
 }
-//=================================================================================================================
+// =================================================================================================================

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/LocalRepositoryWriterFlatFactory.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/LocalRepositoryWriterFlatFactory.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/LocalRepositoryWriterFlatFactory.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/flat/LocalRepositoryWriterFlatFactory.java Mon Apr 27 23:12:25 2009
@@ -28,23 +28,25 @@
 import org.codehaus.plexus.lang.Language;
 
 public class LocalRepositoryWriterFlatFactory
-implements RepositoryWriterFactory
+    implements RepositoryWriterFactory
 {
-  private static final Language LANG = new DefaultLanguage( LocalRepositoryWriterFlatFactory.class );
-  private static final LocalRepositoryWriterFlatFactory FACTORY = new LocalRepositoryWriterFlatFactory();
-  
-  static 
-  {
-    AbstractRepository.register( LocalRepositoryFlat.FLAT_REPOSITORY_TYPE, FACTORY  );
-  }
-  
-  public RepositoryWriter getWriter( Repository repo )
-  throws RepositoryException
-  {
-    if( repo == null || !(repo instanceof LocalRepository) )
-      throw new RepositoryException( LANG.getMessage( "bad.repository.type", repo == null ? "null" : repo.getClass().getName() ) );
-    
-    return new LocalRepositoryWriterFlat( (LocalRepository)repo );
-  }
+    private static final Language LANG = new DefaultLanguage( LocalRepositoryWriterFlatFactory.class );
+
+    private static final LocalRepositoryWriterFlatFactory FACTORY = new LocalRepositoryWriterFlatFactory();
+
+    static
+    {
+        AbstractRepository.register( LocalRepositoryFlat.FLAT_REPOSITORY_TYPE, FACTORY );
+    }
+
+    public RepositoryWriter getWriter( Repository repo )
+        throws RepositoryException
+    {
+        if ( repo == null || !( repo instanceof LocalRepository ) )
+            throw new RepositoryException( LANG.getMessage( "bad.repository.type", repo == null ? "null"
+                            : repo.getClass().getName() ) );
+
+        return new LocalRepositoryWriterFlat( (LocalRepository) repo );
+    }
 
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/ArtifactLocation.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/ArtifactLocation.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/ArtifactLocation.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/ArtifactLocation.java Mon Apr 27 23:12:25 2009
@@ -24,262 +24,283 @@
 import org.apache.maven.mercury.util.FileUtil;
 
 /**
- * artifact relative location data object - used by repositories to hold on to intermediate path calculations 
- *
- *
+ * artifact relative location data object - used by repositories to hold on to intermediate path calculations
+ * 
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public class ArtifactLocation
 {
-  public static final String POM_EXT = ".pom";
+    public static final String POM_EXT = ".pom";
+
+    private String prefix;
+
+    private String gaPath;
+
+    private String versionDir;
+
+    private String baseName;
+
+    private String version;
+
+    private String classifier;
+
+    private String type;
+
+    private ArtifactMetadata bmd;
+
+    public ArtifactLocation( String prefix, ArtifactMetadata bmd )
+    {
+        if ( prefix == null || bmd == null || bmd.getGroupId() == null || bmd.getArtifactId() == null
+            || bmd.getVersion() == null )
+            return;
+
+        this.bmd = bmd;
+
+        this.prefix = prefix;
+        this.gaPath = bmd.getGroupId().replace( '.', FileUtil.SEP_CHAR ) + FileUtil.SEP + bmd.getArtifactId();
+        this.version = bmd.getVersion();
+        this.baseName = bmd.getArtifactId();
+        this.versionDir = this.version;
+        this.classifier = bmd.getClassifier();
+        this.type = bmd.getType();
+    }
+
+    public String getRelPath()
+    {
+        return gaPath + FileUtil.SEP + calculateVersionDir( version ) + FileUtil.SEP + baseName + FileUtil.DASH
+            + version + getDashedClassifier() + '.' + type;
+    }
+
+    public String getRelPomPath()
+    {
+        return gaPath + FileUtil.SEP + calculateVersionDir( version ) + FileUtil.SEP + baseName + FileUtil.DASH
+            + version + POM_EXT;
+    }
+
+    public String getAbsPath()
+    {
+        if ( prefix == null )
+            return null;
+
+        return getSeparatedPrefix() + getRelPath();
+    }
+
+    public String getAbsPomPath()
+    {
+        if ( prefix == null )
+            return null;
+
+        return getSeparatedPrefix() + getRelPomPath();
+    }
+
+    public String getAbsGavPath()
+    {
+        if ( prefix == null )
+            return null;
+
+        return getSeparatedPrefix() + getGavPath();
+    }
+
+    public String getGavPath()
+    {
+        return getGaPath() + FileUtil.SEP + calculateVersionDir( version );
+    }
+
+    public String getBaseVersion()
+    {
+        if ( version == null )
+            return null;
+
+        DefaultArtifactVersion dav = new DefaultArtifactVersion( version );
+        return dav.getBase();
+    }
+
+    public String getVersionWithoutTS()
+    {
+        if ( version == null )
+            return null;
+
+        int li = version.lastIndexOf( '-' );
+
+        if ( li < 1 )
+            return version;
+
+        int li2 = version.substring( 0, li ).lastIndexOf( '-' );
+
+        if ( li2 > 0 )
+            return version.substring( 0, li2 );
 
-  private String prefix;
-  
-  private String gaPath;
-  private String versionDir;
-  private String baseName;
-  private String version;
-  private String classifier;
-  private String type;
-  
-  private ArtifactMetadata bmd;
-  
-  public ArtifactLocation( String prefix, ArtifactMetadata bmd )
-  {
-    if( prefix == null || bmd == null || bmd.getGroupId() == null || bmd.getArtifactId() == null || bmd.getVersion() == null )
-      return;
-    
-    this.bmd = bmd;
-
-    this.prefix     = prefix;
-    this.gaPath     = bmd.getGroupId().replace( '.', FileUtil.SEP_CHAR ) + FileUtil.SEP + bmd.getArtifactId();
-    this.version    = bmd.getVersion();
-    this.baseName   = bmd.getArtifactId();
-    this.versionDir = this.version;
-    this.classifier = bmd.getClassifier();
-    this.type       = bmd.getType();
-  }
-  
-  public String getRelPath()
-  {
-    return gaPath+FileUtil.SEP+calculateVersionDir( version )+FileUtil.SEP+baseName+FileUtil.DASH+version+getDashedClassifier()+'.'+type;
-  }
-  
-  public String getRelPomPath()
-  {
-    return gaPath+FileUtil.SEP+calculateVersionDir( version )+FileUtil.SEP+baseName+FileUtil.DASH+version+POM_EXT;
-  }
-  
-  public String getAbsPath()
-  {
-    if( prefix == null )
-      return null;
-
-    return getSeparatedPrefix() + getRelPath();
-  }
-  
-  public String getAbsPomPath()
-  {
-    if( prefix == null )
-      return null;
-
-    return getSeparatedPrefix() + getRelPomPath();
-  }
-  
-  public String getAbsGavPath()
-  {
-      if( prefix == null )
-          return null;
-
-    return getSeparatedPrefix() + getGavPath();
-  }
-  
-  public String getGavPath()
-  {
-    return getGaPath() + FileUtil.SEP + calculateVersionDir( version );
-  }
-  
-  public String getBaseVersion()
-  {
-    if( version == null )
-      return null;
-    
-    DefaultArtifactVersion dav = new DefaultArtifactVersion( version );
-    return dav.getBase();
-  }
-  
-  public String getVersionWithoutTS(  )
-  {
-    if( version == null )
-      return null;
-    
-    int li = version.lastIndexOf( '-' );
-    
-    if( li < 1 )
         return version;
-    
-    int li2 = version.substring( 0, li ).lastIndexOf( '-' );
-    
-    if( li2 > 0 )
-        return version.substring( 0, li2 );
-    
-    return version;
-  }
-  
-  public static String stripTS( String ver  )
-  {
-    if( ver == null )
-      return null;
-    
-    int li = ver.lastIndexOf( '-' );
-    
-    if( li < 1 )
+    }
+
+    public static String stripTS( String ver )
+    {
+        if ( ver == null )
+            return null;
+
+        int li = ver.lastIndexOf( '-' );
+
+        if ( li < 1 )
+            return ver;
+
+        int li2 = ver.substring( 0, li ).lastIndexOf( '-' );
+
+        if ( li2 > 0 )
+            return ver.substring( 0, li2 );
+
         return ver;
-    
-    int li2 = ver.substring( 0, li ).lastIndexOf( '-' );
-    
-    if( li2 > 0 )
-        return ver.substring( 0, li2 );
-    
-    return ver;
-  }
-  
-  public static String stripSN( String ver  )
-  {
-    if( ver == null )
-      return null;
-    
-    int li = ver.lastIndexOf( '-' );
-    
-    if( li < 1 )
+    }
+
+    public static String stripSN( String ver )
+    {
+        if ( ver == null )
+            return null;
+
+        int li = ver.lastIndexOf( '-' );
+
+        if ( li < 1 )
+            return ver;
+
+        return ver.substring( 0, li );
+    }
+
+    public static String getTS( String ver )
+    {
+        if ( ver == null )
+            return null;
+
+        int li = ver.lastIndexOf( '-' );
+
+        if ( li < 1 )
+            return ver;
+
+        int li2 = ver.substring( 0, li ).lastIndexOf( '-' );
+
+        if ( li2 > 0 )
+            return ver.substring( li2 + 1 );
+
         return ver;
-    
-    return ver.substring( 0, li );
-  }
-  
-  public static String getTS( String ver  )
-  {
-    if( ver == null )
-      return null;
-    
-    int li = ver.lastIndexOf( '-' );
-    
-    if( li < 1 )
+    }
+
+    public static String getFileTS( String name )
+    {
+        if ( name == null )
+            return null;
+
+        int lastDash = name.lastIndexOf( '-' );
+        if ( lastDash < 2 )
+            return null;
+
+        int firstDash = name.lastIndexOf( '-', lastDash - 1 );
+        if ( firstDash < 1 )
+            return null;
+
+        String fTS = name.substring( firstDash + 1, lastDash );
+
+        return fTS;
+    }
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public static String calculateVersionDir( String ver )
+    {
+        if ( ver == null )
+            return ver;
+
+        if ( ver.matches( Artifact.SNAPSHOT_TS_REGEX ) )
+            return stripTS( ver ) + FileUtil.DASH + Artifact.SNAPSHOT_VERSION;
+
         return ver;
-    
-    int li2 = ver.substring( 0, li ).lastIndexOf( '-' );
-    
-    if( li2 > 0 )
-        return ver.substring( li2+1 );
-    
-    return ver;
-  }
-  
-  public static String getFileTS( String name  )
-  {
-      if( name == null )
-          return null;
-      
-      int lastDash = name.lastIndexOf( '-' );
-      if( lastDash < 2 )
-          return null;
-      
-      int firstDash = name.lastIndexOf( '-', lastDash-1 );
-      if( firstDash < 1 )
-          return null;
-      
-      String fTS = name.substring( firstDash+1, lastDash );
-      
-      return fTS;
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  public static String calculateVersionDir( String ver )
-  {
-      if( ver == null )
-          return ver;
-      
-      if( ver.matches( Artifact.SNAPSHOT_TS_REGEX ) )
-          return stripTS( ver )+FileUtil.DASH+Artifact.SNAPSHOT_VERSION;
-      
-      return ver;
-  }
-  
-  //---------------------------------------------------------
-  public String getGaPath()
-  {
-    return gaPath;
-  }
-  public void setGaPath( String gaPath )
-  {
-    this.gaPath = gaPath;
-  }
-  public String getVersionDir()
-  {
-    return versionDir;
-  }
-  public void setVersionDir( String versionDir )
-  {
-    this.versionDir = versionDir;
-  }
-  public String getBaseName()
-  {
-    return baseName;
-  }
-  public void setBaseName( String baseName )
-  {
-    this.baseName = baseName;
-  }
-  public String getVersion()
-  {
-    return version;
-  }
-  public void setVersion( String version )
-  {
-    this.version = version;
-  }
-  public String getClassifier()
-  {
-    return classifier;
-  }
-  public String getDashedClassifier()
-  {
-    return (classifier == null||classifier.length()<1) ? "" : FileUtil.DASH+classifier;
-  }
-  public void setClassifier( String classifier )
-  {
-    this.classifier = classifier;
-  }
-  public String getType()
-  {
-    return type;
-  }
-  public void setType( String type )
-  {
-    this.type = type;
-  }
-  public String getPrefix()
-  {
-    return prefix;
-  }
-  public String getSeparatedPrefix()
-  {
-    if( prefix == null )
-      return null;
-
-    return prefix+(prefix.endsWith( FileUtil.SEP ) ? "" : FileUtil.SEP);
-  }
-
-  public void setPrefix( String prefix )
-  {
-    this.prefix = prefix;
-  }
-
-  @Override
-  public String toString()
-  {
-    return bmd == null ? "no ArtifactBasicMetadata" : bmd.toString();
-  }
-  
+    }
+
+    // ---------------------------------------------------------
+    public String getGaPath()
+    {
+        return gaPath;
+    }
+
+    public void setGaPath( String gaPath )
+    {
+        this.gaPath = gaPath;
+    }
+
+    public String getVersionDir()
+    {
+        return versionDir;
+    }
+
+    public void setVersionDir( String versionDir )
+    {
+        this.versionDir = versionDir;
+    }
+
+    public String getBaseName()
+    {
+        return baseName;
+    }
+
+    public void setBaseName( String baseName )
+    {
+        this.baseName = baseName;
+    }
+
+    public String getVersion()
+    {
+        return version;
+    }
+
+    public void setVersion( String version )
+    {
+        this.version = version;
+    }
+
+    public String getClassifier()
+    {
+        return classifier;
+    }
+
+    public String getDashedClassifier()
+    {
+        return ( classifier == null || classifier.length() < 1 ) ? "" : FileUtil.DASH + classifier;
+    }
+
+    public void setClassifier( String classifier )
+    {
+        this.classifier = classifier;
+    }
+
+    public String getType()
+    {
+        return type;
+    }
+
+    public void setType( String type )
+    {
+        this.type = type;
+    }
+
+    public String getPrefix()
+    {
+        return prefix;
+    }
+
+    public String getSeparatedPrefix()
+    {
+        if ( prefix == null )
+            return null;
+
+        return prefix + ( prefix.endsWith( FileUtil.SEP ) ? "" : FileUtil.SEP );
+    }
+
+    public void setPrefix( String prefix )
+    {
+        this.prefix = prefix;
+    }
+
+    @Override
+    public String toString()
+    {
+        return bmd == null ? "no ArtifactBasicMetadata" : bmd.toString();
+    }
+
 }
\ No newline at end of file

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryM2.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryM2.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryM2.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryM2.java Mon Apr 27 23:12:25 2009
@@ -33,112 +33,124 @@
 import org.codehaus.plexus.lang.Language;
 
 public class LocalRepositoryM2
-extends AbstractRepository
-implements LocalRepository
+    extends AbstractRepository
+    implements LocalRepository
 {
     private static final Language LANG = new DefaultLanguage( LocalRepositoryM2.class );
 
     private File directory;
-    
+
     public static final String METADATA_FILE_NAME = "maven-metadata-local.xml";
-    
-    /** indicates that if a-1.0-SNAPSHOT.jar exists, it wins despite any timestamps
-     *  required for Maven comatibility 
+
+    /**
+     * indicates that if a-1.0-SNAPSHOT.jar exists, it wins despite any timestamps required for Maven comatibility
      **/
     private boolean _snapshotAlwaysWins = false;
 
-    //----------------------------------------------------------------------------------
+    // ----------------------------------------------------------------------------------
     private void setDirectory( File directory )
     {
-      if( directory == null )
-        throw new IllegalArgumentException( LANG.getMessage( "null.directory" ) );
-      
-      if( !directory.exists() )
-        directory.mkdirs();
-
-      if( !directory.isDirectory() )
-          throw new IllegalArgumentException( LANG.getMessage( "file.directory", directory.getAbsolutePath() ) );
-        
-      this.directory = directory;
+        if ( directory == null )
+            throw new IllegalArgumentException( LANG.getMessage( "null.directory" ) );
+
+        if ( !directory.exists() )
+            directory.mkdirs();
+
+        if ( !directory.isDirectory() )
+            throw new IllegalArgumentException( LANG.getMessage( "file.directory", directory.getAbsolutePath() ) );
+
+        this.directory = directory;
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public LocalRepositoryM2( Server server, DependencyProcessor dependencyProcessor )
     {
         super( server.getId(), DEFAULT_REPOSITORY_TYPE );
         setDirectory( new File( server.getURL().getFile() ) );
         this.server = server;
-        
+
         setDependencyProcessor( dependencyProcessor );
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public LocalRepositoryM2( File directory, DependencyProcessor dependencyProcessor )
-    throws IOException
+        throws IOException
     {
         this( directory.getCanonicalPath(), directory, DEFAULT_REPOSITORY_TYPE, dependencyProcessor );
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public LocalRepositoryM2( String id, File directory, DependencyProcessor dependencyProcessor )
     {
         this( id, directory, DEFAULT_REPOSITORY_TYPE, dependencyProcessor );
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public LocalRepositoryM2( String id, File directory, String type, DependencyProcessor dependencyProcessor )
     {
         super( id, type );
 
         setDirectory( directory );
-        
+
         setDependencyProcessor( dependencyProcessor );
-        
+
         try
         {
             this.server = new Server( getId(), directory.toURL() );
         }
         catch ( MalformedURLException e )
         {
-            throw new IllegalArgumentException(e);
+            throw new IllegalArgumentException( e );
         }
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public File getDirectory()
     {
         return directory;
     }
-    //----------------------------------------------------------------------------------
-    public RepositoryReader getReader() 
+
+    // ----------------------------------------------------------------------------------
+    public RepositoryReader getReader()
     {
-      return new LocalRepositoryReaderM2( this, getDependencyProcessor() );
+        return new LocalRepositoryReaderM2( this, getDependencyProcessor() );
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public RepositoryReader getReader( String protocol )
     {
-       return getReader();
+        return getReader();
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public RepositoryWriter getWriter()
     {
-      return new LocalRepositoryWriterM2(this);
+        return new LocalRepositoryWriterM2( this );
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public RepositoryWriter getWriter( String protocol )
         throws NonExistentProtocolException
     {
-      return getWriter();
+        return getWriter();
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public boolean isLocal()
     {
-      return true;
+        return true;
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public boolean isReadable()
     {
-      return true;
+        return true;
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public boolean isWriteable()
     {
-      return true;
+        return true;
     }
 
     public void setSnapshotAlwaysWins( boolean alwaysWins )
@@ -150,17 +162,18 @@
     {
         return _snapshotAlwaysWins;
     }
-    
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public String getType()
     {
-      return DEFAULT_REPOSITORY_TYPE;
+        return DEFAULT_REPOSITORY_TYPE;
     }
-    //----------------------------------------------------------------------------------
+
+    // ----------------------------------------------------------------------------------
     public String getMetadataName()
     {
-      return METADATA_FILE_NAME;
+        return METADATA_FILE_NAME;
     }
-    //----------------------------------------------------------------------------------
-    //----------------------------------------------------------------------------------
+    // ----------------------------------------------------------------------------------
+    // ----------------------------------------------------------------------------------
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2.java Mon Apr 27 23:12:25 2009
@@ -48,9 +48,9 @@
 import org.apache.maven.mercury.repository.api.AbstracRepositoryReader;
 import org.apache.maven.mercury.repository.api.AbstractRepOpResult;
 import org.apache.maven.mercury.repository.api.AbstractRepository;
-import org.apache.maven.mercury.repository.api.MetadataResults;
 import org.apache.maven.mercury.repository.api.ArtifactResults;
 import org.apache.maven.mercury.repository.api.LocalRepository;
+import org.apache.maven.mercury.repository.api.MetadataResults;
 import org.apache.maven.mercury.repository.api.Repository;
 import org.apache.maven.mercury.repository.api.RepositoryException;
 import org.apache.maven.mercury.repository.api.RepositoryReader;
@@ -124,33 +124,31 @@
         {
             final boolean noSnapshots = Artifact.RELEASE_VERSION.equals( loc.getVersion() );
             loc.setVersion( null );
-            
+
             final TreeSet<String> ts = new TreeSet<String>( new VersionComparator() );
 
-            gaDir.listFiles(
-                     new FilenameFilter()
-                     {
-                        public boolean accept( File dir, String name )
-                        {   
-                            if( new File(dir,name).isDirectory() )
-                            {
-                                if( noSnapshots && name.endsWith( Artifact.SNAPSHOT_VERSION ) )
-                                    return false;
-                                
-                                ts.add( name );
-                                return true;
-                            }
+            gaDir.listFiles( new FilenameFilter()
+            {
+                public boolean accept( File dir, String name )
+                {
+                    if ( new File( dir, name ).isDirectory() )
+                    {
+                        if ( noSnapshots && name.endsWith( Artifact.SNAPSHOT_VERSION ) )
                             return false;
-                        }
-                         
-                     }
-                           );
-            
-            if( !ts.isEmpty() )
+
+                        ts.add( name );
+                        return true;
+                    }
+                    return false;
+                }
+
+            } );
+
+            if ( !ts.isEmpty() )
                 loc.setVersion( ts.last() );
             else
             {
-                if( LOG.isDebugEnabled() )
+                if ( LOG.isDebugEnabled() )
                     LOG.debug( LANG.getMessage( "gav.not.found", bmd.toString(), loc.getGaPath() ) );
                 return null;
             }
@@ -173,11 +171,11 @@
             File gavDir = new File( gaDir, loc.getVersion() );
             if ( !gavDir.exists() )
             {
-//                res.addError( bmd, new RepositoryException( LANG.getMessage( "gavdir.not.found", bmd.toString(),
-//                                                                             gavDir.getAbsolutePath() ) ) );
-                if( LOG.isDebugEnabled() )
+                // res.addError( bmd, new RepositoryException( LANG.getMessage( "gavdir.not.found", bmd.toString(),
+                // gavDir.getAbsolutePath() ) ) );
+                if ( LOG.isDebugEnabled() )
                     LOG.debug( LANG.getMessage( "gavdir.not.found", bmd.toString(), gavDir.getAbsolutePath() ) );
-                
+
                 return null;
             }
 
@@ -210,7 +208,7 @@
 
         for ( ArtifactMetadata md : query )
         {
-            if( ! _repo.getRepositoryQualityRange().isAcceptedQuality( md.getRequestedQuality() ) )
+            if ( !_repo.getRepositoryQualityRange().isAcceptedQuality( md.getRequestedQuality() ) )
                 continue;
 
             DefaultArtifact da = md instanceof DefaultArtifact ? (DefaultArtifact) md : new DefaultArtifact( md );
@@ -225,15 +223,16 @@
             // binary calculated
             if ( !binary.exists() )
             {
-//                res.addError( bmd, new RepositoryException( LANG.getMessage( "binary.not.found", bmd.toString(),
-//                                                                             binary.getAbsolutePath() ) ) );
-                if( LOG.isDebugEnabled() )
+                // res.addError( bmd, new RepositoryException( LANG.getMessage( "binary.not.found", bmd.toString(),
+                // binary.getAbsolutePath() ) ) );
+                if ( LOG.isDebugEnabled() )
                     LOG.debug( LANG.getMessage( "binary.not.found", md.toString(), binary.getAbsolutePath() ) );
 
                 continue;
             }
 
-            try // reading pom if one exists
+            try
+            // reading pom if one exists
             {
                 if ( checkFile( binary, vFacs ) )
                 {
@@ -374,17 +373,18 @@
         File pomFile = null;
         for ( ArtifactMetadata md : query )
         {
-            if( ! _repo.getRepositoryQualityRange().isAcceptedQuality( md.getRequestedQuality() ) )
+            if ( !_repo.getRepositoryQualityRange().isAcceptedQuality( md.getRequestedQuality() ) )
                 continue;
 
             String pomPath =
-                md.getGroupId().replace( '.', '/' ) + "/" + md.getArtifactId() + "/" + ArtifactLocation.calculateVersionDir( md.getVersion() ) + "/"
-                    + md.getArtifactId() + '-' + md.getVersion() + ".pom";
+                md.getGroupId().replace( '.', '/' ) + "/" + md.getArtifactId() + "/"
+                    + ArtifactLocation.calculateVersionDir( md.getVersion() ) + "/" + md.getArtifactId() + '-'
+                    + md.getVersion() + ".pom";
 
             pomFile = new File( _repoDir, pomPath );
             if ( !pomFile.exists() )
             {
-                if( LOG.isDebugEnabled() )
+                if ( LOG.isDebugEnabled() )
                     LOG.debug( "file \"" + pomPath + "\" does not exist in local repo" );
                 continue;
             }
@@ -394,15 +394,15 @@
                 List<ArtifactMetadata> deps =
                     _mdProcessor.getDependencies( md, _mdReader == null ? this : _mdReader, System.getenv(),
                                                   System.getProperties() );
-// for(ArtifactBasicMetadata d : deps )
-// {
-// System.out.println("======> "+d.getScope() );
-// }
+                // for(ArtifactBasicMetadata d : deps )
+                // {
+                // System.out.println("======> "+d.getScope() );
+                // }
                 ror = MetadataResults.add( ror, md, deps );
             }
             catch ( Exception e )
             {
-                if( LOG.isDebugEnabled() )
+                if ( LOG.isDebugEnabled() )
                     LOG.debug( "error reading " + md.toString() + " dependencies", e );
                 continue;
             }
@@ -416,81 +416,80 @@
     private boolean findLatestSnapshot( final ArtifactMetadata md, final ArtifactLocation loc, AbstractRepOpResult res )
     {
         File snapshotFile = new File( loc.getAbsPath() );
-        
+
         boolean virtualRequested = md.isVirtual();
-        
+
         final boolean virtualExists = snapshotFile.exists();
-        
-        final long  virtualLM = virtualExists ? snapshotFile.lastModified() : 0L;
+
+        final long virtualLM = virtualExists ? snapshotFile.lastModified() : 0L;
         final String virtualTS = virtualExists ? TimeUtil.defaultToSnTs( virtualLM ) : "00000000.000000";
 
         // TS exists - return it
-        if ( ! virtualRequested )
+        if ( !virtualRequested )
             return snapshotFile.exists();
 
-        if( virtualExists &&  ((LocalRepositoryM2)_repo).getSnapshotAlwaysWins() )
+        if ( virtualExists && ( (LocalRepositoryM2) _repo ).getSnapshotAlwaysWins() )
             return true;
-        
+
         // no real SNAPSHOT file, let's try to find one
         File gavDir = new File( loc.getAbsGavPath() );
-        
-        String classifier = Util.isEmpty( md.getClassifier() ) ? "" : '-'+md.getClassifier();
-        
-        final String regEx = Artifact.SNAPSHOT_TS_REGEX + classifier + "\\."+md.getCheckedType();
-        
+
+        String classifier = Util.isEmpty( md.getClassifier() ) ? "" : '-' + md.getClassifier();
+
+        final String regEx = Artifact.SNAPSHOT_TS_REGEX + classifier + "\\." + md.getCheckedType();
+
         final TreeSet<String> ts = new TreeSet<String>( new VersionComparator() );
-        
+
         final int pos = md.getArtifactId().length() + 1;
-        
+
         gavDir.listFiles( new FilenameFilter()
-                            {
-                                public boolean accept( File dir, String name )
-                                {
-                                    if( name.matches( regEx ) )
-                                    {
-                                        String ver = name.substring( pos, name.lastIndexOf( '.' ) );
-                                        
-                                        if( !virtualExists )
-                                        {
-                                            ts.add( ver );
-                                            
-                                            return true;
-                                        }
-                                        
-                                        // otherwise - only add it if older'n the SNAPSHOT
-                                        String fTS = ArtifactLocation.getFileTS( name );
-                                        
-                                        if( fTS.compareTo( virtualTS ) >= 0 )
-                                        {
-                                            ts.add( ver );
-                                            
-                                            return true;
-                                        }
-                                        
-                                        return false;
-                                        
-                                    }
-    
-                                    return false;
-                                }
-                                
-                            }
-                          );
-        
-        if( ts.isEmpty() )
         {
-            if( virtualExists ) // none were older'n the snapshot
+            public boolean accept( File dir, String name )
+            {
+                if ( name.matches( regEx ) )
+                {
+                    String ver = name.substring( pos, name.lastIndexOf( '.' ) );
+
+                    if ( !virtualExists )
+                    {
+                        ts.add( ver );
+
+                        return true;
+                    }
+
+                    // otherwise - only add it if older'n the SNAPSHOT
+                    String fTS = ArtifactLocation.getFileTS( name );
+
+                    if ( fTS.compareTo( virtualTS ) >= 0 )
+                    {
+                        ts.add( ver );
+
+                        return true;
+                    }
+
+                    return false;
+
+                }
+
+                return false;
+            }
+
+        } );
+
+        if ( ts.isEmpty() )
+        {
+            if ( virtualExists ) // none were older'n the snapshot
             {
                 md.setTimeStamp( virtualTS );
                 return true;
             }
-            
-            if( LOG.isErrorEnabled() )
-                LOG.error( LANG.getMessage( "snapshot.not.found", md.toString(), gavDir.getAbsolutePath() )  );
-            
+
+            if ( LOG.isErrorEnabled() )
+                LOG.error( LANG.getMessage( "snapshot.not.found", md.toString(), gavDir.getAbsolutePath() ) );
+
             return false;
         }
-        
+
         // at east one is older - return it
         loc.setVersion( ts.last() );
 
@@ -512,7 +511,7 @@
         File gaDir = null;
         for ( ArtifactMetadata md : query )
         {
-            if( ! _repo.getRepositoryQualityRange().isAcceptedQuality( md.getRequestedQuality() ) )
+            if ( !_repo.getRepositoryQualityRange().isAcceptedQuality( md.getRequestedQuality() ) )
                 continue;
 
             gaDir = new File( _repoDir, md.getGroupId().replace( '.', '/' ) + "/" + md.getArtifactId() );
@@ -589,11 +588,12 @@
     {
         return readRawData( md, classifier, type, false );
     }
+
     // ---------------------------------------------------------------------------------------------------------------
     public byte[] readRawData( ArtifactMetadata md, String classifier, String type, boolean exempt )
         throws MetadataReaderException
     {
-        if( ! _repo.getRepositoryQualityRange().isAcceptedQuality( md.getRequestedQuality() ) )
+        if ( !_repo.getRepositoryQualityRange().isAcceptedQuality( md.getRequestedQuality() ) )
             return null;
 
         return readRawData( relPathOf( md, classifier, type ), exempt );
@@ -603,25 +603,27 @@
     private static String relPathOf( ArtifactMetadata bmd, String classifier, String type )
     {
         String bmdPath =
-            bmd.getGroupId().replace( '.', '/' ) + '/' + bmd.getArtifactId() + '/' + ArtifactLocation.calculateVersionDir( bmd.getVersion() );
+            bmd.getGroupId().replace( '.', '/' ) + '/' + bmd.getArtifactId() + '/'
+                + ArtifactLocation.calculateVersionDir( bmd.getVersion() );
 
         String path = bmdPath + '/' + bmd.getBaseName( classifier ) + '.' + ( type == null ? bmd.getType() : type );
-        
-        if( LOG.isDebugEnabled() )
-            LOG.debug( bmd.toString()+" path is "+ path);
+
+        if ( LOG.isDebugEnabled() )
+            LOG.debug( bmd.toString() + " path is " + path );
 
         return path;
     }
 
     // ---------------------------------------------------------------------------------------------------------------
     public byte[] readRawData( String path )
-    throws MetadataReaderException
+        throws MetadataReaderException
     {
         return readRawData( path, false );
     }
+
     // ---------------------------------------------------------------------------------------------------------------
     public byte[] readRawData( String path, boolean exempt )
-    throws MetadataReaderException
+        throws MetadataReaderException
     {
         File file = new File( _repoDir, path );
 
@@ -683,5 +685,5 @@
     {
     }
     // ---------------------------------------------------------------------------------------------------------------
-    
+
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2Factory.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2Factory.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2Factory.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryReaderM2Factory.java Mon Apr 27 23:12:25 2009
@@ -29,23 +29,25 @@
 import org.codehaus.plexus.lang.Language;
 
 public class LocalRepositoryReaderM2Factory
-implements RepositoryReaderFactory
+    implements RepositoryReaderFactory
 {
-  private static final Language LANG = new DefaultLanguage( LocalRepositoryReaderM2Factory.class );
-  private static final LocalRepositoryReaderM2Factory FACTORY = new LocalRepositoryReaderM2Factory();
-  
-  static 
-  {
-    AbstractRepository.register( AbstractRepository.DEFAULT_REPOSITORY_TYPE, FACTORY  );
-  }
-  
-  public RepositoryReader getReader( Repository repo, DependencyProcessor mdProcessor)
-  throws RepositoryException
-  {
-    if( repo == null || !(repo instanceof LocalRepository) )
-      throw new RepositoryException( LANG.getMessage( "bad.repository.type", repo == null ? "null" : repo.getClass().getName() ) );
-    
-    return new LocalRepositoryReaderM2( (LocalRepository)repo, mdProcessor );
-  }
+    private static final Language LANG = new DefaultLanguage( LocalRepositoryReaderM2Factory.class );
+
+    private static final LocalRepositoryReaderM2Factory FACTORY = new LocalRepositoryReaderM2Factory();
+
+    static
+    {
+        AbstractRepository.register( AbstractRepository.DEFAULT_REPOSITORY_TYPE, FACTORY );
+    }
+
+    public RepositoryReader getReader( Repository repo, DependencyProcessor mdProcessor )
+        throws RepositoryException
+    {
+        if ( repo == null || !( repo instanceof LocalRepository ) )
+            throw new RepositoryException( LANG.getMessage( "bad.repository.type", repo == null ? "null"
+                            : repo.getClass().getName() ) );
+
+        return new LocalRepositoryReaderM2( (LocalRepository) repo, mdProcessor );
+    }
 
 }