public abstract class AbstractRepository extends java.lang.Object implements Repository, RepositorySpi
RepositorySpi.ValidateHashResult| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRepository() |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
addArchive(GitCommitJar commit) |
java.lang.String |
addArchive(java.io.InputStream is)
Adds a path to the repository.
|
java.lang.String |
addArchive(Path path)
Adds a path to the repository.
|
java.lang.String |
addBlob(java.io.InputStream is,
long length)
Adds a stream to the repository.
|
abstract java.lang.String |
addCommit(GitCommit commit)
Adds a git commit to the repository
|
void |
addListener(java.lang.String tag,
RepositoryTagListener listener)
Adds a tag listener
|
java.lang.String |
addPath(Path path)
Adds a path to the repository.
|
protected RepositoryTagMap |
addTagData(java.lang.String tagName,
java.lang.String contentHash,
java.util.Map<java.lang.String,java.lang.String> commitMetaData)
Creates a tag entry
|
java.lang.String |
addTree(GitTree tree)
Adds a git tree to the repository
|
void |
checkForUpdate()
Updates the repository
|
void |
checkForUpdate(boolean isExact)
Updates the repository
|
java.lang.String |
commitArchive(CommitBuilder commit,
java.io.InputStream is)
Convenience method for adding the content of a jar.
|
java.lang.String |
commitArchive(CommitBuilder commit,
Path archivePath)
Convenience method for adding the content of a jar.
|
java.lang.String |
commitPath(CommitBuilder commit,
Path directoryPath)
Convenience method for adding a path/directory.
|
abstract boolean |
exists(java.lang.String sha1)
Returns true if the file exists.
|
abstract void |
expandToPath(java.lang.String contentHash,
Path path)
Expands the repository to the filesystem.
|
protected java.lang.String |
getCommitHash()
Returns the tag commit hash
|
abstract java.lang.String |
getRepositoryRootHash()
Returns the sha1 stored at the gitTag
|
protected java.lang.String |
getRepositoryTag()
Returns the .git repository tag
|
java.lang.String |
getTagContentHash(java.lang.String tag)
Returns the tag root.
|
protected java.lang.String |
getTagHash() |
java.util.Map<java.lang.String,RepositoryTagEntry> |
getTagMap()
Returns the tag map.
|
protected long |
getTagSequence() |
abstract GitType |
getType(java.lang.String sha1)
Returns true if the file is a blob.
|
void |
init()
Initialize the repository
|
boolean |
isBlob(java.lang.String sha1)
Returns true if the file is a blob.
|
boolean |
isCommit(java.lang.String sha1)
Returns true if the file is a commit
|
boolean |
isTree(java.lang.String sha1)
Returns true if the file is a tree
|
protected void |
loadLocalRoot() |
abstract java.io.InputStream |
openBlob(java.lang.String sha1)
Opens a stream to a git blob
|
abstract java.io.InputStream |
openRawGitFile(java.lang.String contentHash)
Opens a stream to the raw git file.
|
abstract boolean |
putTag(java.lang.String tag,
java.lang.String contentHash,
java.util.Map<java.lang.String,java.lang.String> commitMetaData)
Adds a tag
|
abstract GitCommit |
readCommit(java.lang.String commitHash)
Reads a git commit from the repository
|
abstract GitTree |
readTree(java.lang.String treeHash)
Reads a git tree from the repository
|
void |
removeListener(java.lang.String tag,
RepositoryTagListener listener)
Adds a tag listener
|
boolean |
removeTag(CommitBuilder commit)
Convenience method for adding the content of a jar.
|
abstract boolean |
removeTag(java.lang.String tag,
java.util.Map<java.lang.String,java.lang.String> commitMetaData)
Removes a tag
|
protected RepositoryTagMap |
removeTagData(java.lang.String tagName,
java.util.Map<java.lang.String,java.lang.String> commitMetaData)
Removes a tag entry
|
abstract void |
setRepositoryRootHash(java.lang.String repositoryCommitHash)
Writes the sha1 stored at the gitTag
|
protected boolean |
setTagMap(RepositoryTagMap tagMap) |
void |
start()
Start the repository
|
void |
stop() |
java.lang.String |
toString() |
protected boolean |
update(java.lang.String sha1,
boolean isNew)
Updates based on a sha1 commit entry
|
protected void |
updateLoad(java.lang.String sha1,
boolean isNew) |
protected void |
updateRepositoryRoot(java.lang.String sha1,
long sequence) |
protected void |
updateTagMap(java.lang.String sha1,
boolean isNew) |
RepositorySpi.ValidateHashResult |
validateHash(java.lang.String name,
java.lang.String sha1)
Validates a file, checking that it and its dependencies exist.
|
void |
validateRawGitFile(java.lang.String contentHash)
Removes a raw git file
|
protected GitType |
validateRawHash(java.lang.String hash) |
abstract void |
writeBlobToStream(java.lang.String blobHash,
java.io.OutputStream os)
Writes the contents to a stream.
|
abstract void |
writeRawGitFile(java.lang.String contentHash,
java.io.InputStream is)
Writes a raw git file
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitaddBlob, isActivepublic void init()
public void start()
public void stop()
protected java.lang.String getRepositoryTag()
public final void checkForUpdate()
public void checkForUpdate(boolean isExact)
checkForUpdate in interface RepositorySpiprotected void loadLocalRoot()
protected boolean update(java.lang.String sha1,
boolean isNew)
protected java.lang.String getTagHash()
protected long getTagSequence()
protected void updateLoad(java.lang.String sha1,
boolean isNew)
protected void updateTagMap(java.lang.String sha1,
boolean isNew)
protected java.lang.String getCommitHash()
public java.util.Map<java.lang.String,RepositoryTagEntry> getTagMap()
getTagMap in interface RepositorygetTagMap in interface RepositorySpipublic java.lang.String getTagContentHash(java.lang.String tag)
getTagContentHash in interface RepositorygetTagContentHash in interface RepositorySpipublic abstract boolean putTag(java.lang.String tag,
java.lang.String contentHash,
java.util.Map<java.lang.String,java.lang.String> commitMetaData)
putTag in interface RepositorySpitagName - the symbolic tag for the repositorycontentHash - the hash of the tag's contentcommitMessage - the commit message for the tag updatecommitMetaData - additional commit attributespublic abstract boolean removeTag(java.lang.String tag,
java.util.Map<java.lang.String,java.lang.String> commitMetaData)
removeTag in interface RepositorySpitagName - the symbolic tag for the repositorycommitMessage - user's message for the commitcommitMetaData - additional commit meta-datapublic java.lang.String commitArchive(CommitBuilder commit, Path archivePath)
commitArchive in interface Repositorypublic java.lang.String commitArchive(CommitBuilder commit, java.io.InputStream is)
commitArchive in interface Repositorypublic java.lang.String commitPath(CommitBuilder commit, Path directoryPath)
commitPath in interface Repositorypublic boolean removeTag(CommitBuilder commit)
removeTag in interface Repositoryprotected RepositoryTagMap addTagData(java.lang.String tagName, java.lang.String contentHash, java.util.Map<java.lang.String,java.lang.String> commitMetaData)
tagName - the symbolic tag for the repositorycontentHash - the hash of the tag's contentcommitMessage - user's message for the commitcommitMetaData - additional attributes for the commitprotected RepositoryTagMap removeTagData(java.lang.String tagName, java.util.Map<java.lang.String,java.lang.String> commitMetaData)
tag - the symbolic tag for the repositoryuser - the user adding a tag.server - the server adding a tag.message - user's message for the commitversion - symbolic version name for the commitprotected boolean setTagMap(RepositoryTagMap tagMap)
protected void updateRepositoryRoot(java.lang.String sha1,
long sequence)
public void addListener(java.lang.String tag,
RepositoryTagListener listener)
addListener in interface RepositoryaddListener in interface RepositorySpipublic void removeListener(java.lang.String tag,
RepositoryTagListener listener)
removeListener in interface RepositoryremoveListener in interface RepositorySpipublic abstract java.lang.String getRepositoryRootHash()
getRepositoryRootHash in interface RepositorySpipublic abstract void setRepositoryRootHash(java.lang.String repositoryCommitHash)
setRepositoryRootHash in interface RepositorySpirepositoryCommitHash - the hash of the new .git Commit for the
repository.public abstract boolean exists(java.lang.String sha1)
exists in interface RepositorySpipublic abstract GitType getType(java.lang.String sha1)
getType in interface RepositorySpipublic final boolean isBlob(java.lang.String sha1)
isBlob in interface RepositorySpipublic final boolean isTree(java.lang.String sha1)
isTree in interface RepositorySpipublic final boolean isCommit(java.lang.String sha1)
isCommit in interface RepositorySpipublic RepositorySpi.ValidateHashResult validateHash(java.lang.String name, java.lang.String sha1) throws java.io.IOException
validateHash in interface RepositorySpijava.io.IOExceptionprotected GitType validateRawHash(java.lang.String hash)
public java.lang.String addPath(Path path)
addPath in interface RepositorySpipublic java.lang.String addArchive(Path path)
addArchive in interface RepositorySpipublic java.lang.String addArchive(java.io.InputStream is)
protected java.lang.String addArchive(GitCommitJar commit) throws java.io.IOException
java.io.IOExceptionpublic java.lang.String addBlob(java.io.InputStream is,
long length)
throws java.io.IOException
addBlob in interface RepositorySpiis - the blob's input streamlength - the blob's lengthjava.io.IOExceptionpublic abstract java.io.InputStream openBlob(java.lang.String sha1)
throws java.io.IOException
openBlob in interface RepositorySpijava.io.IOExceptionpublic abstract GitTree readTree(java.lang.String treeHash) throws java.io.IOException
readTree in interface RepositorySpijava.io.IOExceptionpublic java.lang.String addTree(GitTree tree) throws java.io.IOException
addTree in interface RepositorySpijava.io.IOExceptionpublic abstract GitCommit readCommit(java.lang.String commitHash) throws java.io.IOException
readCommit in interface RepositorySpijava.io.IOExceptionpublic abstract java.lang.String addCommit(GitCommit commit) throws java.io.IOException
addCommit in interface RepositorySpijava.io.IOExceptionpublic abstract java.io.InputStream openRawGitFile(java.lang.String contentHash)
throws java.io.IOException
openRawGitFile in interface RepositorySpijava.io.IOExceptionpublic abstract void writeRawGitFile(java.lang.String contentHash,
java.io.InputStream is)
throws java.io.IOException
writeRawGitFile in interface RepositorySpijava.io.IOExceptionpublic void validateRawGitFile(java.lang.String contentHash)
validateRawGitFile in interface RepositorySpipublic abstract void writeBlobToStream(java.lang.String blobHash,
java.io.OutputStream os)
writeBlobToStream in interface RepositorySpiblobHash - the hash of the source blobos - the OutputStream to write topublic abstract void expandToPath(java.lang.String contentHash,
Path path)
expandToPath in interface RepositorySpipublic java.lang.String toString()
toString in class java.lang.Object