Specifies the storage index revision mappings (with revision and revision mapping extended GUIDs, and revision mapping serial number).
Inheritance: StreamObject
Example #1
0
        private List <RevisionStoreObjectGroup> ParseObjectGroup(CellID objectGroupCellID, MSOneStorePackage package)
        {
            StorageIndexCellMapping         storageIndexCellMapping = package.FindStorageIndexCellMapping(objectGroupCellID);
            CellManifestDataElementData     cellManifest            = this.FindCellManifest(storageIndexCellMapping.CellMappingExtendedGUID);
            List <RevisionStoreObjectGroup> objectGroups            = new List <RevisionStoreObjectGroup>();

            package.CellManifests.Add(cellManifest);
            StorageIndexRevisionMapping revisionMapping =
                package.FindStorageIndexRevisionMapping(cellManifest.CellManifestCurrentRevision.CellManifestCurrentRevisionExtendedGUID);
            RevisionManifestDataElementData revisionManifest =
                this.FindRevisionManifestDataElement(revisionMapping.RevisionMappingExtendedGUID);

            package.RevisionManifests.Add(revisionManifest);
            RevisionManifestRootDeclare encryptionKeyRoot = revisionManifest.RevisionManifestRootDeclareList.Where(r => r.RootExtendedGUID.Equals(new ExGuid(3, Guid.Parse("4A3717F8-1C14-49E7-9526-81D942DE1741")))).SingleOrDefault();
            bool isEncryption = encryptionKeyRoot != null;

            foreach (RevisionManifestObjectGroupReferences objRef in revisionManifest.RevisionManifestObjectGroupReferencesList)
            {
                ObjectGroupDataElementData dataObject = objectGroupDataElements.Where(d => d.DataElementExtendedGUID.Equals(
                                                                                          objRef.ObjectGroupExtendedGUID)).Single().Data as ObjectGroupDataElementData;

                RevisionStoreObjectGroup objectGroup = RevisionStoreObjectGroup.CreateInstance(objRef.ObjectGroupExtendedGUID, dataObject, isEncryption);
                objectGroups.Add(objectGroup);
            }

            return(objectGroups);
        }
        /// <summary>
        /// This method is used to create the storage index data element.
        /// </summary>
        /// <param name="manifestExGuid">Specify the storage manifest data element extended GUID.</param>
        /// <param name="cellIDMappings">Specify the mapping of cell manifest.</param>
        /// <param name="revisionIDMappings">Specify the mapping of revision manifest.</param>
        /// <returns>Return the storage index data element.</returns>
        public static DataElement CreateStorageIndexDataElement(ExGuid manifestExGuid, Dictionary <CellID, ExGuid> cellIDMappings, Dictionary <ExGuid, ExGuid> revisionIDMappings)
        {
            StorageIndexDataElementData data = new StorageIndexDataElementData();

            data.StorageIndexManifestMapping = new StorageIndexManifestMapping();
            data.StorageIndexManifestMapping.ManifestMappingExtendedGUID = new ExGuid(manifestExGuid);
            data.StorageIndexManifestMapping.ManifestMappingSerialNumber = new SerialNumber(System.Guid.NewGuid(), SequenceNumberGenerator.GetCurrentSerialNumber());

            foreach (KeyValuePair <CellID, ExGuid> kv in cellIDMappings)
            {
                StorageIndexCellMapping cellMapping = new StorageIndexCellMapping();
                cellMapping.CellID = kv.Key;
                cellMapping.CellMappingExtendedGUID = kv.Value;
                cellMapping.CellMappingSerialNumber = new SerialNumber(System.Guid.NewGuid(), SequenceNumberGenerator.GetCurrentSerialNumber());
                data.StorageIndexCellMappingList.Add(cellMapping);
            }

            foreach (KeyValuePair <ExGuid, ExGuid> kv in revisionIDMappings)
            {
                StorageIndexRevisionMapping revisionMapping = new StorageIndexRevisionMapping();
                revisionMapping.RevisionExtendedGUID        = kv.Key;
                revisionMapping.RevisionMappingExtendedGUID = kv.Value;
                revisionMapping.RevisionMappingSerialNumber = new SerialNumber(Guid.NewGuid(), SequenceNumberGenerator.GetCurrentSerialNumber());
                data.StorageIndexRevisionMappingList.Add(revisionMapping);
            }

            return(new DataElement(DataElementType.StorageIndexDataElementData, data));
        }
        /// <summary>
        /// This method is used to find the Storage Index Revision Mapping that matches the Revision Mapping Extended GUID.
        /// </summary>
        /// <param name="revisionExtendedGUID">Specify the Revision Mapping Extended GUID.</param>
        /// <returns>Return the instance of Storage Index Revision Mapping.</returns>
        public StorageIndexRevisionMapping FindStorageIndexRevisionMapping(ExGuid revisionExtendedGUID)
        {
            StorageIndexRevisionMapping instance = null;

            if (this.StorageIndex != null)
            {
                instance = this.StorageIndex.StorageIndexRevisionMappingList.Where(r => r.RevisionExtendedGUID.Equals(revisionExtendedGUID)).SingleOrDefault();
            }

            return(instance);
        }
