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 [7/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/local/m2/LocalRepositoryWriterM2.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryWriterM2.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryWriterM2.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryWriterM2.java Mon Apr 27 23:12:25 2009
@@ -60,252 +60,279 @@
 import org.codehaus.plexus.lang.Language;
 
 public class LocalRepositoryWriterM2
-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( LocalRepositoryWriterM2.class ); 
-  private static final Language LANG = new DefaultLanguage( LocalRepositoryWriterM2.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 LocalRepositoryWriterM2( 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 LocalRepositoryWriterM2( 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();
-    LocalRepositoryWriterM2 [] workers = new LocalRepositoryWriterM2[ nWorkers ];
-    
-    for( int i=0; i<nWorkers; i++ )
-      workers[ i ] = new LocalRepositoryWriterM2( _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 ) {}
-        }
-    }
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  /* (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 );
-      }
-    }
-    DefaultArtifactVersion dav = new DefaultArtifactVersion( artifact.getVersion() );
-    Quality aq = dav.getQuality();
-    boolean isSnapshot = aq.equals( Quality.SNAPSHOT_QUALITY ) || aq.equals( Quality.SNAPSHOT_TS_QUALITY );
-
-    String relGroupPath = artifact.getGroupId().replace( '.', '/' )+"/"+artifact.getArtifactId();
-    String versionDirName = isSnapshot ? (dav.getBase()+'-'+Artifact.SNAPSHOT_VERSION) : artifact.getVersion();
-    String relVersionPath = relGroupPath + '/' + versionDirName;
-    
-    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 = _repoDir.getAbsolutePath()+'/'+relGroupPath;
-
-      File gav = new File( lockDir );
-      gav.mkdirs();
-
-//    haveLock = FileUtil.lockDir( lockDir, SLEEP_FOR_LOCK, SLEEP_FOR_LOCK_TICK );
-//    if( !haveLock )
-//      throw new RepositoryException( _lang.getMessage( "cannot.lock.gav", lockDir, ""+SLEEP_FOR_LOCK ) );
-      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 = _repoDir.getAbsolutePath()+'/'+relVersionPath+'/'+artifact.getBaseName()+'.'+artifact.getType();
-      
-      if( !isPom ) // first - take care of the binary
-      {
-        FileUtil.writeAndSign( fName, in, vFacs );
-        artifact.setFile( new File(fName) );
-      }
-
-      // GA metadata
-      File mdFile = new File( _repoDir, relGroupPath+'/'+_repo.getMetadataName() );
-      updateGAMetadata( mdFile, artifact, versionDirName, aq, vFacs );
-
-      // now - GAV metadata
-      mdFile = new File( _repoDir, relVersionPath+'/'+_repo.getMetadataName() );
-      updateGAVMetadata( mdFile, artifact, aq, vFacs );
-
-      // if classier - nothing else to do :)
-      if( artifact.hasClassifier() )
-        return;
-      
-      if( hasPomBlob )
-      {
-        FileUtil.writeAndSign( _repoDir.getAbsolutePath()+'/'+relVersionPath
-                              +'/'+artifact.getArtifactId()+'-'+artifact.getVersion()+".pom", pomBlob, vFacs
-                              );
-      }
-        
+    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( LocalRepositoryWriterM2.class );
+
+    private static final Language LANG = new DefaultLanguage( LocalRepositoryWriterM2.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 LocalRepositoryWriterM2( 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;
     }
-    catch( Exception e )
+
+    // ---------------------------------------------------------------------------------------------------------------
+    private LocalRepositoryWriterM2( LocalRepository repo, File repoDir, ArtifactQueue aq )
     {
-      throw new RepositoryException( e );
+        _repo = repo;
+        _repoDir = repoDir;
+        _aq = aq;
     }
-    finally
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public Repository getRepository()
     {
-      if( fLock != null )
-        fLock.release();
+        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();
+        LocalRepositoryWriterM2[] workers = new LocalRepositoryWriterM2[nWorkers];
+
+        for ( int i = 0; i < nWorkers; i++ )
+            workers[i] = new LocalRepositoryWriterM2( _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 )
+                    {
+                    }
+                }
+        }
+    }
+
+    // ---------------------------------------------------------------------------------------------------------------
+    /*
+     * (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 );
+            }
+        }
+        DefaultArtifactVersion dav = new DefaultArtifactVersion( artifact.getVersion() );
+        Quality aq = dav.getQuality();
+        boolean isSnapshot = aq.equals( Quality.SNAPSHOT_QUALITY ) || aq.equals( Quality.SNAPSHOT_TS_QUALITY );
+
+        String relGroupPath = artifact.getGroupId().replace( '.', '/' ) + "/" + artifact.getArtifactId();
+        String versionDirName =
+            isSnapshot ? ( dav.getBase() + '-' + Artifact.SNAPSHOT_VERSION ) : artifact.getVersion();
+        String relVersionPath = relGroupPath + '/' + versionDirName;
+
+        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 = _repoDir.getAbsolutePath() + '/' + relGroupPath;
+
+            File gav = new File( lockDir );
+            gav.mkdirs();
+
+            // haveLock = FileUtil.lockDir( lockDir, SLEEP_FOR_LOCK, SLEEP_FOR_LOCK_TICK );
+            // if( !haveLock )
+            // throw new RepositoryException( _lang.getMessage( "cannot.lock.gav", lockDir, ""+SLEEP_FOR_LOCK ) );
+            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 =
+                _repoDir.getAbsolutePath() + '/' + relVersionPath + '/' + artifact.getBaseName() + '.'
+                    + artifact.getType();
+
+            if ( !isPom ) // first - take care of the binary
+            {
+                FileUtil.writeAndSign( fName, in, vFacs );
+                artifact.setFile( new File( fName ) );
+            }
+
+            // GA metadata
+            File mdFile = new File( _repoDir, relGroupPath + '/' + _repo.getMetadataName() );
+            updateGAMetadata( mdFile, artifact, versionDirName, aq, vFacs );
+
+            // now - GAV metadata
+            mdFile = new File( _repoDir, relVersionPath + '/' + _repo.getMetadataName() );
+            updateGAVMetadata( mdFile, artifact, aq, vFacs );
+
+            // if classier - nothing else to do :)
+            if ( artifact.hasClassifier() )
+                return;
+
+            if ( hasPomBlob )
+            {
+                FileUtil.writeAndSign( _repoDir.getAbsolutePath() + '/' + relVersionPath + '/'
+                    + artifact.getArtifactId() + '-' + artifact.getVersion() + ".pom", pomBlob, vFacs );
+            }
+
+        }
+        catch ( Exception e )
+        {
+            throw new RepositoryException( e );
+        }
+        finally
+        {
+            if ( fLock != null )
+                fLock.release();
             if ( in != null )
             {
                 try
@@ -317,133 +344,132 @@
                     // ignore, tried our best to clean up
                 }
             }
+        }
+
+    }
+
+    // ---------------------------------------------------------------------------------------------------------------
+    private void updateGAMetadata( final File mdFile, final Artifact artifact, final String version, final Quality aq,
+                                   final Set<StreamVerifierFactory> vFacs )
+        throws MetadataException, IOException, StreamObserverException
+    {
+        Metadata md = null;
+
+        if ( mdFile.exists() )
+        {
+            try
+            {
+                byte[] mdBytes = FileUtil.readRawData( mdFile );
+
+                if ( mdBytes == null )
+                    throw new MetadataException( LANG.getMessage( "file.is.empty", mdFile.getAbsolutePath() ) );
+
+                md = MetadataBuilder.read( new ByteArrayInputStream( mdBytes ) );
+            }
+            catch ( MetadataException e )
+            {
+                throw e;
+            }
+        }
+        else
+        {
+            md = new Metadata();
+            md.setGroupId( artifact.getGroupId() );
+            md.setArtifactId( artifact.getArtifactId() );
+        }
+
+        MetadataOperation mdOp = new AddVersionOperation( new StringOperand( version ) );
+
+        byte[] resBytes = MetadataBuilder.changeMetadata( md, mdOp );
+
+        FileUtil.writeAndSign( mdFile.getAbsolutePath(), resBytes, vFacs );
+    }
+
+    // ---------------------------------------------------------------------------------------------------------------
+    private void updateGAVMetadata( final File mdFile, final Artifact artifact, final Quality aq,
+                                    final Set<StreamVerifierFactory> vFacs )
+        throws MetadataException, IOException, StreamObserverException
+    {
+        Metadata md = null;
+
+        if ( mdFile.exists() )
+        {
+            byte[] mdBytes = FileUtil.readRawData( mdFile );
+            md = MetadataBuilder.read( new ByteArrayInputStream( mdBytes ) );
+        }
+        else
+        {
+            md = new Metadata();
+            md.setGroupId( artifact.getGroupId() );
+            md.setArtifactId( artifact.getArtifactId() );
+            md.setVersion( artifact.getVersion() );
+        }
+        List<MetadataOperation> mdOps = new ArrayList<MetadataOperation>( 2 );
+
+        if ( aq.equals( Quality.SNAPSHOT_TS_QUALITY ) )
+        {
+            Snapshot sn = MetadataBuilder.createSnapshot( artifact.getVersion() );
+            sn.setLocalCopy( true );
+            mdOps.add( new SetSnapshotOperation( new SnapshotOperand( sn ) ) );
+        }
+
+        mdOps.add( new AddVersionOperation( new StringOperand( artifact.getVersion() ) ) );
+
+        // System.out.println("added "+artifact.getVersion());
+        // System.out.flush();
+        byte[] resBytes = MetadataBuilder.changeMetadata( md, mdOps );
+        FileUtil.writeAndSign( mdFile.getAbsolutePath(), resBytes, vFacs );
     }
-    
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  private void updateGAMetadata(  final File mdFile
-                                , final Artifact artifact
-                                , final String version
-                                , final Quality aq
-                                , final Set<StreamVerifierFactory> vFacs
-                              )
-  throws MetadataException, IOException, StreamObserverException
-  {
-    Metadata md = null;
-    
-    if( mdFile.exists() )
-    {
-      try
-      {
-        byte [] mdBytes = FileUtil.readRawData( mdFile );
-        
-        if( mdBytes == null )
-          throw new MetadataException( LANG.getMessage( "file.is.empty", mdFile.getAbsolutePath() ));
-        
-        md = MetadataBuilder.read( new ByteArrayInputStream(mdBytes) );
-      }
-      catch( MetadataException e )
-      {
-        throw e;
-      }
-    }
-    else
-    {
-      md = new Metadata();
-      md.setGroupId( artifact.getGroupId() );
-      md.setArtifactId( artifact.getArtifactId() );
-    }
-    
-    MetadataOperation mdOp = new AddVersionOperation( new StringOperand( version ) ); 
-    
-    byte [] resBytes = MetadataBuilder.changeMetadata( md, mdOp );
-
-    FileUtil.writeAndSign( mdFile.getAbsolutePath(), resBytes, vFacs );
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  private void updateGAVMetadata( final File mdFile
-                                , final Artifact artifact
-                                , final Quality aq
-                                , final Set<StreamVerifierFactory> vFacs
-                              )
-  throws MetadataException, IOException, StreamObserverException
-  {
-    Metadata md = null;
-    
-    if( mdFile.exists() )
-    {
-      byte [] mdBytes = FileUtil.readRawData( mdFile );
-      md = MetadataBuilder.read( new ByteArrayInputStream(mdBytes) );
-    }
-    else
-    {
-      md = new Metadata();
-      md.setGroupId( artifact.getGroupId() );
-      md.setArtifactId( artifact.getArtifactId() );
-      md.setVersion( artifact.getVersion() );
-    }
-    List<MetadataOperation> mdOps = new ArrayList<MetadataOperation>(2);
-    
-    if( aq.equals( Quality.SNAPSHOT_TS_QUALITY ) )
-    {
-      Snapshot sn = MetadataBuilder.createSnapshot( artifact.getVersion() );
-      sn.setLocalCopy( true );
-      mdOps.add( new SetSnapshotOperation( new SnapshotOperand(sn) ) );
-    }
-    
-    mdOps.add( new AddVersionOperation( new StringOperand(artifact.getVersion()) ) ); 
- 
-//System.out.println("added "+artifact.getVersion());
-//System.out.flush();
-    byte [] resBytes = MetadataBuilder.changeMetadata( md, mdOps );
-    FileUtil.writeAndSign( mdFile.getAbsolutePath(), resBytes, vFacs );
-  }
-  //---------------------------------------------------------------------------------------------------------------
-  //---------------------------------------------------------------------------------------------------------------
+    // ---------------------------------------------------------------------------------------------------------------
+    // ---------------------------------------------------------------------------------------------------------------
 }
-//=================================================================================================================
+
+// =================================================================================================================
 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/m2/LocalRepositoryWriterM2Factory.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryWriterM2Factory.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryWriterM2Factory.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/m2/LocalRepositoryWriterM2Factory.java Mon Apr 27 23:12:25 2009
@@ -28,23 +28,25 @@
 import org.codehaus.plexus.lang.Language;
 
 public class LocalRepositoryWriterM2Factory
-implements RepositoryWriterFactory
+    implements RepositoryWriterFactory
 {
-  private static final Language LANG = new DefaultLanguage( LocalRepositoryWriterM2Factory.class );
-  private static final LocalRepositoryWriterM2Factory FACTORY = new LocalRepositoryWriterM2Factory();
-  
-  static 
-  {
-    AbstractRepository.register( AbstractRepository.DEFAULT_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 LocalRepositoryWriterM2( (LocalRepository)repo );
-  }
+    private static final Language LANG = new DefaultLanguage( LocalRepositoryWriterM2Factory.class );
+
+    private static final LocalRepositoryWriterM2Factory FACTORY = new LocalRepositoryWriterM2Factory();
+
+    static
+    {
+        AbstractRepository.register( AbstractRepository.DEFAULT_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 LocalRepositoryWriterM2( (LocalRepository) repo );
+    }
 
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/DefaultStorage.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/DefaultStorage.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/DefaultStorage.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/DefaultStorage.java Mon Apr 27 23:12:25 2009
@@ -13,27 +13,24 @@
 import org.codehaus.plexus.lang.Language;
 
 /**
- *
- *
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public class DefaultStorage
-implements Storage
+    implements Storage
 {
     private static final Language _lang = new DefaultLanguage( DefaultStorage.class );
-    
-    Map< String, Artifact > _artifacts;
 
-    Map< String, File > _files;
-    
+    Map<String, Artifact> _artifacts;
+
+    Map<String, File> _files;
+
     File _dir;
-        
+
     public DefaultStorage( File dir )
-    throws StorageException
+        throws StorageException
     {
-        if( dir == null )
+        if ( dir == null )
         {
             try
             {
@@ -42,70 +39,69 @@
             }
             catch ( IOException e )
             {
-                throw new StorageException(e);
+                throw new StorageException( e );
             }
-            
+
             _dir.delete();
-            
+
             _dir.mkdirs();
         }
         else
         {
-            if( !dir.exists() )
+            if ( !dir.exists() )
                 dir.mkdirs();
-            else
-                if( dir.isDirectory() )
-                    throw new StorageException( _lang.getMessage( "default.storage.bad.dir", dir.getAbsolutePath() ) );
-            
+            else if ( dir.isDirectory() )
+                throw new StorageException( _lang.getMessage( "default.storage.bad.dir", dir.getAbsolutePath() ) );
+
             _dir = dir;
         }
     }
 
     public DefaultStorage()
-    throws StorageException
+        throws StorageException
     {
         this( null );
     }
 
     public void add( ArtifactMetadata bmd, Artifact artifact )
     {
-        if( _artifacts == null )
-            _artifacts = new HashMap<String, Artifact>(32);
-        
+        if ( _artifacts == null )
+            _artifacts = new HashMap<String, Artifact>( 32 );
+
         _artifacts.put( bmd.toString(), artifact );
     }
 
     public Artifact findArtifact( ArtifactMetadata bmd )
     {
-        if( _artifacts == null )
+        if ( _artifacts == null )
             return null;
-        
+
         return _artifacts.get( bmd.getGAV() );
     }
 
     public byte[] findRaw( String key )
-    throws StorageException
+        throws StorageException
     {
-        if( Util.isEmpty( _files ) )
+        if ( Util.isEmpty( _files ) )
             return null;
-        
+
         File f = _files.get( key );
-        
-        if( f == null )
+
+        if ( f == null )
             return null;
-        
+
         try
         {
             return FileUtil.readRawData( f );
         }
         catch ( IOException e )
         {
-            throw new StorageException(e);
+            throw new StorageException( e );
         }
     }
 
     public void add( String key, byte[] bytes )
-    throws StorageException
+        throws StorageException
     {
         try
         {
@@ -113,30 +109,31 @@
         }
         catch ( IOException e )
         {
-            throw new StorageException(e);
+            throw new StorageException( e );
         }
     }
 
     public void add( String key, File file )
-    throws StorageException
+        throws StorageException
     {
-        if( file == null || !file.exists() )
+        if ( file == null || !file.exists() )
             throw new StorageException( _lang.getMessage( "defaultStorage.add.file.no.file", key ) );
-        
-        if( _files == null )
-            _files = new HashMap<String, File>(32);
-        
+
+        if ( _files == null )
+            _files = new HashMap<String, File>( 32 );
+
         _files.put( key, file );
     }
 
-    /* (non-Javadoc)
+    /*
+     * (non-Javadoc)
      * @see org.apache.maven.mercury.repository.local.map.Storage#removeRaw(java.lang.String)
      */
     public void removeRaw( String key )
-    throws StorageException
+        throws StorageException
     {
-        if( Util.isEmpty( _files ) )
+        if ( Util.isEmpty( _files ) )
             throw new StorageException( _lang.getMessage( "dep.cannot.remove", key ) );
     }
-    
+
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/LocalRepositoryMap.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/LocalRepositoryMap.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/LocalRepositoryMap.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/LocalRepositoryMap.java Mon Apr 27 23:12:25 2009
@@ -20,6 +20,7 @@
 
 import java.io.File;
 
+import org.apache.maven.mercury.artifact.ArtifactMetadata;
 import org.apache.maven.mercury.builder.api.DependencyProcessor;
 import org.apache.maven.mercury.builder.api.MetadataReader;
 import org.apache.maven.mercury.repository.api.AbstractRepository;
@@ -35,89 +36,111 @@
  * @version $Id$
  */
 public class LocalRepositoryMap
-extends AbstractRepository
-implements LocalRepository
+    extends AbstractRepository
+    implements LocalRepository
 {
     public static final String FLAT_REPOSITORY_TYPE = "map";
-    
+
     protected Storage _storage;
-    
+
     protected MetadataReader _mdReader;
-    
+
     // ----------------------------------------------------------------------------------
     public Storage getStorage()
     {
         return _storage;
     }
+
     // ----------------------------------------------------------------------------------
     public LocalRepositoryMap( String id, DependencyProcessor dp, Storage storage )
     {
         super( id, FLAT_REPOSITORY_TYPE );
         setDependencyProcessor( dp );
-        
+
         _storage = storage;
     }
+
     // ----------------------------------------------------------------------------------
     public LocalRepositoryMap( DependencyProcessor dp, Storage storage )
     {
-        this( "" + System.currentTimeMillis() + (int)(Math.random()*10000), dp, storage );
+        this( "" + System.currentTimeMillis() + (int) ( Math.random() * 10000 ), dp, storage );
     }
-    
+
     public void setMetadataReader( MetadataReader reader )
     {
         _mdReader = reader;
     }
+
     // ----------------------------------------------------------------------------------
     public File getDirectory()
     {
         return null;
     }
+
     // ----------------------------------------------------------------------------------
     public RepositoryReader getReader()
     {
         return new LocalRepositoryReaderMap( this, getDependencyProcessor() );
     }
+
     // ----------------------------------------------------------------------------------
     public RepositoryReader getReader( String protocol )
     {
         return getReader();
     }
+
     // ----------------------------------------------------------------------------------
     public RepositoryWriter getWriter()
     {
         return RepositoryWriter.NULL_WRITER;
     }
+
     // ----------------------------------------------------------------------------------
     public RepositoryWriter getWriter( String protocol )
         throws NonExistentProtocolException
     {
         return getWriter();
     }
+
     // ----------------------------------------------------------------------------------
     public boolean isLocal()
     {
         return true;
     }
+
     // ----------------------------------------------------------------------------------
     public boolean isReadable()
     {
         return true;
     }
+
     // ----------------------------------------------------------------------------------
     public boolean isWriteable()
     {
         return false;
     }
+
     // ----------------------------------------------------------------------------------
     public String getType()
     {
         return FLAT_REPOSITORY_TYPE;
     }
+
     // ----------------------------------------------------------------------------------
     public String getMetadataName()
     {
         return null;
     }
+
+    // ---------------------------------------------------------------------------------------------------------------
+    public static final String calculateStorageKey( ArtifactMetadata md, String classifier, String type )
+    {
+        String key =
+            md.getGroupId() + ":" + md.getArtifactId() + ":" + md.getVersion() + ":"
+                + ( classifier == null ? "" : classifier ) + ":" + ( type == null ? md.getType() : type );
+
+        return key;
+    }
     // ----------------------------------------------------------------------------------
     // ----------------------------------------------------------------------------------
 }
\ No newline at end of file

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/LocalRepositoryReaderMap.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/LocalRepositoryReaderMap.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/LocalRepositoryReaderMap.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/LocalRepositoryReaderMap.java Mon Apr 27 23:12:25 2009
@@ -30,8 +30,8 @@
 import org.apache.maven.mercury.logging.MercuryLoggerManager;
 import org.apache.maven.mercury.repository.api.AbstracRepositoryReader;
 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.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;
@@ -66,34 +66,38 @@
         _repo = (LocalRepositoryMap) repo;
 
     }
+
     // ---------------------------------------------------------------------------------------------------------------
     public Repository getRepository()
     {
         return _repo;
     }
+
     // ---------------------------------------------------------------------------------------------------------------
     public boolean canHandle( String protocol )
     {
         return AbstractRepository.DEFAULT_LOCAL_READ_PROTOCOL.equals( protocol );
     }
+
     // ---------------------------------------------------------------------------------------------------------------
     public String[] getProtocols()
     {
         return _protocols;
     }
+
     // ---------------------------------------------------------------------------------------------------------------
     public ArtifactResults readArtifacts( Collection<ArtifactMetadata> query )
         throws RepositoryException
     {
-        if( Util.isEmpty( query ) )
+        if ( Util.isEmpty( query ) )
             return null;
-        
-        if( Util.isEmpty( _repo._storage ) )
+
+        if ( Util.isEmpty( _repo._storage ) )
             return null;
-        
+
         ArtifactResults res = new ArtifactResults();
-        
-        for( ArtifactMetadata md : query )
+
+        for ( ArtifactMetadata md : query )
         {
             Artifact a;
             try
@@ -102,24 +106,26 @@
             }
             catch ( Exception e )
             {
-                throw new RepositoryException(e);
+                throw new RepositoryException( e );
             }
-            
-            if( a != null )
+
+            if ( a != null )
                 res.add( md, a );
         }
 
         return res;
     }
