public class ArtifactManager extends Object
The database is normally stored in "/configuration/sincerity/artifacts.conf".
Constructor and Description |
---|
ArtifactManager(File file,
PackagingContext packagingContext)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Artifact artifact,
boolean installed,
byte[] digest)
Adds the artifact to the database, marking the configuration file as
requiring a save if the addition caused a change.
|
byte[] |
getOriginalDigest(Artifact artifact)
The digest when the artifact's file was first unpacked.
|
void |
prune()
Removes all artifacts from the database, deletes all unnecessary files
that have not been modified (for which the digest has not changed), and
finally saves the changes.
|
void |
prune(Iterable<Artifact> necessaryArtifacts)
Removes all artifacts from the database that are not mentioned,
deletes all unnecessary files that have not been modified (for which the
digest has not changed), and finally saves the changes.
|
void |
save()
Saves the database if there were changes.
|
boolean |
wasInstalled(Artifact artifact)
True if the artifact was marked as installed.
|
public ArtifactManager(File file, PackagingContext packagingContext)
file
- The database file (usually
"/configuration/sincerity/artifacts.conf")packagingContext
- The packaging contextpublic boolean wasInstalled(Artifact artifact) throws SincerityException
artifact
- The artifactSincerityException
- In case of an errorpublic byte[] getOriginalDigest(Artifact artifact) throws SincerityException
artifact
- The artifactSincerityException
- In case of an errorpublic void add(Artifact artifact, boolean installed, byte[] digest) throws SincerityException
artifact
- The artifactinstalled
- True if the artifact is installeddigest
- The artifact's digest or nullSincerityException
- In case of an errorpublic void save() throws SincerityException
SincerityException
- In case of an errorpublic void prune() throws SincerityException
SincerityException
- In case of an errorpublic void prune(Iterable<Artifact> necessaryArtifacts) throws SincerityException
necessaryArtifacts
- The artifacts that should staySincerityException
- In case of an errorCopyright © 2011-2016 Three Crickets LLC.