T - the return type which is expected from call()abstract class GitHook<T>
extends java.lang.Object
implements java.util.concurrent.Callable<T>
| Modifier and Type | Field and Description |
|---|---|
protected java.io.PrintStream |
outputStream
The output stream to be used by the hook.
|
private Repository |
repo |
| Modifier | Constructor and Description |
|---|---|
protected |
GitHook(Repository repo,
java.io.PrintStream outputStream)
Constructor for GitHook
|
| Modifier and Type | Method and Description |
|---|---|
abstract T |
call() |
protected void |
doRun()
Runs the hook, without performing any validity checks.
|
abstract java.lang.String |
getHookName()
Get name of the hook
|
protected java.io.PrintStream |
getOutputStream()
Get output stream
|
protected java.lang.String[] |
getParameters()
Override this method when needed to provide relevant parameters to the
underlying hook script.
|
protected Repository |
getRepository()
Get the repository
|
protected java.lang.String |
getStdinArgs()
Override to provide relevant arguments via stdin to the underlying hook
script.
|
boolean |
isNativeHookPresent()
Check whether a 'native' (i.e.
|
private final Repository repo
protected final java.io.PrintStream outputStream
protected GitHook(Repository repo, java.io.PrintStream outputStream)
repo - a Repository object.outputStream - The output stream the hook must use. null is allowed,
in which case the hook will use System.out.public abstract T call() throws java.io.IOException, AbortedByHookException
Run the hook.
call in interface java.util.concurrent.Callable<T>java.io.IOExceptionAbortedByHookExceptionpublic abstract java.lang.String getHookName()
null.protected Repository getRepository()
protected java.lang.String[] getParameters()
protected java.lang.String getStdinArgs()
null.protected java.io.PrintStream getOutputStream()
null,
System.out is returned by default.protected void doRun()
throws AbortedByHookException
AbortedByHookException - If the underlying hook script exited with non-zero.public boolean isNativeHookPresent()