Search in sources :

Example 1 with Copy

use of com.artipie.asto.Copy in project maven-adapter by artipie.

the class AstoMaven method moveToTheRepository.

/**
 * Moves artifacts from temp location to repository.
 * @param upload Upload temp location
 * @param target Repository
 * @param artifact Artifact repository location
 * @return Completion action
 */
private CompletableFuture<Void> moveToTheRepository(final Key upload, final Storage target, final Key artifact) {
    final Storage sub = new SubStorage(new Key.From(upload, PutMetadataSlice.SUB_META), this.storage);
    final Storage subversion = new SubStorage(upload.parent().get(), this.storage);
    return sub.list(Key.ROOT).thenCompose(list -> new Copy(sub, list.stream().filter(key -> key.string().contains(AstoMaven.MAVEN_META)).collect(Collectors.toList())).copy(new SubStorage(artifact, target))).thenCompose(nothing -> subversion.list(Key.ROOT).thenCompose(list -> new Copy(subversion, list.stream().filter(key -> !key.string().contains(String.format("/%s/", PutMetadataSlice.SUB_META))).collect(Collectors.toList())).copy(new SubStorage(artifact, target))));
}
Also used : Copy(com.artipie.asto.Copy) Maven(com.artipie.maven.Maven) SubStorage(com.artipie.asto.SubStorage) XMLDocument(com.jcabi.xml.XMLDocument) Collection(java.util.Collection) KeyLastPart(com.artipie.asto.ext.KeyLastPart) Directives(org.xembly.Directives) PutMetadataSlice(com.artipie.maven.http.PutMetadataSlice) CompletableFuture(java.util.concurrent.CompletableFuture) Key(com.artipie.asto.Key) Collectors(java.util.stream.Collectors) PublisherAs(com.artipie.asto.ext.PublisherAs) CompletionStage(java.util.concurrent.CompletionStage) Storage(com.artipie.asto.Storage) MavenMetadata(com.artipie.maven.metadata.MavenMetadata) SubStorage(com.artipie.asto.SubStorage) Storage(com.artipie.asto.Storage) Copy(com.artipie.asto.Copy) SubStorage(com.artipie.asto.SubStorage) Key(com.artipie.asto.Key)

Aggregations

Copy (com.artipie.asto.Copy)1 Key (com.artipie.asto.Key)1 Storage (com.artipie.asto.Storage)1 SubStorage (com.artipie.asto.SubStorage)1 KeyLastPart (com.artipie.asto.ext.KeyLastPart)1 PublisherAs (com.artipie.asto.ext.PublisherAs)1 Maven (com.artipie.maven.Maven)1 PutMetadataSlice (com.artipie.maven.http.PutMetadataSlice)1 MavenMetadata (com.artipie.maven.metadata.MavenMetadata)1 XMLDocument (com.jcabi.xml.XMLDocument)1 Collection (java.util.Collection)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 CompletionStage (java.util.concurrent.CompletionStage)1 Collectors (java.util.stream.Collectors)1 Directives (org.xembly.Directives)1