Class ModuleArtifactRepository
- java.lang.Object
-
- org.eclipse.core.runtime.PlatformObject
-
- org.eclipse.equinox.p2.repository.spi.AbstractRepository<org.eclipse.equinox.p2.metadata.IArtifactKey>
-
- org.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository
-
- org.eclipse.tycho.repository.p2base.artifact.repository.AbstractArtifactRepository2
-
- org.eclipse.tycho.repository.p2base.artifact.repository.ArtifactRepositoryBaseImpl<ModuleArtifactRepository.ModuleArtifactDescriptor>
-
- org.eclipse.tycho.repository.module.ModuleArtifactRepository
-
- 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
class ModuleArtifactRepository extends ArtifactRepositoryBaseImpl<ModuleArtifactRepository.ModuleArtifactDescriptor>
A p2 artifact repository implementation for the build output directory. Instances are persisted in the following files:- A p2artifacts.xml file in the given build target directory, which contains a list of all artifacts with p2 and Maven coordinates. (In particular the classifier part of the Maven coordinates is relevant.) This file is deployed to Maven repositories alongside with the built Tycho artifact.
- The
local-artifacts.propertiesfile, which maps classifiers to the file system locations of the artifacts before they are uploaded into a Maven repository. (Unlike in a Maven repository, there are no predefined locations for the artifacts in the build output directory.)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classModuleArtifactRepository.ModuleArtifactComparableDescriptorAn artifact descriptor that can be compared withModuleArtifactRepository.ModuleArtifactDescriptor.(package private) classModuleArtifactRepository.ModuleArtifactDescriptorAn artifact descriptor with Maven coordinates.
-
Field Summary
Fields Modifier and Type Field Description private ModuleArtifactMapartifactsMapprivate static GAVDUMMY_GAVprivate GAVmoduleGAVprivate java.io.Filep2DataFilestatic java.lang.StringREPOSITORY_TYPEType string for this repository type.-
Fields inherited from class org.eclipse.tycho.repository.p2base.artifact.repository.ArtifactRepositoryBaseImpl
descriptors, descriptorsMap
-
-
Constructor Summary
Constructors Modifier Constructor Description privateModuleArtifactRepository(org.eclipse.equinox.p2.core.IProvisioningAgent agent, java.io.File location, ModuleArtifactMap artifactsMap)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) static booleancanAttemptRead(java.io.File repositoryDir)ModuleArtifactRepository.ModuleArtifactDescriptorcreateArtifactDescriptor(org.eclipse.equinox.p2.metadata.IArtifactKey key)org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptorcreateArtifactDescriptor(org.eclipse.equinox.p2.metadata.IArtifactKey key, WriteSessionContext writeSession)private static ModuleArtifactMapcreateArtifactLocationMap(java.io.File repositoryDir)static ModuleArtifactRepositorycreateInstance(org.eclipse.equinox.p2.core.IProvisioningAgent agent, java.io.File repositoryDir)(package private) static <T> booleaneq(T left, T right)(package private) static org.eclipse.equinox.p2.core.ProvisionExceptionfailedReadException(java.io.File sourceFile, java.lang.String details, java.lang.Exception exception)ModuleArtifactMapgetArtifactsMap()protected org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptorgetComparableDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)Returns anIArtifactDescriptorinstance which is comparable to the artifact descriptors stored in the index (i.e.protected ModuleArtifactRepository.ModuleArtifactDescriptorgetInternalDescriptorForAdding(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)Returns an artifact descriptor of the internal descriptor typeArtifactDescriptorTwhich may be added to the index.private ModuleArtifactRepository.ModuleArtifactDescriptorgetInternalDescriptorFromLoadedDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor loadedDescriptor, java.io.File sourceFile)protected java.io.FileinternalGetArtifactStorageLocation(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)Returns the file system location where the given artifact is or would be stored.protected voidinternalStore(org.eclipse.core.runtime.IProgressMonitor monitor)Persists the index of this repository.private voidinternalStoreWithException()booleanisModifiable()private voidload()IArtifactSinknewAddingArtifactSink(org.eclipse.equinox.p2.metadata.IArtifactKey key, WriteSessionContext writeSession)private static MavenRepositoryCoordinatesreadMavenCoordinates(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)static ModuleArtifactRepositoryrestoreInstance(org.eclipse.equinox.p2.core.IProvisioningAgent agent, java.io.File repositoryDir)voidsetGAV(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)private voidstoreOrProvisioningException()-
Methods inherited from class org.eclipse.tycho.repository.p2base.artifact.repository.ArtifactRepositoryBaseImpl
contains, contains, descriptorQueryable, getArtifact, getArtifact, getArtifactDescriptors, getArtifactFile, getArtifactFile, getRawArtifact, internalAddDescriptor, internalAddInternalDescriptor, internalNewAddingArtifactSink, internalRemoveAllDescriptors, internalRemoveDescriptor, internalRemoveDescriptors, internalRemoveDescriptors, internalRemoveDescriptors, newAddingArtifactSink, newAddingRawArtifactSink, query
-
Methods inherited from class org.eclipse.tycho.repository.p2base.artifact.repository.AbstractArtifactRepository2
addDescriptor, addDescriptor, addDescriptors, addDescriptors, getArtifacts, getOutputStream, getRawArtifact, isFatal, removeAll, removeAll, removeDescriptor, removeDescriptor, removeDescriptor, removeDescriptor, removeDescriptors, removeDescriptors, removeDescriptors, removeDescriptors, setStatusOnStreamIfPossible
-
Methods inherited from class org.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository
createArtifactKey, equals, executeBatch, hashCode
-
Methods inherited from class org.eclipse.equinox.p2.repository.spi.AbstractRepository
assertModifiable, getDescription, getLocation, getName, getProperties, getProperty, getProvider, getProvisioningAgent, getType, getVersion, setDescription, setLocation, setName, setProperties, setProperty, setProperty, setProvider, setType, setVersion
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.equinox.p2.repository.artifact.IArtifactRepository
addDescriptor, addDescriptor, addDescriptors, addDescriptors, createArtifactKey, executeBatch, getArtifacts, getOutputStream, getRawArtifact, removeAll, removeAll, removeDescriptor, removeDescriptor, removeDescriptor, removeDescriptor, removeDescriptors, removeDescriptors, removeDescriptors, removeDescriptors
-
-
-
-
Field Detail
-
REPOSITORY_TYPE
public static final java.lang.String REPOSITORY_TYPE
Type string for this repository type. This value needs to be passed toIArtifactRepositoryManager.createRepository(URI, String, String, Map)in order to create a repository of typeModuleArtifactRepository.- See Also:
- Constant Field Values
-
DUMMY_GAV
private static final GAV DUMMY_GAV
-
p2DataFile
private final java.io.File p2DataFile
-
artifactsMap
private final ModuleArtifactMap artifactsMap
-
moduleGAV
private GAV moduleGAV
-
-
Constructor Detail
-
ModuleArtifactRepository
private ModuleArtifactRepository(org.eclipse.equinox.p2.core.IProvisioningAgent agent, java.io.File location, ModuleArtifactMap artifactsMap)
-
-
Method Detail
-
canAttemptRead
static boolean canAttemptRead(java.io.File repositoryDir)
-
restoreInstance
public static ModuleArtifactRepository restoreInstance(org.eclipse.equinox.p2.core.IProvisioningAgent agent, java.io.File repositoryDir) throws org.eclipse.equinox.p2.core.ProvisionException
- Throws:
org.eclipse.equinox.p2.core.ProvisionException
-
createInstance
public static ModuleArtifactRepository createInstance(org.eclipse.equinox.p2.core.IProvisioningAgent agent, java.io.File repositoryDir) throws org.eclipse.equinox.p2.core.ProvisionException
- Throws:
org.eclipse.equinox.p2.core.ProvisionException
-
createArtifactLocationMap
private static ModuleArtifactMap createArtifactLocationMap(java.io.File repositoryDir) throws org.eclipse.equinox.p2.core.ProvisionException
- Throws:
org.eclipse.equinox.p2.core.ProvisionException
-
setGAV
public void setGAV(java.lang.String groupId, java.lang.String artifactId, java.lang.String version)
-
getArtifactsMap
public ModuleArtifactMap getArtifactsMap()
-
internalGetArtifactStorageLocation
protected java.io.File internalGetArtifactStorageLocation(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
Description copied from class:ArtifactRepositoryBaseImplReturns the file system location where the given artifact is or would be stored. UnlikeArtifactRepositoryBaseImpl.getArtifactFile(IArtifactDescriptor), this method does not check if the given artifact exists in the repository and never returnsnull.This method may be called by any API method for reading or writing artifacts.
-
readMavenCoordinates
private static MavenRepositoryCoordinates readMavenCoordinates(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
-
getComparableDescriptor
protected org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor getComparableDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor)
Description copied from class:ArtifactRepositoryBaseImplReturns anIArtifactDescriptorinstance which is comparable to the artifact descriptors stored in the index (i.e. theArtifactRepositoryBaseImpl.descriptorsmember). A valid implementation is to convert the argument to the internal descriptor typeArtifactDescriptorT, but this is not a requirement. This method should be implemented in a way so that callingdescriptors.contains(getComparableDescriptor(foreignDescriptor))with a descriptor from a foreign artifact repository returnstrueif and only if copying that foreign artifact to this repository withAbstractArtifactRepository2.getOutputStream(IArtifactDescriptor)would not add a new artifact to this repository.This method may be called by any API method with an
IArtifactDescriptorargument.- Specified by:
getComparableDescriptorin classArtifactRepositoryBaseImpl<ModuleArtifactRepository.ModuleArtifactDescriptor>- Parameters:
descriptor- AnIArtifactDescriptorfrom any artifact repository.
-
getInternalDescriptorForAdding
protected ModuleArtifactRepository.ModuleArtifactDescriptor getInternalDescriptorForAdding(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor descriptor) throws java.lang.IllegalArgumentException
Description copied from class:ArtifactRepositoryBaseImplReturns an artifact descriptor of the internal descriptor typeArtifactDescriptorTwhich may be added to the index. Implementations may require that the descriptor argument is a descriptor instance created by this repository – seeAbstractArtifactRepository.createArtifactDescriptor(IArtifactKey).This method is called by methods that add entries to the index, i.e. from
ArtifactRepositoryBaseImpl.newAddingArtifactSink(IArtifactKey).- Specified by:
getInternalDescriptorForAddingin classArtifactRepositoryBaseImpl<ModuleArtifactRepository.ModuleArtifactDescriptor>- Parameters:
descriptor- AnIArtifactDescriptorinstance- Throws:
java.lang.IllegalArgumentException- if the provided descriptor cannot be added
-
createArtifactDescriptor
public ModuleArtifactRepository.ModuleArtifactDescriptor createArtifactDescriptor(org.eclipse.equinox.p2.metadata.IArtifactKey key)
- Specified by:
createArtifactDescriptorin interfaceorg.eclipse.equinox.p2.repository.artifact.IArtifactRepository- Overrides:
createArtifactDescriptorin classorg.eclipse.equinox.p2.repository.artifact.spi.AbstractArtifactRepository
-
createArtifactDescriptor
public org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor createArtifactDescriptor(org.eclipse.equinox.p2.metadata.IArtifactKey key, WriteSessionContext writeSession)
-
newAddingArtifactSink
public IArtifactSink newAddingArtifactSink(org.eclipse.equinox.p2.metadata.IArtifactKey key, WriteSessionContext writeSession) throws org.eclipse.equinox.p2.core.ProvisionException
- Throws:
org.eclipse.equinox.p2.core.ProvisionException
-
internalStore
protected void internalStore(org.eclipse.core.runtime.IProgressMonitor monitor)
Description copied from class:ArtifactRepositoryBaseImplPersists the index of this repository.This method is called after every (bulk) change to the index.
- Overrides:
internalStorein classArtifactRepositoryBaseImpl<ModuleArtifactRepository.ModuleArtifactDescriptor>
-
storeOrProvisioningException
private void storeOrProvisioningException() throws org.eclipse.equinox.p2.core.ProvisionException- Throws:
org.eclipse.equinox.p2.core.ProvisionException
-
internalStoreWithException
private void internalStoreWithException() throws java.io.IOException- Throws:
java.io.IOException
-
load
private void load() throws org.eclipse.equinox.p2.core.ProvisionException- Throws:
org.eclipse.equinox.p2.core.ProvisionException
-
getInternalDescriptorFromLoadedDescriptor
private ModuleArtifactRepository.ModuleArtifactDescriptor getInternalDescriptorFromLoadedDescriptor(org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor loadedDescriptor, java.io.File sourceFile) throws org.eclipse.equinox.p2.core.ProvisionException
- Throws:
org.eclipse.equinox.p2.core.ProvisionException
-
failedReadException
static org.eclipse.equinox.p2.core.ProvisionException failedReadException(java.io.File sourceFile, java.lang.String details, java.lang.Exception exception)
-
isModifiable
public boolean isModifiable()
- Specified by:
isModifiablein interfaceorg.eclipse.equinox.p2.repository.IRepository<org.eclipse.equinox.p2.metadata.IArtifactKey>- Overrides:
isModifiablein classorg.eclipse.equinox.p2.repository.spi.AbstractRepository<org.eclipse.equinox.p2.metadata.IArtifactKey>
-
eq
static <T> boolean eq(T left, T right)
-
-