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
Modifier and TypeClassDescriptionstatic enum
Deprecated.Use com.couchbase.lite.ReplicatorType -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
This is a long time: just under 25 days.Fields inherited from class com.couchbase.lite.internal.BaseReplicatorConfiguration
collectionConfigurations
-
Constructor Summary
ModifierConstructorDescriptionprotected
protected
AbstractReplicatorConfiguration
(Database db, Map<Collection, CollectionConfiguration> collections, Endpoint target) -
Method Summary
Modifier and TypeMethodDescriptionfinal ReplicatorConfiguration
addCollection
(Collection collection, CollectionConfiguration config) Add a collection used for the replication with an optional collection configuration.final ReplicatorConfiguration
addCollections
(Collection<Collection> collections, CollectionConfiguration config) Add multiple collections used for the replication with an optional shared collection configuration.protected static Map<Collection,
CollectionConfiguration> final Authenticator
Return the Authenticator used to authenticate the remote.Deprecated.Use CollectionConfiguration.getChannelsfinal CollectionConfiguration
getCollectionConfiguration
(Collection collection) Get the CollectionConfiguration for the passed Collection.final Set<Collection>
Return the list of collections in the replicator configurationfinal ConflictResolver
Deprecated.Use CollectionConfiguration.getConflictResolverfinal Database
Deprecated.Use Collection.getDatabaseDeprecated.Use CollectionConfiguration.getDocumentIDsReturn Extra HTTP headers to send in all requests to the remote target.final int
Return the heartbeat interval, in seconds.final int
Return the max number of retry attempts made after connection failure.final int
Return the max time between retry attempts (exponential backoff).final byte[]
Deprecated.Use getPinnedServerX509Certificatefinal X509Certificate
Return the remote target's SSL certificate.Returns the proxy authenticator.final ReplicationFilter
Deprecated.Use CollectionConfiguration.getPullFilterfinal ReplicationFilter
Deprecated.Use CollectionConfiguration.getPushFilterDeprecated.Use getType()final Endpoint
Return the replication target to replicate with.final ReplicatorType
getType()
Return Replicator type indicating the direction of the replicator.final boolean
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 boolean
Enable/disable auto-purge.final boolean
Return the continuous flag indicating whether the replicator should stay active indefinitely to replicate changed documents.final ReplicatorConfiguration
removeCollection
(Collection collection) Remove a collection from the replication.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.final ReplicatorConfiguration
setAuthenticator
(Authenticator authenticator) Sets the authenticator to authenticate with a remote target server.final ReplicatorConfiguration
setAutoPurgeEnabled
(boolean enabled) Enable/disable auto-purge.final ReplicatorConfiguration
setChannels
(List<String> channels) Deprecated.Use CollectionConfiguration.setChannelsfinal ReplicatorConfiguration
setConflictResolver
(ConflictResolver conflictResolver) Deprecated.Use CollectionConfiguration.setConflictResolverfinal ReplicatorConfiguration
setContinuous
(boolean continuous) Sets whether the replicator stays active indefinitely to replicate changed documents.final ReplicatorConfiguration
setDocumentIDs
(List<String> documentIDs) Deprecated.Use CollectionConfiguration.setDocumentIDsfinal ReplicatorConfiguration
setHeaders
(Map<String, String> headers) Sets the extra HTTP headers to send in all requests to the remote target.final ReplicatorConfiguration
setHeartbeat
(int heartbeat) Set the heartbeat interval, in seconds.final ReplicatorConfiguration
setMaxAttempts
(int maxAttempts) Set the max number of retry attempts made after a connection failure.final ReplicatorConfiguration
setMaxAttemptWaitTime
(int maxAttemptWaitTime) Set the max time between retry attempts, in seconds.final ReplicatorConfiguration
setPinnedServerCertificate
(byte[] pinnedCert) Deprecated.Please use setPinnedServerX509Certificate(Certificate)final ReplicatorConfiguration
setPinnedServerX509Certificate
(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 ReplicatorConfiguration
setPullFilter
(ReplicationFilter pullFilter) Deprecated.Use CollectionConfiguration.setPullFilterfinal ReplicatorConfiguration
setPushFilter
(ReplicationFilter pushFilter) Deprecated.Use CollectionConfiguration.setPushFilterfinal ReplicatorConfiguration
setReplicatorType
(AbstractReplicatorConfiguration.ReplicatorType replicatorType) Deprecated.Use setType(AbstractReplicator.ReplicatorType)final ReplicatorConfiguration
setType
(ReplicatorType type) Sets the replicator type indicating the direction of the replicator.toString()
Methods inherited from class com.couchbase.lite.internal.BaseReplicatorConfiguration
addCollectionInternal, getCollectionConfigurations, removeCollectionInternal
-
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, @Nullable Map<Collection, CollectionConfiguration> collections, @NonNull Endpoint target) -
AbstractReplicatorConfiguration
-
-
Method Details
-
configureDefaultCollection
@Nullable protected static Map<Collection,CollectionConfiguration> configureDefaultCollection(@Nullable Database db) -
addCollection
@NonNull public final ReplicatorConfiguration addCollection(@NonNull Collection collection, @Nullable CollectionConfiguration config) Add a collection used for the replication with an optional collection configuration. If the collection has been added before, the previously added collection and its configuration if specified will be replaced.- Parameters:
collection
- the collectionconfig
- its configuration- Returns:
- this
-
addCollections
@NonNull public final ReplicatorConfiguration addCollections(@NonNull Collection<Collection> collections, @Nullable CollectionConfiguration config) Add multiple collections used for the replication with an optional shared collection configuration. If any of the collections have been added before, the previously added collections and their configuration if specified will be replaced. Adding an empty collection array is a no-op.- Parameters:
collections
- a collection of Collectionsconfig
- the configuration to be applied to all of the collections- Returns:
- this
-
removeCollection
Remove a collection from the replication.- Parameters:
collection
- the collection to be removed- Returns:
- this
-
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(AbstractReplicator.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.Please use setPinnedServerX509Certificate(Certificate)Sets the target server's SSL certificate. The default is no pinned cert.- Parameters:
pinnedCert
- the SSL certificate.- Returns:
- this.
-
setDocumentIDs
@Deprecated @NonNull public final ReplicatorConfiguration setDocumentIDs(@Nullable List<String> documentIDs) Deprecated.Use CollectionConfiguration.setDocumentIDsA collection of document IDs identifying documents to be replicated. If non-empty, only documents with IDs in this collection will be pushed and/or pulled. Default is empty: do not filter documents.- Parameters:
documentIDs
- The document IDs.- Returns:
- this.
-
setChannels
@Deprecated @NonNull public final ReplicatorConfiguration setChannels(@Nullable List<String> channels) Deprecated.Use CollectionConfiguration.setChannelsSets a collection of Sync Gateway channel names from which to pull Documents. If unset, all accessible channels will be pulled. Default is empty: pull from all accessible channels.Note: Channel specifications apply only to replications pulling from a SyncGateway and only the channels visible to the authenticated user. Channel specs are ignored:
- during a push replication.
- during peer-to-peer or database-to-database replication
- when the specified channel is not accessible to the user
- Parameters:
channels
- The Sync Gateway channel names.- Returns:
- this.
-
setConflictResolver
@Deprecated @NonNull public final ReplicatorConfiguration setConflictResolver(@Nullable ConflictResolver conflictResolver) Deprecated.Use CollectionConfiguration.setConflictResolverSets the the conflict resolver. Default isConflictResolver.DEFAULT
- Parameters:
conflictResolver
- A conflict resolver.- Returns:
- this.
-
setPullFilter
@Deprecated @NonNull public final ReplicatorConfiguration setPullFilter(@Nullable ReplicationFilter pullFilter) Deprecated.Use CollectionConfiguration.setPullFilterSets a filter object for validating whether the documents can be pulled from the remote endpoint. Only documents for which the object returns true are replicated. Default is no filter.- Parameters:
pullFilter
- The filter to filter the document to be pulled.- Returns:
- this.
-
setPushFilter
@Deprecated @NonNull public final ReplicatorConfiguration setPushFilter(@Nullable ReplicationFilter pushFilter) Deprecated.Use CollectionConfiguration.setPushFilterSets a filter object for validating whether the documents can be pushed to the remote endpoint. Default is no filter.- Parameters:
pushFilter
- The filter to filter the document to be pushed.- Returns:
- this.
-
getTarget
Return the replication target to replicate with. -
getCollectionConfiguration
@Nullable public final CollectionConfiguration getCollectionConfiguration(@NonNull Collection collection) Get the CollectionConfiguration for the passed Collection.- Parameters:
collection
- a collection whose configuration is sought.- Returns:
- the collections configuration
-
getCollections
Return the list of collections in the replicator configuration -
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 getType()Old getter for Replicator type indicating the direction of the replicator. -
getPinnedServerCertificate
Deprecated.Use getPinnedServerX509CertificateReturn the remote target's SSL certificate. -
getDatabase
Deprecated.Use Collection.getDatabaseReturn the local database to replicate with the replication target. -
getDocumentIDs
Deprecated.Use CollectionConfiguration.getDocumentIDsA collection of document IDs to filter: if not nil, only documents with these IDs will be pushed and/or pulled. -
getChannels
Deprecated.Use CollectionConfiguration.getChannelsGets the collection of Sync Gateway channel names from which to pull documents. If unset, all accessible channels will be pulled. Default is empty: pull from all accessible channels.Note: Channel specifications apply only to replications pulling from a SyncGateway and only the channels visible to the authenticated user. Channel specs are ignored:
- during a push replication.
- during peer-to-peer or database-to-database replication
- when the specified channel is not accessible to the user
-
getConflictResolver
Deprecated.Use CollectionConfiguration.getConflictResolverReturn the conflict resolver. -
getPullFilter
Deprecated.Use CollectionConfiguration.getPullFilterGets the filter used to determine whether a document will be pulled from the remote endpoint. -
getPushFilter
Deprecated.Use CollectionConfiguration.getPushFilterGets a filter used to determine whether a document will be pushed to the remote endpoint. -
toString
-