]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1327] fix 'used by' to work under JCR store. Remove updateProjectReferences API
authorBrett Porter <brett@apache.org>
Tue, 29 Mar 2011 12:42:47 +0000 (12:42 +0000)
committerBrett Porter <brett@apache.org>
Tue, 29 Mar 2011 12:42:47 +0000 (12:42 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1086569 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-proxy/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java
archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/archiva/metadata/repository/memory/TestMetadataRepository.java
archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/DefaultMetadataResolver.java
archiva-modules/metadata/metadata-repository-api/src/main/java/org/apache/archiva/metadata/repository/MetadataRepository.java
archiva-modules/plugins/maven2-repository/src/test/java/org/apache/archiva/metadata/repository/TestMetadataRepository.java
archiva-modules/plugins/metadata-repository-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java
archiva-modules/plugins/metadata-store-jcr/src/main/java/org/apache/archiva/metadata/repository/jcr/JcrMetadataRepository.java

index 2d8584e4d7f313d410ac7ff2f22129adc642fb7c..73b8616cc8f8165a7bf26f97355b417f5bf6f7e1 100644 (file)
@@ -94,12 +94,6 @@ public class TestMetadataRepository
         //To change body of implemented methods use File | Settings | File Templates.
     }
 
-    public void updateProjectReference( String repoId, String namespace, String projectId, String projectVersion,
-                                        ProjectVersionReference reference )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
     public void updateNamespace( String repoId, String namespace )
     {
         //To change body of implemented methods use File | Settings | File Templates.
index 796f32dabdb86c45296e368dd5faa47040a6930a..dc6f11568e9dada8bc84d0b701d4c16039d6a56a 100644 (file)
@@ -195,12 +195,6 @@ public class NewArtifactsRssFeedProcessorTest
             throw new UnsupportedOperationException();
         }
 
-        public void updateProjectReference( String arg0, String arg1, String arg2, String arg3,
-                                            ProjectVersionReference arg4 )
-        {
-            throw new UnsupportedOperationException();
-        }
-
         public void updateProjectVersion( String arg0, String arg1, String arg2, ProjectVersionMetadata arg3 )
         {
             throw new UnsupportedOperationException();
index b1d60e7e4700404a9791c893515e2b9c0c51f39e..f1ae981af9792b1f193aa9c9ef75257b091aa254 100644 (file)
@@ -133,12 +133,6 @@ public class TestMetadataRepository
         throw new UnsupportedOperationException();
     }
 
-    public void updateProjectReference( String repoId, String namespace, String projectId, String projectVersion,
-                                        ProjectVersionReference reference )
-    {
-        throw new UnsupportedOperationException();
-    }
-
     public void updateNamespace( String repoId, String namespace )
     {
         throw new UnsupportedOperationException();
index 40db2513d57611d270671621c58353d5ec9a673c..fc1370c52b840a8c7011e7e30d18655143e36aa8 100644 (file)
@@ -94,12 +94,6 @@ public class TestMetadataRepository
         //To change body of implemented methods use File | Settings | File Templates.
     }
 
-    public void updateProjectReference( String repoId, String namespace, String projectId, String projectVersion,
-                                        ProjectVersionReference reference )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
     public void updateNamespace( String repoId, String namespace )
     {
         //To change body of implemented methods use File | Settings | File Templates.
index 3e61ab9905a8ee89779f482eb207dde09e53f6b2..08115b1cbcc9433c4d1b7c642b86e62791278466 100644 (file)
@@ -20,7 +20,6 @@ package org.apache.archiva.metadata.repository;
  */
 
 import org.apache.archiva.metadata.model.ArtifactMetadata;
-import org.apache.archiva.metadata.model.Dependency;
 import org.apache.archiva.metadata.model.ProjectMetadata;
 import org.apache.archiva.metadata.model.ProjectVersionMetadata;
 import org.apache.archiva.metadata.model.ProjectVersionReference;
@@ -108,19 +107,6 @@ public class DefaultMetadataResolver
                     ref.setProjectId( projectId );
                     ref.setProjectVersion( projectVersion );
                     ref.setReferenceType( ProjectVersionReference.ReferenceType.DEPENDENCY );
-                    for ( Dependency dependency : metadata.getDependencies() )
-                    {
-                        try
-                        {
-                            metadataRepository.updateProjectReference( repoId, dependency.getGroupId(),
-                                                                       dependency.getArtifactId(),
-                                                                       dependency.getVersion(), ref );
-                        }
-                        catch ( MetadataRepositoryException e )
-                        {
-                            log.warn( "Unable to persist resolved information: " + e.getMessage(), e );
-                        }
-                    }
                 }
                 try
                 {
index 727a4e7a5c3500a6172de87236d9ffbab0128811..4e84500700993363a0a758821ff6ead1cbc3097c 100644 (file)
@@ -48,10 +48,6 @@ public interface MetadataRepository
                                ProjectVersionMetadata versionMetadata )
         throws MetadataRepositoryException;
 