+
     // ---------------------------------------------------------------------------------------------------------------
     public byte[] readRawData( String path )
-    throws MetadataReaderException
+        throws MetadataReaderException
     {
         return readRawData( path, false );
     }
+
     // ---------------------------------------------------------------------------------------------------------------
     public byte[] readRawData( String path, boolean exempt )
-    throws MetadataReaderException
+        throws MetadataReaderException
     {
         try
         {
@@ -127,70 +133,68 @@
         }
         catch ( StorageException e )
         {
-            throw new MetadataReaderException(e);
+            throw new MetadataReaderException( e );
         }
     }
+
     // ---------------------------------------------------------------------------------------------------------------
     public byte[] readRawData( ArtifactMetadata bmd, String classifier, String type )
         throws MetadataReaderException
     {
         return readRawData( bmd, classifier, type, false );
     }
+
     // ---------------------------------------------------------------------------------------------------------------
-    public byte[] readRawData( ArtifactMetadata bmd, String classifier, String type, boolean exempt )
+    public byte[] readRawData( ArtifactMetadata md, String classifier, String type, boolean exempt )
         throws MetadataReaderException
     {
-        
-        String key =  bmd.getGroupId()
-            + ":"+bmd.getArtifactId()
-            + ":"+bmd.getVersion()
-            + ":"+ (classifier == null ? "" : classifier)
-            + ":"+ (type == null ? bmd.getType() : type)
-        ;
-        
+        String key = LocalRepositoryMap.calculateStorageKey( md, classifier, type );
+
         return readRawData( key, exempt );
     }
