Class BootstrapMessage (0.18.0)

public abstract class BootstrapMessage extends WireMessage

This represents all messages which occur before ControlMessage type messages. Those include encryption, admin (e.g.: cancellation) and start-up messages.

Inheritance

java.lang.Object > WireMessage > BootstrapMessage

Static Methods

create(ConnectionHandler connection)

public static BootstrapMessage create(ConnectionHandler connection)

Factory method to create the bootstrap message from their designated format. Note this is backwards from control messages where identifier is first and length second.

Parameter
NameDescription
connectionConnectionHandler

The connection handler object setup with the ability to send/receive.

Returns
TypeDescription
BootstrapMessage

The constructed wire message given the input message.

Exceptions
TypeDescription
Exception

If construction or reading fails.

sendStartupMessage(DataOutputStream output, int connectionId, int secret, SessionState sessionState, Iterable<NoticeResponse> startupNotices)

public static void sendStartupMessage(DataOutputStream output, int connectionId, int secret, SessionState sessionState, Iterable<NoticeResponse> startupNotices)

Expected PG start-up reply, including Auth approval, Key Data connection-specific info, PGAdapter specific parameters, and a ready signal.

Parameters
NameDescription
outputDataOutputStream

The data output stream to send results to.

connectionIdint

The connection Id representing the current connection to send to client.

secretint

The secret apposite this connection

sessionStateSessionState
startupNoticesIterable<NoticeResponse>
Exceptions
TypeDescription
Exception

Constructors

BootstrapMessage(ConnectionHandler connection, int length)

public BootstrapMessage(ConnectionHandler connection, int length)
Parameters
NameDescription
connectionConnectionHandler
lengthint

Methods

parseParameterKeys(String rawParameters)

protected List<String> parseParameterKeys(String rawParameters)

Parses the parameter keys from the given raw parameter string and returns these in the received order. This can be used to detect the client that is connecting to PGAdapter.

Parameter
NameDescription
rawParametersString
Returns
TypeDescription
List<String>

parseParameters(String rawParameters)

protected Map<String,String> parseParameters(String rawParameters)

Parses parameters specific to bootstrap messages. Those generally (unlike control parameters) exclude metadata including length and are simple null (0) delimited.

Parameter
NameDescription
rawParametersString

The input string containing parameters (null delimited)

Returns
TypeDescription
Map<String,String>

A KV map of the parameters