Class URLEndpointListenerConfiguration

java.lang.Object
com.couchbase.lite.URLEndpointListenerConfiguration

public class URLEndpointListenerConfiguration extends Object
ENTERPRISE EDITION API

Configuration information for a URL endpoint listener. There are two varieties: Http and Tls.

  • Field Details

  • Constructor Details

    • URLEndpointListenerConfiguration

      @Deprecated public URLEndpointListenerConfiguration(@NonNull Database database)
      Deprecated.
      Use URLEndpointListenerConfiguration(Collections)
      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 Set<Collection> collections)
      Init with the collections that will be available for replication. The specified collections must contain at least one collection, otherwise an Invalid Argument Exception will be thrown. Currently only collections from a single scope are supported: all of the specified collections must belong to the same scope, otherwise an Invalid Argument Exception will be thrown. All of the collections must belong to the same database, otherwise an Invalid Argument Exception will be thrown. If one of the collections is removed during the replication, the listener will be stopped and the connections to the connected clients will be closed with an error
      Parameters:
      collections - the collections to which the listener is attached
    • URLEndpointListenerConfiguration

      public URLEndpointListenerConfiguration(@NonNull Set<Collection> collections, @Nullable String networkInterface, int port, boolean disableTls, @Nullable TLSIdentity identity, @Nullable ListenerAuthenticator authenticator, boolean readOnly, boolean enableDeltaSync)
      Create a URLEndpointListenerConfiguration with the passed properties. The set of passed Collections must contain at least one collection and all of the collections it contains must belong to the same scope and the same database, otherwise an InvalidArgumentException will be thrown. If one of the specified collections is deleted during replication, connected clients will be closed with an error.
      Parameters:
      collections - the collections to which the listener is attached
      networkInterface - the name of the interface on which to receive connections
      port - the ip port (0 - 65535) on which to configure the listener. Default is 0: first available
      disableTls - set true to turn of TLS. Default is false
      identity - the identity this listener will use to authenticate itself
      authenticator - the predicate used to authenticate clients
      readOnly - set true to prevent modification of the local connections
      enableDeltaSync - set true to turn on fast synching.
    • URLEndpointListenerConfiguration

      public URLEndpointListenerConfiguration(@NonNull URLEndpointListenerConfiguration config)
      Clone the passed listener configuration.
      Parameters:
      config - the configuration to duplicate
  • Method Details

    • getDatabase

      @Deprecated @NonNull public Database getDatabase()
      Deprecated.
      use getCollections()
      Get the configured database.
      Returns:
      the configured database.
    • getCollections

      @NonNull public Set<Collection> getCollections()
      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. See ListenerCertificateAuthenticator

      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
    • toString

      @NonNull public String toString()
      Overrides:
      toString in class Object