Class FileBasedTychoRepositoryIndex
- java.lang.Object
-
- org.eclipse.tycho.repository.local.index.FileBasedTychoRepositoryIndex
-
- All Implemented Interfaces:
TychoRepositoryIndex
public class FileBasedTychoRepositoryIndex extends java.lang.Object implements TychoRepositoryIndex
Simplistic local Maven repository index to allow efficient lookup of all installed Tycho projects. The content is persisted in a local file.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Set<GAV>addedGavsstatic java.lang.StringARTIFACTS_INDEX_RELPATHprivate static java.lang.StringENCODINGprivate static java.lang.StringEOLprivate FileLockerfileLockerprivate java.util.Set<GAV>gavsprivate java.io.FileindexFileprivate MavenLoggerloggerstatic java.lang.StringMETADATA_INDEX_RELPATHprivate java.util.Set<GAV>removedGavs
-
Constructor Summary
Constructors Modifier Constructor Description privateFileBasedTychoRepositoryIndex(java.io.File indexFile, FileLockService fileLockService, MavenLogger logger)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddGav(GAV gav)Adds a GAV to the indexstatic TychoRepositoryIndexcreateArtifactsIndex(java.io.File basedir, FileLockService fileLockService, MavenLogger logger)static TychoRepositoryIndexcreateMetadataIndex(java.io.File basedir, FileLockService fileLockService, MavenLogger logger)java.util.Set<GAV>getProjectGAVs()Receive the set of GAVs contained in this indexprivate voidlock()private java.util.Set<GAV>read(java.io.InputStream inStream)private voidreconcile()voidremoveGav(GAV gav)Remove a GAV from the index.voidsave()Changes performed viaTychoRepositoryIndex.addGav(GAV),TychoRepositoryIndex.removeGav(GAV)will only be reflected in the memory state of the index.private voidunlock()private voidwrite(java.io.OutputStream outStream)
-
-
-
Field Detail
-
ARTIFACTS_INDEX_RELPATH
public static final java.lang.String ARTIFACTS_INDEX_RELPATH
- See Also:
- Constant Field Values
-
METADATA_INDEX_RELPATH
public static final java.lang.String METADATA_INDEX_RELPATH
- See Also:
- Constant Field Values
-
ENCODING
private static final java.lang.String ENCODING
- See Also:
- Constant Field Values
-
EOL
private static final java.lang.String EOL
- See Also:
- Constant Field Values
-
indexFile
private final java.io.File indexFile
-
logger
private final MavenLogger logger
-
fileLocker
private FileLocker fileLocker
-
addedGavs
private java.util.Set<GAV> addedGavs
-
removedGavs
private java.util.Set<GAV> removedGavs
-
gavs
private java.util.Set<GAV> gavs
-
-
Constructor Detail
-
FileBasedTychoRepositoryIndex
private FileBasedTychoRepositoryIndex(java.io.File indexFile, FileLockService fileLockService, MavenLogger logger)
-
-
Method Detail
-
lock
private void lock()
-
unlock
private void unlock()
-
getProjectGAVs
public java.util.Set<GAV> getProjectGAVs()
Description copied from interface:TychoRepositoryIndexReceive the set of GAVs contained in this index- Specified by:
getProjectGAVsin interfaceTychoRepositoryIndex- Returns:
- an unmodifiable defensive copy of the GAV set contained in this index
-
addGav
public void addGav(GAV gav)
Description copied from interface:TychoRepositoryIndexAdds a GAV to the index- Specified by:
addGavin interfaceTychoRepositoryIndex- Parameters:
gav- notnull
-
removeGav
public void removeGav(GAV gav)
Description copied from interface:TychoRepositoryIndexRemove a GAV from the index.- Specified by:
removeGavin interfaceTychoRepositoryIndex
-
save
public void save() throws java.io.IOExceptionDescription copied from interface:TychoRepositoryIndexChanges performed viaTychoRepositoryIndex.addGav(GAV),TychoRepositoryIndex.removeGav(GAV)will only be reflected in the memory state of the index. In case the index is bound some persistence location (e.g. a file seeFileBasedTychoRepositoryIndex#createArtifactsIndex(java.io.File)) the method will store the current memory content to the persistence storage.- Specified by:
savein interfaceTychoRepositoryIndex- Throws:
java.io.IOException
-
reconcile
private void reconcile() throws java.io.IOException- Throws:
java.io.IOException
-
write
private void write(java.io.OutputStream outStream) throws java.io.IOException- Throws:
java.io.IOException
-
read
private java.util.Set<GAV> read(java.io.InputStream inStream) throws java.io.IOException
- Throws:
java.io.IOException
-
createMetadataIndex
public static TychoRepositoryIndex createMetadataIndex(java.io.File basedir, FileLockService fileLockService, MavenLogger logger)
-
createArtifactsIndex
public static TychoRepositoryIndex createArtifactsIndex(java.io.File basedir, FileLockService fileLockService, MavenLogger logger)
-
-