Package com.couchbase.lite
Class AbstractReplicatorConfiguration
java.lang.Object
com.couchbase.lite.internal.BaseReplicatorConfiguration
com.couchbase.lite.AbstractReplicatorConfiguration
- Direct Known Subclasses:
ReplicatorConfiguration
public abstract class AbstractReplicatorConfiguration
extends com.couchbase.lite.internal.BaseReplicatorConfiguration
Replicator configuration.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDeprecated.Use com.couchbase.lite.ReplicatorType -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThis is a long time: just under 25 days.Fields inherited from class com.couchbase.lite.internal.BaseReplicatorConfiguration
collectionConfigurations -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedAbstractReplicatorConfiguration(Database db, Map<Collection, CollectionConfiguration> collections, Endpoint target) -
Method Summary
Modifier and TypeMethodDescriptionprotected static Map<Collection,CollectionConfiguration> final AuthenticatorReturn the Authenticator used to authenticate the remote.final Set<CollectionConfiguration>Returns a copy of the collection configurations associated with this replicator configuration.Return Extra HTTP headers to send in all requests to the remote target.final intReturn the heartbeat interval, in seconds.final intReturn the max number of retry attempts made after connection failure.final intReturn the max time between retry attempts (exponential backoff).final byte[]Deprecated.Use getPinnedServerX509Certificatefinal X509CertificateReturn the remote target's SSL certificate.Returns the proxy authenticator.Deprecated.Use com.couchbase.lite.ReplicatorType ReplicatorConfiguration.getType()final EndpointReturn the replication target to replicate with.final ReplicatorTypegetType()Return Replicator type indicating the direction of the replicator.final booleanThe option to remove a restriction that does not allow a replicator to accept cookies from a remote host unless the cookie domain exactly matches the the domain of the sender.final booleanEnable/disable auto-purge.final booleanReturn the continuous flag indicating whether the replicator should stay active indefinitely to replicate changed documents.final ReplicatorConfigurationsetAcceptParentDomainCookies(boolean acceptParentCookies) The option to remove a restriction that does not allow a replicator to accept cookies from a remote host unless the cookie domain exactly matches the the domain of the sender.final ReplicatorConfigurationsetAuthenticator(Authenticator authenticator) Sets the authenticator to authenticate with a remote target server.final ReplicatorConfigurationsetAutoPurgeEnabled(boolean enabled) Enable/disable auto-purge.final ReplicatorConfigurationsetContinuous(boolean continuous) Sets whether the replicator stays active indefinitely to replicate changed documents.final ReplicatorConfigurationsetHeaders(Map<String, String> headers) Sets the extra HTTP headers to send in all requests to the remote target.final ReplicatorConfigurationsetHeartbeat(int heartbeat) Set the heartbeat interval, in seconds.final ReplicatorConfigurationsetMaxAttempts(int maxAttempts) Set the max number of retry attempts made after a connection failure.final ReplicatorConfigurationsetMaxAttemptWaitTime(int maxAttemptWaitTime) Set the max time between retry attempts, in seconds.final ReplicatorConfigurationsetPinnedServerCertificate(byte[] pinnedCert) Deprecated.Use setPinnedServerX509Certificate(Certificate)final ReplicatorConfigurationsetPinnedServerX509Certificate(X509Certificate pinnedCert) Sets the certificate used to authenticate the target server.setProxyAuthenticator(ProxyAuthenticator authenticator) Sets the proxy authenticator to authenticate with the HTTP Proxy.final ReplicatorConfigurationsetReplicatorType(AbstractReplicatorConfiguration.ReplicatorType replicatorType) Deprecated.Use setType(com.couchbase.lite.ReplicatorType)final ReplicatorConfigurationsetType(ReplicatorType type) Sets the replicator type indicating the direction of the replicator.toString()Methods inherited from class com.couchbase.lite.internal.BaseReplicatorConfiguration
getCollectionConfigurations
-
Field Details
-
DISABLE_HEARTBEAT
public static final int DISABLE_HEARTBEATThis is a long time: just under 25 days. This many seconds, however, is just less than Integer.MAX_INT millis and will fit in the heartbeat property.- See Also:
-
-
Constructor Details
-
AbstractReplicatorConfiguration
protected AbstractReplicatorConfiguration(@Nullable Database db, @NonNull Map<Collection, CollectionConfiguration> collections, @NonNull Endpoint target) -
AbstractReplicatorConfiguration
-
-
Method Details
-
createCollectionConfigMap
@NonNull protected static Map<Collection,CollectionConfiguration> createCollectionConfigMap(@NonNull Collection<CollectionConfiguration> configs) -
setType
Sets the replicator type indicating the direction of the replicator. The default is ReplicatorType.PUSH_AND_PULL: bi-directional replication.- Parameters:
type- The replicator type.- Returns:
- this.
-
setContinuous
Sets whether the replicator stays active indefinitely to replicate changed documents. The default is false: the replicator will stop after it finishes replicating changed documents.- Parameters:
continuous- The continuous flag.- Returns:
- this.
-
setAutoPurgeEnabled
Enable/disable auto-purge. The default is auto-purge enabled.Note: A document that is blocked by a document Id filter will not be auto-purged regardless of the setting of the auto purge property
-
setHeaders
Sets the extra HTTP headers to send in all requests to the remote target. The default is no extra headers.- Parameters:
headers- The HTTP Headers.- Returns:
- this.
-
setAcceptParentDomainCookies
@NonNull public final ReplicatorConfiguration setAcceptParentDomainCookies(boolean acceptParentCookies) The option to remove a restriction that does not allow a replicator to accept cookies from a remote host unless the cookie domain exactly matches the the domain of the sender. For instance, when the option is set to false (the default), and the remote host, “bar.foo.com”, sends a cookie for the domain “.foo.com”, the replicator will reject it. If the option is set true, however, the replicator will accept it. This is, in general, dangerous: a host might, for instance, set a cookie for the domain ".com". It is safe only when the replicator is connecting only to known hosts. The default value of this option is false: parent-domain cookies are not accepted -
setAuthenticator
@NonNull public final ReplicatorConfiguration setAuthenticator(@Nullable Authenticator authenticator) Sets the authenticator to authenticate with a remote target server. Currently there are two types of the authenticators, BasicAuthenticator and SessionAuthenticator, supported. The default is no authenticator.- Parameters:
authenticator- The authenticator.- Returns:
- this.
-
setProxyAuthenticator
@NonNull public ReplicatorConfiguration setProxyAuthenticator(@Nullable ProxyAuthenticator authenticator) Sets the proxy authenticator to authenticate with the HTTP Proxy. The default is no authenticator.- Parameters:
authenticator- The authenticator.- Returns:
- this.
-
setPinnedServerX509Certificate
@NonNull public final ReplicatorConfiguration setPinnedServerX509Certificate(@Nullable X509Certificate pinnedCert) Sets the certificate used to authenticate the target server. A server will be authenticated if it presents a chain of certificates (possibly of length 1) in which any one of the certificates matches the one passed here. The default is no pinned certificate.- Parameters:
pinnedCert- the SSL certificate.- Returns:
- this.
-
setMaxAttempts
Set the max number of retry attempts made after a connection failure. Set to 1 for no retries and to 0 to restore default behavior. The default is 10 total connection attempts (the initial attempt and up to 9 retries) for a one-shot replicator and a very, very large number of retries, for a continuous replicator.- Parameters:
maxAttempts- max retry attempts
-
setMaxAttemptWaitTime
Set the max time between retry attempts, in seconds. Time between retries is initially small but backs off exponentially up to this limit. Once the limit is reached the interval between subsequent attempts will be the value set here, until max-attempts attempts have been made. The minimum value legal value is 1 second. The default is 5 minutes (300 seconds). Setting the parameter to 0 will restore the default- Parameters:
maxAttemptWaitTime- max attempt wait time
-
setHeartbeat
Set the heartbeat interval, in seconds. The default is 5 minutes (300 seconds). Setting the parameter to 0 will restore the defaultMust be non-negative and less than Integer.MAX_VALUE milliseconds
-
setReplicatorType
@Deprecated @NonNull public final ReplicatorConfiguration setReplicatorType(@NonNull AbstractReplicatorConfiguration.ReplicatorType replicatorType) Deprecated.Use setType(com.couchbase.lite.ReplicatorType)Old setter for replicator type, indicating the direction of the replicator. The default value is PUSH_AND_PULL which is bi-directional.- Parameters:
replicatorType- The replicator type.- Returns:
- this.
-
setPinnedServerCertificate
@Deprecated @NonNull public final ReplicatorConfiguration setPinnedServerCertificate(@Nullable byte[] pinnedCert) Deprecated.Use setPinnedServerX509Certificate(Certificate)Sets the target server's SSL certificate. The default is no pinned cert.- Parameters:
pinnedCert- the SSL certificate.- Returns:
- this.
-
getTarget
Return the replication target to replicate with. -
getCollections
Returns a copy of the collection configurations associated with this replicator configuration.- Returns:
- a set of
CollectionConfigurationobjects.
-
getType
Return Replicator type indicating the direction of the replicator. -
isContinuous
public final boolean isContinuous()Return the continuous flag indicating whether the replicator should stay active indefinitely to replicate changed documents. -
isAutoPurgeEnabled
public final boolean isAutoPurgeEnabled()Enable/disable auto-purge. Default is enabled.Note: A document that is blocked by a document Id filter will not be auto-purged regardless of the setting of the auto purge property
-
getHeaders
Return Extra HTTP headers to send in all requests to the remote target. -
isAcceptParentDomainCookies
public final boolean isAcceptParentDomainCookies()The option to remove a restriction that does not allow a replicator to accept cookies from a remote host unless the cookie domain exactly matches the the domain of the sender. For instance, when the option is set to false (the default), and the remote host, “bar.foo.com”, sends a cookie for the domain “.foo.com”, the replicator will reject it. If the option is set true, however, the replicator will accept it. This is, in general, dangerous: a host might, for instance, set a cookie for the domain ".com". It is safe only when the replicator is connecting only to known hosts. The default value of this option is false: parent-domain cookies are not accepted -
getAuthenticator
Return the Authenticator used to authenticate the remote. -
getProxyAuthenticator
Returns the proxy authenticator.- Returns:
- the proxy authenticator or null.
-
getPinnedServerX509Certificate
Return the remote target's SSL certificate. -
getMaxAttempts
public final int getMaxAttempts()Return the max number of retry attempts made after connection failure. This method will return 0 when implicitly using the default: 10 total connection attempts (the initial attempt and up to 9 retries) for a one-shot replicator and a very, very large number of retries, for a continuous replicator. -
getMaxAttemptWaitTime
public final int getMaxAttemptWaitTime()Return the max time between retry attempts (exponential backoff).- Returns:
- max retry wait time
-
getHeartbeat
public final int getHeartbeat()Return the heartbeat interval, in seconds.- Returns:
- heartbeat interval in seconds
-
getReplicatorType
@Deprecated @NonNull public final AbstractReplicatorConfiguration.ReplicatorType getReplicatorType()Deprecated.Use com.couchbase.lite.ReplicatorType ReplicatorConfiguration.getType()Old getter for Replicator type indicating the direction of the replicator. -
getPinnedServerCertificate
Deprecated.Use getPinnedServerX509CertificateReturn the remote target's SSL certificate. -
toString
-