+
     // ---------------------------------------------------------------------------------------------------------------
     public MetadataResults readDependencies( Collection<ArtifactMetadata> query )
         throws RepositoryException
     {
-        if( Util.isEmpty( query ) )
+        if ( Util.isEmpty( query ) )
             return null;
-        
+
         DependencyProcessor dp = _repo.getDependencyProcessor();
-        
+
         MetadataResults res = new MetadataResults( query.size() );
-        
-        for( ArtifactMetadata bmd : query )
+
+        for ( ArtifactMetadata bmd : query )
         {
             try
             {
                 MetadataReader mdr = _repo._mdReader == null ? this : _repo._mdReader;
-                
+
                 List<ArtifactMetadata> deps = dp.getDependencies( bmd, mdr, System.getenv(), System.getProperties() );
-                
+
                 res.add( bmd, deps );
             }
             catch ( Exception e )
             {
                 LOG.error( e.getMessage() );
-                
+
                 res.addError( bmd, e );
             }
         }
-        
+
         return res;
     }
+
     // ---------------------------------------------------------------------------------------------------------------
     public MetadataResults readVersions( Collection<ArtifactMetadata> query )
         throws RepositoryException
     {
         return null;
     }
+
     // ---------------------------------------------------------------------------------------------------------------
     public void close()
     {
     }
     // ---------------------------------------------------------------------------------------------------------------
