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 Cell Mapping matches the Cell ID. /// </summary> /// <param name="cellID">Specify the Cell ID.</param> /// <returns>Return the specific Storage Index Cell Mapping.</returns> public StorageIndexCellMapping FindStorageIndexCellMapping(CellID cellID) { StorageIndexCellMapping storageIndexCellMapping = null; if (this.StorageIndex != null) { storageIndexCellMapping = this.StorageIndex.StorageIndexCellMappingList.Where(s => s.CellID.Equals(cellID)).SingleOrDefault(); } return(storageIndexCellMapping); }
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 Cell 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 VerifyStorageIndexCellMapping(StorageIndexCellMapping instance, ITestSite site) { // If the instance is not null and there are no parsing errors, then the StorageIndexCellMapping related adapter requirements can be directly captured. if (null == instance) { site.Assert.Fail("The instance of type StorageIndexCellMapping 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_R262, if the stream object header is StreamObjectHeaderStart16bit. site.CaptureRequirementIfAreEqual<Type>( typeof(StreamObjectHeaderStart16bit), instance.StreamObjectHeaderStart.GetType(), "MS-FSSHTTPB", 262, @"[In Storage Index Data Element] Storage Index Cell Mapping (2 bytes): Zero or more 16-bit stream object header that specifies the storage index cell mappings (with cell identifier, cell mapping extended GUID, and cell mapping serial number)."); // Directly capture requirement MS-FSSHTTPB_R263, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 263, @"[In Storage Index Data Element] Cell ID (variable): A cell ID (section 2.2.1.10) that specifies the cell identifier."); // Directly capture requirement MS-FSSHTTPB_R264, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 264, @"[In Storage Index Data Element] Cell Mapping Extended GUID (variable): An extended GUID that specifies the cell mapping."); // Directly capture requirement MS-FSSHTTPB_R265, if there are no parsing errors. site.CaptureRequirement( "MS-FSSHTTPB", 265, @"[In Storage Index Data Element] Cell Mapping Serial Number (variable): A serial number that specifies the cell mapping."); // Verify the stream object header end related requirements. this.ExpectSingleObject(instance.StreamObjectHeaderStart, site); }