Mercury provides an implementation-neutral way to access GAV-based repositories, including AV repositories, like OSGi
APIs
Upper level API works like the following:
- create a bunch of Repository objects
- obtain an instance of DependencyProcessor implementation
- if you don't plan to use getDependencies call, you can use DependencyProcessor.NULL_PROCESSOR
- create an instance of VirtualRepositoryReader by passing the repositories and dependency processor
- use it
All the calls accept a collection of requests as an input and return an object that hides getResults, that normally is a map< queryElement, Collection<ResultObject> > response. The response object has convenience methos hasExceptions(), hasResults(), getExceptions(), getResults()
One of the key building blocks is a hierarchy of Artifact data:
- ArtifactCoordinates - is truly the 3 components GAV
- ArtifactBasicMetadata - is coordinates plus type/classifier plus convenience methods like hash calculation and such
- ArtifactMetadata adds a list of dependency objects, captured as ArtifactBasicMetadata
- DefaultArtifact implements Artifact interface and adds pomBlob (byte[]) and file, that points to actual binary
Let's assume that you obtained virtual reader in a variable, called vr. The "use it" part means the following:
- vr.readVersions( Collection<ArtifactBasicMetadata> query )
- this one takes a collection of queries in the form of ArtifactBasicMetadata and returns a collection of good old ArtifactBasicMetadata ojects. The input object can have a query in the version field
- version query is now accepted as:
- 1.2.3 - means any version, higher or equal to 1.2.3, variations:
- 1.2.3-SNAPSHOT - find latest snapshot of this version
- 1.2.3-LATEST - find latest snapshot or release of this version
- 1.2.3-RELEASE - find latest release of this version
- range in the form of
- [1.2.3,) this is equal to simple 1.2.3 query
- (1.2.3,) same as previous, but 1.2.3 version is excluded from results
- all other obvious variations of /( V1, V2/)
- 1.2.3 - means any version, higher or equal to 1.2.3, variations: