log.debug( "artifacts: {}", artifacts );
+ if ( artifacts.isEmpty() )
+ {
+ if ( !snapshotVersion )
+ {
+ // verify metata repository doesn't contains anymore the version
+ Collection<String> projectVersions =
+ metadataRepository.getProjectVersions( repositoryId, artifact.getGroupId(),
+ artifact.getArtifactId() );
+
+ if ( projectVersions.contains( artifact.getVersion() ) )
+ {
+ log.warn( "artifact not found when deleted but version still here ! so force cleanup" );
+ metadataRepository.removeProjectVersion( repositoryId, artifact.getGroupId(),
+ artifact.getArtifactId(), artifact.getVersion() );
+ }
+
+ }
+ }
+
for ( ArtifactMetadata artifactMetadata : artifacts )
{
triggerAuditEvent( repositoryId, path, AuditEvent.REMOVE_FILE );
}
}
-
-
}
catch ( ContentNotFoundException e )
{
throws MetadataRepositoryException;
/**
- *
* @param repositoryId
- * @param namespace (groupId for maven )
- * @since 1.4-M3
+ * @param namespace (groupId for maven )
* @throws MetadataRepositoryException
+ * @since 1.4-M3
*/
void removeNamespace( String repositoryId, String namespace )
throws MetadataRepositoryException;
Collection<String> getProjectVersions( String repoId, String namespace, String projectId )
throws MetadataResolutionException;
+ /**
+ *
+ * @param repoId
+ * @param namespace
+ * @param projectId
+ * @param projectVersion
+ * @since 1.4-M4
+ * @throws MetadataResolutionException
+ */
+ void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
+ throws MetadataRepositoryException;
+
Collection<ArtifactMetadata> getArtifacts( String repoId, String namespace, String projectId,
String projectVersion )
throws MetadataResolutionException;
}
+
+ public void removeProjectVersion( String repoId, String namespace, String projectId, String projectVersion )
+ throws MetadataRepositoryException
+ {
+ try
+ {
+
+ String path = getProjectPath( repoId, namespace, projectId );
+ Node root = getJcrSession().getRootNode();
+
+ Node nodeAtPath = root.getNode( path );
+
+ for ( Node node : JcrUtils.getChildNodes( nodeAtPath ) )
+ {
+ if ( node.isNodeType( PROJECT_VERSION_NODE_TYPE ) && StringUtils.equals( projectVersion,
+ node.getName() ) )
+ {
+ node.remove();
+ }
+ }
+ }
+ catch ( RepositoryException e )
+ {
+ throw new MetadataRepositoryException( e.getMessage(), e );
+ }
+ }
+
public void removeArtifact( String repositoryId, String namespace, String projectId, String projectVersion,
String id )
throws MetadataRepositoryException