-    // ---------------------------------------------------------------------------------------------------------------
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/ReactorStorage.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/ReactorStorage.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/ReactorStorage.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/ReactorStorage.java Mon Apr 27 23:12:25 2009
@@ -7,136 +7,136 @@
 
 import org.apache.maven.mercury.artifact.Artifact;
 import org.apache.maven.mercury.artifact.ArtifactMetadata;
+import org.apache.maven.mercury.artifact.DefaultArtifact;
 import org.apache.maven.mercury.util.FileUtil;
 import org.apache.maven.mercury.util.Util;
 import org.codehaus.plexus.lang.DefaultLanguage;
 import org.codehaus.plexus.lang.Language;
 
 /**
- *
- *
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public class ReactorStorage
-implements Storage
+    implements Storage
 {
     private static final Language _lang = new DefaultLanguage( ReactorStorage.class );
-    
-    Map< String, Artifact > _artifacts;
 
-    Map< String, File > _files;
-    
     File _dir;
-        
-    public ReactorStorage( File dir )
-    throws StorageException
+
+    Map<String, String> _reactor;
+
+    public ReactorStorage( File dir, Map<String, String> reactorMap )
+        throws StorageException
     {
-        if( dir == null )
-        {
-            try
-            {
-                _dir = File.createTempFile( "temp-", "-mercury-default-storage" );
-                _dir.deleteOnExit();
-            }
-            catch ( IOException e )
-            {
-                throw new StorageException(e);
-            }
-            
-            _dir.delete();
-            
-            _dir.mkdirs();
-        }
+        if ( !dir.exists() )
+            dir.mkdirs();
+        else if ( !dir.isDirectory() )
+            throw new StorageException( _lang.getMessage( "reactor.storage.bad.dir", dir.getAbsolutePath() ) );
+
+        _dir = dir;
+
+        if ( Util.isEmpty( reactorMap ) )
+            _reactor = new HashMap<String, String>( 8 );
         else
-        {
-            if( !dir.exists() )
-                dir.mkdirs();
-            else
-                if( dir.isDirectory() )
-                    throw new StorageException( _lang.getMessage( "default.storage.bad.dir", dir.getAbsolutePath() ) );
-            
-            _dir = dir;
-        }
+            _reactor = reactorMap;
     }
 
-    public ReactorStorage()
-    throws StorageException
+    public static final String calculateKeyString( ArtifactMetadata md )
     {
-        this( null );
+        return md.getGroupId() + ":" + md.getArtifactId() + ":" + md.getVersion();
     }
 
-    public void add( ArtifactMetadata bmd, Artifact artifact )
+    private static final String calculateBinaryName( ArtifactMetadata md )
     {
-        if( _artifacts == null )
-            _artifacts = new HashMap<String, Artifact>(32);
-        
-        _artifacts.put( bmd.toString(), artifact );
+        String type = md.getType();
+
+        String classifier = md.getClassifier();
+
+        if ( "test-jar".equals( type ) )
+        {
+            type = "jar";
+            classifier = "tests";
+        }
+        else if ( "maven-plugin".equals( type ) )
+        {
+            type = "jar";
+            classifier = null;
+        }
+
+        boolean hasClassifier = classifier != null && classifier.length() > 0;
+
+        return md.getArtifactId() + "-" + md.getVersion() + ( hasClassifier ? "-" + classifier : "" ) + "." + type;
     }
 
-    public Artifact findArtifact( ArtifactMetadata bmd )
+    public Artifact findArtifact( ArtifactMetadata md )
     {
-        if( _artifacts == null )
+
+        if ( _reactor.isEmpty() )
+            return null;
+
+        String key = calculateKeyString( md );
+
+        String target = _reactor.get( key );
+
+        if ( target == null )
             return null;
-        
-        return _artifacts.get( bmd.getGAV() );
+
+        File candidate = new File( _dir, target + "/" + calculateBinaryName( md ) );
+
+        if ( !candidate.exists() )
+            return null;
+
+        DefaultArtifact da = new DefaultArtifact( md );
+        da.setFile( candidate );
+
+        // TODO: 2009.04.27 oleg - investigate if POM should be set into Artifact
+        // looks like none of the use cases require POM file being set
+
+        return da;
     }
 
     public byte[] findRaw( String key )
-    throws StorageException
+        throws StorageException
     {
-        if( Util.isEmpty( _files ) )
-            return null;
-        
-        File f = _files.get( key );
-        
-        if( f == null )
-            return null;
-        
+        ArtifactMetadata md = new ArtifactMetadata( key );
+
+        Artifact a = findArtifact( md );
+
         try
         {
-            return FileUtil.readRawData( f );
+            if ( a != null )
+                return FileUtil.readRawData( a.getFile() );
         }
         catch ( IOException e )
         {
-            throw new StorageException(e);
+            throw new StorageException( e );
         }
+
+        return null;
+    }
+
+    public void add( ArtifactMetadata md, Artifact artifact )
+    {
+        // noop, all artifacts came from the constructor
     }
 
     public void add( String key, byte[] bytes )
-    throws StorageException
+        throws StorageException
     {
-        try
-        {
-            add( key, FileUtil.writeTempData( bytes ) );
-        }
-        catch ( IOException e )
-        {
-            throw new StorageException(e);
-        }
+        // noop, all artifacts came from the constructor
     }
 
     public void add( String key, File file )
-    throws StorageException
+        throws StorageException
     {
-        if( file == null || !file.exists() )
-            throw new StorageException( _lang.getMessage( "defaultStorage.add.file.no.file", key ) );
-        
-        if( _files == null )
-            _files = new HashMap<String, File>(32);
-        
-        _files.put( key, file );
+        // noop, all artifacts came from the constructor
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.maven.mercury.repository.local.map.Storage#removeRaw(java.lang.String)
-     */
     public void removeRaw( String key )
