public interface

HookRequestHandle

implements Closeable
com.atlassian.stash.hook.HookRequestHandle

Class Overview

A handle on the hook request which provides the required information to make a successful callback to Stash via their hook callback socket

Summary

Constants
String ENV_HOOK_ADDRESS The environment variable to be set in order to provide the getHostAddress() socket bind address} to external processes.
String ENV_HOOK_CALLBACK The environment variable to be set in order to provide the callback scripts location to external processes.
String ENV_HOOK_COORDINATOR The environment variable to be set in order to provide the coordinator scripts location to external processes.
String ENV_HOOK_PORT The environment variable to be set in order to provide the port number to external processes.
String ENV_HOOK_REQUEST_ID The environment variable to be set in order to provide the getRequestId() hook request id} to external processes.
Public Methods
void close()
Indicate that the SCM provider has finished with the hook request.
@Nonnull File getCallbackScript()
@Nonnull File getCoordinatorScript()
@Nonnull String getHostAddress()
int getPort()
@Nonnull String getRequestId()
[Expand]
Inherited Methods
From interface java.io.Closeable
From interface java.lang.AutoCloseable

Constants

public static final String ENV_HOOK_ADDRESS

The environment variable to be set in order to provide the getHostAddress() socket bind address} to external processes.

Constant Value: "STASH_HOOK_ADDRESS"

public static final String ENV_HOOK_CALLBACK

The environment variable to be set in order to provide the callback scripts location to external processes.

Constant Value: "STASH_HOOK_CALLBACK"

public static final String ENV_HOOK_COORDINATOR

The environment variable to be set in order to provide the coordinator scripts location to external processes.

Constant Value: "STASH_HOOK_COORDINATOR"

public static final String ENV_HOOK_PORT

The environment variable to be set in order to provide the port number to external processes.

Constant Value: "STASH_HOOK_PORT"

public static final String ENV_HOOK_REQUEST_ID

The environment variable to be set in order to provide the getRequestId() hook request id} to external processes.

Constant Value: "STASH_HOOK_REQUEST_ID"

Public Methods

public void close ()

Indicate that the SCM provider has finished with the hook request. This allows the host application to cleanup any references it is maintaining

@Nonnull public File getCallbackScript ()

Returns
  • the absolute location of the callback script Stash provides which handles communication with callback socket. SCM implementers do not have to use this but it is provided for convenience.

@Nonnull public File getCoordinatorScript ()

Returns
  • the absolute location of the coordinator script Stash provides which handles iterating through a list of scripts in a directory. SCM implementers do not have to use this but it is provided for convenience.

@Nonnull public String getHostAddress ()

Returns
  • the host address to the hook callback socket is bound to. This is most likely localhost.

public int getPort ()

Returns
  • the port the hook callback socket is bound to. This is a randomly allocated port number

@Nonnull public String getRequestId ()

Returns
  • the request id to identify the callback. This is securely generated