Package com.couchbase.lite
Class URLEndpointListenerConfiguration
- java.lang.Object
-
- com.couchbase.lite.URLEndpointListenerConfiguration
-
public class URLEndpointListenerConfiguration extends Object
Configuration information for a URL endpoint listener. There are two varieties: Http and Tls.
-
-
Constructor Summary
Constructors Constructor Description URLEndpointListenerConfiguration(Database database)
Create a listener configuration, for the specified database, with default values.URLEndpointListenerConfiguration(Database database, String networkInterface, int port, boolean disableTls, TLSIdentity identity, ListenerAuthenticator authenticator, boolean readOnly, boolean enableDeltaSync)
URLEndpointListenerConfiguration(URLEndpointListenerConfiguration config)
Clone the passed listener configuration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ListenerAuthenticator
getAuthenticator()
Get the configured authenticator.Database
getDatabase()
Get the configured database.String
getNetworkInterface()
Get the configured network interface.int
getPort()
Get the configured port.TLSIdentity
getTlsIdentity()
Get the configured TLS identity.boolean
isDeltaSyncEnabled()
Is delta sync enabled.boolean
isReadOnly()
Is connection read-only.boolean
isTlsDisabled()
Get configured connection type.void
setAuthenticator(ListenerAuthenticator authenticator)
Set the authenticator.void
setDisableTls(boolean disableTls)
Set the configured security protocol.void
setEnableDeltaSync(boolean enableDeltaSync)
Set delta sync enabled.void
setNetworkInterface(String networkInterface)
Set the configured network interface.void
setPort(int port)
Set the configured port.void
setReadOnly(boolean readOnly)
Set the connection read-only.void
setTlsIdentity(TLSIdentity identity)
Set the certificates and keys for the associated listener.
-
-
-
Field Detail
-
MIN_PORT
public static final int MIN_PORT
- See Also:
- Constant Field Values
-
MAX_PORT
public static final int MAX_PORT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
URLEndpointListenerConfiguration
public URLEndpointListenerConfiguration(@NonNull Database database)
Create a listener configuration, for the specified database, with default values.- Parameters:
database
- the database to which the listener is attached
-
URLEndpointListenerConfiguration
public URLEndpointListenerConfiguration(@NonNull URLEndpointListenerConfiguration config)
Clone the passed listener configuration.- Parameters:
config
- the configuration to duplicate
-
URLEndpointListenerConfiguration
public URLEndpointListenerConfiguration(@NonNull Database database, @Nullable String networkInterface, int port, boolean disableTls, @Nullable TLSIdentity identity, @Nullable ListenerAuthenticator authenticator, boolean readOnly, boolean enableDeltaSync)
-
-
Method Detail
-
getDatabase
@NonNull public Database getDatabase()
Get the configured database.- Returns:
- the configured database.
-
getNetworkInterface
@Nullable public String getNetworkInterface()
Get the configured network interface.- Returns:
- the configured network interface.
-
setNetworkInterface
public void setNetworkInterface(@Nullable String networkInterface)
Set the configured network interface.- Parameters:
networkInterface
- the name of the interface on which to configure the listener (e.g. "en0")
-
getPort
public int getPort()
Get the configured port.- Returns:
- the configured port.
-
setPort
public void setPort(int port)
Set the configured port. A port number of 0 (the default) tells the OS to choose some available port.- Parameters:
port
- the port number on which to configure the listener (between 0 and 65535, inclusive)
-
isTlsDisabled
public boolean isTlsDisabled()
Get configured connection type.- Returns:
- true if this configuration will disable TLS in its associated listener.
-
setDisableTls
public void setDisableTls(boolean disableTls)
Set the configured security protocol. TLS is enabled by default. disabling it is not recommended for production.- Parameters:
disableTls
- true to disable TLS security.
-
getTlsIdentity
@Nullable public TLSIdentity getTlsIdentity()
Get the configured TLS identity.- Returns:
- the TLS identity for the associated listener.
-
setTlsIdentity
public void setTlsIdentity(@Nullable TLSIdentity identity)
Set the certificates and keys for the associated listener.- Parameters:
identity
- a TLSIdentity that the listener will supply to authenticate itself.
-
getAuthenticator
@Nullable public ListenerAuthenticator getAuthenticator()
Get the configured authenticator.- Returns:
- the authenticator for the associated listener.
-
setAuthenticator
public void setAuthenticator(@Nullable ListenerAuthenticator authenticator)
Set the authenticator. When TLS is enabled, a null authenticator (the default) will allow clients whose certificate chains can be verified by one of the OS-bundled root certificates. There are two types of TLS authenticators. SeeListenerCertificateAuthenticator
When TLS is disabled, a null authenticator (the default) will allow all clients. A non-null authenticator will be passed the client's credentials and is completely responsible for authenticating them. See
ListenerPasswordAuthenticator
- Parameters:
authenticator
- the client authenticator
-
isReadOnly
public boolean isReadOnly()
Is connection read-only.- Returns:
- true if the connections is read-only.
-
setReadOnly
public void setReadOnly(boolean readOnly)
Set the connection read-only.- Parameters:
readOnly
- set true to make the configured listener read-only
-
isDeltaSyncEnabled
public boolean isDeltaSyncEnabled()
Is delta sync enabled.- Returns:
- true if delta sync is enabled.
-
setEnableDeltaSync
public void setEnableDeltaSync(boolean enableDeltaSync)
Set delta sync enabled.- Parameters:
enableDeltaSync
- set true to enable delta sync
-
-