-    throws StorageException
+        throws StorageException
     {
-        if( Util.isEmpty( _files ) )
-            throw new StorageException( _lang.getMessage( "dep.cannot.remove", key ) );
+        // noop, all artifacts came from the constructor
     }
-    
+
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/Storage.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/Storage.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/Storage.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/Storage.java Mon Apr 27 23:12:25 2009
@@ -7,10 +7,9 @@
 
 /**
  * storage for the repository
- *
+ * 
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public interface Storage
 {
@@ -35,27 +34,26 @@
      * 
      * @param key
      * @return
-     * @throws StorageException 
+     * @throws StorageException
      */
-    public abstract byte[] findRaw( String key ) throws StorageException;
+    public abstract byte[] findRaw( String key )
+        throws StorageException;
 
     /**
-     * 
      * @param key
      * @param bytes
-     * @throws StorageException 
+     * @throws StorageException
      */
-    public abstract void add( String key, byte [] bytes )
-    throws StorageException;
-    
+    public abstract void add( String key, byte[] bytes )
+        throws StorageException;
+
     /**
-     * 
      * @param key
      * @param file
-     * @throws StorageException 
+     * @throws StorageException
      */
     public abstract void add( String key, File file )
-    throws StorageException;
+        throws StorageException;
 
     /**
      * delete this datum
@@ -63,6 +61,6 @@
      * @param key
      */
     public abstract void removeRaw( String key )
