Abstract "place-holder" for synchronization.
The application must not make any attempt to interpret the value of the token. From the standpoint of the application the token is merely a black-box. The application may only persist the value of the token for use on subsequent synchronization requests.

What this token represents is entirely connector-specific. On some connectors this might be a last-modified value. On others, it might be a unique ID of a log table entry. On others such as JMS, this might be a dummy value since JMS itself keeps track of the state of the sync.

 /// <summary>
 /// Implementation of SynOp.Sync
 /// </summary>
 /// <param name="objClass">Object class</param>
 /// <param name="token">Syncronization token</param>
 /// <param name="handler">Handler for syncronization results</param>
 /// <param name="options">Operation options, can be null</param>
 public override void Sync(
     ObjectClass objClass,
     SyncToken token,
     SyncResultsHandler handler,
     OperationOptions options)
 {
     // TODO: implement Sync
     base.Sync(objClass, token, handler, options);
 }
Example #2
0
 public ISubscription Subscribe(ObjectClass objectClass, SyncToken token, IObserver<SyncDelta> handler, OperationOptions operationOptions)
 {
     return ((ISyncEventSubscriptionApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<ISyncEventSubscriptionApiOp>()))
      .Subscribe(objectClass, token, handler, operationOptions);
 }
Example #3
0
 public SyncToken Sync(ObjectClass objectClass, SyncToken token,
     SyncResultsHandler handler,
     OperationOptions options)
 {
     return ((SyncApiOp)GetOperationCheckSupported(SafeType<APIOperation>.Get<SyncApiOp>()))
     .Sync(objectClass, token, handler, options);
 }
Example #4
0
 /// <summary>
 /// Creates a new <code>SyncDeltaBuilder</code> whose
 /// values are initialized to those of the delta.
 /// </summary>
 /// <param name="delta">The original delta.</param>
 public SyncDeltaBuilder(SyncDelta delta)
 {
     _token = delta.Token;
     _deltaType = delta.DeltaType;
     _previousUid = delta.PreviousUid;
     _uid = delta.Uid;
     _object = delta.Object;
 }
 public void TestSyncToken()
 {
     SyncToken v1 = new SyncToken("mytoken");
     SyncToken v2 = (SyncToken)CloneObject(v1);
     Assert.AreEqual(v1.Value, v2.Value);
     Assert.AreEqual(v1, v2);
 }
 public ActiveDirectorySyncToken(SyncToken token, string serverName, bool useGlobalCatalog)
     : this(token == null ? null : (string)token.Value, serverName, useGlobalCatalog)
 {
 }
Example #7
0
        /// <summary>
        /// Creates a SyncDelata
        /// </summary>
        /// <param name="token">The token. Must not be null.</param>
        /// <param name="deltaType">The delta. Must not be null.</param>
        /// <param name="uid">The uid. Must not be null.</param>
        /// <param name="object">The object that has changed. May be null for delete.</param>
        internal SyncDelta(SyncToken token, SyncDeltaType deltaType,
            Uid previousUid, Uid uid,
            ConnectorObject obj)
        {
            Assertions.NullCheck(token, "token");
            Assertions.NullCheck(deltaType, "deltaType");
            Assertions.NullCheck(uid, "uid");

            //do not allow previous Uid for anything else than create or update
            if (previousUid != null && deltaType != SyncDeltaType.CREATE_OR_UPDATE)
            {
                throw new ArgumentException("The previous Uid can only be specified for create or update.");
            }

            //only allow null object for delete
            if (obj == null &&
                 deltaType != SyncDeltaType.DELETE)
            {
                throw new ArgumentException("ConnectorObject must be specified for anything other than delete.");
            }

            //if object not null, make sure its Uid
            //matches
            if (obj != null)
            {
                if (!uid.Equals(obj.Uid))
                {
                    throw new ArgumentException("Uid does not match that of the object.");
                }
            }

            _token = token;
            _deltaType = deltaType;
            _previousUid = previousUid;
            _uid = uid;
            _object = obj;
        }
 public long GetUpdateUsnFromToken(SyncToken token)
 {
     string[] tokenParts = ((string)token.Value).Split('|');
     return long.Parse(tokenParts[0]);
 }
 public bool SyncHandler_Initial(SyncDelta delta)
 {
     // do nothing .. just establishing the baseline
     _token = delta.Token;
     return true;
 }
 public void Init(SyncToken token)
 {
     _mods = new Dictionary<Uid, ICollection<ConnectorAttribute>>();
     _dels = new List<Uid>();
     _token = token;
 }
            public bool SyncHandler_ModifiedAccounts(SyncDelta delta)
            {
                _token = delta.Token;
                if(delta.DeltaType.Equals(SyncDeltaType.CREATE_OR_UPDATE)) {
                    // just ignore extra ones.  they might have come in by other means
                    if (_mods.ContainsKey(delta.Uid))
                    {
                        ICollection<ConnectorAttribute> requestedAttrs = _mods[delta.Uid];

                        ActiveDirectoryConnectorTest.VerifyObject(requestedAttrs,
                            delta.Object);
                        _mods.Remove(delta.Uid);
                    }
                }
                return true;
            }
            public bool SyncHandler_DeletedAccounts(SyncDelta delta)
            {
                _token = delta.Token;

                _dels.Remove(delta.Uid);
                return true;
            }