Esempio n. 1
0
 public AggregateOperationResult DeleteCustomSyncState(SyncStateInfo syncStateInfo)
 {
     this.CheckDisposed("DeleteCustomSyncState");
     this.syncLogger.Information <int>(ExTraceGlobals.SyncTracer, (long)this.GetHashCode(), "[SyncStateStorage.DeleteCustomSyncState] Hashcode = {0}", this.GetHashCode());
     ArgumentValidator.ThrowIfNull("syncStateInfo", syncStateInfo);
     return(this.InternalDeleteSyncState(syncStateInfo.UniqueName));
 }
Esempio n. 2
0
 public CustomSyncState CreateCustomSyncState(SyncStateInfo syncStateInfo)
 {
     this.CheckDisposed("CreateCustomSyncState");
     this.syncLogger.Information <int>(ExTraceGlobals.SyncTracer, (long)this.GetHashCode(), "SyncStateStorage::CreateCustomSyncState. Hashcode = {0}", this.GetHashCode());
     if (syncStateInfo == null)
     {
         throw new ArgumentNullException("syncStateInfo");
     }
     return(CustomSyncState.CreateSyncState(this, syncStateInfo, this.folder, this.syncLogger));
 }
Esempio n. 3
0
        public CustomSyncState GetCustomSyncState(SyncStateInfo syncStateInfo, params PropertyDefinition[] additionalPropsToFetch)
        {
            this.CheckDisposed("GetCustomSyncState");
            this.syncLogger.Information <int>(ExTraceGlobals.SyncTracer, (long)this.GetHashCode(), "SyncStateStorage::GetCustomSyncState. Hashcode = {0}", this.GetHashCode());
            this.GetMailboxSession();
            CustomSyncState result = null;

            try
            {
                result = CustomSyncState.GetSyncState(this, this.folder, syncStateInfo, this.syncLogger, additionalPropsToFetch);
            }
            catch (ObjectNotFoundException arg)
            {
                this.syncLogger.TraceDebug <string, ObjectNotFoundException>(ExTraceGlobals.SyncTracer, (long)this.GetHashCode(), "[SyncStateStorage.GetCustomSyncState] Hark! SyncState {0} was not found.  Exception: {1}", syncStateInfo.UniqueName, arg);
            }
            return(result);
        }
Esempio n. 4
0
 public CustomSyncState GetCustomSyncState(SyncStateInfo syncStateInfo)
 {
     base.CheckDisposed();
     return(this.syncStateStorage.GetCustomSyncState(syncStateInfo, new PropertyDefinition[0]));
 }
Esempio n. 5
0
 public AggregateOperationResult DeleteCustomSyncState(SyncStateInfo syncStateInfo)
 {
     base.CheckDisposed();
     return(this.syncStateStorage.DeleteCustomSyncState(syncStateInfo));
 }
Esempio n. 6
0
 public CustomSyncState CreateCustomSyncState(SyncStateInfo syncStateInfo)
 {
     base.CheckDisposed();
     return(this.syncStateStorage.CreateCustomSyncState(syncStateInfo));
 }
 protected FolderHierarchySyncState(SyncStateStorage syncStateStorage, StoreObject storeObject, SyncStateMetadata syncStateMetadata, SyncStateInfo syncStateInfo, bool newSyncState, ISyncLogger syncLogger = null) : base(syncStateStorage, storeObject, syncStateMetadata, syncStateInfo, newSyncState, syncLogger)
 {
 }
Esempio n. 8
0
        protected static StoreObject GetSyncStateStoreObject(SyncStateStorage syncStateStorage, Folder syncStateParentFolder, SyncStateInfo syncStateInfo, byte[] identBytes, ISyncLogger syncLogger, params PropertyDefinition[] propsToReturn)
        {
            FolderSyncStateMetadata folderSyncStateMetadata = FolderSyncState.GetFolderSyncStateMetadata(syncStateStorage, syncStateParentFolder.Session as MailboxSession, syncStateInfo.UniqueName, syncLogger);

            if (folderSyncStateMetadata == null)
            {
                return(null);
            }
            StoreObject storeObject = null;

            if (folderSyncStateMetadata.StorageType != StorageType.Folder)
            {
                if (folderSyncStateMetadata.StorageType != StorageType.Item)
                {
                    if (folderSyncStateMetadata.StorageType != StorageType.DirectItem)
                    {
                        goto IL_85;
                    }
                }
                try
                {
                    storeObject = Microsoft.Exchange.Data.Storage.Item.Bind(syncStateParentFolder.Session, folderSyncStateMetadata.ItemSyncStateId, SyncState.AppendAdditionalProperties(propsToReturn));
                    ((Item)storeObject).OpenAsReadWrite();
                    return(storeObject);
                }
                catch
                {
                    storeObject.Dispose();
                    throw;
                }
IL_85:
                throw new InvalidOperationException("Unsupported storage type for sync state");
            }
            storeObject = Folder.Bind(syncStateParentFolder.Session, folderSyncStateMetadata.FolderSyncStateId, SyncState.AppendAdditionalProperties(propsToReturn));
            return(storeObject);
        }