-    void updateProjectReference( String repositoryId, String namespace, String projectId, String projectVersion,
-                                 ProjectVersionReference reference )
-        throws MetadataRepositoryException;
-
     void updateNamespace( String repositoryId, String namespace )
         throws MetadataRepositoryException;
 
index bd07c142ad2e4a0f258043ac820cd902ecaf9519..499223e17aefc2f5efc0c7c60ec156a9146f7da6 100644 (file)
@@ -54,12 +54,6 @@ public class TestMetadataRepository
         //To change body of implemented methods use File | Settings | File Templates.
     }
 
-    public void updateProjectReference( String repoId, String namespace, String projectId, String projectVersion,
-                                        ProjectVersionReference reference )
-    {
-        //To change body of implemented methods use File | Settings | File Templates.
-    }
-
     public void updateNamespace( String repoId, String namespace )
     {
         //To change body of implemented methods use File | Settings | File Templates.
index 2d2fea31a4433cc22e4283d94f221bffbed90a7f..df353fa19a2a634783b8c575fc5c0916cd7e5642 100644 (file)
@@ -188,6 +188,11 @@ public class FileMetadataRepository
             i++;
         }
         i = 0;
+        ProjectVersionReference reference = new ProjectVersionReference();
+        reference.setNamespace( namespace );
+        reference.setProjectId( projectId );
+        reference.setProjectVersion( versionMetadata.getId() );
+        reference.setReferenceType( ProjectVersionReference.ReferenceType.DEPENDENCY );
         for ( Dependency dependency : versionMetadata.getDependencies() )
         {
             setProperty( properties, "dependency." + i + ".classifier", dependency.getClassifier() );
@@ -198,6 +203,10 @@ public class FileMetadataRepository
             setProperty( properties, "dependency." + i + ".version", dependency.getVersion() );
             setProperty( properties, "dependency." + i + ".type", dependency.getType() );
             setProperty( properties, "dependency." + i + ".optional", String.valueOf( dependency.isOptional() ) );
+
+            updateProjectReference( repoId, dependency.getGroupId(), dependency.getArtifactId(),
+                                    dependency.getVersion(), reference );
+
             i++;
         }
         Set<String> facetIds = new LinkedHashSet<String>( versionMetadata.getFacetIds() );
@@ -250,8 +259,8 @@ public class FileMetadataRepository
         }
     }
 
-    public void updateProjectReference( String repoId, String namespace, String projectId, String projectVersion,
-                                        ProjectVersionReference reference )
+    private void updateProjectReference( String repoId, String namespace, String projectId, String projectVersion,
+                                         ProjectVersionReference reference )
     {
         File directory = new File( getDirectory( repoId ), namespace + "/" + projectId + "/" + projectVersion );
 
index 3e2b6c11a5ab767668ee0b22af0b528243f1bc9b..449703437ba10a8aa2ec9fef4df7be95692c2bcf 100644 (file)
@@ -345,30 +345,6 @@ public class JcrMetadataRepository
         }
     }
 
-    // FIXME: remove this and projectversionreference
-    public void updateProjectReference( String repositoryId, String namespace, String projectId, String projectVersion,
-                                        ProjectVersionReference reference )
-        throws MetadataRepositoryException
-    {
-        // not using weak references, since they still need to exist upfront to be referred to
-        try
-        {
-            Node node = getOrAddRepositoryContentNode( repositoryId );
-            node = JcrUtils.getOrAddNode( node, namespace );
-            node = JcrUtils.getOrAddNode( node, projectId );
-            node = JcrUtils.getOrAddNode( node, projectVersion );
-            node = JcrUtils.getOrAddNode( node, "references" );
-            node = JcrUtils.getOrAddNode( node, reference.getNamespace() );
-            node = JcrUtils.getOrAddNode( node, reference.getProjectId() );
-            node = JcrUtils.getOrAddNode( node, reference.getProjectVersion() );
-            node.setProperty( "type", reference.getReferenceType().toString() );
-        }
-        catch ( RepositoryException e )
-        {
-            throw new MetadataRepositoryException( e.getMessage(), e );
-        }
-    }
-
     public void updateNamespace( String repositoryId, String namespace )
         throws MetadataRepositoryException
     {