Class TargetPlatformBundlePublisher.PublishedBundlesArtifactRepository

  • All Implemented Interfaces:
    org.eclipse.core.runtime.IAdaptable, org.eclipse.equinox.p2.query.IQueryable<org.eclipse.equinox.p2.metadata.IArtifactKey>, org.eclipse.equinox.p2.repository.artifact.IArtifactRepository, org.eclipse.equinox.p2.repository.artifact.IFileArtifactRepository, org.eclipse.equinox.p2.repository.IRepository<org.eclipse.equinox.p2.metadata.IArtifactKey>, IArtifactFileProvider, IArtifactProvider, IRawArtifactFileProvider, IRawArtifactProvider
    Enclosing class:
    TargetPlatformBundlePublisher

    private static class TargetPlatformBundlePublisher.PublishedBundlesArtifactRepository
    extends ArtifactRepositoryBaseImpl<GAVArtifactDescriptor>
    p2 artifact repository providing the POM dependency Maven artifacts.

    Although the provided artifacts are also stored in the local Maven repository, they cannot be made available via the LocalArtifactRepository artifact repository implementation. The reason is that there are differences is how the artifacts provided by the respective implementations may be updated:

    • For the LocalArtifactRepository artifacts, it can be assumed that all updates (e.g. as a result of a mvn install) are done by Tycho. Therefore it is safe to write the p2 artifact index data to disk together with the artifacts.
    • For the POM dependency artifacts, this assumption does not hold true: e.g. a maven-bundle-plugin build may update an artifact in the local Maven repository without notifying Tycho. So if we had written p2 artifact index data to disk, that data might then be stale.
    To avoid the need to implement and index invalidation logic, we use this separate artifact repository implementation with an in-memory index.

    • Constructor Detail

      • PublishedBundlesArtifactRepository

        PublishedBundlesArtifactRepository​(java.io.File localMavenRepositoryRoot,
                                           MavenRepositorySystem repositorySystem)
    • Method Detail

      • addPublishedArtifact

        void addPublishedArtifact​(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor baseDescriptor,
                                  IArtifactFacade mavenArtifact)
      • getComparableDescriptor

        protected org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor getComparableDescriptor​(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
        Description copied from class: ArtifactRepositoryBaseImpl
        Returns an IArtifactDescriptor instance which is comparable to the artifact descriptors stored in the index (i.e. the ArtifactRepositoryBaseImpl.descriptors member). A valid implementation is to convert the argument to the internal descriptor type ArtifactDescriptorT, but this is not a requirement. This method should be implemented in a way so that calling descriptors.contains(getComparableDescriptor(foreignDescriptor)) with a descriptor from a foreign artifact repository returns true if and only if copying that foreign artifact to this repository with AbstractArtifactRepository2.getOutputStream(IArtifactDescriptor) would not add a new artifact to this repository.

        This method may be called by any API method with an IArtifactDescriptor argument.

        Specified by:
        getComparableDescriptor in class ArtifactRepositoryBaseImpl<GAVArtifactDescriptor>
        Parameters:
        descriptor - An IArtifactDescriptor from any artifact repository.
      • toInternalDescriptor

        private GAVArtifactDescriptor toInternalDescriptor​(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
      • getBaseDir

        private java.io.File getBaseDir()