Esempio n. 9
0
 protected FolderSyncState(SyncStateStorage syncStateStorage, StoreObject storeObject, FolderSyncStateMetadata syncStateMetadata, SyncStateInfo syncStateInfo, ISyncProviderFactory syncProviderFactory, bool newSyncState, ISyncLogger syncLogger = null) : base(syncStateStorage, storeObject, syncStateMetadata, syncStateInfo, newSyncState, syncLogger)
 {
     this.syncProviderFactory = syncProviderFactory;
 }
Esempio n. 10
0
 protected CustomSyncState(SyncStateStorage syncStateStorage, StoreObject storeObject, SyncStateMetadata syncStateMetadata, SyncStateInfo syncStateInfo, bool syncStateIsNew) : base(syncStateStorage, storeObject, syncStateMetadata, syncStateInfo, syncStateIsNew, null)
 {
 }
Esempio n. 11
0
        internal static CustomSyncState GetSyncState(SyncStateStorage syncStateStorage, Folder syncStateParentFolder, SyncStateInfo syncStateInfo, ISyncLogger syncLogger, params PropertyDefinition[] propertiesToFetch)
        {
            if (syncLogger == null)
            {
                syncLogger = TracingLogger.Singleton;
            }
            SyncStateMetadata syncStateMetadata    = null;
            StoreObject       syncStateStoreObject = SyncState.GetSyncStateStoreObject(syncStateStorage, syncStateParentFolder, syncStateInfo, syncLogger, out syncStateMetadata, propertiesToFetch);

            if (syncStateStoreObject == null)
            {
                return(null);
            }
            return(new CustomSyncState(syncStateStorage, syncStateStoreObject, syncStateMetadata, syncStateInfo, false));
        }
Esempio n. 12
0
 internal static CustomSyncState GetSyncState(SyncStateStorage syncStateStorage, Folder syncStateParentFolder, SyncStateInfo syncStateInfo, ISyncLogger syncLogger = null)
 {
     return(CustomSyncState.GetSyncState(syncStateStorage, syncStateParentFolder, syncStateInfo, syncLogger, null));
 }
Esempio n. 13
0
        internal static CustomSyncState CreateSyncState(SyncStateStorage syncStateStorage, SyncStateInfo syncStateInfo, Folder syncStateParentFolder, ISyncLogger syncLogger = null)
        {
            if (syncLogger == null)
            {
                syncLogger = TracingLogger.Singleton;
            }
            StoreObject storeObject = SyncState.CreateSyncStateStoreObject(syncStateStorage, syncStateInfo, syncStateParentFolder, null, null, syncLogger);

            if (syncStateStorage.DeviceMetadata.TryRemove(syncStateInfo.UniqueName, syncLogger) != null)
            {
                syncLogger.TraceDebug <DeviceIdentity, string>(ExTraceGlobals.SyncTracer, 0L, "[CustomSyncState.CreateSyncState] Removed stale cached sync state metadata for device {0}, sync state {1}", syncStateStorage.DeviceMetadata.Id, syncStateInfo.UniqueName);
            }
            SyncStateMetadata syncStateMetadata = (storeObject is Item) ? new SyncStateMetadata(syncStateStorage.DeviceMetadata, syncStateInfo.UniqueName, syncStateStorage.SaveOnDirectItems ? null : storeObject.ParentId, storeObject.Id.ObjectId) : new SyncStateMetadata(syncStateStorage.DeviceMetadata, syncStateInfo.UniqueName, storeObject.Id.ObjectId, null);

            return(new CustomSyncState(syncStateStorage, storeObject, syncStateMetadata, syncStateInfo, true));
        }