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 Classes Modifier and Type Class Description static class
AbstractReplicatorConfiguration.ReplicatorType
Deprecated.Use com.couchbase.lite.ReplicatorType
-
Field Summary
Fields Modifier and Type Field Description static int
DISABLE_HEARTBEAT
This is a long time: just under 25 days.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ReplicatorConfiguration
addCollection(Collection collection, CollectionConfiguration config)
Add a collection used for the replication with an optional collection configuration.ReplicatorConfiguration
addCollections(java.util.Collection<Collection> collections, CollectionConfiguration config)
Add multiple collections used for the replication with an optional shared collection configuration.Authenticator
getAuthenticator()
Return the Authenticator used to authenticate the remote.java.util.List<java.lang.String>
getChannels()
Deprecated.Use CollectionConfiguration.getChannelsCollectionConfiguration
getCollectionConfiguration(Collection collection)
Get the CollectionConfiguration for the passed Collection.java.util.Set<Collection>
getCollections()
Return the list of collections in the replicator configurationConflictResolver
getConflictResolver()
Deprecated.Use CollectionConfiguration.getConflictResolverDatabase
getDatabase()
Deprecated.Use Collection.getDatabasejava.util.List<java.lang.String>
getDocumentIDs()
Deprecated.Use CollectionConfiguration.getDocumentIDsjava.util.Map<java.lang.String,java.lang.String>
getHeaders()
Return Extra HTTP headers to send in all requests to the remote target.int
getHeartbeat()
Return the heartbeat interval, in seconds.int
getMaxAttempts()
Return the max number of retry attempts made after connection failure.int
getMaxAttemptWaitTime()
Return the max time between retry attempts (exponential backoff).byte[]
getPinnedServerCertificate()
Deprecated.Use getPinnedServerX509Certificatejava.security.cert.X509Certificate
getPinnedServerX509Certificate()
Return the remote target's SSL certificate.ReplicationFilter
getPullFilter()
Deprecated.Use CollectionConfiguration.getPullFilterReplicationFilter
getPushFilter()
Deprecated.Use CollectionConfiguration.getPushFilterAbstractReplicatorConfiguration.ReplicatorType
getReplicatorType()
Deprecated.Use getType()Endpoint
getTarget()
Return the replication target to replicate with.ReplicatorType
getType()
Return Replicator type indicating the direction of the replicator.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.boolean
isAutoPurgeEnabled()
Enable/disable auto-purge.boolean
isContinuous()
Return the continuous flag indicating whether the replicator should stay active indefinitely to replicate changed documents.ReplicatorConfiguration
removeCollection(Collection collection)
Remove a collection from the replication.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.ReplicatorConfiguration
setAuthenticator(Authenticator authenticator)
Sets the authenticator to authenticate with a remote target server.ReplicatorConfiguration
setAutoPurgeEnabled(boolean enabled)
Enable/disable auto-purge.ReplicatorConfiguration
setChannels(java.util.List<java.lang.String> channels)
Deprecated.Use CollectionConfiguration.setChannelsReplicatorConfiguration
setConflictResolver(ConflictResolver conflictResolver)
Deprecated.Use CollectionConfiguration.setConflictResolverReplicatorConfiguration
setContinuous(boolean continuous)
Sets whether the replicator stays active indefinitely to replicate changed documents.ReplicatorConfiguration
setDocumentIDs(java.util.List<java.lang.String> documentIDs)
Deprecated.Use CollectionConfiguration.setDocumentIDsReplicatorConfiguration
setHeaders(java.util.Map<java.lang.String,java.lang.String> headers)
Sets the extra HTTP headers to send in all requests to the remote target.ReplicatorConfiguration
setHeartbeat(int heartbeat)
Set the heartbeat interval, in seconds.ReplicatorConfiguration
setMaxAttempts(int maxAttempts)
Set the max number of retry attempts made after a connection failure.ReplicatorConfiguration
setMaxAttemptWaitTime(int maxAttemptWaitTime)
Set the max time between retry attempts, in seconds.ReplicatorConfiguration
setPinnedServerCertificate(byte[] pinnedCert)
Deprecated.Please use setPinnedServerX509Certificate(Certificate)ReplicatorConfiguration
setPinnedServerX509Certificate(java.security.cert.X509Certificate pinnedCert)
Sets the certificate used to authenticate the target server.ReplicatorConfiguration
setPullFilter(ReplicationFilter pullFilter)
Deprecated.Use CollectionConfiguration.setPullFilterReplicatorConfiguration
setPushFilter(ReplicationFilter pushFilter)
Deprecated.Use CollectionConfiguration.setPushFilterReplicatorConfiguration
setReplicatorType(AbstractReplicatorConfiguration.ReplicatorType replicatorType)
Deprecated.Use setType(AbstractReplicator.ReplicatorType)ReplicatorConfiguration
setType(ReplicatorType type)
Sets the replicator type indicating the direction of the replicator.java.lang.String
toString()
-
-
-
Field Detail
-
DISABLE_HEARTBEAT
public static final int DISABLE_HEARTBEAT
This 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:
- Constant Field Values
-
-
Method Detail
-
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 java.util.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
@NonNull public final ReplicatorConfiguration removeCollection(@NonNull Collection collection)
Remove a collection from the replication.- Parameters:
collection
- the collection to be removed- Returns:
- this
-
setType
@NonNull public final ReplicatorConfiguration setType(@NonNull ReplicatorType type)
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
@NonNull public final ReplicatorConfiguration setContinuous(boolean continuous)
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
@NonNull public final ReplicatorConfiguration setAutoPurgeEnabled(boolean enabled)
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
@NonNull public final ReplicatorConfiguration setHeaders(@Nullable java.util.Map<java.lang.String,java.lang.String> headers)
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.
-
setPinnedServerX509Certificate
@NonNull public final ReplicatorConfiguration setPinnedServerX509Certificate(@Nullable java.security.cert.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
@NonNull public final ReplicatorConfiguration setMaxAttempts(int maxAttempts)
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
@NonNull public final ReplicatorConfiguration setMaxAttemptWaitTime(int maxAttemptWaitTime)
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
@NonNull public final ReplicatorConfiguration setHeartbeat(int heartbeat)
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 java.util.List<java.lang.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 java.util.List<java.lang.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
@NonNull public final Endpoint 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
@NonNull public final java.util.Set<Collection> getCollections()
Return the list of collections in the replicator configuration
-
getType
@NonNull public final ReplicatorType 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
@Nullable public final java.util.Map<java.lang.String,java.lang.String> 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
@Nullable public final Authenticator getAuthenticator()
Return the Authenticator used to authenticate the remote.
-
getPinnedServerX509Certificate
@Nullable public final java.security.cert.X509Certificate 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 @Nullable public final byte[] getPinnedServerCertificate()
Deprecated.Use getPinnedServerX509CertificateReturn the remote target's SSL certificate.
-
getDatabase
@Deprecated @NonNull public final Database getDatabase()
Deprecated.Use Collection.getDatabaseReturn the local database to replicate with the replication target.
-
getDocumentIDs
@Deprecated @Nullable public final java.util.List<java.lang.String> 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 @Nullable public final java.util.List<java.lang.String> 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 @Nullable public final ConflictResolver getConflictResolver()
Deprecated.Use CollectionConfiguration.getConflictResolverReturn the conflict resolver.
-
getPullFilter
@Deprecated @Nullable public final ReplicationFilter getPullFilter()
Deprecated.Use CollectionConfiguration.getPullFilterGets the filter used to determine whether a document will be pulled from the remote endpoint.
-
getPushFilter
@Deprecated @Nullable public final ReplicationFilter getPushFilter()
Deprecated.Use CollectionConfiguration.getPushFilterGets a filter used to determine whether a document will be pushed to the remote endpoint.
-
toString
@NonNull public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-