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>
addedGavs
static java.lang.String
ARTIFACTS_INDEX_RELPATH
private static java.lang.String
EOL
private FileLocker
fileLocker
private java.util.Set<GAV>
gavs
private java.io.File
indexFile
private MavenLogger
logger
static java.lang.String
METADATA_INDEX_RELPATH
private java.util.Set<GAV>
removedGavs
-
Constructor Summary
Constructors Modifier Constructor Description private
FileBasedTychoRepositoryIndex(java.io.File indexFile, FileLockService fileLockService, MavenLogger logger)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addGav(GAV gav)
Adds a GAV to the indexstatic TychoRepositoryIndex
createArtifactsIndex(java.io.File basedir, FileLockService fileLockService, MavenLogger logger)
static TychoRepositoryIndex
createMetadataIndex(java.io.File basedir, FileLockService fileLockService, MavenLogger logger)
java.util.Set<GAV>
getProjectGAVs()
Receive the set of GAVs contained in this indexprivate void
lock()
private java.util.Set<GAV>
read(java.io.InputStream inStream)
private void
reconcile()
void
removeGav(GAV gav)
Remove a GAV from the index.void
save()
Changes performed viaTychoRepositoryIndex.addGav(GAV)
,TychoRepositoryIndex.removeGav(GAV)
will only be reflected in the memory state of the index.private void
unlock()
private void
write(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
-
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:TychoRepositoryIndex
Receive the set of GAVs contained in this index- Specified by:
getProjectGAVs
in interfaceTychoRepositoryIndex
- Returns:
- an unmodifiable defensive copy of the GAV set contained in this index
-
addGav
public void addGav(GAV gav)
Description copied from interface:TychoRepositoryIndex
Adds a GAV to the index- Specified by:
addGav
in interfaceTychoRepositoryIndex
- Parameters:
gav
- notnull
-
removeGav
public void removeGav(GAV gav)
Description copied from interface:TychoRepositoryIndex
Remove a GAV from the index.- Specified by:
removeGav
in interfaceTychoRepositoryIndex
-
save
public void save() throws java.io.IOException
Description copied from interface:TychoRepositoryIndex
Changes 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:
save
in 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)
-
-