-    throws StorageException;
+        throws StorageException;
 
 }
\ No newline at end of file

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/StorageException.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/StorageException.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/StorageException.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/local/map/StorageException.java Mon Apr 27 23:12:25 2009
@@ -1,11 +1,8 @@
 package org.apache.maven.mercury.repository.local.map;
 
 /**
- *
- *
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public class StorageException
     extends Exception

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/AbstractOperand.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/AbstractOperand.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/AbstractOperand.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/AbstractOperand.java Mon Apr 27 23:12:25 2009
@@ -19,11 +19,8 @@
 package org.apache.maven.mercury.repository.metadata;
 
 /**
- *
- *
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public abstract class AbstractOperand
 {

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/AddPluginOperation.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/AddPluginOperation.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/AddPluginOperation.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/AddPluginOperation.java Mon Apr 27 23:12:25 2009
@@ -27,7 +27,7 @@
 
 /**
  * adds new plugin to metadata
- *
+ * 
  * @author Oleg Gusakov
  * @version $Id$
  */
@@ -37,9 +37,9 @@
     private static final Language LANG = new DefaultLanguage( AddPluginOperation.class );
 
     private Plugin plugin;
-    
+
     private static PluginComparator pluginComparator;
-    
+
     {
         pluginComparator = new PluginComparator();
     }
@@ -67,7 +67,7 @@
 
     /**
      * add plugin to the in-memory metadata instance
-     *
+     * 
      * @param metadata
      * @param version
      * @return
@@ -96,10 +96,10 @@
         plugins.add( plugin );
 
         Collections.sort( plugins, pluginComparator );
-        
+
         return true;
     }
-    
+
     class PluginComparator
         implements Comparator<Plugin>
     {
@@ -112,8 +112,8 @@
 
             if ( p1.getArtifactId() == null || p2.getArtifactId() == null )
             {
-                throw new IllegalArgumentException( LANG.getMessage( "null.plugin.artifactId.to.compare", p1
-                    .getArtifactId(), p2.getArtifactId() ) );
+                throw new IllegalArgumentException( LANG.getMessage( "null.plugin.artifactId.to.compare",
+                                                                     p1.getArtifactId(), p2.getArtifactId() ) );
             }
 
             return p1.getArtifactId().compareTo( p2.getArtifactId() );

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/AddVersionOperation.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/AddVersionOperation.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/AddVersionOperation.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/AddVersionOperation.java Mon Apr 27 23:12:25 2009
@@ -28,18 +28,17 @@
 
 /**
  * adds new version to metadata
- *
+ * 
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public class AddVersionOperation
     implements MetadataOperation
 {
     private static final Language LANG = new DefaultLanguage( AddVersionOperation.class );
-  
+
     private String version;
-  
+
     /**
      * @throws MetadataException
      */
@@ -48,8 +47,8 @@
     {
         setOperand( data );
     }
-  
-  public void setOperand( Object data )
+
+    public void setOperand( Object data )
         throws MetadataException
     {
         if ( data == null || !( data instanceof StringOperand ) )
@@ -61,7 +60,7 @@
         version = ( (StringOperand) data ).getOperand();
     }
 