Example #4
0
        public MSOneStorePackage Parse(DataElementPackage dataElementPackage)
        {
            MSOneStorePackage package = new MSOneStorePackage();

            storageIndexDataElements     = dataElementPackage.DataElements.Where(d => d.DataElementType == DataElementType.StorageIndexDataElementData).ToArray();
            storageManifestDataElements  = dataElementPackage.DataElements.Where(d => d.DataElementType == DataElementType.StorageManifestDataElementData).ToArray();
            cellManifestDataElements     = dataElementPackage.DataElements.Where(d => d.DataElementType == DataElementType.CellManifestDataElementData).ToArray();
            revisionManifestDataElements = dataElementPackage.DataElements.Where(d => d.DataElementType == DataElementType.RevisionManifestDataElementData).ToArray();
            objectGroupDataElements      = dataElementPackage.DataElements.Where(d => d.DataElementType == DataElementType.ObjectGroupDataElementData).ToArray();
            objectBlOBElements           = dataElementPackage.DataElements.Where(d => d.DataElementType == DataElementType.ObjectDataBLOBDataElementData).ToArray();

            package.StorageIndex    = storageIndexDataElements[0].Data as StorageIndexDataElementData;
            package.StorageManifest = storageManifestDataElements[0].Data as StorageManifestDataElementData;

            // Parse Header Cell
            CellID headerCellID = package.StorageManifest.StorageManifestRootDeclareList[0].CellID;
            StorageIndexCellMapping headerCellStorageIndexCellMapping = package.FindStorageIndexCellMapping(headerCellID);

            storageIndexHashTab.Add(headerCellID);

            if (headerCellStorageIndexCellMapping != null)
            {
                package.HeaderCellCellManifest = this.FindCellManifest(headerCellStorageIndexCellMapping.CellMappingExtendedGUID);
                StorageIndexRevisionMapping headerCellRevisionManifestMapping =
                    package.FindStorageIndexRevisionMapping(package.HeaderCellCellManifest.CellManifestCurrentRevision.CellManifestCurrentRevisionExtendedGUID);
                package.HeaderCellRevisionManifest = this.FindRevisionManifestDataElement(headerCellRevisionManifestMapping.RevisionMappingExtendedGUID);
                package.HeaderCell = this.ParseHeaderCell(package.HeaderCellRevisionManifest);

                // Parse Data root
                CellID dataRootCellID = package.StorageManifest.StorageManifestRootDeclareList[1].CellID;
                storageIndexHashTab.Add(dataRootCellID);
                package.DataRoot = this.ParseObjectGroup(dataRootCellID, package);
                // Parse other data
                foreach (StorageIndexCellMapping storageIndexCellMapping in package.StorageIndex.StorageIndexCellMappingList)
                {
                    if (storageIndexHashTab.Contains(storageIndexCellMapping.CellID) == false)
                    {
                        package.OtherFileNodeList.AddRange(this.ParseObjectGroup(storageIndexCellMapping.CellID, package));
                        storageIndexHashTab.Add(storageIndexCellMapping.CellID);
                    }
                }
            }
            return(package);
        }
        /// <summary>
        /// This method is used to create the storage index data element.
        /// </summary>
        /// <param name="manifestExGuid">Specify the storage manifest data element extended GUID.</param>
        /// <param name="cellIDMappings">Specify the mapping of cell manifest.</param>
        /// <param name="revisionIDMappings">Specify the mapping of revision manifest.</param>
        /// <returns>Return the storage index data element.</returns>
        public static DataElement CreateStorageIndexDataElement(ExGuid manifestExGuid, Dictionary<CellID, ExGuid> cellIDMappings, Dictionary<ExGuid, ExGuid> revisionIDMappings)
        {
            StorageIndexDataElementData data = new StorageIndexDataElementData();

            data.StorageIndexManifestMapping = new StorageIndexManifestMapping();
            data.StorageIndexManifestMapping.ManifestMappingExtendedGUID = new ExGuid(manifestExGuid);
            data.StorageIndexManifestMapping.ManifestMappingSerialNumber = new SerialNumber(System.Guid.NewGuid(), SequenceNumberGenerator.GetCurrentSerialNumber());

            foreach (KeyValuePair<CellID, ExGuid> kv in cellIDMappings)
            {
                StorageIndexCellMapping cellMapping = new StorageIndexCellMapping();
                cellMapping.CellID = kv.Key;
                cellMapping.CellMappingExtendedGUID = kv.Value;
                cellMapping.CellMappingSerialNumber = new SerialNumber(System.Guid.NewGuid(), SequenceNumberGenerator.GetCurrentSerialNumber());
                data.StorageIndexCellMappingList.Add(cellMapping);
            }

            foreach (KeyValuePair<ExGuid, ExGuid> kv in revisionIDMappings)
            {
                StorageIndexRevisionMapping revisionMapping = new StorageIndexRevisionMapping();
                revisionMapping.RevisionExtendedGUID = kv.Key;
                revisionMapping.RevisionMappingExtendedGUID = kv.Value;
                revisionMapping.RevisionMappingSerialNumber = new SerialNumber(Guid.NewGuid(), SequenceNumberGenerator.GetCurrentSerialNumber());
                data.StorageIndexRevisionMappingList.Add(revisionMapping);
            }

            return new DataElement(DataElementType.StorageIndexDataElementData, data);
        }
        /// <summary>
        /// This method is used to test Storage Index Revision Mapping related adapter requirements.
        /// </summary>
        /// <param name="instance">Specify the instance which need to be verified.</param> 
        /// <param name="site">Specify the ITestSite instance.</param>
        public void VerifyStorageIndexRevisionMapping(StorageIndexRevisionMapping instance, ITestSite site)
        {
            // If the instance is not null and there are no parsing errors, then the StorageIndexRevisionMapping related adapter requirements can be directly captured.
            if (null == instance)
            {
                site.Assert.Fail("The instance of type StorageIndexRevisionMapping is null due to parsing error or type casting error.");
            }

            // Verify the stream object header related requirements.
            this.ExpectStreamObjectHeaderStart(instance.StreamObjectHeaderStart, instance.GetType(), site);

            // Directly capture requirement MS-FSSHTTPB_R266, if the stream object header is StreamObjectHeaderStart16bit.
            site.CaptureRequirementIfAreEqual<Type>(
                     typeof(StreamObjectHeaderStart16bit),
                     instance.StreamObjectHeaderStart.GetType(),
                     "MS-FSSHTTPB",
                     266,
                     @"[In Storage Index Data Element] Storage Index Revision Mapping (2 bytes): Zero or more 16-bit stream object header that specifies the storage index revision mappings (with revision and revision mapping extended GUIDs, and revision mapping serial number).");

            // Directly capture requirement MS-FSSHTTPB_R267, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     267,
                     @"[In Storage Index Data Element] Revision Extended GUID (variable): An extended GUID that specifies the revision.");

            // Directly capture requirement MS-FSSHTTPB_R268, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     268,
                     @"[In Storage Index Data Element] Revision Mapping Extended GUID (variable): An extended GUID that specifies the revision mapping.");

            // Directly capture requirement MS-FSSHTTPB_R269, if there are no parsing errors. 
            site.CaptureRequirement(
                     "MS-FSSHTTPB",
                     269,
                     @"[In Storage Index Data Element] Revision Mapping Serial Number (variable): A serial number that specifies the revision mapping.");

            // Verify the stream object header related requirements.
            this.ExpectSingleObject(instance.StreamObjectHeaderStart, site);
        }