Class AbstractReplicatorConfiguration

  • Direct Known Subclasses:
    ReplicatorConfiguration

    public abstract class AbstractReplicatorConfiguration
    extends java.lang.Object
    Replicator configuration.
    • 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

      • setAuthenticator

        @NonNull
        public final ReplicatorConfiguration setAuthenticator​(@NonNull
                                                              Authenticator authenticator)
        Sets the authenticator to authenticate with a remote target server. Currently there are two types of the authenticators, BasicAuthenticator and SessionAuthenticator, supported.
        Parameters:
        authenticator - The authenticator.
        Returns:
        this.
      • setChannels

        @NonNull
        public final ReplicatorConfiguration setChannels​(@Nullable
                                                         java.util.List<java.lang.String> channels)
        Sets a set of Sync Gateway channel names to pull from. Ignored for push replication. If unset, all accessible channels will be pulled. Note: channels that are not accessible to the user will be ignored by Sync Gateway.
        Parameters:
        channels - The Sync Gateway channel names.
        Returns:
        this.
      • setConflictResolver

        @NonNull
        public final ReplicatorConfiguration setConflictResolver​(@Nullable
                                                                 ConflictResolver conflictResolver)
        Sets the the conflict resolver.
        Parameters:
        conflictResolver - A conflict resolver.
        Returns:
        this.
      • setContinuous

        @NonNull
        public final ReplicatorConfiguration setContinuous​(boolean continuous)
        Sets whether the replicator stays active indefinitely to replicate changed documents. The default value is false, which means that the replicator will stop after it finishes replicating the changed documents.
        Parameters:
        continuous - The continuous flag.
        Returns:
        this.
      • setDocumentIDs

        @NonNull
        public final ReplicatorConfiguration setDocumentIDs​(@Nullable
                                                            java.util.List<java.lang.String> documentIDs)
        Sets a set of document IDs to filter by: if given, only documents with these IDs will be pushed and/or pulled.
        Parameters:
        documentIDs - The document IDs.
        Returns:
        this.
      • 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.
        Parameters:
        headers - The HTTP Headers.
        Returns:
        this.
      • setPinnedServerCertificate

        @NonNull
        public final ReplicatorConfiguration setPinnedServerCertificate​(@Nullable
                                                                        byte[] pinnedCert)
        Sets the target server's SSL certificate.
        Parameters:
        pinnedCert - the SSL certificate.
        Returns:
        this.
      • setPullFilter

        @NonNull
        public final ReplicatorConfiguration setPullFilter​(@Nullable
                                                           ReplicationFilter pullFilter)
        Sets 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.
        Parameters:
        pullFilter - The filter to filter the document to be pulled.
        Returns:
        this.
      • setPushFilter

        @NonNull
        public final ReplicatorConfiguration setPushFilter​(@Nullable
                                                           ReplicationFilter pushFilter)
        Sets a filter object for validating whether the documents can be pushed to the remote endpoint.
        Parameters:
        pushFilter - The filter to filter the document to be pushed.
        Returns:
        this.
      • 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.
      • setType

        @NonNull
        public final ReplicatorConfiguration setType​(@NonNull
                                                     ReplicatorType type)
        Sets the replicator type indicating the direction of the replicator. The default value is .pushAndPull which is bi-directional.
        Parameters:
        type - The replicator type.
        Returns:
        this.
      • setMaxAttempts

        @NonNull
        public final ReplicatorConfiguration setMaxAttempts​(int maxAttempts)
        Set the max number of retry attempts made after a connection failure. Set to 0 for default values. Set to 1 for no retries.
        Parameters:
        maxAttempts - max retry attempts
      • setMaxAttemptWaitTime

        @NonNull
        public final ReplicatorConfiguration setMaxAttemptWaitTime​(int maxAttemptWaitTime)
        Set the max time between retry attempts (exponential backoff). Set to 0 for default values.
        Parameters:
        maxAttemptWaitTime - max attempt wait time
      • setHeartbeat

        @NonNull
        public final ReplicatorConfiguration setHeartbeat​(int heartbeat)
        Set the heartbeat interval, in seconds. Set to 0 for default values

        Must be non-negative and less than Integer.MAX_VALUE milliseconds

      • setAutoPurgeEnabled

        @NonNull
        public final ReplicatorConfiguration setAutoPurgeEnabled​(boolean enabled)
        Enable/disable auto-purge.

        Auto-purge is enabled, by default.

        When the autoPurge flag is disabled, the replicator will notify the registered DocumentReplication listeners with an "access removed" event when access to the document is revoked on the Sync Gateway. On receiving the event, the application may decide to manually purge the document. However, for performance reasons, any DocumentReplication listeners added to the replicator after the replicator is started will not receive the access removed events until the replicator is restarted or reconnected with Sync Gateway.

      • getAuthenticator

        @Nullable
        public final Authenticator getAuthenticator()
        Return the Authenticator to authenticate with a remote target.
      • getChannels

        @Nullable
        public final java.util.List<java.lang.String> getChannels()
        A set of Sync Gateway channel names to pull from. Ignored for push replication. The default value is null, meaning that all accessible channels will be pulled. Note: channels that are not accessible to the user will be ignored by Sync Gateway.
      • getConflictResolver

        @Nullable
        public final ConflictResolver getConflictResolver()
        Return the conflict resolver.
      • isContinuous

        public final boolean isContinuous()
        Return the continuous flag indicating whether the replicator should stay active indefinitely to replicate changed documents.
      • getDatabase

        @NonNull
        public final Database getDatabase()
        Return the local database to replicate with the replication target.
      • getDocumentIDs

        @Nullable
        public final java.util.List<java.lang.String> getDocumentIDs()
        A set of document IDs to filter by: if not nil, only documents with these IDs will be pushed and/or pulled.
      • 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.
      • getPinnedServerCertificate

        @Nullable
        public final byte[] getPinnedServerCertificate()
        Return the remote target's SSL certificate.
      • getPullFilter

        @Nullable
        public final ReplicationFilter getPullFilter()
        Gets a filter object for validating whether the documents can be pulled from the remote endpoint.
      • getPushFilter

        @Nullable
        public final ReplicationFilter getPushFilter()
        Gets a filter object for validating whether the documents can be pushed to the remote endpoint.
      • getType

        @NonNull
        public final ReplicatorType getType()
        Return Replicator type indicating the direction of the replicator.
      • getTarget

        @NonNull
        public final Endpoint getTarget()
        Return the replication target to replicate with.
      • getMaxAttempts

        public final int getMaxAttempts()
        Return the max number of retry attempts made after connection failure.
      • 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
      • isAutoPurgeEnabled

        public final boolean isAutoPurgeEnabled()
        Enable/disable auto-purge. Default is enabled.
      • toString

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