RepositoryContext

public class RepositoryContext extends Object

Context object to enable the Repository to make asynchronous calls to the Cloud Search SDK.

Normally the SDK initiates all data repository access based on its traversal scheduling methods. If the data repository supports automatic document modification detection, then this context object is used by the Repository to perform updates asynchronously to the scheduled traversal calls.

This context object is created by the template traversal connectors FullTraversalConnector and ListingConnector during initialization. The connector passes the context to the init(RepositoryContext) method. The context is then saved for use when the data repository reports a document change.

Public Method Summary

DefaultAcl.DefaultAclMode
getDefaultAclMode()
Gets DefaultAcl.DefaultAclMode as configured in connector configuration.
ListenableFuture<List<GenericJson>>
postApiOperationAsync(ApiOperation operation)
Posts an ApiOperation from the Repository asynchronously.
void

Inherited Method Summary

Public Methods

public DefaultAcl.DefaultAclMode getDefaultAclMode ()

Gets DefaultAcl.DefaultAclMode as configured in connector configuration.

Returns

public ListenableFuture<List<GenericJson>> postApiOperationAsync (ApiOperation operation)

Posts an ApiOperation from the Repository asynchronously.

This is the call back method for data repository document modification detection.

Sample usage:


 public MyRepository implements Repository {
   @Override
   public void init(RepositoryContext context) {
     this.context = context;
   }

   private void onDocumentRemoved(String docId) {
     ApiOperation operation = ApiOperations.deleteItem(docId);

     Futures.addCallback(
         this.context.postApiOperationAsync(operation),
         new FutureCallback<List<GenericJson>>() {
           @Override
           public void onSuccess(@Nullable List<GenericJson> result) {
             // Acking logic.
           }

           @Override
           public void onFailure(Throwable t) {
             // Error handling.
           }
         },
         MoreExecutors.directExecutor());
   }

   // other implemented methods
 }
 

Parameters
operation

public void postAsyncOperation (AsyncApiOperation operation)

This method is deprecated.
Use postApiOperationAsync(ApiOperation)

Posts an AsyncApiOperation from the Repository.

This is the call back method for data repository document modification detection. Sample usage is detailed in the AsyncApiOperation documentation.

Parameters
operation