diff options
author | Olivier Lamy <olamy@apache.org> | 2012-06-26 17:25:08 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-06-26 17:25:08 +0000 |
commit | f68a05a499c3f25a8ecfa9756f87c581bee8c3a6 (patch) | |
tree | fc174a5d68418fa4381e0bde69c10ece1e6e768f /archiva-modules/plugins | |
parent | 9c6b8dba0022ee1e11c6d33db4303bd3d38036de (diff) | |
download | archiva-f68a05a499c3f25a8ecfa9756f87c581bee8c3a6.tar.gz archiva-f68a05a499c3f25a8ecfa9756f87c581bee8c3a6.zip |
implements the method with metadata-store-file
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1354120 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/plugins')
-rw-r--r-- | archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java index 562b89643..6d9c9bea8 100644 --- a/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java +++ b/archiva-modules/plugins/metadata-store-file/src/main/java/org/apache/archiva/metadata/repository/file/FileMetadataRepository.java @@ -600,8 +600,43 @@ public class FileMetadataRepository public void removeArtifact( ArtifactMetadata artifactMetadata, String baseVersion ) throws MetadataRepositoryException { - // FIXME implement this - throw new UnsupportedOperationException(); + + File directory = new File( getDirectory( artifactMetadata.getRepositoryId() ), + artifactMetadata.getNamespace() + "/" + artifactMetadata.getProject() + "/" + + baseVersion ); + + Properties properties = readOrCreateProperties( directory, PROJECT_VERSION_METADATA_KEY ); + + String id = artifactMetadata.getId(); + + properties.remove( "artifact:updated:" + id ); + properties.remove( "artifact:whenGathered:" + id ); + properties.remove( "artifact:size:" + id ); + properties.remove( "artifact:md5:" + id ); + properties.remove( "artifact:sha1:" + id ); + properties.remove( "artifact:version:" + id ); + properties.remove( "artifact:facetIds:" + id ); + + String prefix = "artifact:facet:" + id + ":"; + for ( Object key : new ArrayList<Object>( properties.keySet() ) ) + { + String property = (String) key; + if ( property.startsWith( prefix ) ) + { + properties.remove( property ); + } + } + + try + { + writeProperties( properties, directory, PROJECT_VERSION_METADATA_KEY ); + } + catch ( IOException e ) + { + // TODO + log.error( e.getMessage(), e ); + } + } public void removeArtifact( String repoId, String namespace, String project, String version, String id ) @@ -645,6 +680,7 @@ public class FileMetadataRepository /** * FIXME implements this !!!! + * * @param repositoryId * @param namespace * @param project @@ -654,10 +690,10 @@ public class FileMetadataRepository * @throws MetadataRepositoryException */ public void removeArtifact( String repositoryId, String namespace, String project, String projectVersion, - MetadataFacet metadataFacet ) + MetadataFacet metadataFacet ) throws MetadataRepositoryException { - throw new UnsupportedOperationException("not implemented"); + throw new UnsupportedOperationException( "not implemented" ); } public void removeRepository( String repoId ) |