public abstract class API
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected io.grpc.ManagedChannel |
channel |
protected static int |
DEFAULT_MAX_INBOUND_MESSAGE_SIZE |
protected static java.util.logging.Logger |
log |
protected boolean |
performValidation |
protected StatusExceptionWrapper |
statusExceptionWrapper |
protected WrapperFactory |
wrapperFactory |
| Modifier | Constructor and Description |
|---|---|
protected |
API(io.grpc.ManagedChannel channel)
Constructor used for setting up a connection using a GRPC managed channel that
can be customized.
|
protected |
API(java.lang.String host,
int port,
java.io.File trustedServerCertificate,
java.io.File macaroonFile)
Minimal constructor for setting up a connection with LND Application.
|
protected |
API(java.lang.String host,
int port,
io.grpc.netty.shaded.io.netty.handler.ssl.SslContext sslContext,
MacaroonContext macaroonContext)
Constructor for setting up a connection with LND Application with more flexible
SSL context parameters and macaroon Context.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Method to close underlying channel and free resources.
|
boolean |
isPerformValidation() |
protected java.lang.Object |
processRequest(Message requestMessage)
Method to convert and validate (if validation is enabled) a request message to and underlying apiObject sent
to LDN Server.
|
void |
setPerformValidation(boolean performValidation) |
protected void |
validate(Message message)
Method to validate all fields in related message and throws a validation exception with
a validation report with all found validation problems.
|
protected static final int DEFAULT_MAX_INBOUND_MESSAGE_SIZE
protected static java.util.logging.Logger log
protected WrapperFactory wrapperFactory
protected StatusExceptionWrapper statusExceptionWrapper
protected boolean performValidation
protected io.grpc.ManagedChannel channel
protected API(java.lang.String host,
int port,
java.io.File trustedServerCertificate,
java.io.File macaroonFile)
throws javax.net.ssl.SSLException,
ClientSideException
host - the hostname of ldn applicationport - the port of the application.trustedServerCertificate - a link of the SSL certificate used by the LND Application.macaroonFile - the file pointing to the macaroon to use, or null if no macaroons are used.javax.net.ssl.SSLException - if problems occurred setting up the SSL Connection.ClientSideException - if problems occurred reading the macaroon file.protected API(java.lang.String host,
int port,
io.grpc.netty.shaded.io.netty.handler.ssl.SslContext sslContext,
MacaroonContext macaroonContext)
host - the hostname of ldn applicationport - the port of the application.sslContext - the SSL Context used when connecting the LND Application.macaroonContext - the macaroon context to use.protected API(io.grpc.ManagedChannel channel)
channel - the managed channel to use.protected void validate(Message message) throws ValidationException
message - the message to validate.ValidationException - exception containing a validation report with all validation
problems found.public void close()
throws StatusException
StatusException - if problems occurred in underlying GRPC call. Can be of one of three sub exceptions
protected java.lang.Object processRequest(Message requestMessage) throws ValidationException
requestMessage - the request message to convertValidationException - exception containing a validation report with all validation
problems found, if validation is used.public boolean isPerformValidation()
public void setPerformValidation(boolean performValidation)
performValidation - set to true if messages should be validated before sent or received.