-  /**
+    /**
      * add version to the in-memory metadata instance
      * 
      * @param metadata
@@ -96,35 +95,35 @@
         }
 
         vs.addVersion( version );
-        
+
         List<String> versions = vs.getVersions();
-        
+
         Collections.sort( versions, new VersionComparator() );
-        
-        vs.setLatest( getLatestVersion(versions) );
-        
-        vs.setRelease( getReleaseVersion(versions) );
-        
+
+        vs.setLatest( getLatestVersion( versions ) );
+
+        vs.setRelease( getReleaseVersion( versions ) );
+
         vs.setLastUpdated( TimeUtil.getUTCTimestamp() );
 
         return true;
     }
-    
+
     private String getLatestVersion( List<String> orderedVersions )
     {
-    	return orderedVersions.get( orderedVersions.size() - 1 );
+        return orderedVersions.get( orderedVersions.size() - 1 );
     }
-    
+
     private String getReleaseVersion( List<String> orderedVersions )
     {
-        for (int i = orderedVersions.size() - 1; i >= 0; i--) 
+        for ( int i = orderedVersions.size() - 1; i >= 0; i-- )
         {
-			if (!orderedVersions.get(i).endsWith("SNAPSHOT")) 
-			{
-				return orderedVersions.get(i);
-			}
-		}
-        
+            if ( !orderedVersions.get( i ).endsWith( "SNAPSHOT" ) )
+            {
+                return orderedVersions.get( i );
+            }
+        }
+
         return "";
     }
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/MergeOperation.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/MergeOperation.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/MergeOperation.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/MergeOperation.java Mon Apr 27 23:12:25 2009
@@ -25,10 +25,9 @@
 
 /**
  * merge Metadata.
- *
+ * 
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public class MergeOperation
     implements MetadataOperation

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/MetadataBuilder.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/MetadataBuilder.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/MetadataBuilder.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/MetadataBuilder.java Mon Apr 27 23:12:25 2009
@@ -42,6 +42,7 @@
 public class MetadataBuilder
 {
     private static final Language LANG = new DefaultLanguage( MetadataBuilder.class );
+
     /**
      * instantiate Metadata from a stream
      * 
@@ -265,22 +266,22 @@
         }
 
         int pos = version.lastIndexOf( '-' );
-        
-        if( pos == -1 )
+
+        if ( pos == -1 )
             throw new IllegalArgumentException( LANG.getMessage( "bad.snapshot.version", version ) );
 
         String sbn = version.substring( pos + 1 );
-        
+
         int bn = Integer.parseInt( sbn );
         sn.setBuildNumber( bn );
-        
-        String sts = version.substring( 0, pos);
+
+        String sts = version.substring( 0, pos );
         pos = sts.lastIndexOf( '-' );
-        
-        if( pos == -1 )
+
+        if ( pos == -1 )
             throw new IllegalArgumentException( LANG.getMessage( "bad.snapshot.version", version ) );
-        
-        sn.setTimestamp( sts.substring( pos+1 ) );
+
+        sn.setTimestamp( sts.substring( pos + 1 ) );
 
         return sn;
     }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/MetadataOperation.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/MetadataOperation.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/MetadataOperation.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/MetadataOperation.java Mon Apr 27 23:12:25 2009
@@ -20,19 +20,18 @@
 
 /**
  * change of a Metadata object
- *
+ * 
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public interface MetadataOperation
 {
     /**
-     *  sets the operation's data
+     * sets the operation's data
      */
     public void setOperand( Object data )
         throws MetadataException;
-  
+
     /**
      * performs the operation
      * 

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/SetSnapshotOperation.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/SetSnapshotOperation.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/SetSnapshotOperation.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/metadata/SetSnapshotOperation.java Mon Apr 27 23:12:25 2009
@@ -34,7 +34,7 @@
     private static final Language LANG = new DefaultLanguage( SetSnapshotOperation.class );
 
     private Snapshot snapshot;
-    
+
     private String snapshotPomName;
 
     /**
@@ -45,28 +45,28 @@
     {
         setOperand( data );
     }
-    
+
     public SetSnapshotOperation( StringOperand data )
-    	throws MetadataException
+        throws MetadataException
     {
-    	setOperand( data );
+        setOperand( data );
     }
 
     public void setOperand( Object data )
         throws MetadataException
     {
-        if ( data != null && data instanceof SnapshotOperand  )
+        if ( data != null && data instanceof SnapshotOperand )
         {
-        	snapshot = ( (SnapshotOperand) data ).getOperand();
+            snapshot = ( (SnapshotOperand) data ).getOperand();
         }
         else if ( data != null && data instanceof StringOperand )
         {
-        	snapshotPomName = ( (StringOperand) data ).getOperand();
+            snapshotPomName = ( (StringOperand) data ).getOperand();
         }
         else
         {
             throw new MetadataException( LANG.getMessage( "bad.operand", "SnapshotOperand", data == null ? "null"
-                    : data.getClass().getName() ) );
+                            : data.getClass().getName() ) );
         }
 
     }
@@ -85,7 +85,7 @@
         {
             return false;
         }
-        
+
         Versioning vs = metadata.getVersioning();
 
         if ( vs == null )
@@ -94,63 +94,62 @@
 
             metadata.setVersioning( vs );
         }
-        
+
         if ( snapshotPomName != null )
         {
-        	return updateSnapshot( snapshotPomName, metadata );
+            return updateSnapshot( snapshotPomName, metadata );
         }
         else
         {
-        	return updateSnapshot( snapshot, vs );
+            return updateSnapshot( snapshot, vs );
         }
-        
+
     }
-    
+
     private boolean updateSnapshot( String snapshotVersion, Metadata metadata )
     {
-    	Snapshot snapshot = buildSnapshot( snapshotVersion, metadata );
-    	
-    	Snapshot oldSnapshot = metadata.getVersioning().getSnapshot();
-    	
-    	if ( needUpdateSnapshot( oldSnapshot, snapshot) )
-    	{
-    		return updateSnapshot( snapshot, metadata.getVersioning() );
-    	}
-    	
-    	return false;
-    	
-    	
+        Snapshot snapshot = buildSnapshot( snapshotVersion, metadata );
+
+        Snapshot oldSnapshot = metadata.getVersioning().getSnapshot();
+
+        if ( needUpdateSnapshot( oldSnapshot, snapshot ) )
+        {
+            return updateSnapshot( snapshot, metadata.getVersioning() );
+        }
+
+        return false;
+
     }
-    
+
     private boolean updateSnapshot( Snapshot snapshot, Versioning vs )
     {
-    	vs.setSnapshot( snapshot );
-    	
-    	vs.setLastUpdated( TimeUtil.getUTCTimestamp() );
-    	
-    	return true;
+        vs.setSnapshot( snapshot );
+
+        vs.setLastUpdated( TimeUtil.getUTCTimestamp() );
+
+        return true;
     }
-    
+
     private boolean needUpdateSnapshot( Snapshot oldSnapshot, Snapshot newSnapshot )
     {
-    	if ( newSnapshot == null )
-    	{
-    		return false;
-    	}
-    	
-    	if ( oldSnapshot == null )
-    	{
-    		return true;
-    	}
-    	
-    	if ( oldSnapshot.getBuildNumber() < newSnapshot.getBuildNumber() )
-    	{
-    		return true;
-    	}
-    	
-    	return false;
+        if ( newSnapshot == null )
+        {
+            return false;
+        }
+
+        if ( oldSnapshot == null )
+        {
+            return true;
+        }
+
+        if ( oldSnapshot.getBuildNumber() < newSnapshot.getBuildNumber() )
+        {
+            return true;
+        }
+
+        return false;
     }
-    
+
     private Snapshot buildSnapshot( String pomName, Metadata md )
     {
         // skip files like groupId-artifactId-versionSNAPSHOT.pom
@@ -158,35 +157,34 @@
         {
             return null;
         }
-        
+
         Snapshot result = new Snapshot();
-        
+
         int lastHyphenPos = pomName.lastIndexOf( '-' );
-        
+
         try
         {
-            int buildNumber = Integer.parseInt( pomName.substring(
-                lastHyphenPos + 1,
-                pomName.length() - 4 ) );
-            
-            String timestamp = pomName.substring( ( md.getArtifactId() + '-' + md.getVersion() + '-' )
-                    .length()
-                    - "-SNAPSHOT".length(), lastHyphenPos );
-            
+            int buildNumber = Integer.parseInt( pomName.substring( lastHyphenPos + 1, pomName.length() - 4 ) );
+
+            String timestamp =
+                pomName.substring(
+                                   ( md.getArtifactId() + '-' + md.getVersion() + '-' ).length() - "-SNAPSHOT".length(),
+                                   lastHyphenPos );
+
             result.setLocalCopy( false );
-            
+
             result.setBuildNumber( buildNumber );
-            
+
             result.setTimestamp( timestamp );
-            
+
             return result;
         }
         catch ( Exception e )
         {
             // skip any exception because of illegal version numbers
-        	return null;
-        }        
-        
+            return null;
+        }
+
     }
 
 }

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryM2.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryM2.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryM2.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryM2.java Mon Apr 27 23:12:25 2009
@@ -47,14 +47,13 @@
     protected boolean _workAroundBadMetadata = true;
 
     /** default update policy */
