Search in sources :

Example 11 with Archive

use of aQute.maven.api.Archive in project bnd by bndtools.

the class Releaser method uploadAll.

void uploadAll(Iterator<Archive> iterator) throws Exception {
    if (!iterator.hasNext())
        return;
    Archive archive = iterator.next();
    File f = home.toLocalFile(archive);
    try {
        repo.store(f, archive.remotePath);
        sign(archive, f);
        uploadAll(iterator);
    } catch (Exception e) {
        try {
            repo.delete(archive.remotePath);
        } catch (Exception ee) {
            // original
            throw e;
        }
    }
}
Also used : Archive(aQute.maven.api.Archive) File(java.io.File) IOException(java.io.IOException) HttpRequestException(aQute.bnd.http.HttpRequestException)

Example 12 with Archive

use of aQute.maven.api.Archive in project bnd by bndtools.

the class Releaser method add.

@Override
public void add(String extension, String classifier, InputStream in) throws Exception {
    Archive a = revision.archive(extension, classifier);
    add(a, in);
}
Also used : Archive(aQute.maven.api.Archive)

Example 13 with Archive

use of aQute.maven.api.Archive in project bnd by bndtools.

the class MavenBackingRepository method getSnapshotArchives.

public List<Archive> getSnapshotArchives(Revision revision) throws Exception {
    RevisionMetadata metadata = getMetadata(revision);
    List<Archive> archives = new ArrayList<>();
    for (SnapshotVersion snapshotVersion : metadata.snapshotVersions) {
        Archive archive = revision.archive(snapshotVersion.value, snapshotVersion.extension, snapshotVersion.classifier);
        archives.add(archive);
    }
    return archives;
}
Also used : Archive(aQute.maven.api.Archive) SnapshotVersion(aQute.maven.provider.MetadataParser.SnapshotVersion) ArrayList(java.util.ArrayList) RevisionMetadata(aQute.maven.provider.MetadataParser.RevisionMetadata)

Example 14 with Archive

use of aQute.maven.api.Archive in project bnd by bndtools.

the class MavenBndRepository method doSearchMaven.

boolean doSearchMaven(URI uri) throws UnsupportedEncodingException, Exception {
    Map<String, String> map = getMapFromQuery(uri);
    String filePath = map.get("filepath");
    if (filePath != null) {
        Archive archive = Archive.fromFilepath(filePath);
        if (archive != null) {
            if (archive.extension.equals("pom"))
                archive = archive.revision.archive("jar", null);
            index.add(archive);
            return true;
        }
    }
    return false;
}
Also used : Archive(aQute.maven.api.Archive)

Example 15 with Archive

use of aQute.maven.api.Archive in project bnd by bndtools.

the class MavenRepository method getPomPromise.

private Promise<POM> getPomPromise(final Revision revision) throws Exception {
    Deferred<POM> deferred;
    synchronized (poms) {
        Promise<POM> promise = poms.get(revision);
        if (promise != null) {
            return promise;
        }
        deferred = new Deferred<>();
        poms.put(revision, deferred.getPromise());
    }
    Archive pomArchive = revision.getPomArchive();
    deferred.resolveWith(get(pomArchive, false).map(new Function<File, POM>() {

        @Override
        public POM apply(File pomFile) {
            if (pomFile == null) {
                return null;
            }
            try (InputStream fin = IO.stream(pomFile)) {
                return getPom(fin);
            } catch (Exception e) {
                logger.error("Failed to parse pom {} from file {}", revision, pomFile, e);
                return null;
            }
        }
    }));
    return deferred.getPromise();
}
Also used : Function(org.osgi.util.function.Function) Archive(aQute.maven.api.Archive) InputStream(java.io.InputStream) File(java.io.File) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException)

Aggregations

Archive (aQute.maven.api.Archive)25 File (java.io.File)13 Revision (aQute.maven.api.Revision)6 Program (aQute.maven.api.Program)5 IOException (java.io.IOException)5 FileNotFoundException (java.io.FileNotFoundException)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)3 ArrayList (java.util.ArrayList)3 Resource (org.osgi.resource.Resource)3 HttpClient (aQute.bnd.http.HttpClient)2 Jar (aQute.bnd.osgi.Jar)2 IPom (aQute.maven.api.IPom)2 Release (aQute.maven.api.Release)2 MavenRepository (aQute.maven.provider.MavenRepository)2 SnapshotVersion (aQute.maven.provider.MetadataParser.SnapshotVersion)2 InputStream (java.io.InputStream)2 Failure (org.osgi.util.promise.Failure)2 Promise (org.osgi.util.promise.Promise)2 Workspace (aQute.bnd.build.Workspace)1 HttpRequestException (aQute.bnd.http.HttpRequestException)1