Interface IMavenRepo

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
MavenRepository

@ProviderType public interface IMavenRepo extends Closeable
This is an abstraction of a Maven repository. It is a repository backed by a local directory (usually ~/.m2/repository) and a remote release and/or snapshot repository that is accessed over http(s).

The repository stores archives organized in revisions. Revisions are organized in programs. Archives are the files created per revision, they are distinguished by extension and classifier.

Maven maintains the remote snapshots with date stamped archives. (The SNAPSHOT is replaced with a date stamp + build number). This repository can resolve the latest archive and provide a list of date stamped archives.

  • Field Details

    • ARCHIVE_P

      static final Pattern ARCHIVE_P
      The format for an archive is:
                      group ':' artifact ( ':' extension ( ':' classifier )? )? ':' version ( '-SNAPSHOT' )?
       
  • Method Details

    • getArchive

      Archive getArchive(String s) throws Exception
      Get the archive from the repository. Syntax:
        s = group ':' artifact (':' extension ( ':' classifier )?)? ':' version
       
      Parameters:
      s - the archive specified as string
      Throws:
      Exception
    • getRevisions

      List<Revision> getRevisions(Program program) throws Exception
      Get the revisions that belong to a program. This uses the maven-metadata-xml file in the program directory on the remote repository (release + snapshot). For a local only repository this must return an empty list.
      Parameters:
      program - the program to list the revisions for
      Returns:
      a list of revisions in the repository
      Throws:
      Exception
    • getSnapshotArchives

      List<Archive> getSnapshotArchives(Revision revision) throws Exception
      List the snapshot archives for a given revision. If the revision is not a snapshot, the list will be empty
      Parameters:
      revision - the revisions to list from
      Returns:
      the list snapshot archives
      Throws:
      Exception
    • getResolvedArchive

      Archive getResolvedArchive(Revision revision, String extension, String classifier) throws Exception
      For a given snapshot revision, get the latest resolved archive.
      Parameters:
      revision - the revision (MUST be snapshot)
      extension - the extension of the archive
      classifier - the classifier of the archive ( may be null)
      Returns:
      the archive as resolved against the remote maven-metadata.xml for the revision
      Throws:
      Exception
    • get

      org.osgi.util.promise.Promise<File> get(Archive archive) throws Exception
      Get the file in the repositories local cache directory.
      Parameters:
      archive - The archive to fetch
      Returns:
      the file or null if not found
      Throws:
      Exception
    • get

      org.osgi.util.promise.Promise<File> get(Archive archive, boolean force) throws Exception
      Get the file, refreshing snapshots when force is true.
      Parameters:
      archive - The archive to fetch
      force - refresh snapshots
      Returns:
      the file or null if not found
      Throws:
      Exception
    • getLastUpdated

      long getLastUpdated(Revision revision) throws Exception
      Get the last updated time for a snapshot revision.
      Parameters:
      revision - the snapshot revision to get the time from
      Returns:
      the time of the snapshot revision remote update
      Throws:
      Exception
    • release

      Release release(Revision revision, Properties context) throws Exception
      Create a release object to release the revision.
      Parameters:
      revision - the revision to release
      Returns:
      the Release object
      Throws:
      Exception
    • resolveSnapshot

      Archive resolveSnapshot(Archive archive) throws Exception
      Take a generic snapshot archive and resolve it to the latest released snapshot.
      Parameters:
      archive - the archive to resolve
      Returns:
      the archive or null if not found
      Throws:
      Exception
    • resolveSnapshot

      Archive resolveSnapshot(Archive archive, boolean force) throws Exception
      Take a generic snapshot archive and resolve it to the latest released snapshot, refresh the metadata if force is true.
      Parameters:
      archive - the archive to resolve
      force - if true, refresh the metadata
      Returns:
      the archive or null if not found
      Throws:
      Exception
    • toLocalFile

      File toLocalFile(Archive archive)
      Get the file object for the archive. The file does not have to exist
      Parameters:
      archive - the archive to find the file for
      Returns:
      the File or null if not found
    • toRemoteURI

      URI toRemoteURI(Archive archive) throws Exception
      Get the URI to the remote archive
      Parameters:
      archive - the archive to calculate the URI for
      Returns:
      the URI for the given archive
      Throws:
      Exception
    • refresh

      boolean refresh() throws Exception
      Refresh snapshot metadata so snapshots are retrieved again
      Throws:
      Exception
    • getName

      String getName()
      Get the name of this repository
      Returns:
      the name
    • getPom

      IPom getPom(InputStream pomFile) throws Exception
      Throws:
      Exception
    • getPom

      IPom getPom(Revision revision) throws Exception
      Throws:
      Exception
    • getSnapshotRepositories

      List<MavenBackingRepository> getSnapshotRepositories()
    • getReleaseRepositories

      List<MavenBackingRepository> getReleaseRepositories()
    • isLocalOnly

      boolean isLocalOnly()
    • exists

      boolean exists(Archive binaryArchive) throws Exception
      Throws:
      Exception