-    private RepositoryUpdatePolicy _updatePolicy =
-        RepositoryUpdateIntervalPolicy.DEFAULT_UPDATE_POLICY;
+    private RepositoryUpdatePolicy _updatePolicy = RepositoryUpdateIntervalPolicy.DEFAULT_UPDATE_POLICY;
 
     // ----------------------------------------------------------------------------------
     public RemoteRepositoryM2( String url, DependencyProcessor dependencyProcessor )
-    throws MalformedURLException
+        throws MalformedURLException
     {
-        this( new Server( new URL(url) ), dependencyProcessor );
+        this( new Server( new URL( url ) ), dependencyProcessor );
     }
 
     // ----------------------------------------------------------------------------------
@@ -150,9 +149,10 @@
     // ----------------------------------------------------------------------------------
     public void setUpdatePolicy( RepositoryUpdatePolicy updatePolicy )
     {
-        if( updatePolicy == null )
-            throw new IllegalArgumentException( LANG.getMessage( "null.update.policy", getId(), _server == null ? "no URL":_server.getURL()+"" ) );
-        
+        if ( updatePolicy == null )
+            throw new IllegalArgumentException( LANG.getMessage( "null.update.policy", getId(),
+                                                                 _server == null ? "no URL" : _server.getURL() + "" ) );
+
         this._updatePolicy = updatePolicy;
     }
 

Modified: maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryM2OperationException.java
URL: http://svn.apache.org/viewvc/maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryM2OperationException.java?rev=769199&r1=769198&r2=769199&view=diff
==============================================================================
--- maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryM2OperationException.java (original)
+++ maven/mercury/trunk/mercury-core/src/main/java/org/apache/maven/mercury/repository/remote/m2/RemoteRepositoryM2OperationException.java Mon Apr 27 23:12:25 2009
@@ -21,54 +21,47 @@
 import org.apache.maven.mercury.repository.api.RepositoryException;
 
 /**
- *
- *
  * @author Oleg Gusakov
  * @version $Id$
- *
  */
 public class RemoteRepositoryM2OperationException
-extends RepositoryException
+    extends RepositoryException
 {
 
-  /**
+    /**
    * 
    */
-  public RemoteRepositoryM2OperationException()
-  {
-    // TODO Auto-generated constructor stub
-  }
-
-  /**
-   * @param message
-   */
-  public RemoteRepositoryM2OperationException(
-      String message )
-  {
-    super( message );
-    // TODO Auto-generated constructor stub
-  }
-
-  /**
-   * @param cause
-   */
-  public RemoteRepositoryM2OperationException(
-      Throwable cause )
-  {
-    super( cause );
-    // TODO Auto-generated constructor stub
-  }
-
-  /**
-   * @param message
-   * @param cause
-   */
-  public RemoteRepositoryM2OperationException(
-      String message,
-      Throwable cause )
-  {
-    super( message, cause );
-    // TODO Auto-generated constructor stub
-  }
+    public RemoteRepositoryM2OperationException()
+    {
+        // TODO Auto-generated constructor stub
+    }
+
+    /**
+     * @param message
+     */
+    public RemoteRepositoryM2OperationException( String message )
+    {
+        super( message );
+        // TODO Auto-generated constructor stub
+    }
+
+    /**
+     * @param cause
+     */
+    public RemoteRepositoryM2OperationException( Throwable cause )
+    {
+        super( cause );
+        // TODO Auto-generated constructor stub
+    }
+
+    /**
+     * @param message
+     * @param cause
+     */
+    public RemoteRepositoryM2OperationException( String message, Throwable cause )
+    {
+        super( message, cause );
+        // TODO Auto-generated constructor stub
+    }
 
 }