CN100570549C - System and method for data modeling in a project-based storage platform - Google Patents
System and method for data modeling in a project-based storage platform Download PDFInfo
- Publication number
- CN100570549C CN100570549C CNB038269430A CN03826943A CN100570549C CN 100570549 C CN100570549 C CN 100570549C CN B038269430 A CNB038269430 A CN B038269430A CN 03826943 A CN03826943 A CN 03826943A CN 100570549 C CN100570549 C CN 100570549C
- Authority
- CN
- China
- Prior art keywords
- item
- project
- items
- type
- computer system
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/284—Relational databases
- G06F16/288—Entity relationship models
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/28—Databases characterised by their database models, e.g. relational or object models
- G06F16/289—Object oriented databases
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
交叉引用cross reference
本申请的主题涉及以下共同转让的申请中公开的发明:与本申请同时提交的、标题为“SYSTEMS AND METHODS FOR REPRESENTING UNITS OFINFORMATION MANAGEABLE BY A HARDWARE/SOFTWARE INTERFACESYSTEM BUT INDEPENDENT OF PHYSICAL REPRESENTATION(用于表示可以由硬件/软件接口系统管理但独立于物理表示的信息单元的系统和方法)”的美国专利申请(申请号未分配)(代理卷号MSFT-1748);与本申请同时提交的、标题为“SYSTEMS AND METHODS FOR SEPARATING UNITS OF INFORMATIONMANAGEABLE BY A HARDWARE/SOFTWARE INTERFACE SYSTEM FROMTHEIR PHYSICAL ORGANIZATION(用于将可由硬件/软件接口系统管理的信息单元与其物理组织分离的系统和方法)”的美国专利申请(申请号未分配)(代理卷号MSFT-1749);与本申请同时提交的、标题为“SYSTEMS AND METHODS FORTHE IMPLEMENTATION OF A BASE SCHEMA FOR ORGANIZING UNITS OFINFORMATION MANAGEABLE BY A HARDWARE/SOFTWARE INTERFACESYSTEM(用于实现用于组织可由硬件/软件接口系统管理的信息单元的基本模式的系统和方法)”的美国专利申请(申请号未分配)(代理卷号MSFT-1750);与本申请同时提交的、标题为“SYSTEMS AND METHODS FOR THEIMPLEMENTATION OF A CORE SCHEMA FOR PROVIDING A TOP-LEVELSTRUCTURE FOR ORGANIZING UNITS OF INFORMATION MANAGEABLE BYA HARDWARE/SOFTWARE INTERFACE SYSTEM(用于实现提供用于组织可由硬件/软件接口系统管理的信息单元的顶层结构的核心模式的系统和方法)”的美国专利申请(申请号未分配)(代理卷号MSFT-1751);与本申请同时提交的、标题为“SYSTEMS AND METHOD FOR REPRESENTINGRELATIONSHIPSBETWEEN UNITS OF INFORMATION MANAGEABLE BY AHARDWARE/SOFTWARE INTERFACE SYSTEM(用于表示可由硬件/软件接口系统管理的信息单元之间的关系的系统和方法)”的美国专利申请(申请号未分配)(代理卷号MSFT-1752);与本申请同时提交的、标题为“SYSTEMS ANDMETHODS FOR INTERFACING APPLICATION PROGRAMS WITH ANITEM-BASED STORAGE PLATFORM(用于将应用程序与基于项目的存储平台接口的系统和方法)”的美国专利申请(申请号未分配)(代理卷号MSFT-2733);以及与本申请同时提交的、标题为“STORAGE PLATFORM FOR ORGANIZING,SEARCHING AND SHARING DATA(用于组织、搜索和共享数据的存储平台)”的美国专利申请(申请号未分配)(代理卷号MSFT-2734)。The subject matter of this application is related to the invention disclosed in the following commonly-assigned application: SYSTEMS AND METHODS FOR REPRESENTING UNITS OFINFORMATION MANAGEABLE BY A HARDWARE/SOFTWARE INTERFACE SYSTEM BUT INDEPENDENT OF PHYSICAL REPRESENTATION, filed concurrently with this application Hardware/Software Interface System and Method for Information Units Managed Yet Independent of Physical Representation)" (Application No. Unassigned) (Attorney Docket MSFT-1748); filed concurrently with this application, entitled "SYSTEMS AND METHODS FOR SEPARATING UNITS OF INFORMATIONMANAGEABLE BY A HARDWARE/SOFTWARE INTERFACE SYSTEM FROMTHEIR PHYSICAL ORGANIZATION (system and method for separating information units manageable by hardware/software interface systems from their physical organization)" (application number unassigned ) (Attorney Docket No. MSFT-1749); filed concurrently with this application, entitled "SYSTEMS AND METHODS FORTHE IMPLEMENTATION OF A BASE SCHEMA FOR ORGANIZING UNITS OFINFORMATION MANAGEABLE BY A HARDWARE/SOFTWARE INTERFACE SYSTEM System and Method for Basic Modes of Information Units Managed by a Software Interface System)" (Application No. Unassigned) (Attorney Docket MSFT-1750); filed concurrently with this application, entitled "SYSTEMS AND METHODS FOR THE IMPLEMENTATION OF A CORE SCHEMA FOR PROVIDING A TOP-LEVELSTRUCTURE FOR ORGANIZING UNITS OF INFORMATION MANAGEABLE BYA HARDWARE/SOFTWARE INTERFACE SYSTEM )" (Application No. Unassigned) (Attorney Docket MSFT-1751); filed concurrently with this application and entitled "SYSTEMS A ND METHOD FOR REPRESENTINGRELATIONSHIPSBETWEEN UNITS OF INFORMATION MANAGEABLE BY AHARDWARE/SOFTWARE INTERFACE SYSTEM (System and Method for Representing Relationships Between Information Units Manageable by a Hardware/Software Interface System)" (Application No. Unassigned) (Attorney Docket No. MSFT-1752); filed concurrently with this application, U.S. Patent Application (Application Number Unassigned) (Attorney Docket No. MSFT-2733); and, filed concurrently with this application, entitled "STORAGE PLATFORM FOR ORGANIZING, SEARCHING AND SHARING DATA (Storage Platform for Organizing, Searching, and Sharing Data) "U.S. Patent Application (Application No. Unassigned) (Attorney Docket No. MSFT-2734).
技术领域 technical field
本发明一般涉及信息存储和检索领域,尤其涉及用于在计算机化系统中组织、搜索和共享不同类型的数据的活动存储平台。The present invention relates generally to the field of information storage and retrieval, and more particularly to an active storage platform for organizing, searching and sharing different types of data in computerized systems.
发明背景Background of the invention
在最近十年中,单个盘的容量每年增长约百分之70(70%)。摩尔(Moore)定律精确地预测了在过去数年中中央处理单元(CPU)能力的惊人增长。有线和无线技术已经提供了数量上巨大的连接和带宽。假设当前趋势持续,在数年内一般的膝上计算机将具有约万亿字节(TB)的存储并包含数百万个文件,而5千亿字节(500GB)的驱动器成为常见的。During the last ten years, the capacity of a single disk has increased by approximately seventy percent (70%) per year. Moore's Law has accurately predicted the incredible growth in central processing unit (CPU) power over the past few years. Wired and wireless technologies have provided massive amounts of connectivity and bandwidth. Assuming current trends continue, within a few years the typical laptop computer will have about a terabyte (TB) of storage and contain millions of files, with 500 gigabyte (500GB) drives becoming common.
消费者使用他们的计算机主要用于通信和组织个人信息,不论它们是传统的个人信息管理器(PIM)风格的数据还是如数字音乐或照片那样的媒体。数字内容的量和存储原始字节的能力已经大量地增长;然而消费者可用于组织和统一此数据的方法却跟不上步伐。知识工人花费大量时间来管理和共享信息,某些研究估计,知识工人花费15-25%的时间在与无效信息有关的活动上。另外研究估计,典型的知识工人每天约花费2.5小时搜索信息。Consumers use their computers primarily to communicate and organize personal information, whether they be traditional Personal Information Manager (PIM) style data or media such as digital music or photos. The volume of digital content and the ability to store raw bytes has grown enormously; however, the methods available to consumers to organize and unify this data have not kept pace. Knowledge workers spend a significant amount of time managing and sharing information, with some studies estimating that knowledge workers spend 15-25% of their time on activities related to invalid information. Another study estimates that the typical knowledge worker spends approximately 2.5 hours per day searching for information.
开发者与信息技术(IT)部门投资大量的时间与金钱来构建他们自己的用于公用存储抽象的数据存储,以表示如人、地方、时间和事件等事项。这不仅导致重复的工作,还形成公用数据的孤岛,没有共同搜索或共享那些数据的机制。仅考虑当今在运行Microsoft Windows操作系统的计算机上有多少地址簿。如电子邮件客户端和个人财务程序那样的许多应用程序保留各自的地址簿,且在每个那样的程序分别维护的地址簿数据应用程序之间只有很少共享。因而,财务程序(如MicrosoftMoney)不与在电子邮件联系人文件夹(如Microsoft Outlook中的联系人文件夹)中维护的地址共享支付人的地址。确实,许多用户具有多个设备,在这些设备之间和包括到如MSN和AOL等商业服务的手机电话号码的各种附加来源之间应该在逻辑上同步它们的个人数据;然而共享文档的协作大部分是通过将文档附到电子邮件消息来完成的-这是手动的且低效的。Developers and information technology (IT) departments invest significant time and money building their own data stores for common storage abstractions to represent things like people, places, times, and events. Not only does this result in duplication of effort, but it also creates silos of common data, with no mechanism for collectively searching or sharing that data. Just consider how many address books there are on computers running the Microsoft Windows operating system today. Many applications, such as email clients and personal finance programs, maintain their own address books, and there is little sharing between the applications of the address book data that each such program maintains separately. Thus, financial programs such as Microsoft Money do not share payer addresses with addresses maintained in email contact folders such as those in Microsoft Outlook. Indeed, many users have multiple devices between which their personal data should be logically synchronized and between various additional sources including mobile phone numbers to commercial services such as MSN and AOL; however collaboration on shared documents Much of this is done by attaching documents to email messages - which is manual and inefficient.
缺乏协作的一个原因是组织计算机系统中的信息的传统方法集中在使用基于文件-文件夹-目录的系统(“文件系统”),来基于用于存储文件的存储介质的物理组织的抽象将多个文件组织到文件夹的目录分层结构中。在1960年代开发的Multics操作系统被认为是在操作系统级上使用文件、文件夹和目录来管理可存储数据单元的先驱。具体而言,Multics在文件的分层结构中使用符号地址(从而引入文件路径的概念),其中文件的物理地址对用户(应用程序和最终用户)是不透明的。此文件系统完全不考虑任何单个文件的文件格式,且在文件中及文件之间的关系在操作系统级上被认为是无关的(即,与分层结构中文件的位置不同)。由于Multics的出现,在操作系统级上可存储的数据被组织成文件、文件夹和目录。这些文件一般包括放在由文件系统维护的一特定文件中的文件分层结构本身(“目录”)。此目录进而维护对应于该目录中所有其它文件和那些文件在分层结构(这里指文件夹)中的节点位置的条目的列表。这是本领域中近40年的状态。One reason for the lack of collaboration is that traditional methods of organizing information in computer systems have focused on using a file-folder-directory-based system ("file system") to divide more files organized into a directory hierarchy of folders. The Multics operating system, developed in the 1960s, is considered a pioneer in the use of files, folders, and directories to manage storable data units at the operating system level. Specifically, Multics uses symbolic addresses in the hierarchical structure of files (thus introducing the concept of file paths), where the physical address of a file is opaque to users (applications and end users). This file system takes no account of the file format of any individual file at all, and the relationships within and between files are considered independent at the operating system level (ie, distinct from the location of the files in the hierarchy). Thanks to Multics, storable data at the operating system level is organized into files, folders, and directories. These files typically include the file hierarchy itself ("directory") placed within a specific file maintained by the file system. This directory in turn maintains a list of entries corresponding to all other files in the directory and the node positions of those files in the hierarchy (here folders). This has been the state of the art for nearly 40 years.
然而,虽然提供了驻留在计算机的物理存储系统中的信息的合理表示,但是文件系统是物理存储系统的抽象,因而文件的利用需要在用户处理什么(具有上下文、特征以及与其它单元的关系的单元)和操作系统提供什么(文件、文件夹和目录)之间的间接(解释)层。结果,用户(应用程序和/或最终用户)只好强制把信息单元放入文件系统结构,即使这样做是低效的、不一致的、或不希望的。此外,现有的文件系统关于在各个文件中存储的数据的结构知之甚少,因此,大多数信息在文件中保持封闭,只能被写那些数据的应用程序访问(和可理解)。因此,缺乏信息的模式描述和管理信息的机制,导致形成数据的先进先出存储缓冲区(silo),只有很少数据能在各先进先出存储缓冲区之间共享。例如,许多个人计算机(PC)用户具有5个以上各异的存储,它们包含有关他们在某一层上交互的人的信息-如Outlook联系人、在线账户地址、Windows地址簿、Quicken受款人和即时消息(IM)伙伴列表-因为组织文件向这些PC用户提出重要的挑战。由于大多数现有的文件系统利用嵌套的文件夹隐喻来组织文件和文件夹,因此当文件数量增加时,为维持灵活且有效的组织模式所必需的努力变得十分惊人。在这些情况下,具有单个文件的多重分类是非常有用的;然而使用现有文件系统中的硬和软链接是麻烦且难以维护的。However, while providing a reasonable representation of information residing in a computer's physical storage system, the file system is an abstraction of the physical storage system, and thus utilization of a file requires the user to process what (with context, characteristics, and relationships to other units) A layer of indirection (interpretation) between what the operating system provides (files, folders, and directories). As a result, users (applications and/or end users) have to force information units into file system structures, even if doing so is inefficient, inconsistent, or undesirable. Furthermore, existing file systems know very little about the structure of the data stored in individual files, and thus, most information remains closed within the files, only accessible (and understandable) by the applications that wrote that data. Therefore, the lack of a schema description of information and a mechanism to manage the information results in the formation of FIFO storage buffers (silos) of data, with very little data being shared between FIFO storage buffers. For example, many personal computer (PC) users have more than 5 disparate stores that contain information about the people they interact with at some level - such as Outlook contacts, online account addresses, Windows address book, Quicken payees and Instant Messaging (IM) buddy lists - because organizing files presents important challenges to these PC users. Since most existing file systems utilize a nested folder metaphor to organize files and folders, the effort necessary to maintain a flexible and efficient organizational model becomes overwhelming as the number of files increases. In these cases, having multiple catalogs for a single file is very useful; however using hard and soft links in existing file systems is cumbersome and difficult to maintain.
过去已作了若干不成功的尝试来克服文件系统的缺点。这些以前尝试中的某一些已经涉及使用内容可定址的存储器来提供可以通过内容而不是通过物理地址来访问数据的机制。然而,这些努力被证明是不成功的,因而虽然内容可定址的存储器对由如高速缓存和存储器管理单元等设备的小规模使用被证明是有用的,但对如物理存储介质等设备的大规模使用由于各种原因尚不可能,因此那样的解决方案简直不存在。已作出使用面向对象的数据库(OODB)系统的其它尝试,但是这些尝试虽然带有强烈的数据库的特征,且良好的非文件表示,但在处理文件表示方面并不有效,并不能重现在硬件/软件接口系统级上基于分层结构的文件及文件夹的速度、效率和简单性。诸如试图使用SmallTalk(和其它派生方法)的其它尝试在处理文件和非文件表示方面被证明相当有效,但缺乏有效地组织和利用在各种数据文件之间存在的关系所必需的数据库特征,因此那种系统的整体有效性是不可接受的。使用BeOS(和其它那样操作系统研究)的又一种尝试尽管能够胜任适当地表示文件的同时又提供某些必要的数据库特征,在处理非文件的表示上被证明是不够的,这是传统文件系统同样的核心缺点。Several unsuccessful attempts have been made in the past to overcome the shortcomings of file systems. Some of these previous attempts have involved the use of content-addressable memory to provide mechanisms by which data can be accessed by content rather than by physical address. However, these efforts proved unsuccessful, and while content-addressable memory proved useful for small-scale use by devices such as cache memory and memory management units, it was not effective for large-scale Using is not yet possible for various reasons, so a solution like that simply doesn't exist. Other attempts have been made using object-oriented database (OODB) systems, but these attempts, while strongly database-like, and good non-file representations, are not efficient at handling file representations and cannot be reproduced on hardware/ Speed, efficiency, and simplicity of software interfaces to hierarchically structured files and folders at the system level. Other attempts, such as the attempt to use SmallTalk (and other derivatives), proved to be quite effective in dealing with file and non-file representations, but lacked the database features necessary to effectively organize and exploit the relationships that existed between the various data files, so The overall effectiveness of that system is unacceptable. Yet another attempt to use BeOS (and others such as Operating System Research), while capable of adequately representing files while providing some of the necessary database features, proved inadequate in dealing with non-file representations, which are traditional file The same core shortcomings of the system.
数据库技术是存在类似挑战的另一专业领域。例如,虽然关系型数据库模型已取得很大的商业上的成功,实际上独立软件分销商(ISV)一般运用了关系型数据库软件产品(如Microsoft SQL Server)中可得到的功能一小部分。相反,应用程序与那样产品的大多数交互是以简单的“gets”和“puts”的形式。对此虽然有若干容易明白的原因(如作为平台或数据库的不可知),一个常被忽略的关键的原因是数据库没有必要提供主要商业应用程序分销商确实需要的精确抽象。例如,虽然真实世界具有如“客户”或“订单”等“项目”的概念(以及订单的嵌入的“行式项目”作为其中的项目和项目本身),而关系型数据库只在表和行的方面来谈论。结果,虽然应用程序可能希望具有在项目级上的一致性、锁定、安全和/或触发器的方面(只列出一些),通常数据库只在表/行级上提供这些特征。尽管若每个项目映射到数据库某个表的单个行也能工作得很好,但在带多个行式项目的订单的情况下,存在一个项目实际上要映射到多个表的原因,且在此情况下,单个关系型数据库系统不能确切地提供正确的抽象。因此,应用程序必须在数据库的顶层构建逻辑以提供这些基本抽象。换言之,基本关系模型不提供在其上容易开发高级应用程序的存储数据的足够平台,因为基本关系模型需要在应用程序和存储系统之间的间接层,其中只在某些情况的应用程序中可以看到数据的语义结构。尽管某些数据库分销商正将高级功能构建到他们的产品中(如提供对象关系能力,新的组织模型等),至今尚没有哪个提供需要的全面解决方案,其中真正的全面解决方案是为有用的域抽象(如“个人”、“位置”、“事件”等)提供有用的数据模型抽象(如“项目”、“扩展”、“关系”等)的解决方案。Database technology is another area of expertise that presents similar challenges. For example, although the relational database model has achieved great commercial success, in practice Independent Software Vendors (ISVs) typically utilize a small fraction of the functionality available in relational database software products such as Microsoft SQL Server. Instead, most of an application's interaction with such a product is in the form of simple "gets" and "puts". While there are several obvious reasons for this (such as being platform or database agnostic), a key reason that is often overlooked is that databases don't necessarily provide the precise abstraction that major business application distributors really need. For example, while the real world has concepts of "items" like "customers" or "orders" (and orders' embedded "row items" as items within them and the items themselves), relational databases only aspect to discuss. As a result, while applications may wish to have aspects of consistency, locking, security, and/or triggers at the item level (to name a few), typically databases only provide these features at the table/row level. Although it would work fine if each item mapped to a single row of a table in the database, in the case of orders with multiple row items, there is a reason for an item to actually map to multiple tables, and In this case, a single relational database system cannot exactly provide the correct abstraction. Therefore, applications must build logic on top of the database to provide these basic abstractions. In other words, the basic relational model does not provide an adequate platform for storing data on which advanced applications are easily developed, because the basic relational model requires a layer of indirection between the application and the storage system, which is only possible in certain cases of the application See the semantic structure of the data. Although some database vendors are building advanced functionality into their products (such as providing object-relational capabilities, new organizational models, etc.), none have yet provided the comprehensive solution needed, and where a truly comprehensive solution is useful for The domain abstractions (such as "person", "location", "event", etc.) provide solutions for useful data model abstractions (such as "item", "extension", "relationship", etc.).
考虑到现有数据存储和数据库技术中的上述缺点,需要一种新的存储平台,它提供了一种改进的能力以便组织、搜索和共享计算机系统中的所有类型的数据-一种存储平台,它在现有的文件系统和数据库系统之外扩展和扩大了数据平台,并且被设计为存储所有类型的数据。本发明满足这一需求。In view of the aforementioned shortcomings in existing data storage and database technologies, there is a need for a new storage platform that provides an improved ability to organize, search and share all types of data in computer systems - a storage platform that It extends and augments the data platform beyond existing file systems and database systems, and is designed to store all types of data. The present invention fulfills this need.
发明概述Summary of the invention
以下概述提供了对本发明的各方面的综述。该综述并非旨在提供对本发明的所有重要方面的详尽描述,也不旨在定义本发明的范围。相反,本概述旨在用作对以下的详细描述和附图的介绍。The following summary provides an overview of various aspects of the invention. This overview is not intended to provide an exhaustive description of all important aspects of the invention, nor is it intended to define the scope of the invention. Rather, this summary is intended to serve as an introduction to the following detailed description and accompanying drawings.
本发明针对一种用于组织、搜索和共享数据的存储平台。本发明的存储平台在现有文件系统和数据库系统之外扩展和扩大了数据存储的概念,并被设计成储存所有类型的数据,包括结构化的、非结构化的或半结构化的数据。The present invention is directed to a storage platform for organizing, searching and sharing data. The storage platform of the present invention expands and expands the concept of data storage beyond existing file systems and database systems, and is designed to store all types of data, including structured, unstructured or semi-structured data.
依照本发明的一方面,本发明的存储平台包括在数据库引擎上实现的数据存储。在本发明的各实施例中,数据库引擎包括具有对象关系扩展的关系型数据库引擎。该数据存储实现支持数据的组织、搜索、共享、同步和安全性的数据模型。具体的数据类型在模式中描述,且该平台提供了一种扩展模式集以定义新数据类型(本质上是由模式提供的基本类型的子类型)的机制。一种同步能力有助于在用户或系统间共享数据。提供了类似文件系统的能力,它允许该数据存储与现有文件系统的互操作性,而不存在这种传统文件系统的限制。一种改变跟踪机制提供了跟踪数据存储的改变的能力。该存储平台还包括一组应用程序接口,它们使得应用程序能够访问该存储平台的上述的所有能力,并且能够访问在模式中描述的数据。According to an aspect of the present invention, the storage platform of the present invention includes data storage implemented on a database engine. In various embodiments of the invention, the database engine includes a relational database engine with object-relational extensions. The data store implements a data model that supports organization, search, sharing, synchronization, and security of data. Concrete data types are described in schemas, and the platform provides a mechanism for extending the set of schemas to define new data types (essentially subtypes of the base types provided by the schemas). A synchronization capability facilitates the sharing of data between users or systems. Provides file system-like capabilities that allow interoperability of this data store with existing file systems without the limitations of such traditional file systems. A change tracking mechanism provides the ability to track changes to the data store. The storage platform also includes a set of application program interfaces, which enable applications to access all the above-mentioned capabilities of the storage platform, and to access the data described in the schema.
依照本发明的另一方面,由该数据存储实现的数据模型按照项目、元素和关系定义了数据存储的单元。项目是可在数据存储中存储的数据单元,并且可以包括一个或多个元素和关系。元素是类型的实例,包括一个或多个字段(此处也被称为属性)。关系是两个项目之间的链接。(如此处所使用的,这些以及其它特定的术语可以被大写,以便将它们从类似所使用的其它术语分离,然而,并不是旨在区别对待被大写的术语例如“Item”和不被大写时的同一个术语,例如“item”,并且不应假设或暗示这种区别。)According to another aspect of the invention, the data model implemented by the data store defines the units of the data store in terms of items, elements and relationships. Items are units of data that can be stored in a data store and can include one or more elements and relationships. An element is an instance of a type that includes one or more fields (also referred to here as attributes). A relationship is a link between two items. (As used herein, these and other specific terms may be capitalized to separate them from other terms similarly used, however, no distinction is made between capitalized terms such as "Item" and non-capitalized terms same term, such as "item", and no such distinction should be assumed or implied.)
依照本发明的另一方面,一种计算机系统包括多个项目,其中每个项构成可由硬件/软件接口系统操纵的离散的可存储信息单元;多个项目文件夹,它们构成了所述项目的组织结构;以及用于操纵多个项目的硬件/软件接口系统,并且其中每个项目属于至少一个项目文件夹,并且可以属于一个以上项目文件夹。According to another aspect of the present invention, a computer system includes a plurality of items, each of which constitutes a discrete unit of storable information manipulable by a hardware/software interface system; a plurality of project folders, which constitute the an organizational structure; and a hardware/software interface system for manipulating a plurality of projects, and wherein each project belongs to at least one project folder, and may belong to more than one project folder.
依照本发明的另一方面,一种计算机系统包括多个项目,其中,每一项目构成可由硬件/软件接口系统操纵的离散信息单元,且与从持久存储中导出相反,项目或某些项目属性值可以被动态地计算。换言之,该硬件/软件接口系统不要求项目被存储,并且支持某些操作,诸如枚举当前项目集的能力,或是给出项目在存储平台上的标识符(在描述应用程序编程接口或API的一节中更完整地描述)而检索项目的能力-例如,项目可以是蜂窝电话的当前位置,或从温度传感器读到的温度。According to another aspect of the invention, a computer system includes a plurality of items, wherein each item constitutes a discrete unit of information manipulable by a hardware/software interface system, and the item or certain item attributes are, as opposed to being derived from persistent storage, Values can be calculated dynamically. In other words, the hardware/software interface system does not require items to be stored, and supports certain operations, such as the ability to enumerate the current set of items, or to give an identifier for an item on the storage platform (described in Application Programming Interface or API described more fully in the section on ), the ability to retrieve items—for example, an item could be the current location of a cell phone, or the temperature read from a temperature sensor.
依照本发明的另一方面,一种用于计算机系统的硬件/软件接口系统还包括由该硬件/软件接口系统管理的多个关系互连的项目,其中所述硬件/软件接口系统操纵多个项目。依照本发明的另一方面,一种用于计算机系统的硬件/软件接口系统,其中所述硬件/软件接口系统操纵具有可由所述硬件/软件接口系统理解的属性的多个离散信息单元。依照本发明的另一方面,一种用于计算机系统的硬件/软件接口系统包括核心模式,以便定义所述硬件/软件接口系统可以理解,并且能够以一种预定的和可预测的方式直接进行处理的一组核心项目。依照本发明的另一方面,公开了一种用于操纵用于计算机系统的硬件/软件接口系统中的多个离散信息单元(“项目”)的方法,所述方法包括将所述项目与多个关系互连,以及在硬件/软件接口系统级上管理所述关系。According to another aspect of the present invention, a hardware/software interface system for a computer system further includes a plurality of relationally interconnected items managed by the hardware/software interface system, wherein the hardware/software interface system manipulates a plurality of project. According to another aspect of the present invention, a hardware/software interface system for a computer system, wherein said hardware/software interface system manipulates a plurality of discrete information units having attributes understandable by said hardware/software interface system. According to another aspect of the present invention, a hardware/software interface system for a computer system includes a kernel schema to define that said hardware/software interface system can understand and directly perform in a predetermined and predictable manner A core set of items to work on. In accordance with another aspect of the present invention, a method for manipulating a plurality of discrete units of information ("items") in a hardware/software interface system for a computer system is disclosed, the method comprising combining the items with multiple Relationships are interconnected and the relationships are managed at the hardware/software interface system level.
依照本发明的另一特征,该存储平台的API为存储平台模式集中定义的每个项目、项目扩展和关系提供了数据类。此外,该应用程序编程接口提供了一组框架类,它们为所述数据类定义了一组公共行为,并且与数据类一起为存储平台API提供了基本的编程模型。依照本发明的另一特征,该存储平台API提供了简化的查询模型,它以将应用程序员从底层数据库引擎的查询语言的细节隔离开的方式,使得应用程序员能够形成基于数据存储中的项目的各种属性的查询。依照本发明的存储平台API的又一方面,该API收集由应用程序对项目作出的改变,并且然后将它们组织到实现该数据存储的数据库引擎(或任何种类的存储引擎)所需的正确更新中。这使得应用程序员能够对在存储器中项目进行改变,而将数据存储更新的复杂性留给API。According to another feature of the invention, the storage platform's API provides data classes for each item, item extension, and relationship defined in the storage platform's schema set. In addition, the application programming interface provides a set of framework classes that define a set of common behaviors for the data classes and, together with the data classes, provide the basic programming model for the storage platform API. In accordance with another feature of the invention, the storage platform API provides a simplified query model that enables application programmers to form queries based on data storage in a manner that isolates the application programmer from the details of the query language of the underlying database engine. Queries for various properties of an item. According to yet another aspect of the storage platform API of the present invention, the API collects changes made to items by applications and then organizes them into the correct updates required by the database engine (or any kind of storage engine) implementing the data store middle. This enables application programmers to make changes to items in memory, leaving the complexity of data store updates to the API.
通过其公共存储基础和被模式化的数据,本发明的存储平台能够为消费者、知识工作者和企业作出更有效的应用程序开发。它提供了丰富且可扩展的应用程序编程接口,该接口不仅使得其数据模型中所固有的能力可用,而且还包含并扩展了现有文件系统和数据库的访问方法。Through its common storage base and schematized data, the storage platform of the present invention enables more efficient application development for consumers, knowledge workers and enterprises. It provides a rich and extensible application programming interface that not only makes available the capabilities inherent in its data model, but also includes and extends existing file system and database access methods.
通过阅读以下本发明的详细描述和附图,可以清楚本发明的其它特征和优点。Other features and advantages of the present invention will become apparent by reading the following detailed description of the invention and accompanying drawings.
附图简述Brief description of the drawings
当结合所附的附图进行阅读时,可以更好地理解上面的概述以及下面对本发明的详细描述。出于解释本发明的目的,在附图中示出了本发明的各个方面的示例性实施例;然而,本发明不限于所公开的具体方法和手段。在附图中:The foregoing general description, as well as the following detailed description of the invention, are better understood when read in conjunction with the accompanying drawings. Exemplary embodiments of various aspects of the invention are shown in the drawings for purposes of explaining the invention; however, the invention is not limited to the precise methods and instrumentalities disclosed. In the attached picture:
图1是表示其中可结合本发明的各方面的计算机系统的框图;Figure 1 is a block diagram representing a computer system in which aspects of the present invention may be incorporated;
图2是示出了被分为3个组件组的计算机系统的框图:硬件组件、硬件/软件系统接口组件和应用程序组件;2 is a block diagram showing a computer system divided into three component groups: hardware components, hardware/software system interface components, and application components;
图2A示出了用于被分组到基于文件的操作系统中的目录内的文件夹中的文件的传统的基于树的分层结构;Figure 2A shows a conventional tree-based hierarchical structure for files grouped into folders within directories in a file-based operating system;
图3是示出依照本发明的存储平台的框图;Figure 3 is a block diagram illustrating a storage platform in accordance with the present invention;
图4示出了本发明的各实施例中项目、项目文件夹和类别之间的结构关系;Fig. 4 shows the structural relationship between projects, project folders and categories in various embodiments of the present invention;
图5A示出了项目的结构的框图;Figure 5A shows a block diagram of the structure of the project;
图5B是示出图5A的项目的复杂属性类型的框图;Figure 5B is a block diagram illustrating complex attribute types for the item of Figure 5A;
图5C是示出“Location(位置)”项目的框图,其中进一步描述(明确地列出)其复杂类型;Figure 5C is a block diagram showing the "Location (position)" item, wherein its complex type is further described (explicitly listed);
图6A示出了作为基础模式中找到的项目的子类型的项目;Figure 6A shows items that are subtypes of items found in the base schema;
图6B是示出了图6A的子类型项目的框图,其中明确地列出了其继承的类型(除了其直接属性之外);Fig. 6B is a block diagram showing the subtype item of Fig. 6A, which explicitly lists the types it inherits (in addition to its immediate attributes);
图7是示出了基本模式的框图,该基本模式包括其两个顶层类类型,即Item(项目)和PropertyBase(属性基),以及从其中导出的附加基础模式类型;Figure 7 is a block diagram showing the base schema, including its two top-level class types, Item (item) and PropertyBase (property base), and additional base schema types derived therefrom;
图8A是示出核心模式中的项目的框图;FIG. 8A is a block diagram illustrating items in a core schema;
图8B是示出核心模式中的属性类型的框图;Figure 8B is a block diagram illustrating attribute types in a core schema;
图9是示出项目文件夹、其成员项目以及项目文件夹和其成员项目之间的互连关系的框图;9 is a block diagram illustrating a project folder, its member projects, and the interconnection relationship between the project folder and its member projects;
图10是示出了类别(它本身也是项目)、其成员项目以及类别及其成员项目之间的互连关系的框图;Figure 10 is a block diagram showing a category (which is itself an item), its member items, and the interconnection between the category and its member items;
图11是示出依照本发明的存储平台的数据模型的引用类型层次的图;FIG. 11 is a diagram illustrating a reference type hierarchy of a data model of a storage platform according to the present invention;
图12是示出依照本发明的一个实施例关系是如何被分类的图;Figure 12 is a diagram illustrating how relationships are classified according to one embodiment of the invention;
图13是示出依照本发明的一个实施例的通知机制的图;Figure 13 is a diagram illustrating a notification mechanism according to one embodiment of the present invention;
图14是示出其中两个事务都向同一个B树插入新记录的示例的图;Figure 14 is a diagram showing an example where both transactions insert new records into the same B-tree;
图15示出了依照本发明的一个实施例的数据改变检测过程;Figure 15 shows a data change detection process according to one embodiment of the present invention;
图16示出了示例性的目录树;Figure 16 shows an exemplary directory tree;
图17示出了依照本发明的一方面其中现有的基于目录的文件系统的文件夹被移动到该存储平台数据存储中的示例;17 shows an example in which folders of an existing directory-based file system are moved into the storage platform data store according to an aspect of the present invention;
图18示出了依照本发明的一方面包含文件夹的概念;Figure 18 illustrates the concept of containing folders in accordance with an aspect of the invention;
图19示出了存储平台API的基本体系结构;Figure 19 shows the basic architecture of the storage platform API;
图20示意性地表示了存储平台API栈的各个组件;Figure 20 schematically represents the various components of the storage platform API stack;
图21A和21B是示例性联系人模式(项目和元素)的图形表示;21A and 21B are graphical representations of exemplary contact schemas (items and elements);
图22示出了依照本发明的一方面的存储平台API的运行时框架;Figure 22 shows the runtime framework of the Storage Platform API in accordance with an aspect of the invention;
图23示出了依照本发明的一个实施例的“FindAll”操作的执行;Figure 23 illustrates execution of a "FindAll" operation in accordance with one embodiment of the invention;
图24示出了依照本发明的一方面用于从存储平台模式生成存储平台API类的过程;Figure 24 illustrates a process for generating storage platform API classes from a storage platform schema in accordance with an aspect of the invention;
图25示出了依照本发明的另一方面File(文件)API所基于的模式;Figure 25 shows the schema on which the File (file) API is based according to another aspect of the present invention;
图26是示出依照本发明的一个实施例用于数据安全目的的访问掩码格式的示意图;Figure 26 is a schematic diagram illustrating an access mask format for data security purposes according to one embodiment of the present invention;
图27(a)、(b)、(c)给出了依照本发明的一方面的一个实施例从现有的安全区域内划分出的一个新的同样地保护的安全区域;Fig. 27 (a), (b), (c) have provided a new security zone that protects equally from existing security zone according to an embodiment of an aspect of the present invention;
图28是示出依照本发明的一方面的一个实施例的项目搜索视图的概念的示意图;28 is a schematic diagram illustrating the concept of an item search view according to one embodiment of an aspect of the present invention;
图29是示出依照本发明的一个实施例的示例性项目层次的示意图;Figure 29 is a diagram illustrating an exemplary project hierarchy according to one embodiment of the present invention;
发明详细描述Detailed description of the invention
目录Table of contents
A.示例性计算环境.............................................16A. Exemplary Computing Environment ................................................ .16
B.传统的基于文件的存储.......................................19B. Traditional File-Based Storage .................................19
II.用于组织、搜索和共享数据的新存储平台......................20II. New Storage Platforms for Organizing, Searching, and Sharing Data................................20
A.词汇表.....................................................20A. Glossary................................................ ......20
B.存储平台综述...............................................21B. Storage Platform Overview ................................................ ..twenty one
C.数据模型...................................................22C. Data Model ................................................ .....twenty two
1.项目.......................................................231. Items................................................ ........twenty three
2.项目标识...................................................262. Item Identification ................................................ ......26
a)项目引用...................................................26a) Project references................................................... ......26
(1)ItemIDReference...........................................26(1)ItemIDReference................................................26
(2)ItemPathReference.........................................26(2)ItemPathReference................................................26
b)引用类型分层结构...........................................27b) Reference Type Hierarchy ................................................... 27
3.项目文件夹和类别...........................................273. Project folders and categories ................................................ 27
4.模式.......................................................284. Mode................................................ ..........28
a)基础模式...................................................28a)Basic mode................................................ ......28
b)核心模式...................................................29b) Kernel mode................................................... ......29
5.关系.......................................................305. Relationships ................................................ ..........30
a)关系声明...................................................31a) Statement of Relationship .............................................. ......31
b)持有关系...................................................32b) hold a relationship ................................................ ......32
c)嵌入关系...................................................33c)Embedding relationship................................................ ......33
d)引用关系...................................................33d) Citation relationship................................... ......33
e)规则和约束.................................................34e) Rules and Constraints ................................................ ....34
f)关系的排序.................................................34f) Ordering of relations ................................................ ....34
6.可扩展性...................................................386. Scalability................................................ ......38
a)项目扩展...................................................39a)Project Expansion................................................ ......39
b)扩展NestedElement类型......................................42b) Extended NestedElement type....................................42
D.数据库引擎.................................................43D. Database Engine ................................................ ...43
1.使用UDT的数据存储实现......................................441. Implementation of data storage using UDT...................................................44
2.项目映射...................................................452. Project Mapping................................................ ..45
3.扩展映射...................................................473. Extended Mapping................................................ ..47
4.嵌套元素映射...............................................484. Nested Element Mapping................................................... ...48
5.对象身份...................................................485. Subject identity ................................................ ..48
6.SQL对象命名................................................496. SQL Object Naming................................................ ...49
7.列命名.....................................................507. Column naming ................................................ ......50
8.搜索视图..................................................508. Search View ................................................ ...50
a)项目......................................................50a) Items................................................... ......50
(1)主项目搜索视图...........................................51(1) Main item search view................................................... 51
(2)类型化的项目搜索视图.....................................51(2) Typed item search view...................................51
b)项目扩展..................................................52b)Project Expansion................................... ....52
(1)主扩展搜索视图...........................................52(1) Main Extended Search View ................................................ 52
(2)类型化的扩展搜索视图.....................................52(2) Typed Extended Search View...................................52
c)嵌套的元素................................................53c) Nested elements................................................ ....53
d)关系......................................................53d) Relationship ................................................ ......53
(1)主关系搜索视图...........................................53(1) Main relational search view................................................... 53
(2)关系实例搜索视图.........................................53(2) Relation instance search view....................................53
9.更新......................................................549. Update................................................ ......54
10.改变跟踪及墓碑...........................................5410. Changing Tracking and Tombstones....................................54
a)改变跟踪..................................................55a) Change Tracking ................................................ ....55
(1)“主”搜索视图中的改变跟踪...............................55(1) Change Tracking in the "Main" Search View .................................. 55
(2)“类型化的”搜索视图中的改变跟踪.........................56(2) Change Tracking in "Typed" Search Views ................................................................ 56
b)墓碑......................................................56b) Tombstone................................................ ......56
(1)项目墓碑.................................................57(1) Project Tombstone................................... ....57
(2)扩展墓碑.................................................57(2) Extended tombstone................................................ ....57
(3)关系墓碑.................................................57(3) Relationship tombstone................................... ....57
(4)墓碑清除.................................................58(4)Tombstone removal................................... ....58
11.助手API和函数............................................5811. Helper API and functions................................................... 58
a)函数[System.Storage].GetItem..............................58a) Function [System.Storage].GetItem................................58
b)函数[System.Storage].GetExtension.........................58b) Function [System.Storage].GetExtension.............58
c)函数[System.Storage].GetRelationship......................59c) Function [System.Storage].GetRelationship..........59
12.元数据...................................................5912. Metadata ................................................ ......59
a)模式元数据................................................59a) Schema Metadata ................................................ ...59
b)实例元数据................................................59b) Instance Metadata ................................................ ...59
E.安全性....................................................59E.Security................................................ ......59
1.综述......................................................591. Overview................................................ ......59
2.安全模型的详细描述........................................632. Detailed description of the security model...................................63
a)安全描述符结构............................................64a) Security Descriptor Structure ................................................ 64
(1)访问掩码格式.............................................65(1) Access mask format................................................... ..65
(2)类属访问权限.............................................65(2) Generic access rights................................................... ..65
(3)标准访问权限.............................................65(3) Standard Access Rights................................................... .65
b)项目专用权限............................................66b) Project-specific permissions....................................66
(1)文件和目录对象专用权限.................................66(1) Special permissions for file and directory objects....................66
(2)WinFSItemRead..........................................67(2)WinFSItemRead................................................67
(3)WinFSItemReadAttributes................................68(3)WinFSItemReadAttributes................................68
(4)WinFSItemWriteAttributes...............................68(4)WinFSItemWriteAttributes................................68
(5)WinFSItemWrite.........................................68(5)WinFSItemWrite...................................................68
(6)WinFSItemAddLink.......................................69(6)WinFSItemAddLink...................................69
(7)WinFSItemDeleteLink....................................69(7)WinFSItemDeleteLink...................................69
(8)删除项目的权限.........................................69(8) Permission to delete items...................................69
(9)复制项目的权限.........................................69(9) Permission to copy items...................................69
(10)移动项目的权限........................................70(10) Permission to move items....................................70
(11)查看项目上的安全策略的权限............................70(11) Permission to view the security policy on the project..................... 70
(12)改变项目上的安全策略的权限............................70(12) Permission to change the security policy on the project................... 70
(13)没有直接等效物的权限..................................70(13) Privilege with No Direct Equivalent ................................. 70
3.实现....................................................713. Realization................................................ ......71
a)在容器中创建新项目......................................71a) Create a new project in the container....................................71
b)向项目添加显式ACL.......................................71b) Adding an explicit ACL to the project...................................71
c)向项目添加持有关系......................................72c) Adding Holder Relationships to Projects .................................. 72
d)从项目删除持有关系......................................72d) Deleting a Holding Relationship from a Project .................................................. 72
e)从项目中删除显式ACL.....................................72e) Removing explicit ACLs from the project....................................72
f)修改与项目相关联的ACL...................................72f) Modifying the ACL associated with the project....................................72
F.通知和改变跟踪..........................................73F. Notification and Change Tracking .................................73
1.存储改变事件............................................731. Storage change event.....................................73
a)事件....................................................73a) Events................................................ ......73
b)监视程序................................................74b) Monitoring program ................................................ ..74
2.改变跟踪和通知生成机制..................................752. Change Tracking and Notification Generation Mechanisms .................................75
a)改变跟踪................................................76a) Change Tracking ................................................ ..76
b)时间标记管理............................................77b) Time Stamp Management .................................. 77
c)数据改变检测-事件检测...................................77c) Data Change Detection - Event Detection .................................77
G.同步....................................................78G.Synchronization................................................ ......78
1.存储平台到存储平台的同步................................781. Synchronization from storage platform to storage platform....................78
a)同步(Sync)控制应用程序..................................79a) Synchronous (Sync) Control Application ........................ 79
b)模式注释................................................79b) Schema Comments ................................................ ..79
c)同步配置................................................80c) Synchronization Configuration ................................................ ..80
(1)共同体文件夹-映射......................................81(1) Community Folder - Mapping..................................................81
(2)概况...........................................81(2) Overview ................................................. 81
(3)时间表.........................................82(3) Schedule....................................82
d)冲突处理........................................82d) Conflict handling....................................82
(1)冲突检测.......................................83(1) Conflict detection....................................83
(a)基于知识的冲突.................................83(a) Knowledge-Based Conflict .................................. 83
(b)基于约束的冲突.................................83(b) Constraint-Based Conflicts ................................. 83
(2)冲突处理.......................................83(2) Conflict handling....................................83
(a)自动冲突分解...................................84(a) Automatic Conflict Resolution ................................. 84
(b)冲突日志记录...................................84(b) Conflict Logging ................................. 84
(c)冲突检查和分解.................................85(c) Conflict Checking and Resolution ................................. 85
(d)复制品的收敛和冲突分解的传播...................85(d) Convergence of Replicas and Propagation of Conflict Resolution... 85
2.对非存储平台数据存储的同步......................852. Synchronization of data storage on non-storage platforms.....................85
a)同步服务........................................86a) Synchronization Service....................................86
(1)改变枚举.......................................86(1) Changing the enumeration.................................................86
(2)改变应用.......................................87(2) Changing the application....................................87
(3)冲突分解.......................................87(3) Conflict resolution....................................87
b)适配器实现......................................87b) Adapter implementation ................................. 87
3.安全性..........................................883. Security.................................................88
4.可管理性........................................884. Manageability.................................................88
G.传统文件互操作性................................88G. Legacy Documentation Interoperability .................................88
1.互操作性模型....................................891. Interoperability Model .................................89
2.数据存储特征....................................902. Data Storage Characteristics .................................90
a)非卷............................................90a) Non-volume................................................90
b)存储结构........................................90b)Storage structure...................................90
c)不移植所有文件..................................90c) Not Migrating All Files ................................. 90
d)对存储平台文件的NTFS名字空间访问................91d) NTFS Namespace Access to Storage Platform Files 91
e)期望的名字空间/驱动器字母.......................91e) Expected Namespace/Drive Letter ................................................91
I.存储平台API.....................................91I. Storage Platform API...................................91
1.综述............................................911. Overview ................................................. 91
2.命名和范围......................................922. Nomenclature and Scope...................................92
3.存储平台API组件.................................943. Storage Platform API Components ................................. 94
4.数据类..........................................944. Data classes .................................................94
5.运行时架构......................................1015. Runtime Architecture .................................. 101
a)运行时架构类....................................101a)Runtime architecture class....................................101
(1)ItemContext....................................101(1)ItemContext....................................101
(2)ItemSearcher.....................................102(2)ItemSearcher....................................102
(a)目标类型.........................................102(a) Target Type.................................................102
(b)过滤器...........................................102(b) Filter ................................................. 102
(c)准备搜索.........................................103(c) Preparing to search....................................103
(d)查找选项.........................................103(d) Search Options....................................103
(3)项目结果流(“FindResult”).......................104(3) Item Result Stream ("FindResult")...................................104
b)操作中的运行时架构................................105b) Runtime Architecture in Operation ................................................. 105
c)公共编程模式......................................106c) Common programming mode....................................106
(1)打开和关闭ItemContext对象........................106(1) Opening and closing the ItemContext object....................106
(2)搜索对象.........................................107(2) Search object....................................107
(a)搜索选项.........................................108(a) Search Options....................................108
(b)FindOne和FindOnly................................108(b) FindOne and FindOnly....................................108
(c)搜索ItemContext上的快捷方式......................109(c) Search for shortcuts on ItemContext ................................. 109
(d)按照ID或路径查找.................................109(d) Search by ID or path....................................109
(e)GetSearcher模式..................................110(e) GetSearcher mode....................................110
(3)更新存储.........................................110(3) Updating storage....................................110
6.安全性............................................1126. Security ................................................. 112
7.对关系的支持......................................1127. Support for Relationships .................................112
a)基础关系类型......................................113a) Basic relationship type....................................113
(1)Relationship类...................................113(1)Relationship class....................................113
(2)ItemReference类..................................114(2) ItemReference class....................................114
(3)ItemIdReference类................................114(3) ItemIdReference class....................................114
(4)ItemPathReference类..............................115(4) ItemPathReference class....................................115
(5)RelationshipId结构...............................115(5) RelationshipId structure....................................115
(6)VirtualRelationshipCollection类..................116(6)VirtualRelationshipCollection class...................116
b)生成的关系类型....................................117b) Generated relationship types....................................117
(1)生成的关系类型...................................118(1) Generated relation types....................................118
(2)RelationshipPrototype类..........................118(2) RelationshipPrototype class....................................118
(3)RelationshipPrototpyeCollection类................119(3)RelationshipPrototpyeCollection class... 119
c)Item类中的关系支持................................119c)Relationship support in the Item class.................................................119
(1)Item类...........................................119(1) Item class....................................................119
(2)RelationshipCollection类.........................119(2)RelationshipCollection class....................................119
d)搜索表达式中的关系支持............................120d) Relational Support in Search Expressions .................................. 120
(1)从项目遍历到关系.................................120(1) From item traversal to relationship....................................120
(2)从关系遍历到项目.................................120(2) From relationship traversal to items....................................120
(3)组合关系遍历....................................121(3) Combination relationship traversal....................................121
e)关系支持的示例使用...............................121e) Example use of relational support ..................................121
(1)搜索关系........................................121(1) Search relationship.................................................121
(2)从关系导航到源和目标项目........................122(2) Navigating from the relationship to the source and target items...................................122
(3)从源项目导航到关系..............................123(3) Navigating from the source project to the relationship ................................. 123
(4)创建关系(以及项目)..............................124(4) Create relationships (and items)...................................124
(5)删除关系(以及项目)..............................125(5) Deleting relationships (and items) ................................................. 125
8.“扩展”存储平台API..............................1258. "Extending" the storage platform API....................................125
a)域行为...........................................126a) Domain Behavior..................................................126
b)增值行为.........................................126b) Value-Adding Behavior ................................. 126
c)作为服务提供者的增值行为.........................127c) Value-Added Behavior as a Service Provider ..................................127
9.设计时架构.......................................1289. Design-Time Architecture .................................128
10.查询形式........................................12810. Inquiry form....................................128
a)过滤器基础.......................................129a) Filter Basics .................................129
b)类型强制转换.....................................130b) Type coercion....................................130
c)过滤器句法.......................................130c) Filter Syntax .................................. 130
11.遥控............................................13111. Remote Control ............................................. 131
a)API中的本地/远程透明性...........................131a) Local/Remote Transparency in API ................................................. 131
b)遥控的存储平台实现...............................132b) Realization of remote control storage platform....................132
c)访问非存储平台存储...............................132c)Accessing non-storage platform storage...................................132
d)与DFS的关系......................................132d) Relationship to DFS..................................................132
e)与GXA/Indigo的关系...............................132e) Relationship with GXA/Indigo...................................132
12.约束............................................13312. Constraints ................................................. 133
13.共享............................................13413. Sharing ................................................. 134
a)表示共享.........................................135a) Indicates sharing ................................................. 135
b)管理共享.........................................135b) Manage Shares ................................. 135
c)访问共享.........................................135c) Accessing Shares.................................................. 135
d)可发现性.........................................136d) Discoverability ................................................. 136
14.Find的语义......................................13614.Semantics of Find....................................136
15.存储平台Contacts API............................13615. Storage Platform Contacts API....................................136
a)System.Storage.Contact的综述.....................137a) Overview of System.Storage.Contact ................................................. 137
b)域行为...........................................137b) Domain Behavior..................................................137
16.存储平台File API................................13816. Storage Platform File API....................................138
a)介绍.............................................138a) Introduction ................................................. 138
(1)在存储平台中反映NTFS卷..........................139(1) Reflecting NTFS volumes in the storage platform....................139
(2)在存储平台名字空间中创建文件和目录....................139(2) Create files and directories in the storage platform name space... 139
b)文件模式...............................................140b) File mode ................................................ .140
c)System.Storage.Files的综述.............................140c) Overview of System.Storage.Files...................................140
d)代码示例...............................................140d) Code example................................................ .140
(1)打开文件并向其写入....................................140(1) Open the file and write to it...................................140
(2)使用查询..............................................141(2) Use query................................................ .141
e)域行为.................................................141e) Domain Behavior ................................................ ...141
J.总结...................................................141J.Summary................................................ ....141
I.引言I. Introduction
本发明的主题用细节来描述,以满足法定的要求。然而,该描述本身不试图限制本专利的范围。相反,本发明者设想要求保护的主题也能以其它方式实施,以结合其它当前和未来的技术来包括类似于本文档所描述的不同的步骤或步骤的组合。此外,虽然术语“步骤”在这里可用于意味着所采用的方法的不同元素,然而该术语不能被解释为隐含这里所揭示的各步骤之间的特定次序,除非明确地描述了各个步骤的次序。The subject matter of the invention is described in detail to satisfy statutory requirements. However, the description itself is not intended to limit the scope of this patent. Rather, the inventors contemplate that the claimed subject matter can be implemented in other ways as well, to include different steps or combinations of steps similar to those described in this document, in conjunction with other present and future technologies. Furthermore, while the term "step" may be used herein to refer to various elements of the method employed, the term should not be construed to imply a specific order between the steps disclosed herein unless an explicit description of the various steps is explicitly described. order.
A.示例性计算环境A. Exemplary Computing Environment
本发明的许多实施例可在计算机上执行。图1和下面讨论旨在提供其中实现本发明的合适计算环境的简要描述。虽然不是必需,但本发明的诸方面能以诸如由如客户工作站或服务器的计算机上执行的程序模块的计算机可执行指令的一般上下文中描述。一般而言,程序模块包括例程、程序、对象、组件、数据结构等,它们执行特定任务或实现特定抽象数据类型。此外,本发明可用其它计算机系统配置实现,包括手持设备、多处理器系统、基于微处理器的系统或可编程消费者电子设备、网络PC、小型机、大型机等。本发明还能在分布式计算环境中实现,其中任务由通过通信网络链接的远程处理设备完成。在分布式计算环境中,程序模块能位于本地或远程存储器存储设备中。Many embodiments of the invention can be implemented on computers. Figure 1 and the following discussion are intended to provide a brief description of a suitable computing environment in which the invention may be implemented. Although not required, aspects of the invention can be described in the general context of computer-executable instructions, such as program modules, being executed on a computer, such as a client workstation or server. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. In addition, the invention may be practiced with other computer system configurations, including handheld devices, multiprocessor systems, microprocessor-based or programmable consumer electronics, network PCs, minicomputers, mainframes, and the like. The invention can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules can be located in local or remote memory storage devices.
如图1所示,示例性通用计算系统包括传统的个人计算机20等,它包括处理单元21、系统存储器22和将包括系统存储器的各种系统组件耦合到处理单元21的系统总线23。系统总线23可以是若干种总线结构的任一种,包括存储总线或存储控制器、外围总线、以及使用各种总线体系结构的任一种的局部总线。系统存储器包括只读存储器(ROM)24和随机存取存储器(RAM)25。基本输入/输出系统26(BIOS)包含如在启动时帮助在个人计算机20的诸元件之间传输信息的基本例程,它存储在ROM 24中。个人计算机20还可包括读写硬盘(未示出)的硬盘驱动器27、读写可移动磁盘29的磁盘驱动器28、读写如CDROM或其它光介质的可移动光盘31的光盘驱动器30。硬盘驱动器27、磁盘驱动器28和光盘驱动器30分别通过硬盘驱动器接口32、磁盘驱动器接口33和光盘驱动器接口34连接到系统总线23。驱动器及其相关联的计算机可读介质为个人计算机20提供计算机可读指令、数据结构、程序模块和其它数据的非易失性存储。虽然这里描述的示例性环境采用硬盘、可移动磁盘29和可移动光盘31,但本领域的技术人员可以理解,在示例性操作环境中也能使用可存储能由计算机访问的数据的其它类型计算机可读介质,如盒式磁带、闪存卡、数字视频盘、Bernoulli盒式磁带、随机存取存储器(RAM)、只读存储器(ROM)等。类似地,示例环境还可包括许多类型的监视设备,如热敏和安全或火警系统,及其它信息源。As shown in FIG. 1 , an exemplary general purpose computing system includes a conventional personal computer 20 or the like including a
若干程序模块能存储在硬盘、磁盘29、光盘31、ROM 24或RAM 25中,包括操作系统35、一个或多个应用程序36、其它程序模块37和程序数据38。用户能通过如键盘40和定点设备42等输入设备将命令和信息输入到个人计算机20。其它输入设备(未示出)可包括麦克风、操纵杆、游戏垫、圆盘式卫星天线、扫描仪等。这些和其它输入设备常通过耦合到系统总线的串行接口46连接到处理单元21,但也可通过其它接口连接,如并行口、游戏口或通用串行总线(USB)。监视器47或其它类型的显示设备也通过如视频适配器48的接口连接到系统总线23。除监视器47以外,个人计算机通常包括如扬声器和打印机等其它外围输出设备(未示出)。图1的示例系统还包括主机适配器55、小型计算机系统接口(SCSI)总线56和连接到SCSI总线56的外部存储设备62。Several program modules can be stored on a hard disk, magnetic disk 29,
个人计算机20可使用到如远程计算机49的一个或多个远程计算机的逻辑连接在网络环境中操作。远程计算机49可以是另一台个人计算机、服务器、路由器、网络PC、对等设备或其它常见的网络节点,并通常包括以上对个人计算机20描述的许多或所有元件,虽然在图1中只示出存储器存储设备50。图1中画出的逻辑连接包括局域网(LAN)51和广域网(WAN)52。那样的网络环境常见于办公室、企业范围计算机网络、内联网和因特网。Personal computer 20 may operate in a network environment using logical connections to one or more remote computers, such as remote computer 49 . Remote computer 49 may be another personal computer, server, router, network PC, peer-to-peer device, or other common network node, and typically includes many or all of the elements described above for personal computer 20, although only shown in FIG. Out of the memory storage device 50. The logical connections depicted in FIG. 1 include a local area network (LAN) 51 and a wide area network (WAN) 52 . Such networking environments are commonplace in offices, enterprise-wide computer networks, intranets and the Internet.
在LAN网络环境中使用时,个人计算机20通过网络接口或适配器53连接到LAN 51。在WAN网络环境中使用时,个人计算机20通常包括调制解调器54或用于通过如因特网等广域网52建立通信的其它装置。内置或外接的调制解调器54通过串行端口接口46连接到系统总线23。在网络环境中,相对个人计算机20描述的程序模块或其部分可存储在远程存储器存储设备中。可以理解,示出的网络连接是示例性的,可使用在计算机之间建立通信链路的其它手段。When used in a LAN network environment, the personal computer 20 is connected to the
如图2的框图所示,计算机系统200能被粗略地分成三个组件组:硬件组件202、硬件/软件接口系统组件204、以及应用程序组件206(在这里某些上下文中也称为“用户组件”或“软件组件”)。As shown in the block diagram of FIG. 2 ,
回到图1,在计算机系统200的各实施例中,硬件组件202可包括中央处理单元(CPU)21、存储器(ROM 24和RAM 25)、基本输入/输出系统(BIOS)26、以及各种输入/输出(I/O)设备,如键盘40、鼠标42、监视器47、和/或打印机(未示出)等。硬件组件202包括计算机系统200的基本物理基础结构。1, in various embodiments of
应用程序组件206包括各种软件程序,包括但不限于编译器、数据库系统、文字处理程序、商业程序、视频游戏等。应用程序提供计算机资源用于为各种用户(机器、其它计算机系统和/或最终用户)解决问题、提供解决方案和处理数据的手段。
硬件/软件接口系统组件204包括(在某些实施例中可以仅包括)操作系统,在大多数情况下后者本身包括外壳和内核。“操作系统”(OS)是担当在应用程序和计算机硬件之间的中介的特殊程序。硬件/软件接口系统组件204还可包括虚拟机管理器(VMM)、公用语言运行库(CLR)或其功能等效物、Java虚拟机(JVM)或其功能等效物、或在计算机系统中代替操作系统或除操作系统外的其它软件组件。硬件/软件接口系统的目的是提供用户能在其中执行应用程序的环境。任何硬件/软件接口系统的目标是使计算机系统便于使用,以及以有效的方式利用计算机硬件。The hardware/software
硬件/软件接口系统一般在启动时被加载到计算机系统,并随后管理在计算机系统中所有应用程序。应用程序通过经由应用程序接口(API)请求服务来与硬件/软件接口系统交互。某些应用程序使最终用户能通过如命令语言或图形用户界面(GUI)等用户接口与硬件/软件接口系统交互。A hardware/software interface system is typically loaded into a computer system at startup and then manages all application programs in the computer system. Applications interact with the hardware/software interface system by requesting services through an application programming interface (API). Certain applications enable an end user to interact with a hardware/software interface system through a user interface such as a command language or a graphical user interface (GUI).
硬件/软件接口系统传统上执行应用程序的各种服务。在多个程序同时运行的多任务硬件/软件接口系统中,硬件/软件接口系统确定哪些应用程序应以什么次序运行,以及在切换到另一应用程序以供轮流之前对每个应用程允许多少时间。硬件/软件接口系统还管理在多个应用程序之间内部存储器的共享,并处理来往于如硬盘、打印机和拨号端口等附加的硬件设备的输入和输出。硬件/软件接口系统还将有关操作状态和可能发生的任何错误的消息发送到每个应用程序(在某些情况下到最终用户)。硬件/软件接口系统也能下传(offload)批处理作业(如打印)的管理,使得启动的应用程序能摆脱此工作并重新开始其它处理和/或操作。在能提供并行处理的计算机上,硬件/软件接口系统还管理划分程序,使得它同时在多个处理器上运行。Hardware/software interface systems traditionally perform various services for applications. In a multitasking hardware/software interface system where multiple programs run simultaneously, the hardware/software interface system determines which applications should run in what order and how much each application is allowed to run before switching to another application for its turn time. The hardware/software interface system also manages the sharing of internal memory among multiple applications and handles input and output to and from attached hardware devices such as hard disks, printers, and dial-up ports. The hardware/software interface system also sends messages to each application (and in some cases to the end user) about the status of the operation and any errors that may have occurred. The hardware/software interface system can also offload the management of batch jobs (such as printing), so that the launched application can get rid of the job and resume other processing and/or operations. On computers capable of parallel processing, the hardware/software interface system also manages partitioning the program so that it runs on multiple processors simultaneously.
硬件/软件接口系统外壳(这里简称“外壳”)是到硬件/软件接口系统的交互式最终用户界面。(外壳也称为“命令解释器”,或在操作系统中称为“操作系统外壳”)。外壳是可直接由应用程序和/或最终用户访问的硬件/软件接口系统的外层。与外壳相反,内核是直接与硬件组件交互的硬件/软件接口系统的最内层。The hardware/software interface system shell (referred to herein as "the shell") is the interactive end-user interface to the hardware/software interface system. (The shell is also known as the "command interpreter", or in operating systems, the "operating system shell"). A shell is the outer layer of a hardware/software interface system that is directly accessible by applications and/or end users. In contrast to the shell, the kernel is the innermost layer of the hardware/software interface system that directly interacts with hardware components.
虽然可构想本发明的许多实施例尤其适用于计算机化的系统,然而在本文档哪个中不意味着将本发明限于那些实施例。相反,这里使用的术语“计算机系统”旨在包括能存储和处理信息和/或能使用存储的信息控制设备本身的行为或执行的任何和所有设备,而不管那些设备本质上是否为电子的、机械的、逻辑的、或虚拟的。While many embodiments of the invention are envisioned to be particularly applicable to computerized systems, nothing in this document is meant to limit the invention to those embodiments. Rather, the term "computer system" as used herein is intended to include any and all devices capable of storing and processing information and/or using stored information to control the behavior or performance of the device itself, whether or not those devices are electronic in nature, mechanical, logical, or virtual.
B.传统的基于文件的存储B. Traditional file-based storage
在当今大多数计算机系统中,“文件”是可存储信息的单元,它可包括硬件/软件接口系统和应用程序、数据集等。在所有现代硬件/软件接口系统中(Windows,Unix,Linux,MacOS,虚拟机系统等),文件是能由硬件/软件接口系统处理的基本的分立(可存储和可检索)信息单元。文件组通常被组织成“文件夹”。在MicrosoftWindows、Macintosh OS和其它硬件/软件接口系统中,文件夹是能作为单个信息单元被检索、移动和处理的文件的集合。这些文件夹进而被组织成称为“目录”(在后面详细讨论)的基于树的分层排列。在如Dos、z/OS和大多数基于Unix的操作系统的其它硬件/软件接口系统中,术语“目录”和/或“文件夹”是可互换使用的,早期的Apple计算机系统(如Apple IIe)使用术语“类别”来代替目录;然而在这里使用时,所有这些术语被看成是同义语并可互换使用,并旨在还包括对分层信息存储结构及其文件夹和文件组件的所有其它等价术语的引用。In most computer systems today, a "file" is a unit of storable information, which may include hardware/software interface systems and applications, data sets, etc. In all modern hardware/software interface systems (Windows, Unix, Linux, MacOS, virtual machine systems, etc.), a file is the fundamental discrete (storable and retrievable) unit of information that can be processed by the hardware/software interface system. Groups of files are usually organized into "folders". In Microsoft Windows, Macintosh OS, and other hardware/software interface systems, a folder is a collection of files that can be retrieved, moved, and manipulated as a single unit of information. These folders are in turn organized into tree-based hierarchical arrangements called "directories" (discussed in more detail later). In other hardware/software interface systems such as Dos, z/OS, and most Unix-based operating systems, the terms "directory" and/or "folder" are used interchangeably, early Apple computer systems such as the Apple IIe) The term "category" is used in place of a directory; however, as used herein, all these terms are considered synonymous and used interchangeably, and are intended to also include reference to hierarchical information storage structures and their folders and files References to all other equivalent terms for components.
传统上,目录(又名文件夹的目录)是基于树的分层结构,其中文件被组合成文件夹,文件夹进而按构成目录树的相对节点位置排列。例如,如图2A所示,基于DOS的文件系统的基本文件夹(或“根目录”)212可包括多个文件夹214,其每一个可以还包括另外的文件夹(如特定文件夹的“子文件夹”)216,而这些的每一个又包括另外的文件夹218,直到无限。这些文件夹的每一个可具有一个或多个文件220,虽然在硬件/软件接口系统级上,文件夹中的各个文件除了它们在树形分层结构中的位置外没有什么共同点。不奇怪,将文件组织到文件分层结构的方法间接地反映了用于存储这些文件的典型存储介质(如硬盘、软盘、CD-ROM等)的物理组织。Traditionally, directories (aka directories of folders) are tree-based hierarchies, where files are grouped into folders, which in turn are arranged by relative node positions that make up the directory tree. For example, as shown in FIG. 2A, a base folder (or "root directory") 212 of a DOS-based file system may include a plurality of
除上述以外,每个文件夹是对其子文件夹和其文件的容器-即,每个文件夹拥有其子文件夹和文件。例如,当文件夹被硬件/软件接口系统删除时,该文件夹的子文件夹和文件也被删除(在每个子文件夹的情况下还递归地包括它自己的子文件夹和文件)。同样,每个文件一般只由一个文件夹拥有,并且虽然文件能被复制且副本位于不同的文件夹,文件的副本本身是不同且独立单元,它与原始文件无直接连接(如对原始文件的改变在硬件/软件接口系统级上不反映到副本文件)。因此在这方面,文件和文件夹在本质上是“物理的”,因为文件夹类似于物理容器来处理,而文件作为这些容器中不同且独立的物理元素来处理。In addition to the above, each folder is a container for its subfolders and its files - that is, each folder owns its subfolders and files. For example, when a folder is deleted by the hardware/software interface system, the folder's subfolders and files are also deleted (and in the case of each subfolder recursively including its own subfolders and files). Also, each file is typically owned by only one folder, and while a file can be copied and the copies are in different folders, the copies of the file are themselves distinct and independent units that have no direct connection to the original file (e.g. Changes at the hardware/software interface system level are not reflected in the copy file). Files and folders are therefore "physical" in nature in this respect, in that folders are treated like physical containers, whereas files are treated as distinct and separate physical elements within those containers.
II.用于组织、搜索和共享数据的新存储平台II. A new storage platform for organizing, searching and sharing data
本发明针对用于组织、搜索和共享数据的存储平台。本发明的存储平台在上文讨论的文件系统及数据库系统的种类之外扩展和拓宽了数据平台,并被设计成存储所有类型的数据,包括称为项目的新形式的数据。The present invention is directed to a storage platform for organizing, searching and sharing data. The storage platform of the present invention extends and broadens the data platform beyond the categories of file systems and database systems discussed above, and is designed to store all types of data, including new forms of data called items.
A.词汇表A. Glossary
在这里及在权利要求书中使用的术语有下列意义:The terms used here and in the claims have the following meanings:
“项目”是能存储硬件/软件接口系统可访问的信息的单元,不象简单文件,它是具有由硬件/软件接口系统外壳展现给最终用户的所有对象共同支持的基本属性集的对象。项目还具对所有项目类型共同支持的属性和关系,包括允许引入新属性和关系的特征(在下面详细讨论)。An "item" is a unit that can store information accessible to the hardware/software interface system, unlike a simple file, it is an object with a basic set of attributes commonly supported by all objects that are presented to the end user by the hardware/software interface system shell. Items also have attributes and relationships supported common to all item types, including features that allow the introduction of new attributes and relationships (discussed in detail below).
“操作系统”(OS)是担当应用程序和计算机硬件之间的中介的特殊程序。在大多数情况下,操作系统包括外壳和内核。An "operating system" (OS) is a special program that acts as an intermediary between application programs and computer hardware. In most cases, an operating system consists of a shell and a kernel.
“硬件/软件接口系统”是软件、或硬件及软件的组合,它起着计算机系统的底层硬件组件和在计算机系统上执行的应用程序之间的接口的作用。硬件/软件接口系统通常包括(在某些实施例中只包括)操作系统。硬件/软件接口系统还能包括虚拟机管理器(VMM)、公用语言运行库(CLR)或其功能等效物,Java虚拟机(JVM)或其功能等效物、或在计算机系统中代替操作系统或除操作系统外的其它软件组件。硬件/软件接口系统的目的是提供用户能执行应用程序的环境。任何硬件/软件接口系统的目标是使计算机系统便于使用,并以有效方式利用计算机硬件。A "hardware/software interface system" is software, or a combination of hardware and software, that functions as an interface between the underlying hardware components of a computer system and application programs executing on the computer system. A hardware/software interface system typically includes (and in some embodiments only) an operating system. The hardware/software interface system can also include a virtual machine manager (VMM), a common language runtime (CLR) or its functional equivalent, a Java virtual machine (JVM) or its functional equivalent, or replace the operating A system or other software component other than an operating system. The purpose of a hardware/software interface system is to provide an environment in which users can execute applications. The goal of any hardware/software interface system is to make the computer system easy to use and utilize the computer hardware in an efficient manner.
B.存储平台综述B. Overview of storage platforms
参考图3,依照本发明存储平台300包括在数据库引擎314上实现的数据存储302。在一个实施例中,数据库引擎包括带有对象关系扩展的关系型数据库引擎。在一个实施例中,关系型数据库引擎314包括Microsoft SQL Server关系型数据库引擎。Referring to FIG. 3 , a
数据存储302实现支持数据的组织、搜索、共享、同步和安全的数据模型304。在如模式340等模式中描述特定的数据类型,并且存储平台300提供用于采用这些模式并用于扩展这些模式的工具346,这在后面详述。Data store 302 implements
在数据存储302中实现的改变跟踪机制306提供跟踪数据存储的改变的能力。数据存储302还提供安全能力308和升级/降级能力310,这些均在后文详述。数据存储302还提供一组应用程序编程接口312,以向利用该存储平台的其它存储平台组件和应用程序(如应用程序350a,350b和350c)展现数据存储302的能力。A change tracking mechanism 306 implemented in the data store 302 provides the ability to track changes to the data store. Data store 302 also provides
本发明的存储平台还包括应用程序编程接口(API)322,使如应用程序350a,350b,和350c等应用程序能访问存储平台的所有上述功能并能访问在模式中描述的数据。应用程序能结合如OLE DB API 324和Microsoft Windows Win 32 API 326等其它API来使用存储平台API 322。The storage platform of the present invention also includes an application programming interface (API) 322 that enables applications such as
本发明的存储平台300能向应用程序提供各种服务,包括便于在用户或系统之间共享数据的同步服务330。例如,同步服务330允许与具有与数据存储302相同格式的其它数据存储340的互操作,并访问具有其它格式的数据存储342。存储平台300还提供允许数据存储302与如Windows NTFS文件系统318等现有文件系统的互操作的文件系统能力。The
在至少某些实施例中,存储平台320还能向应用程序提供另外的能力,以允许对数据起作用并允许与其它系统的交互。这些能力可具体化为如Info Agent服务334和通知服务332等附加服务328的形式,以及其它实用程序336的形式。In at least some embodiments, storage platform 320 can also provide applications with additional capabilities to allow acting on data and to allow interaction with other systems. These capabilities may be embodied in the form of additional services 328 such as
在至少某些实施例中,存储平台以计算机系统的硬件/软件接口系统来实施,或形成其完整的一部分。例如而非限制,本发明的存储平台能用操作系统、虚拟机管理器(VMM)、公用语言运行库(CLR)或其功能等效物、或Java虚拟机(JVM)或其功能等效物来实施,或形成其完整的一部分。In at least some embodiments, the storage platform is implemented in, or forms an integral part of, a hardware/software interface system of a computer system. For example and without limitation, the storage platform of the present invention can use an operating system, a virtual machine manager (VMM), a common language runtime (CLR) or its functional equivalent, or a Java virtual machine (JVM) or its functional equivalent to carry out, or form an integral part of.
通过其公用的存储基础和模式化的数据,本发明的存储平台使消费者、知识工人和企业作能够更有效地进行应用程序的开发。它提供了丰富和可扩展的编程表面区域,不仅可得到其数据模型中固有的能力,还能包括和扩展现有文件系统和数据库访问方法。Through its common storage base and schematized data, the storage platform of the present invention enables more efficient application development for consumers, knowledge workers and business operators. It provides a rich and extensible programming surface area not only to access the capabilities inherent in its data model, but also to include and extend existing file system and database access methods.
在下述描述中及在各附图中,本发明的存储平台300可称作“WinFS”。然而使用此名字指存储平台仅是为了描述方便,并不试图作出任何限制。In the following description and in the various drawings, the
C.数据模型C. Data Model
本发明的存储平台300的数据存储302实现一种数据模型,它支持对驻留在存储中的数据的组织、搜索、共享、同步和安全。在本发明的数据模型中,“项目”是存储信息的基本单元。该数据模型提供一种机制,用于声明项目和项目的扩展、用于建立项目之间的关系、以及用于将项目组织到项目文件夹和类别中,这些将在下文中更充分描述。The data store 302 of the
该数据模型依赖于两个原语机制:类型和关系。类型是提供支配类型的实例的形式的格式的结构。格式被表达成属性的有序组。属性是给定类型的值或一组值的名字。例如,USPostalAddress(美国邮政地址)类型具有属性Street(街道)、City(城市)、Zip(邮编)、State(州),其中Street、City和State是String类型,而Zip是Int32类型。Street可以是多值(即一组值),允许地址对Street属性具有一个以上值。系统定义能在其它类型构造中使用的某些原语类型,包括String(串)、Binary(二进制)、Boolean(布尔)、Int16(16位整数)、Int32(32位整数)、Int64(64位整数)、Single(单精度)、Double(双精度)、Byte(字节)DateTime(日期时间)、Decimal(十进制)和GUID。可使用任何原语类型(带有下面注释的某些限制)或任何构造的类型来定义类型的属性。例如,Location(位置)类型可被定义为具有属性Coordinate(座标)和Address(地址),其中Address属性是上述类型USPostalAddress。属性也可以是必需的或可任选的。This data model relies on two primitive mechanisms: types and relations. Types are structures that provide a format that governs the form of instances of a type. Formats are expressed as ordered groups of attributes. A property is the name of a value or set of values of a given type. For example, the USPostalAddress (United States postal address) type has attributes Street (street), City (city), Zip (zip code), State (state), where Street, City, and State are of type String, and Zip is of type Int32. Street can be multivalued (ie, a set of values), allowing addresses to have more than one value for the Street property. The system defines certain primitive types that can be used in other types of construction, including String (string), Binary (binary), Boolean (Boolean), Int16 (16-bit integer), Int32 (32-bit integer), Int64 (64-bit Integer), Single (single precision), Double (double precision), Byte (byte) DateTime (date time), Decimal (decimal) and GUID. Properties of a type may be defined using any primitive type (with some restrictions noted below) or any constructed type. For example, a Location type may be defined with attributes Coordinate and Address, where the Address attribute is the above-mentioned type USPostalAddress. Properties can also be required or optional.
关系可被声明并表示两个类型的实例集之间的映射。例如,可以有在Person(个人)类型和Location类型之间声明的关系,称为LivesAt(生活在),它确定什么人生活在什么位置。关系具有名称和两个端点,即源端点和目标端点。关系也可具有属性的有序集。源端点及目标端点均具有名称和类型。例如,LivesAt关系具有称为类型Person的Occupant(居民)的源和称为类型Location的Dwelling(住房)的目标,且此外具有属性StartDate(起始日期)和EndDate(终止日期),表示该居民生活在该住房的时间段。注意,随时间推移,个人能生活在多个住房,且住房可有多个居民,所以放置StartDate和EndDate信息的最可能的地方是在关系本身处。A relationship can be declared and represents a mapping between two sets of instances of a type. For example, there could be a relationship declared between a Person type and a Location type, called LivesAt, which determines who lives at what location. A relationship has a name and two endpoints, a source and a target. Relationships can also have ordered sets of attributes. Both source and destination endpoints have names and types. For example, a LivesAt relationship has a source called Occupant of type Person and a target called Dwelling of type Location, and furthermore has attributes StartDate and EndDate representing the resident's life time period in the housing. Note that individuals can live in multiple homes over time, and that homes can have multiple residents, so the most likely place to put the StartDate and EndDate information is at the relationship itself.
关系定义了在由作为端点类型给出的类型约束的实例之间的映射。例如LivesAt关系不能是其中Automobile(汽车)是Occupant(居民)的关系,因为Automobile不是Person。A relationship defines a mapping between instances constrained by a type given as an endpoint type. For example a LivesAt relationship cannot be one in which Automobile (car) is Occupant (resident) because Automobile is not Person.
数据模型允许定义类型间的子类型-超类型关系。也称为基本类型(BaseType)关系的子类型-超类系型关系以如下方式定义,若类型A是类型B的基本类型,则情况必须是B的每个实例也是A的实例。另一种表达的方法是符合B的每个实例也必须符合A。例如,若A具有String类型的属性Name(名字),而B具有Int16类型的属性Age(年龄),则得出,B的任何实例必须兼有Name和Age。类型的分层结构可被设想成在根上带有单个超类型的树。根的分枝提供第一级子类型,该级分枝提供第二级子类型,依此类推,直到本身不再具有任何子类型的叶端(leaf-most)子类型。树不限于统一深度,但不能包含任何回路。给定的类型可具有零个或多个子类型和零个或一个超类型。给定实例可最多符合一个类型以及该类型的超类型。换言之,对树中任一级处给定的实例,该实例最多可符合该级上的一个子类型。Data models allow defining subtype-supertype relationships between types. A subtype-supertype relationship, also known as a BaseType relationship, is defined in such a way that if a type A is a base type of a type B, then it must be the case that every instance of B is also an instance of A. Another way to express it is that every instance that conforms to B must also conform to A. For example, if A has an attribute Name (name) of type String, and B has an attribute Age (age) of type Int16, it follows that any instance of B must have both Name and Age. A hierarchy of types can be thought of as a tree with a single supertype at the root. Branches at the root provide first-level subtypes, which provide second-level subtypes, and so on, up to leaf-most subtypes that no longer have any subtypes themselves. Trees are not limited to uniform depth, but cannot contain any cycles. A given type can have zero or more subtypes and zero or one supertype. A given instance may conform to at most one type and that type's supertypes. In other words, for a given instance at any level in the tree, the instance can conform to at most one subtype at that level.
如果类型的实例必须也是该类型的子类型的实例,则该类型可被认为是抽象。A type may be considered abstract if instances of the type must also be instances of subtypes of that type.
1.项目1. Project
项目是可存储信息的单元,不象简单的文件,它是具有由存储平台向最终用户或应用程序展现的所有对象共同支持的基本属性集的对象。项目也具有所有项目类型共同支持的属性和关系,包括如下所述允许引入新的属性和关系的特征。An item is a unit of storable information, unlike a simple file, it is an object with a basic set of properties common to all objects presented by the storage platform to end users or applications. Items also have attributes and relationships supported common to all item types, including features described below that allow the introduction of new attributes and relationships.
项目是公用操作的对象,如拷贝、删除、移动、打开、打印、备份、恢复、复制等。项目是能被存储和检索的单元,且由存储平台处理的可存储信息的所有形式作为项目、项目的属性、或项目之间的关系存在,其每一个在下面更详细讨论。Items are objects for common operations such as copy, delete, move, open, print, backup, restore, duplicate, and so on. Items are units that can be stored and retrieved, and all forms of storable information handled by the storage platform exist as items, attributes of items, or relationships between items, each of which is discussed in more detail below.
项目旨在表示现实的且容易理解的数据单元,如Contacts(联系人)、People(人)、Services(服务)、Locations(位置)、(各种类型的)Documents(文档)等。图5A是示出项目的结构的框图。该项目的不合格名是“Location”。该项目的合格名是“Core.Location”,它表明此项目结构被定义成核心(Core)模式中的特定类型的项目(核心模式在下面详细讨论)。Projects are designed to represent realistic and easy-to-understand data units, such as Contacts (contacts), People (people), Services (services), Locations (locations), (various types of) Documents (documents), etc. FIG. 5A is a block diagram showing the structure of an item. The unqualified name for this item is "Location". The qualified name of the item is "Core.Location", which indicates that the item structure is defined as a specific type of item in the Core schema (the Core schema is discussed in detail below).
Location项目具有多个属性,包括EAddress(电子邮件地址)、MetropolitanRegion(都市地区)、Neighborhood(街坊)、和PostalAddress(邮政地址)。每个项目的特定类型属性紧跟属性名表示,并用冒号(“:”)与属性名分开。在类型名的右边,对该属性类型允许的值的数量在方括号(“[]”)之间表示,其中冒号(“:”)右边的星号(“*”)表示未规定的和/或无限制的数量(“许多”)。冒号右边的“1”表明最多一个值。冒号左边的零(“0”)表明该属性是可任选的(可以完全没有值)。冒号左边的“1”表明必须至少有一个值(该属性是必须的)。Neighborhood和MetropolitanRegin均是“nvarchar”类型(或等效类型),它是预定义的数据类型或“简单类型”(这里用缺少大写来表示)。然而EAddress和PostalAddress分别是类型EAddress和PostalAddress的已定义类型或“复杂类型”(这里用大写标记)的属性。复杂类型是从一个或多个简单数据类型和/或从其它复杂类型导出的类型。项目的属性的复杂类型还构成“嵌套元素”,因为复杂类型的细节嵌套入直接项目中以定义其属性,而涉及这些复杂类型的信息用具有这些属性的项目来维持(在该项目的边界内,如后面讨论)。类型的这些概念是众知的,且容易被本领域的技术人员理解。The Location item has several attributes, including EAddress (email address), MetropolitanRegion (metropolitan region), Neighborhood (neighborhood), and PostalAddress (postal address). Each item-specific property is indicated immediately following the property name, separated from the property name by a colon (":"). To the right of the type name, the number of values allowed for that attribute type is indicated between square brackets ("[]"), where an asterisk ("*") to the right of a colon (":") indicates unspecified and/ or an unlimited number ("many"). A "1" to the right of the colon indicates at most one value. A zero ("0") to the left of the colon indicates that the attribute is optional (may have no value at all). A "1" to the left of the colon indicates that there must be at least one value (the attribute is required). Both Neighborhood and MetropolitanRegin are of type "nvarchar" (or equivalent), which is a predefined data type or "simple type" (represented here by the lack of capitalization). However EAddress and PostalAddress are properties of defined types or "complex types" (marked here in capitals) of types EAddress and PostalAddress respectively. A complex type is a type that is derived from one or more simple data types and/or from other complex types. Complex types of properties of items also constitute "nested elements" because details of complex types are nested into immediate items to define their properties, while information concerning these complex types is maintained with items having these properties (in the item's within the boundaries, as discussed later). These concepts of type are well known and readily understood by those skilled in the art.
图5B是示出复杂属性类型PostalAddress和EAddress的框图。PostalAddress属性类型定义属性类型PostalAddress的项目可期望有零个或一个City(城市)值、零个或一个CountryCode(国家代码)值、零个或一个MailStop(信箱代码)值、和任何数量(零到许多)PostalAddress类型等等。以此方式,定义了项目中的特定属性的数据的形状。EAddress属性类型如所示类似地定义。虽然这里在本申请中可任选地使用,表示Location项目中复杂类型的另一方法是用其中列出的每个复杂类型的各个属性得出该项目。图5C是示出Location项目的框图,在其中进一步描述其复杂类型。然而应该理解,在图5C中Location项目的另一种表示恰是对图5A中示出的同一个项目。本发明的存储平台还允许子类型化,从而一个属性类型是另一个的子类型(其中一个属性类继承另一个父属性类型的属性)。Figure 5B is a block diagram illustrating complex attribute types PostalAddress and EAddress. The PostalAddress attribute type defines that an item of attribute type PostalAddress can expect zero or one City (city) value, zero or one CountryCode (country code) value, zero or one MailStop (mailbox code) value, and any number (zero to many) PostalAddress type and so on. In this way, the shape of the data for a particular attribute in the item is defined. The EAddress property type is similarly defined as shown. Although optionally used here in this application, another way to represent complex types in a Location item is to derive the item with individual properties for each complex type listed therein. Figure 5C is a block diagram showing the Location item, in which its complex type is further described. It should be understood, however, that an alternative representation of the Location item in FIG. 5C is just the same item shown in FIG. 5A. The storage platform of the present invention also allows subtyping so that one property type is a subtype of another (where one property class inherits properties from another parent property type).
类似于但不同于属性及它们的属性类型,项目继承性地表示其自己的Item(项目)类型,它也是子分类的主题。换言之,本发明的若干实施例中的存储平台允许一个项目是另一个项目的子类型(从而一个项目继承另一个父项目的属性)。此外,对本发明的各种实施例,每个项目是“Item”项目类型的子类型,后者是在基础模式中找到的第一且基本的项目类型(基础模式也在后面详细讨论)。图6A示出一项目(在此实例中为Location项目)为在基础模式中找到的Item项目类型的子类型。在此图中,箭头表示Location项目(与所有其它项目一样)是Item项目类型的子类型。作为从中导出所有其它项目的基本项目的Item项目类型具有若干如ItemId(项目ID)等重要属性和各种时间标记,从而定义了操作系统中所有项目的标准属性。在本图中,Item项目类型的这些属性被Location所继承,并从而成为Location的属性。Similar to, but distinct from, properties and their property types, Items inherit their own Item type, which is also the subject of subcategories. In other words, the storage platform in several embodiments of the invention allows an item to be a subtype of another item (so that an item inherits the properties of another parent item). Furthermore, for various embodiments of the present invention, each item is a subtype of the "Item" item type, which is the first and fundamental item type found in the base schema (the base schema is also discussed in detail below). Figure 6A shows that an item (in this example the Location item) is a subtype of the Item item type found in the base schema. In this figure, the arrows indicate that the Location item (like all other items) is a subtype of the Item item type. The Item item type, which is the base item from which all other items are derived, has several important properties such as ItemId (item ID) and various time stamps, thereby defining standard properties for all items in the operating system. In this figure, these properties of the Item item type are inherited by Location and thus become properties of Location.
表示从Item项目类型继承的Location项目中属性的另一种方法是用来自其中列出的父项目的每个属性类型的各个属性得出Location。图6B是示出Location项目的框图,其中除了其直接属性外描述其继承的类型。应注意和理解,此项目是图5A中示出的同一项目,虽然在本图中,Location用所有其属性示出,包括直接属性(在本图及图5A中示出)和继承属性(在本图中示出但未在图5A中示出)(而在图5A中,通过用箭头示出Location项目是Item项目类型的子类型来引用这些属性)。Another way to represent properties in a Location item that inherits from the Item item type is to derive a Location with individual properties from each property type of the parent item listed therein. Fig. 6B is a block diagram showing the Location item, in which its inherited types are described in addition to its immediate attributes. It should be noted and understood that this item is the same item shown in Figure 5A, although in this figure, Location is shown with all its attributes, including direct attributes (shown in this figure and in Figure 5A) and inherited attributes (in Shown in this figure but not in Figure 5A) (whereas in Figure 5A these attributes are referenced by arrows showing that the Location item is a subtype of the Item item type).
项目是独立的对象,因而若删除一项目,也删除项目的所有直接和继承的属性。类似地,当检索一项目时,接收到的是该项目及其所有直接和继承的属性(包括涉及其复杂属性类型的信息)。本发明的某些实施例可使人们能在检索特定项目时请求属性的子集;然而对许多那样的实施例默认的是在检索时向项目提供所有其直接和继承的属性。此外,项目的属性也能通过添加新的属性到该项目的类型的现有属性而加以扩展。这些“扩展”其后是该项目的真实属性,且该项目类型的子类型可自动地包括扩展属性。Items are self-contained objects, so deleting an item also deletes all of the item's direct and inherited properties. Similarly, when an item is retrieved, what is received is the item and all of its direct and inherited attributes (including information concerning its complex attribute types). Certain embodiments of the present invention may enable one to request a subset of attributes when retrieving a particular item; however the default for many such embodiments is to provide an item with all its direct and inherited attributes when retrieving. In addition, the properties of an item can also be extended by adding new properties to the existing properties of the item's type. These "extensions" are followed by the actual properties of the item, and subtypes of the item type may automatically include extended properties.
项目的“边界”由其属性(包括复杂属性类型、扩展等)来表示。项目的边界也表示在项目上执行的操作的限制,包括复制、删除、移动、创建等。例如在本发明的若干实施例中,当复制项目时,在该项目边界之内的所有内容也被复制。对每个项目,边界包括下列:The "boundary" of an item is represented by its attributes (including complex attribute types, extensions, etc.). The boundaries of an item also represent the limits of operations performed on the item, including copying, deleting, moving, creating, and so on. For example, in several embodiments of the invention, when an item is copied, all content within the boundaries of the item is also copied. For each project, the boundary includes the following:
·项目的项目类型,且若该项目是另一项目的子类型(如在所有项目从基础模式的单个项目和项目类型导出的本发明的若干实施例的情况下),是任何适用的子类型信息(即涉及父项目类型的信息)。若要复制的原始项目是另一项目的子类型,该副本也能是该同一项目的子类型。The item type of an item, and if the item is a subtype of another item (as in the case of several embodiments of the invention where all items are derived from a single item and item type of the base schema), any applicable subtype Information (that is, information referring to the parent item type). The original item being copied is a subtype of another item, and the copy can also be a subtype of that same item.
·项目的复杂类型属性和扩展(如果有的话)。若原始项目具有复杂类型(原来的或扩展的)的属性,副本也能具有同一复杂类型。· Item's complex type properties and extensions (if any). If the original item has properties of a complex type (original or extended), the copy can also have the same complex type.
·在“所有权关系”上的项目的记录,即,本项目(“拥有项目”)拥有什么其它项目(“目录项目”)的项目拥有列表。这特别关系到下面充分讨论的项目文件夹和下面说到的所有项目必须至少属于一个项目文件夹的规则。此外,关于嵌入项目(下面更充分讨论),嵌入项目被认为是其中嵌入如复制、删除等操作的项目的一部分。• A record of items on an "ownership relationship", ie, an item-owned list of what other items ("catalogue items") owns what this item ("owning item") owns. This specifically relates to the project folders discussed fully below and the rule that all projects must belong to at least one project folder. Furthermore, with respect to embedded items (discussed more fully below), an embedded item is considered to be the part of the item in which operations such as copying, deleting, etc. are embedded.
2.项目标识2. Project identification
在全局项目空间中用ItemID唯一地标识项目。Base.Item类型定义了存储该项目身份的类型GUID的字段ItemID。一个项目必须在数据存储302中只有一个身份。ItemID is used to uniquely identify items in the global item space. The Base.Item type defines a field ItemID of type GUID that stores the identity of the item. An item must have only one identity in the data store 302 .
a)项目引用a) Project References
项目引用是包含定位和标识项目的信息的数据结构。在该数据模型中,定义名为ItemReference(项目引用)的抽象类型,从中导出所有项目引用类型。ItemReference类型定义了名为Resolve(解析)的虚拟方法。Resolve方法解析ItemReference并返回一项目。此方法被ItemReference的具体子类型所覆盖,后者实现给定一引用时检索项目的功能。调用Resolve方法作为存储平台API 322的一部分。Item references are data structures that contain information to locate and identify items. In this data model, define an abstract type called ItemReference (item reference), from which all item reference types are derived. The ItemReference type defines a virtual method named Resolve. The Resolve method resolves the ItemReference and returns an item. This method is overridden by a concrete subtype of ItemReference that implements functionality for retrieving an item given a reference. Call the Resolve method as part of the
(1)ItemIDReference(1)ItemIDReference
ItemIDReference(项目ID引用)是ItemReference的子类型。它定义了Locator(定位器)和ItemID字段。Locator字段命名(即标识)项目域。它由能将Locator的值解析到项目域的定位器解析方法来处理。ItemID字段是ItemID类型。ItemIDReference (item ID reference) is a subtype of ItemReference. It defines the Locator (locator) and ItemID fields. The Locator field names (ie identifies) the project field. It is handled by the locator resolve method that resolves the value of the Locator to the project field. The ItemID field is of type ItemID.
(2)ItemPathReference(2)ItemPathReference
ItemPathReference(项目路径引用)是定义Locator和Path(路径)字段的ItemReference的特殊化。Locator字段标识项目域。它由能将Locator的值解析到项目域的定位器解析方法来处理。Path字段包含以由Locator提供的项目域为根的存储平台名字空间中的(相对)路径。ItemPathReference (item path reference) is a specialization of ItemReference that defines the Locator and Path fields. The Locator field identifies the project domain. It is handled by the locator resolve method that resolves the value of the Locator to the project field. The Path field contains a (relative) path in the storage platform namespace rooted at the project domain provided by the Locator.
不能在集合运算中使用此类引用。引用一般必须通过路径解析过程来解析。存储平台API 322的Resolve方法提供此功能。Such references cannot be used in set operations. References generally must be resolved through the path resolution process. The Resolve method of the
b)引用类型分层结构b) Reference type hierarchy
上面讨论的引用形式通过图11示出的引用类型分层结构来表示。从这些类型继承的其它引用类型能在模式中定义。它们能在关系声明中用作目标字段的类型。The citation forms discussed above are represented by the citation type hierarchy shown in FIG. 11 . Other reference types that inherit from these types can be defined in the schema. They can be used as the type of the target field in the relation declaration.
3.项目文件夹和类别3. Project folders and categories
如下面将更充分讨论的,项目组能被组织成称为项目文件夹(不要与文件的文件夹混淆)的特殊项目。然而不象大多数文件系统,一个项目可属于多个项目文件夹,使得当项目在一个项目文件夹中被访问和修订时,此修订的项目随后能直接从另一项目文件夹访问。实质上,虽然对一个项目的访问可从不同的项目文件夹发生,事实上真正访问的是同一个项目。然而,项目文件夹不必拥有其所有成员项目,或简单地结合其它文件夹共同拥有项目,使得一个项目文件夹的删除不必要导致项目的删除。然而在本发明的若干实施例中,一个项目必须至少属于一个项目文件夹,使得如果特定项目的唯一项目文件夹被删除,则对某些实施例,该项目被自动被删除,或在另外实施例中,该项目自动地成为默认项目文件夹的成员(例如,“TrashCan(垃圾箱)”项目文件夹在概念上类似于在各种基于文件和文件夹的系统中使用的类似名字文件夹。)As will be discussed more fully below, groups of projects can be organized into special projects called project folders (not to be confused with folders of files). Unlike most file systems, however, a project can belong to multiple project folders, so that when a project is accessed and revised in one project folder, the revised project can then be accessed directly from another project folder. Essentially, although access to a project can occur from different project folders, what is actually being accessed is the same project. However, a project folder does not have to own all of its member projects, or simply own projects in conjunction with other folders, so that the deletion of one project folder does not necessarily result in the deletion of projects. However, in several embodiments of the invention, a project must belong to at least one project folder, so that if the unique project folder for a particular project is deleted, then for some embodiments, the project is automatically deleted, or in other implementations In this case, the project automatically becomes a member of the default project folder (for example, the "TrashCan" project folder is conceptually similar to similarly named folders used in various file and folder-based systems. )
如下面更充分讨论的,项目也可属于基于共同描述的特征的类别,特征如:(a)项目类型(或类型),(b)特定的直接或继承的属性(或属性),或(c)对应于项目属性的特定值(或值)。例如,包括个人联系人信息的特定属性的项目可自动属于Contact(联系人)类别,具有联系人信息属性的任何项目也自动属于此类别。同样,具有“New York City(纽约市)”值的位置属性的任何项目可自动属于NewYorkCity(纽约市)类别。As discussed more fully below, items may also belong to categories based on commonly described characteristics such as: (a) item type (or types), (b) specific direct or inherited attributes (or attributes), or (c ) corresponds to a specific value (or values) of an item property. For example, items that include certain attributes of personal contact information can automatically belong to the Contact category, as do any items that have the attribute of contact information. Likewise, any item that has a location attribute with a value of "New York City" can automatically belong to the NewYorkCity (New York City) category.
类别在概念上不同于项目文件夹之处在于,项目文件夹可包括互相无关的项目(即无共同的描述的特征),而在类别中的每个项目具有对该类别描述的共同类型、属性或值(“共同性”),正是这个共同性形成对它与该类别中其它项目或那些项目之间的关系的基础。此外,虽然在特定文件夹中的项目的成员资格基于该项目的任何特定方面不是强制的,然而对某些实施例,具有在分类上与一类别相关的共同性的所有项目在硬件/软件接口系统级上可自动地成为该类别的成员。概念上,类别也能看作虚拟项目文件夹,其成员资格基于特定查询(如在数据库的上下文中)的结果,而满足此查询的条件(由类别的共同性确定)的项目应构成该类别的成员资格。Categories are conceptually different from project folders in that project folders may contain items that are unrelated to each other (i.e., have no common descriptive characteristics), whereas each item in a category has a common type, attribute, or value ("commonality"), it is this commonality that forms the basis for its relationship to other items or items in the class. Furthermore, while membership of an item in a particular folder is not mandatory based on any particular aspect of the item, for some embodiments, all items having a taxonomically common Membership of this class is automatic at the system level. Conceptually, categories can also be seen as virtual project folders, whose membership is based on the results of a specific query (such as in the context of a database), and projects that satisfy the conditions of this query (determined by the commonality of the category) should form the category membership.
图4示出在本发明各实施例中在项目、项目文件夹和类别之间的结构关系。多个项目402、404、406、408、410、412、414、416、418和420是各个项目文件夹422、424、426、428和430的成员。某些项目属于一个以上项目文件夹,如项目402属于项目文件夹422和424。某些项目,如项目402、404、406、408、410和412也是一个或多个类别432、434和436的成员,而其它项目,如项目44,416,418和420可以不属于任何类别(虽然这大部分不象在某些实施例中,其中具有任何属性自动暗示类别中的成员资格,因此在那样实施例中为了不是任何类别的成员,项目应完全地无特征)。与文件夹的分层结构相反,类别和项目文件夹均有更像如所示的有向图的结构。在任何情况下,项目、项目文件夹和类别都是项目(尽管是不同的项目类型)。Figure 4 shows the structural relationship among projects, project folders and categories in various embodiments of the present invention. A plurality of
与文件、文件夹和目录相反,本发明的项目、项目文件夹和类别的特征在本质上不是“物理的”,因为它们不具有物理容器的概念上的等价性,因而项目可存在于一个以上那样的位置。项目存在于一个以上项目文件位置以及被组织成类别的能力提供了在硬件/软件接口级上增强和丰富程度的数据处理及存储结构能力,超越了在本领域中当前可得到的能力。Contrary to files, folders and directories, the project, project folder and category features of the present invention are not "physical" in nature, because they have no conceptual equivalent of physical containers, so projects can exist in a the position above. The ability for projects to exist in more than one project file location and be organized into categories provides an enhanced and rich degree of data processing and storage structure capabilities at the hardware/software interface level beyond what is currently available in the art.
4.模式4. Mode
a)基础模式a) Basic pattern
为了提供创建和使用项目的通用基础,本发明的存储平台的各实施例包括建立用于创建和组织项目及属性的概念性框架的基础模式。基础模式定义了某些特定类型的项目和属性,以及从中进一步导出子类型的这些特定基本类型的特征。使用此基础模式使程序员能在概念上将项目(及其各自的类型)与属性(及其各自的类型)加以区别。此外,基础模式列出所有项目可拥有的基本属性集,因为所有项目(及其对应的项目类型)是从基础模式的此基本项目(及其对应的项目类型)导出的。To provide a common basis for creating and using items, embodiments of the storage platform of the present invention include an underlying schema that establishes a conceptual framework for creating and organizing items and attributes. The base schema defines the items and properties of some specific types, and the characteristics of these specific base types from which subtypes are further derived. Using this basic pattern enables programmers to conceptually distinguish items (and their respective types) from attributes (and their respective types). Additionally, the base schema lists the base set of properties that all items can have, since all items (and their corresponding item types) are derived from this base item (and their corresponding item types) of the base schema.
如图7所示,对于本发明的若干实施例,基础模式定义三个顶层类型:Item(项目)、Extension(扩展)和PropertyBase(属性基)。如图所示,通过此基本“Item”项目类型的属性定义了项目类型。相反,顶层属性类型“PropertyBase”没有预定义的属性,仅是一个定位点,从中导出所有其它属性类型,并且所有导出的属性类型通过它互相联系(共同从单个属性类型导出)。Extension类型属性定义该扩展扩展了哪个项目,并定义将一个扩展与另一个项目相区别的标识,因为一个项目可具有多个扩展。As shown in FIG. 7 , for several embodiments of the present invention, the basic schema defines three top-level types: Item (item), Extension (extension) and PropertyBase (property base). As shown, the item type is defined through the properties of this base "Item" item type. In contrast, the top-level property type "PropertyBase" has no predefined properties, and is merely an anchor point from which all other property types are derived, and through which all derived property types relate to each other (collectively derived from a single property type). The Extension type attribute defines which project the extension extends, and defines the identity that distinguishes one extension from another project, since a project can have multiple extensions.
ItemFolder(项目文件夹)是Item项目类型的子类型,除了从Item继承的属性外,它表征用于建立到其成员(如果有的话)的链接的关系,尽管Identitykey(身份键)和Property(属性)均是PropertyBase的子类型。CategoryRef(目录引用)进而是IdentityKey的子类型。ItemFolder (item folder) is a subtype of the Item item type, which, in addition to inheriting properties from Item, characterizes the relationship used to establish links to its members (if any), although Identitykey (identity key) and Property ( Attributes) are subtypes of PropertyBase. CategoryRef (category reference) is in turn a subtype of IdentityKey.
b)核心模式b) Kernel mode
本发明的存储平台的各种实施例还包括为顶层项目类型结构提供概念框架的核心模式。图8A是示出核心模式中的项目的框图,而图8B是示出核心模式中属性类型的框图。在带不同扩展名(*.com、*.exe、*.bat、*.sys等)的文件和在基于文件和文件夹系统中其它准则之间作出的区分是类似于核心模式的功能。在基于项目的硬件/软件接口系统中,核心模式定义了一组核心项目类型,它们直接(按项目类型)或间接地(按项目子类型)将所有项目特征化成基于项目的硬件/软件接口系统理解并能以预定或可预测的方式直接处理的一个或多个核心模式项目类型。预定义的项目类型反映了在基于项目的硬件/软件接口系统中最常用的项目,且因此由理解这些构成核心模式的预定义项目类型的基于项目的硬件/软件接口系统获取有效性级别。Various embodiments of the storage platform of the present invention also include a core schema that provides a conceptual framework for the top-level project type structure. FIG. 8A is a block diagram showing items in the core schema, and FIG. 8B is a block diagram showing attribute types in the core schema. The distinction made between files with different extensions (*.com, *.exe, *.bat, *.sys, etc.) and other criteria in the file- and folder-based system is a kernel-mode-like function. In an item-based hardware/software interface system, the core schema defines a core set of item types that directly (by item type) or indirectly (by item subtype) characterize all items into an item-based hardware/software interface system One or more core schema item types that are understood and can be directly processed in a predetermined or predictable manner. The predefined item types reflect the most commonly used items in the item-based hardware/software interface system, and thus the level of validity is derived by the item-based hardware/software interface system that understands these predefined item types that make up the core schema.
在某些实施例中,核心模式是不可扩展的,即,没有另外的类型可直接从基础模式中的项目类型子分类,除非作为核心模式的一部分的特定的预定导出的项目类型。通过禁止对核心模式的扩展(即,通过禁止向核心模式添加新的项目),存储平台托管核心模式项目类型的使用,因为每个后续的项目类型必须是核心模式项目类型的子类型。此结构允许在保持具有一组预定的核心项目类型的益处的同时在定义另外项目类型时有合理程度的灵活性。In some embodiments, the core schema is not extensible, ie, no additional types can be subclassed directly from item types in the base schema, except for specific predefined derived item types that are part of the core schema. By prohibiting extensions to the core schema (ie, by prohibiting the addition of new items to the core schema), the storage platform hosts the use of the core schema item type, since each subsequent item type must be a subtype of the core schema item type. This structure allows a reasonable degree of flexibility in defining additional item types while maintaining the benefits of having a predetermined set of core item types.
参考图8A,对本发明的各种实施例,由核心模式支持的特定项目类型可包括下列的一个或多个:Referring to FIG. 8A, for various embodiments of the present invention, specific item types supported by the core schema may include one or more of the following:
·Category(类别):此项目类型(及从中导出的子类型)的项目表示在基于项目的硬件/软件接口系统中的有效类别。• Category: Items of this item type (and subtypes derived from it) represent valid categories in the item-based hardware/software interface system.
·Commodity(物品):作为值的可标识事物的项目。• Commodity: An item that is an identifiable thing as a value.
·Device(设备):具有支持信息处理能力的逻辑结构的项目。• Device: An item having a logical structure supporting information processing capabilities.
·Document(文档):具有不能由基于项目的硬件/软件接口系统解释而相反由对应于文档类型的应用程序解释的内容的项目。• Document: An item with content that cannot be interpreted by an item-based hardware/software interface system but instead by an application corresponding to the document type.
·Event(事件):记录环境中某些发生事件的项目。· Event (event): records some events in the environment of the project.
·Location(位置):代表物理位置(如地理位置)的项目。• Location: An item representing a physical location (eg, geographic location).
·Message(消息):在两个或多个主体(下面定义)之间通信的项目。• Message: An item for communication between two or more principals (defined below).
·Principal(主体):具有除ItemId之外的至少一个肯定可证实身份(如,个人、组织、组、家庭、作者、服务等的标识)的项目。• Principal: An item that has at least one positively verifiable identity (eg, identification of a person, organization, group, family, author, service, etc.) other than the ItemId.
·Statement(语句):具有关于环境的特定信息的项目,包括但不限于:策略、预订、凭证等。• Statement: An item with specific information about an environment, including but not limited to: Policies, Subscriptions, Credentials, etc.
类似地参考图8B,由核心模式支持的特定属性类型可包括下列的一个或多个:Referring similarly to FIG. 8B , specific attribute types supported by the core schema may include one or more of the following:
·Certificate(证书)(从基础模式中的基本PropertyBase类型导出)Certificate (certificate) (derived from the base PropertyBase type in the base schema)
·PrincipalIdentityKey(主体身份键)(从基础模式中的IdentityKey类型导出)· PrincipalIdentityKey (subject identity key) (derived from the IdentityKey type in the underlying schema)
·PostalAddress(邮政地址)(从基础模式中Property类型导出)· PostalAddress (postal address) (derived from the Property type in the basic mode)
·RichText(多信息文本)(从基础模式中Property类型导出)RichText (rich text) (derived from the Property type in the basic mode)
·EAddress(电子邮件地质)(从基础模式中Property类型导出)EAddress (email geology) (derived from the Property type in the base schema)
·IdentitySecnrityPackage(身份安全包)(从基础模式中Relationship类型导出)· IdentitySecnrityPackage (identity security package) (exported from the Relationship type in the basic model)
·RoleOccupancy(居民角色)(从基础模式中Relationship类型导出)·RoleOccupancy (resident role) (derived from the Relationship type in the basic model)
·BasicPresence(基础存在)(从基础模式中Relationship类型导出)这些项目和属性按在图8A和图8B中列出的各自属性进一步描述。• BasicPresence (derived from the Relationship type in the Basic Schema) These items and attributes are further described by the respective attributes listed in Figures 8A and 8B.
5.关系5. Relationship
关系是二元关系,其中一个项目被指定为源,另一个被指定为目标。源项目和目标项目通过关系相联系。源项目一般控制关系的生命周期。即,当源项目被删除,项目之间的关系也被删除。Relationships are binary, where one item is designated as the source and the other as the target. Source and target items are related by a relationship. The source project generally controls the life cycle of the relationship. That is, when the source item is deleted, the relationship between the items is also deleted.
关系被分类成:包含(Containment)和引用(Reference)关系。包含关系控制目标项目的生命周期,而引用关系不提供任何生命周期管理语义。图12示出关系分类的方式。Relationships are classified into: Containment and Reference relationships. Contains relationships control the lifecycle of the target item, while references relationships do not provide any lifecycle management semantics. Fig. 12 shows how relationships are classified.
包含关系类型又被分类成持有(Holding)和嵌入(Embedding)关系。当对一个项目的所有持有关系被移除,该项目被删除。持有关系通过引用计数机制控制目标的生命周期。嵌入关系能够对复合项目建模,并能被看作排他的持有关系。一个项目能是一个或多个持有关系的目标;但一个项目只能是一个嵌入关系的目标。作为嵌入关系的目标的项目不能是任一其它持有或嵌入关系的目标。Containment relationship types are further classified into Holding and Embedding relationships. When all holdings to an item are removed, the item is deleted. The holding relationship controls the life cycle of the target through the reference counting mechanism. Embedding relationships can model composite items and can be viewed as exclusive holding relationships. An item can be the target of one or more holding relationships; but an item can only be the target of one embedded relationship. An item that is the target of an embedded relationship cannot be the target of any other holding or embedded relationship.
引用关系不控制目标项目的生命周期。它们可以是悬挂的-目标项目可以不存在。引用关系能用于在全局项目名字空间的任何处(即,包括远程数据存储)建模对项目的引用。Reference relationships do not control the lifecycle of the target project. They can be dangling - the target item can be absent. Reference relationships can be used to model references to projects anywhere in the global project namespace (ie, including remote data stores).
获得项目不自动取得其关系,应用程序必须明确地请求项目的关系。此外,修改关系不修改源或目标项目;类似地,添加关系不影响源/目标项目。Obtaining an item does not automatically acquire its relationship, the application must explicitly request the item's relationship. Also, modifying a relationship does not modify the source or target items; similarly, adding a relationship does not affect the source/target items.
a)关系声明a) Relationship statement
显式的关系类型用下列元素定义;Explicit relation types are defined with the following elements;
·在Name(名字)属性中指定关系名Specify the relationship name in the Name attribute
·下列之一的关系类型:持有、嵌入、引用。这是在Type(类型)属性中指定的。• A relationship type of one of the following: holds, embeds, references. This is specified in the Type attribute.
·源和目标端点。每个端点指定所引用项目的名和类型。• Source and destination endpoints. Each endpoint specifies the name and type of the item being referenced.
·源端点字段一般是ItemID类型(未声明),而必须引用在与关系实例相同的数据存储中的项目。• The source endpoint field is typically of type ItemID (undeclared), but must refer to an item in the same data store as the relation instance.
·对持有和嵌入关系,目标端点字段必须是ItemIDReference类型,且它必须引用在与关系实例相同的存储中的项目。对引用关系,目标端点能是任何ItemReference类型,并能引用在其它存储平台数据存储中的项目。• For holding and embedding relationships, the target endpoint field must be of type ItemIDReference, and it must refer to an item in the same store as the relationship instance. For reference relationships, the target endpoint can be of any ItemReference type and can reference items in other storage platform data stores.
·能可任选地声明标量或PropertyBase类型的一个或多个字段。这些字段能包含与该关系相关联的数据。• One or more fields of type scalar or PropertyBase can optionally be declared. These fields can contain data associated with the relationship.
·关系实例被存储在全局关系表中。• Relationship instances are stored in the global relationship table.
·每个关系实例唯一地由组合(源ItemID、关系ID)标识。对所有源自给定项目的关系,在给定的源ItemID中关系ID是唯一的,而不管它们的类型。• Each relation instance is uniquely identified by the combination (source ItemID, relation ID). Relation IDs are unique within a given source ItemID for all relations originating from a given Item, regardless of their type.
源项目是关系的拥有者。而被指定为拥有者的项目控制关系的生命周期,关系本身和与它们相关的项目分开。存储平台API 322提供用于展现与项目相关联的关系的机制。The source project is the owner of the relationship. While the project designated as the owner controls the lifecycle of the relationship, the relationships themselves are separate from the projects they are related to. The
这里是一个关系声明的例子。Here is an example of a relationship declaration.
<Relationship Name=″Employment″BaseType=″Reference″><Relationship Name="Employment"BaseType="Reference">
<Source Name=″Employee″ItemType=″Contact.Person″/><Source Name="Employee" ItemType="Contact.Person"/>
<Target Name=″Employer″ItemType=″Contact.Organization″<Target Name="Employer" ItemType="Contact.Organization"
ReferenceType=″ItemIDReference″/> ReferenceType = "ItemIDReference" />
<Property Name=″StartDate″Type=″the storage<Property Name="StartDate"Type="the storage
platformTypes.DateTime″/>platformTypes.DateTime″/>
<Property Name=″EndDate″Type=″the storage<Property Name="EndDate"Type="the storage
platformTypes.DateTime″/>platformTypes.DateTime″/>
<Property Name=″Office″Type=″the storage<Property Name="Office"Type="the storage
platformTypes.DateTime″/>platformTypes.DateTime″/>
</Relationship></Relationship>
这是引用关系的例子。若由源引用所引用的个人项目不存在,则不能创建该关系。而且若该个人项目被删除,在个人和组织之间的关系实例也被删除。然而若组织项目被删除,关系不被删除,而它是悬挂的。This is an example of a reference relationship. This relationship cannot be created if the personal item referenced by the source reference does not exist. And if the individual item is deleted, the relationship instance between the individual and the organization is also deleted. However, if the organization item is deleted, the relationship is not deleted, but it is suspended.
b)持有关系b) holds a relationship
持有关系用于基于目标项目的生命周期管理来对引用计数建模。Holding relationships are used to model reference counting based on the lifecycle management of the target project.
项目可以是项目的零个或多个关系的源端点。不是嵌入项目的项目可以是在一个或多个持有关系中的目标。An item can be the source endpoint of zero or more relationships to an item. Items that are not embedded items can be targets in one or more holding relationships.
目标端点引用类型必须是ItemIDReference,且它必须引用在与关系实例相同的存储中的项目。The target endpoint reference type must be ItemIDReference, and it must refer to an item in the same store as the relation instance.
持有关系实施目标端点的生命周期管理。持有关系实例和作为目标的项目的创建是原子操作。可以创建将同一项目作为目标的另外的持有关系实例。当具有给定项目作为目标端点的最后一个持有关系实例被删除时,该目标项目也被删除。Holding relationships enforces lifecycle management of target endpoints. The creation of the holding relation instance and the item as the target is an atomic operation. Additional holding relationship instances can be created that target the same project. When the last holding relationship instance with the given item as target endpoint is deleted, the target item is also deleted.
在关系声明中指定的端点项目的类型一般在创建该关系的实例时强制。在关系建立之后端点项目的类型不能改变。The type of an endpoint item specified in a relationship declaration is generally enforced when an instance of that relationship is created. The type of an endpoint item cannot be changed after the relationship is established.
持有关系在形成项目的名字空间中起着关键作用。它们包含“Name”属性,它定义目标项目相对于源项目的名字。对所有源自给定项目的持有关系,相对名字是唯一的。从根项目开始到给定项目的相对名字的有序列表形成该项目的全名。Holding relationships play a key role in forming a project's namespace. They contain the "Name" attribute, which defines the name of the target project relative to the source project. Relative names are unique across all holding relationships originating from a given project. An ordered list of relative names from the root project to a given project forms the project's full name.
持有关系形成一有向非循环图(DAG)。在创建持有关系时,系统确保不产生回路,从而确保项目的名字空间形成DAG。The holding relationships form a directed acyclic graph (DAG). When creating holding relationships, the system ensures that no loops are created, thereby ensuring that the project's namespace forms a DAG.
虽然持有关系控制目标项目的生命周期,它不控制目标端点项目的操作的一致性。目标项目在操作上独立于通过持有关系拥有它的项目。在作为持有关系的源的项目上的复制、移动、备份和其它操作不影响作为同一关系的目标的项目-例如,备份文件夹项目不自动地备份该文件夹中所有项目(FolderMember(文件夹成员)关系中的目标)。Although the hold relationship controls the lifecycle of the target item, it does not control the consistency of operation of the target endpoint item. The target item is operationally independent of the item that owns it through the holding relationship. Copying, moving, backing up, and other operations on items that are the source of a holding relationship do not affect items that are the target of the same relationship—for example, backing up a folder item does not automatically back up all items in that folder (FolderMember(folder member) target in a relationship).
下面是持有关系的例子:Here is an example of a hold relationship:
<Relationship Name=″FolderMembers″BaseType=″Holding”><Relationship Name="FolderMembers"BaseType="Holding">
<Source Name=″Folder″ItemType=″Base.Folder″/><Source Name="Folder" ItemType="Base.Folder"/>
<Target Name=″Item″ItemType=″Base.Item″<Target Name="Item"ItemType="Base.Item"
ReferenceType=″ItemIDReference″/> ReferenceType = "ItemIDReference" />
</Relationship></Relationship>
FolderMember关系使文件夹的概念成为项目的类属集合。The FolderMember relationship makes the concept of a folder a generic collection of items.
c)嵌入关系c) Embedding relationships
嵌入关系将目标项目的生命周期的排外控制的概念模型化。它们允许合成项目的概念。The embedding relationship models the concept of exclusive control of the life cycle of the target item. They allow the notion of compositing items.
嵌入关系实例和作为目标的项目的创建是原子操作。项目能是零个或多个嵌入关系的源。然而一个项目能是一个且仅是一个嵌入关系的目标。作为嵌入关系的目标的项目不能是持有关系的目标。The creation of an embedded relation instance and an item as a target is an atomic operation. Items can be the source of zero or more embedded relationships. However an item can be the object of one and only one embedded relation. An item that is the target of an embedded relationship cannot be the target of a holding relationship.
目标端点引用类型必须是ItemIDReference,且它必须引用在与关系实例相同数据存储中的项目。The target endpoint reference type must be ItemIDReference, and it must refer to an item in the same data store as the relation instance.
在关系声明中指定的端点项目的类型一般在创建该关系的实例时强制。在关系建立之后端点项目的类型不能改变。The type of an endpoint item specified in a relationship declaration is generally enforced when an instance of that relationship is created. The type of an endpoint item cannot be changed after the relationship is established.
嵌入关系控制该目标端点的操作一致性。例如,串行化项目的操作可包括串行化所有源自该项目及所有其目标的所有嵌入关系;复制项目也复制所有其嵌入项目。The embedding relationship controls the operational consistency of that target endpoint. For example, the operation of serializing an item may include serializing all embedded relationships originating from the item and all of its targets; copying an item also copies all of its embedded items.
下面是示例声明:Here is an example declaration:
<Relationship Name=″ArchiveMembers″BaseType=″Embedding”><Relationship Name="ArchiveMembers"BaseType="Embedding">
<Source Name=″Archive″ItemType=″Zip.Archive″/><Source Name="Archive" ItemType="Zip.Archive"/>
<Target Name=″Member″ItemType=″Base.Item″<Target Name="Member" ItemType="Base.Item"
ReferenceType=″ItemIDReference″/> ReferenceType="ItemIDReference"/>
<Property Name=″ZipSize″Type=″the storage<Property Name="ZipSize"Type="the storage
platformTypes.bigint″/>platformTypes.bigint″/>
<Property Name=″SizeReduction″Type=″the storage<Property Name="SizeReduction"Type="the storage
platformTypes.float″/>platformTypes.float″/>
</Relationship></Relationship>
d)引用关系d) Reference relationship
引用关系不控制它引用的项目的生命周期。尤其是,引用关系不保证目标的存在,也不保证目标的类型如关系声明中指定的那样。这意味着引用关系能是悬挂的。而且引用关系能引用在其它数据存储中的项目。引用关系能看作类似于网页上的链接的概念。A reference relationship does not control the lifecycle of the item it references. In particular, a referencing relationship does not guarantee the existence of the target, nor does it guarantee that the target is of the type as specified in the relationship declaration. This means that reference relationships can be dangling. And reference relationships can reference items in other data stores. A citation relationship can be viewed as a concept similar to a link on a web page.
下面是引用关系声明的例子:The following is an example of a reference relationship declaration:
<Relationship Name=″DocumentAuthor″BaseType=″Reference″><Relationship Name="DocumentAuthor"BaseType="Reference">
<Sourc ItemType=″Document″<Sourc ItemType="Document"
ItemType=″Base.Document″/> ItemType = "Base.Document"/>
<Target ItemType=″Author″ItemType=″Base.Author″<Target ItemType="Author"ItemType="Base.Author"
ReferenceType=″ItemIDReference″/> ReferenceType = "ItemIDReference" />
<Property Type=″Role″Type=″Core.CategoryRef″/><Property Type="Role"Type="Core.CategoryRef"/>
<Property Type=″DisplayName″Type=″the storage<Property Type="DisplayName"Type="the storage
platformTypes.nvarchar(256)″/>platformTypes.nvarchar(256)″/>
</Relationship></Relationship>
在目标的端点允许任何引用类型。参与引用关系的项目可以是任何项目类型。Any reference type is allowed on the target's endpoint. Items participating in a reference relationship can be of any item type.
引用关系用于对项目之间的大多数非生命周期管理关系建模。因为不强制目标的存在,引用关系便于对松散耦合的关系建模。引用关系能用于在其它存储,包括在其它计算机上的存储中的目标项目。Reference relationships are used to model most non-lifecycle management relationships between projects. Reference relationships are convenient for modeling loosely coupled relationships because the existence of the target is not enforced. Reference relationships can be used for target items in other stores, including stores on other computers.
e)规则和约束e) Rules and constraints
下列附加规则和约束应用于关系:The following additional rules and constraints apply to relationships:
1.项目必须是(仅一个嵌入关系)或(一个或多个持有关系)的目标。一个例外是根项目。项目能是零个或多个引用关系的目标。1. The item must be the target of (only one embedded relationship) or (one or more holding relationships). One exception is the root project. An item can be the target of zero or more reference relationships.
2.作为嵌入关系目标的项目不能是持有关系的源。它能是引用关系的源。2. An item that is the target of an embedded relationship cannot be the source of the holding relationship. It can be the source of a reference relationship.
3.项目若是从文件升级,则不能是持有关系的源。它能是嵌入关系和引用关系的源。3. If the project is upgraded from a file, it cannot be the source of the holding relationship. It can be the source of embedding and referencing relationships.
4.从文件升级的项目不能是嵌入关系的目标。4. Items promoted from files cannot be targets of embedded relationships.
f)关系的排序f) Ordering of relations
在至少一个实施例中,本发明的存储平台支持关系的排序。通过在基本关系定义中的名为“Order(排序)”的属性来完成排序。在Order字段中无唯一性约束。不保证带有同一“Order”属性值的关系的次序,然而保证它们能排序在带较低“Order”值的关系之后并在带较高“Order”字段值的关系之前。In at least one embodiment, the storage platform of the present invention supports ordering of relationships. Sorting is done through an attribute called "Order" in the base relation definition. There is no uniqueness constraint in the Order field. The order of relations with the same "Order" property value is not guaranteed, however they are guaranteed to be sorted after relations with lower "Order" values and before relations with higher "Order" field values.
应用程序通过在组合(SourceItem ID,RelationshipID,Order)上排序得到默认次序的关系。源自给定项目的所有关系实例被排序成单个集合,而不管在集合中关系的类型。然而这保证给定类型(如,FolderMembers)的所有关系是给定项目的关系集合的已排序子集。The application gets the default order of relationships by sorting on the combination (SourceItem ID, RelationshipID, Order). All relationship instances originating from a given item are sorted into a single collection, regardless of the type of relationship in the collection. However this guarantees that all relations of a given type (eg, FolderMembers) are an ordered subset of a given item's relation collection.
用于操纵关系的数据存储API 312实现一组支持关系的排序的操作。引入下列术语帮助解释那些操作:The
RelFirst是有序集合中带次序值OrdFirst的第一个关系;RelFirst is the first relation in the ordered set with the order value OrdFirst;
RelLast是有序集合中带次序值OrdLast的最后一个关系;RelLast is the last relation in the ordered set with the order value OrdLast;
RelX是集合中带次序值OrdX的给定关系;RelX is a given relation in a collection with an order value OrdX;
RelPrev是集合中最接近于RelX的带小于OrdX的次序值OrdPrev的关系;以及RelPrev is the closest relation in the set to RelX with an order value OrdPrev less than OrdX; and
RelNext是集合中最接近于RelX的带大于OrdX的次序值OrdNext的关系。RelNext is the closest relation in the set to RelX with an order value OrdNext greater than OrdX.
InsertBeforeFirst(SourceItemID,Relationship)InsertBeforeFirst(SourceItemID, Relationship)
插入关系作为集合中的第一个关系。新关系的“Order”属性的值可小于OrdFirst。Inserts a relation as the first relation in the collection. The value of the "Order" attribute of the new relationship can be less than OrdFirst.
InsertAfterLast(SourceItemID,Relationship)InsertAfterLast(SourceItemID, Relationship)
插入关系作为集合中的最后一个关系。新关系的“Order”属性的值可大于OrdLast。Inserts a relation as the last relation in the collection. The "Order" property of the new relationship can have a value greater than OrdLast.
InsertAt(SourceItemID,ord,Relationship)InsertAt(SourceItemID, ord, Relationship)
插入带有对“Order”属性指定的值的关系。Inserts a relationship with the value specified for the "Order" property.
InsertBefore(SourceItemID,ord,Relationship)InsertBefore(SourceItemID, ord, Relationship)
在带有给定次序值的关系之前插入该关系。新的关系可被分配“Order”值,它在OrdPrev和ord之间,但不包括这两个值。Inserts this relation before the relation with the given order value. New relations may be assigned the "Order" value, which is between, but not including, OrdPrev and ord.
InsertAfter(SourceItemID,ord,Relationship)InsertAfter(SourceItemID, ord, Relationship)
在带有给定次序值的关系之后插入该关系。新的关系可被分配“Order”值,它在ord和OrdNext之间,但不包括这两个值。Inserts this relation after the relation with the given order value. New relations may be assigned the "Order" value, which is between but not including ord and OrdNext.
MoveBefore(SourceItemID,ord,Relationship)MoveBefore(SourceItemID, ord, Relationship)
将带给定关系ID的关系移动到带指定“Order”值的关系之前。关系可被分配新的“Order”值,它在OrdPrev和ord之间,但不包括这两个值。Moves the relation with the given relation ID before the relation with the specified "Order" value. Relationships can be assigned a new "Order" value, which is between, but not including, OrdPrev and ord.
MoveAfter(SourceItemID,ord,Relationship)MoveAfter(SourceItemID, ord, Relationship)
将带给定关系ID的关系移动到带指定“Order”值的关系之后。该关系可被分配新的次序值,它在ord和OrdNext之间,但不包括这两个值。Moves the relationship with the given relationship ID after the relationship with the specified "Order" value. The relationship can be assigned a new order value, which is between but not including ord and OrdNext.
如前提到,每个项目必须是项目文件夹的成员。按照关系,每个项目必须与一项目文件夹有关系。在本发明的若干实施例中,某些关系由在诸项目之间存在的关系表示。As mentioned earlier, each project must be a member of the project folder. By relationship, each project must have a relationship with a project folder. In several embodiments of the invention, certain relationships are represented by relationships that exist between items.
如对本发明的各实施例的实现,关系提供有向的二元关系,它由一个项目(源)延伸到另一项目(目标)。关系由源项目(延伸它的项目)拥有,因此若源被移除则关系被移除(如在源项目被删除时关系被删除)。此外在某些情况下,关系可共享(共同拥有的)目标项目的拥有权,且那样的拥有权仅可反映在关系的IsOwned(被拥有)属性(或其等效属性)中(如图7对关系属性类型所示)。在这些实施例中,创建新的IsOwned关系自动递增该目标项目上的引用计数,而删除那样的关系可递减该目标项目上的引用计数。对这些特定实施例,若项目具有大于0的引用计数,则继续存在,若项目计数达到0则自动删除。再一次,项目文件夹是具有(或能具有)与其它项目的一组关系的项目,这些其它项目包括项目文件夹的成员资格。关系的其它实际实现是可能的,并由本发明构想来实现这里描述的功能。As implemented for various embodiments of the invention, relationships provide directed binary relationships extending from one item (source) to another item (target). A relationship is owned by the source item (the item that extends it), so the relationship is removed if the source is removed (eg, the relationship is deleted when the source item is deleted). Also in some cases, relationships can share (co-owned) ownership of the target item, and that ownership can only be reflected in the relationship's IsOwned property (or its equivalent) (see Figure 7 shown for relational attribute types). In these embodiments, creating a new IsOwned relationship automatically increments the reference count on the target project, while deleting such a relationship decrements the reference count on the target project. For these particular embodiments, an item persists if it has a reference count greater than zero, and is automatically deleted if the item count reaches zero. Again, a project folder is a project that has (or can have) a set of relationships with other projects, including membership of the project folder. Other practical implementations of relationships are possible and contemplated by the present invention to achieve the functionality described herein.
不管实际的实现如何,关系是从一个对象到另一对象的可选择的连接。一个项目属于一个以上项目文件夹以及一个或多个类别,而不论这些项目、文件夹和类别是公有的或私有的能力是由给予基于项目的结构中的存在(或缺乏)的意义所确定的。这些逻辑关系是分配给一组关系的意义,而不论其专门用来实现这里所述功能的物理实现如何。逻辑关系是在项目及其文件夹或类别之间建立的(或相反),因为本质上项目文件夹和类别的每一个都是特定类型的项目。因此,能象其它项目一样地对项目文件夹和类别起作用(复制、添加到电子邮件消息中、嵌入文档等等,而无限制),而项目文件夹和类别能象其它项目一样使用相同的机制串行化和反串行化(导入和导出)。(例如在XML中,所有项目可具有串行化的格式,且此格同等地应用于项目文件夹、类别和项目)。Regardless of the actual implementation, a relationship is an optional connection from one object to another. The ability for a project to belong to more than one project folder and one or more categories, whether those projects, folders and categories are public or private, is determined by the meaning given to the presence (or lack thereof) in project-based structures . These logical relationships are the meanings assigned to a set of relationships, regardless of its physical implementation designed to perform the functions described herein. Logical relationships are established between projects and their folders or categories (or vice versa), because essentially project folders and categories are each a specific type of project. Thus, project folders and categories can be acted upon like other projects (copied, added to e-mail messages, embedded in documents, etc. without limitation), and project folders and categories can be used like other projects using the same Mechanisms for serialization and deserialization (import and export). (eg in XML all items can have a serialized format and this grid applies equally to item folders, categories and items).
表示项目及其项目文件夹之间的关系的上述关系在逻辑上能从项目延伸到项目文件夹、从项目文件夹延伸到项目、或两者。逻辑上从项目延伸到项目文件夹的关系表明该项目文件夹对于该项目是公有的,并与该项目共享其成员资格信息;相反,缺乏从项目到项目文件夹的逻辑关系表明该项目文件夹对该项目是私有的,且不与该项目共享其成员资格信息。类似地,逻辑上从项目文件夹延伸到项目的关系表明该项目是公有的,并可与该项目文件夹共享,而缺乏从项目文件夹延伸到项目的逻辑关系表明该项目是私有的且不能共享。因此,当向其它系统导出项目文件夹时,它是“公有”的项目,它在新的环境中共享,且当项目搜索其项目文件夹寻找其它可共享的项目时,它是“公有”的项目文件夹,它向该项目提供关于属于它的可共享项目的信息。The relationships described above, which represent relationships between projects and their project folders, can logically extend from projects to project folders, from project folders to projects, or both. A relationship that logically extends from a project to a project folder indicates that the project folder is public to the project and shares its membership information with the project; conversely, a lack of a logical relationship from the project to the project folder indicates that the project folder is private to the project and does not share membership information with the project. Similarly, a relationship that logically extends from a project folder to a project indicates that the project is public and can be shared with the project folder, whereas the lack of a relationship that extends logically from the project folder to the project indicates that the project is private and cannot shared. Therefore, when exporting a project folder to another system, it is "public" to the project, it is shared in the new environment, and it is "public" when the project searches its project folder for other shareable projects A project folder that provides the project with information about shareable projects that belong to it.
图9是示出项目文件夹(它本身也是项目)、其成员项目、和项目文件夹及其成员项目之间互连关系的框图。项目文件夹900具有多个项目902、904和906作为其成员。项目文件夹900具有从它本身到项目902的关系912,它表明项目902是公有的,且能与项目文件夹900、其成员904和906、和任何可访问项目文件夹900的任何其它项目文件夹、类别、或项目(未示出)共享。然而从项目902到项目文件夹项目900没有关系,这表明项目文件夹900对项目902是私有的,且不与项目902共享其成员资格信息。另一方面,项目904确实具有从它本身到项目文件夹900的关系924,这表明项目文件夹900是公有的,且与项目904共享其成员资格信息。然而没有从项目文件夹900到项目904的关系,这表明项目904是私有的,且不与项目文件夹900、其另外的成员902、906、及可访问项目文件夹900的任何其它项目文件夹、类别、或项目(未示出)共享。与其到项目902和904的关系(或没有这些关系)相反,项目文件夹900具有从其本身到项目906的关系916,且项目906具有回到项目文件夹900的关系926,一起表明项目906是公有的,且能对项目文件夹900、其成员902和904、和可访问项目文件夹900的任何其它项目文件夹、类别、或项目(未示出)共享,且项目文件夹900是公有的,并与项目906共享其成员资格信息。FIG. 9 is a block diagram showing a project folder (which is itself a project), its member projects, and the interconnection relationship between the project folder and its member projects. Project folder 900 has a number of projects 902, 904, and 906 as its members. Project folder 900 has a relationship 912 from itself to project 902, which indicates that project 902 is public and can be shared with project folder 900, its members 904 and 906, and any other project files that can access project folder 900 Folders, categories, or items (not shown) are shared. However, there is no relationship from project 902 to project folder project 900 , indicating that project folder 900 is private to project 902 and does not share its membership information with project 902 . On the other hand, project 904 does have a relationship 924 from itself to project folder 900 , which indicates that project folder 900 is public and shares its membership information with project 904 . However there is no relationship from project folder 900 to project 904, which indicates that project 904 is private and not related to project folder 900, its other members 902, 906, and any other project folder that can access project folder 900 , category, or project (not shown) sharing. In contrast to its relationships (or lack thereof) to projects 902 and 904, project folder 900 has a relationship 916 from itself to project 906, and project 906 has a relationship 926 back to project folder 900, together indicating that project 906 is public, and can be shared with project folder 900, its members 902 and 904, and any other project folder, category, or project (not shown) that can access project folder 900, and project folder 900 is public , and share its membership information with project 906.
如前讨论,在项目文件夹中的项目不需要共享共同性,因为项目文件夹未被“描述”。另一方面,类别由对所有其成员项目共同的共同性描述。因此,类别的成员资格固有地限于具有所描述的共同性的项目,且在某些实施例中,满足类别的描述的所有项目自动地成为该类别的成员。因此,尽管项目文件夹允许由其成员资格来表示不重要的类型结构,类别基于定义的共同性来允许成员资格。As discussed previously, projects within project folders need not share commonality because project folders are not "described". A category, on the other hand, is described by a commonality common to all its member projects. Thus, membership of a class is inherently limited to items that have a described commonality, and in some embodiments, all items that satisfy a class's description automatically become members of that class. Thus, while project folders allow unimportant type structures to be represented by their membership, categories allow membership based on defined commonality.
当然,类别描述本质上是逻辑的,因而类别可通过类型、属性和/或值的任何逻辑表示来描述。例如,对类别的逻辑表示可以是其成员资格,以包括具有两个属性之一或两者的项目。若这些对类别描述的属性是“A”和“B”,则该类别的成员资格可包括具有属性A而没有B的项目、具有属性B而没有A的项目、及兼有属性A和B的项目。通过逻辑运算符“OR(或)”来描述属性的逻辑表示,其中由类别描述成员组是具有属性A OR B的项目。如本领域的技术人员所理解的,也能使用类似的逻辑运算符(包括但不限于单独的“AND(和)”“XOR(异或)”和“NOT(非)”或其组合)来描述类别。Of course, class descriptions are logical in nature, so classes can be described by any logical representation of types, attributes and/or values. For example, a logical representation of a category could be its membership to include items with either or both attributes. If the attributes described for a class are "A" and "B," membership in that class can include items with attribute A but not B, items with attribute B but not A, and items with both attributes A and B project. The logical representation of the attribute is described by the logical operator "OR", where the member group described by the category is an item with attribute A OR B. As will be appreciated by those skilled in the art, similar logical operators (including but not limited to "AND (and)", "XOR (exclusive or)" and "NOT (not)" alone or in combination thereof can also be used to Describe the category.
尽管在项目文件夹(未描述)和类别(已描述)之间有区别,但在本发明的许多实施例中,原则上到项目的类别关系及到类别的项目关系以上面对项目文件夹和项目的同样方法揭示。Although there is a distinction between project folders (not described) and categories (described), in many embodiments of the invention, in principle, category relationships to projects and project relationships to categories above face project folders and Items are revealed in the same way.
图10是示出类别(其本身也是项目)、其成员项目、类别及其成员项目之间的互连关系的框图。类别1000具有多个项目1002、1004和1006作为成员,所有这些都共享由类别1000描述的共同的属性、值和类型1008(共同性描述1008′)的某个组合。类别1000具有从其本身到项目1002的关系,它表明项目1002是公有的,且能与类别1000、其成员1004和1006、以及可访问类别1000的任何其它类别、项目文件夹、或项目(未示出)共享。然而,没有从项目1002到类别1000的关系,这表明类别1000对项目1002是私有的,且不与项目1002共享成员资格信息。另一方面,项目1004的确具有从其本身到类别1000的关系1024,这表明类别1000是公有的,且与项目1004共享其成员资格信息。然而,不存在从类别1000延伸到项目1004的关系,这表明项目1004是私有的,且不能与类别1000、它的其它成员1002和1006、以及可访问类别1000的任何其它类别、项目文件夹、或项目(未示出)共享。与它与项目1002和1004的关系(或没有此关系)相反,类别1000具有从其本身到项目1006的关系1016,且项目1006具有回到类别1000的关系1026,这一起表明项目1006是公有的,且能与类别1000、其项目成员1002和1004、以及可访问类别1000的任何其它类别、项目文件夹、或项目(未示出)共享,且类别1000是公有的,且与项目1006共享其成员资格信息。Fig. 10 is a block diagram showing a category (which is itself an item), its member items, and the interconnection relationship between the category and its member items.
最后,由于类别和项目文件夹本身是项目,且项目可以互相关系,类别可关系到项目文件夹,反之亦然,且在某些另外实施例中,类别、项目文件夹和项目可分别关系到其它类别、项目文件夹和项目。然而在各种实施例中,项目文件夹结构和/或类别结构在硬件/软件接口系统级上禁止包含回路。当项目文件夹和类别结构类似于有向图时,禁止回路的实施例类似于有向非循环图(DAG),根据图论领域的数学定义,DAG是其中没有路径在同一顶点开始与终止的有向图。Finally, since categories and project folders are themselves projects, and projects can relate to each other, categories can relate to project folders and vice versa, and in some further embodiments, categories, project folders and projects can each relate to Other categories, project folders and projects. In various embodiments, however, the project folder structure and/or class structure prohibits containment loops at the hardware/software interface system level. While the project folder and category structure resembles a directed graph, an embodiment that prohibits loops resembles a directed acyclic graph (DAG), which, according to the mathematical definition in the field of graph theory, is one in which no path begins and ends at the same vertex directed graph.
6.可扩展性6. Scalability
如上所述,本存储平台旨在提供初始模式集340。然而,至少在某些实施例中,该存储平台还允许包括独立软件分销商(ISV)等顾客创建新的模式344(即新的项目和嵌套的元素类型)。本节讨论通过扩展在初始模式集340中定义的项目类型和嵌套的元素类型(或简称“元素”类型)着眼于创建该模式的机制。As mentioned above, the present storage platform aims to provide an initial schema set 340 . However, at least in some embodiments, the storage platform also allows customers, including independent software vendors (ISVs), to create new schemas 344 (ie, new items and nested element types). This section discusses the mechanism for creating this schema by extending the item types and nested element types (or simply "element" types) defined in the initial schema set 340 .
较佳地,项目和嵌套元素类型的初始组的扩展如下约束:Preferably, the expansion of the initial set of item and nested element types is constrained as follows:
允许ISV引入新的项目类型,即子类型Base.Item;Allow ISVs to introduce a new item type, the subtype Base.Item;
允许ISV引入新的嵌套元素类型,即子类型Base.NestedElement;Allow ISVs to introduce a new nested element type, the subtype Base.NestedElement;
允许ISV引入新的扩展,即子类型Base.NestedElement;但ISVs are allowed to introduce new extensions, the subtype Base.NestedElement; but
ISV不能子类型化由存储平台的初始模式集340定义的任何类型(项目、嵌入元素、或扩展类型)。ISVs cannot subtype any type (item, embedded element, or extension type) defined by the storage platform's initial schema set 340 .
由于由存储平台的初始模式组定义的项目类型或嵌入元素类型可能完全匹配ISV应用程序的需要,必须允许ISV定制该类型。这就考虑了扩展的概念。扩展是强类型化的实例,但是(a)它们不能独立存在,以及(b)它们必须附属于项目或嵌套元素。Since an item type or embedded element type defined by a storage platform's initial schema set may exactly match the needs of an ISV application, the ISV must be allowed to customize the type. This takes into account the concept of extension. Extensions are strongly typed instances, but (a) they cannot stand alone, and (b) they must be attached to an item or nested element.
除了解决对模式可扩展性的需要之外,扩展还旨在解决“多类型化”问题。在某些实施例中,因为存储平台可能不支持多继承性或重叠子类型,应用程序可以使用扩展作为模型化重叠类型实例(如文档既是合法文档又是安全文档)的方法。In addition to addressing the need for schema extensibility, the extension also aims to address "multityping". In some embodiments, because storage platforms may not support multiple inheritance or overlapping subtypes, applications may use extensions as a way to model instances of overlapping types (eg, a document that is both a legal document and a secure document).
a)项目扩展a) Project extension
为提供项目的可扩展性,数据模型还定义名为Base.Extension的抽象类型。这是扩展类型的分层结构的根类型。应用程序可以子类型化Base.Extension,以创建特定的扩展类型。To provide extensibility of the project, the data model also defines an abstract type called Base.Extension. This is the root type of the hierarchy of extension types. Applications can subtype Base.Extension to create specific extension types.
在基础模式中如下定义Base.Extension类型:Define the Base.Extension type in the base schema as follows:
<Type Name=″Base.Extension″IsAbstract=″True″><Type Name="Base.Extension" IsAbstract="True">
<Propety Name=″ItemID″<Propety Name="ItemID"
Type=″the storage platformTypes.uniqueidentified″Type = "the storage platformTypes.uniqueidentified"
Nullable=″false″ Nullable = "false"
MultiValued=″false″/> MultiValued="false"/>
<Property Name=″ExtensionID″<Property Name="ExtensionID"
Type=″the storage platformTypes.uniqueidentified″Type = "the storage platformTypes.uniqueidentified"
Nullable=″false″Nullable = "false"
MultiValued=″false″/> MultiValued="false"/>
</Type></Type>
ItemID字段包含与该扩展关联的项目的ItemID。带此ItemID的项目必须存在。若带给定ItemID的项目不存在,则不能创建扩展。当项目被删除,带同一ItemID的所有扩展被删除。元组(ItemID,ExtensionID)唯一地标识了扩展实例。The ItemID field contains the ItemID of the item associated with this extension. An item with this ItemID must exist. If an item with the given ItemID does not exist, the extension cannot be created. When an item is deleted, all extensions with the same ItemID are deleted. The tuple (ItemID, ExtensionID) uniquely identifies the extension instance.
扩展类型的结构类似于项目类型的结构:The structure of an extension type is similar to that of an item type:
扩展类型具有字段;Extension types have fields;
字段可以是原语或嵌套元素类型;以及fields can be primitive or nested element types; and
扩展类型可被子分类。Extension types can be subcategorized.
下列限制应用于扩展类型The following restrictions apply to extension types
扩展不能是关系的源和目标;An extension cannot be the source and target of a relationship;
扩展类型实例不能独立于项目存在;以及An instance of an extension type cannot exist independently of the item; and
扩展类型不能用作在存储平台类型定义中的字段类型Extension types cannot be used as field types in storage platform type definitions
对能与给定的项目类型关联的扩展的类型没有约束。任何扩展类型允许扩展任何项目类型。当多个扩展实例被附加到一个项目,它们在结构和行为上彼此独立。There are no constraints on the types of extensions that can be associated with a given item type. Any extension type allows extension of any item type. When multiple extension instances are attached to a project, they are independent of each other in structure and behavior.
扩展实例被分别存储并从项目访问。所有扩展类型实例可从全局扩展视图访问。能组成一有效的查询,它将返回给定类型的扩展的所有实例,而不管它们与什么类型的项目相关联。存储平台API提供可存储、检索和修改项目扩展的编程模型。Extension instances are stored separately and accessed from projects. All extension type instances are accessible from the global extension view. An efficient query can be composed that returns all instances of an extension of a given type, regardless of what type of item they are associated with. The Storage Platform API provides a programming model for storing, retrieving and modifying project extensions.
扩展类型可以是使用存储平台的单个继承模型来子类型化的类型。从一个扩展类型导出创建新的扩展类型。一个扩展的结构或行为不能覆盖或替代项目类型分层结构的结构或行为。An extension type can be a type that is subtyped using the storage platform's single inheritance model. Creates a new extension type derived from an extension type. An extended structure or behavior cannot override or replace the structure or behavior of the item type hierarchy.
类似于项目类型,扩展类型实例能通过与该扩展类型相关联的视图来直接访问。扩展的ItemID表明它们属于哪个项目,并能用于从全局项目视图检索对应的项目对象。Similar to item types, extension type instances can be accessed directly through the views associated with the extension type. Extended ItemIDs indicate which item they belong to and can be used to retrieve the corresponding item object from the global item view.
为操作一致性的目的,扩展被考虑成项目的一部分。复制/移动、备份/恢复和存储平台定义的其它常用操作可以在作为项目的一部分的扩展上操作。For operational consistency purposes, extensions are considered part of the project. Copy/move, backup/restore, and other common operations defined by the storage platform can operate on extensions that are part of the project.
考虑下述例子。在Windows类型集中定义Contact类型。Consider the following example. Define the Contact type in the Windows type set.
<Type Name=″Contact″BaseType=“Base.Item”><Type Name="Contact"BaseType="Base.Item">
<Property Name=″Name″<Property Name="Name"
Type=″String″ Type = "String"
Nullable=″false″Nullable = "false"
MultiValued=″false″/> MultiValued="false"/>
<Property Name=″Address″<Property Name="Address"
Type=″Address″ Type = "Address"
Nullable=″true″
MultiValued=″false″/> MultiValued="false"/>
</Type></Type>
CRM应用程序开发者喜欢将CRM应用程序扩展附加到存储在存储平台中的联系人。应用程序开发者定义包含应用程序能处理的附加数据结构的CRM扩展。CRM application developers like to attach CRM application extensions to contacts stored in storage platforms. Application developers define CRM extensions that contain additional data structures that the application can handle.
<Type Name=″CRMExtension″BaseType=″Base.Extension″><Type Name="CRMExtension"BaseType="Base.Extension">
<Property Name=″CustomerID″<Property Name="CustomerID"
Type=″String″ Type = "String"
Nullable=″false″
MultiValued=″false″/> MultiValued="false"/>
......
</Type></Type>
HR应用程序开发者希望也将附加数据附加到联系人。此数据独立于CRM应用程序数据。应用程序开发者还可创建扩展HR application developers wish to attach additional data to contacts as well. This data is separate from CRM application data. Application developers can also create extensions
<Type Name=″HRExtension″EBaseType=″Base.Extension″><Type Name="HRExtension"EBaseType="Base.Extension">
<Property Name=″EmployeeID″<Property Name="EmployeeID"
Type=″String″ Type = "String"
Nullable=″false″Nullable = "false"
MultiValued=″false″/> MultiValued="false"/>
......
</Type></Type>
CRMExtension和HRExtension是能附加到联系人项目的两个独立扩展。它们能彼此独立地创建和访问。CRMExtension and HRExtension are two separate extensions that can be attached to contact items. They can be created and accessed independently of each other.
在上述例子中,CRMExtension类型的字段和方法不能覆盖联系人分层结构的字段和方法。应注意,CRMExtension类型的实例能被附加到不同于联系人的项目类型。In the above example, the fields and methods of the CRMExtension type cannot override the fields and methods of the contact hierarchy. It should be noted that instances of the CRMExtension type can be attached to item types other than Contacts.
在检索联系人项目时,不自动地检索其项目扩展。给定联系人项目,可通过查询全局扩展视图以寻找带同一ItemID的扩展来访问其有关的项目扩展。When retrieving a contact item, its item extension is not automatically retrieved. Given a contact item, its related item extensions can be accessed by querying the global extensions view for extensions with the same ItemID.
可通过CRMExtension类型视图来访问系统中所有的CRMExtension扩展,而不论它们属于什么项目。一个项目的所有项目扩展共享同一项目ID。在上述例子中,Contact项目实例和附加的CRMExtension和HRExtension实例共享同一ItemID。All CRMExtension extensions in the system, regardless of the project they belong to, can be accessed through the CRMExtension type view. All project extensions of a project share the same project ID. In the above example, the Contact item instance and the attached CRMExtension and HRExtension instances share the same ItemID.
下表总结了在Item(项目)、Extension(扩展)和NestedElement(嵌套元素)类型之间的相似性和差别:The following table summarizes the similarities and differences between the Item, Extension, and NestedElement types:
Item、ItemExtension与NestedElementItem, ItemExtension and NestedElement
b)扩展NestedElement类型b) Extend the NestedElement type
嵌套元素类型不用与项目类型相同的机制来扩展。嵌套元素的扩展用与嵌套元素类型字段相同的机制来存储和访问。Nested element types are not extended by the same mechanism as item types. Nested element extensions are stored and accessed using the same mechanisms as nested element type fields.
数据模型定义了名为Element(元素)的嵌套元素类型的根:The data model defines the root of a nested element type named Element:
<Type Name=″Element″<Type Name="Element"
IsAbstract=″True″>IsAbstract="True">
<Property Name=″ElementID″<Property Name="ElementID"
Type=″the storage platformTypes.uniqueidentifier″Type = "the storage platformTypes.uniqueidentifier"
Nullable=″false″Nullable = "false"
MultiValued=″false″/> MultiValued="false"/>
</Type></Type>
NestedElement类型从此类型继承。NestedElement元素类型另外定义一字段,它是多集元素。The NestedElement type inherits from this type. The NestedElement element type additionally defines one field, which is the multiset element.
<Type Name=″NestedElement″BaseType=″Base.Element″<Type Name="NestedElement"BaseType="Base.Element"
IsAbstract=″True″>IsAbstract="True">
<Property Name=″Extensions″<Property Name="Extensions"
Type=″Base.Element″ Type = "Base.Element"
Nullable=″false″
MultiValued=″true″/>MultiValued="true"/>
</Type></Type>
NestedElement扩展在以下方面不同于项目扩展:NestedElement extensions differ from item extensions in the following ways:
嵌套元素扩展不是扩展类型。它们不属于以Base.Extension类型为根的扩展类型分层结构。Nested element expansion is not an expansion type. They do not belong to the extension type hierarchy rooted at the Base.Extension type.
嵌套元素扩展与该项目的其它字段一起存储,且不是全局可访问的-不能组成检索给定扩展类型的所有实例的查询。Nested element extensions are stored with the item's other fields and are not globally accessible - queries that retrieve all instances of a given extension type cannot be composed.
如存储其它嵌套元素(或项目)一样地存储这些扩展。如其它的嵌套集,NestedElement扩展被存在UDT中。它们可通过嵌套元素类型的Extension(扩展)字段来访问。These extensions are stored like other nested elements (or items). Like other nested sets, NestedElement extensions are stored in UDTs. They are accessible through the Extension field of the nested element type.
用于访问多值属性的集合接口也用于在类型扩展集上的访问和迭代。The collection interfaces used to access multivalued properties are also used for access and iteration over collections of type extensions.
下面的表总结和比较了Item扩展和NestedElement扩展。The following table summarizes and compares Item extensions and NestedElement extensions.
Item扩展与NestedElement扩展Item extension and NestedElement extension
D.数据库引擎D. Database engine
如上提到,数据存储在数据库引擎上实现。在本实施例中,数据库引擎包括诸如Microsoft SQL Server引擎等实现SQL查询语言、带有对象关系扩展的关系型数据库引擎。本节按照本实施例描述了数据存储实现的数据模型到关系存储的映射,在逻辑API上提供由存储平台的客户机使用的信息。然而可以理解,当采用不同的数据库引擎时可采用不同的映射。确实,除了在关系型数据库引擎上实现存储平台概念数据模型之外,也可在其它类型数据库上实现,如面向对象和XML数据库。As mentioned above, data storage is implemented on the database engine. In this embodiment, the database engine includes a relational database engine that implements SQL query language and has object-relational extensions, such as Microsoft SQL Server engine. This section describes the mapping from the data model implemented by the data storage to the relational storage according to this embodiment, and provides the information used by the client of the storage platform on the logic API. It will be appreciated, however, that different mappings may be used when different database engines are used. Indeed, in addition to implementing the storage platform conceptual data model on the relational database engine, it can also be implemented on other types of databases, such as object-oriented and XML databases.
面向对象(OO)数据库系统为编程语言对象(如C++、Java)提供持续性和事务。“项目”的存储平台概念可很好地映射到面向对象系统中的对象,虽然嵌入的集合必须添加给对象。类似继承性和嵌套元素类型等其它存储平台类型概念也映射到面向对象类型的系统。面向对象系统通常已经支持对象身份;因此,项目身份可被映射到对象身份。项目的行为(操作)很好地映射到对象方法。然而,面向对象的系统通常缺乏组织能力并在搜索方面很差。而且,面向对象的系统不提供对非结构化和半结构化数据的支持。为支持这里描述的完全存储平台数据模型,如关系、文件夹和扩展等概念需要添加到对象数据模型。此外,需要实现如升级、同步、通知和安全性等机制。Object-oriented (OO) database systems provide persistence and transactions for programming language objects (eg, C++, Java). The storage platform concept of "items" maps well to objects in object-oriented systems, although embedded collections must be added to objects. Other storage platform type concepts like inheritance and nested element types also map to the object-oriented type system. Object-oriented systems typically already support object identities; thus, item identities can be mapped to object identities. The behavior (operations) of items map nicely to object methods. However, object-oriented systems often lack organizational capabilities and are poor at searching. Also, object-oriented systems do not provide support for unstructured and semi-structured data. To support the full storage platform data model described here, concepts such as relationships, folders, and extensions need to be added to the object data model. Additionally, mechanisms such as upgrades, synchronization, notifications, and security need to be implemented.
类似于面向对象的系统,基于XSD(XML模式定义)的XML数据库支持基于单继承类型的系统。本发明的项目类型系统可映射到XSD类型模型。XSD也不提供对行为的支持。项目的XSD必须增添项目的行为。XML数据库处理单个XSD文档并缺乏组织和拓宽搜索能力。如面向对象数据库那样,为支持这里描述的数据模型,如关系和文件夹等其它概念需要被结合到该XML数据库;而且需要实现如同步、通知和安全性等机制。Similar to object-oriented systems, XML databases based on XSD (XML Schema Definition) support systems based on single-inheritance types. The item type system of the present invention is mappable to an XSD type model. XSD does not provide support for behaviors either. The project's XSD must add the project's behavior. XML databases deal with a single XSD document and lack organization and broad search capabilities. As with object-oriented databases, to support the data model described here, other concepts such as relationships and folders need to be incorporated into the XML database; and mechanisms such as synchronization, notification and security need to be implemented.
1.使用UDT的数据存储实现1. Data storage implementation using UDT
在本实施例中,在一个实施例中包括Microsoft SQL Server引擎的关系型数据库引擎314支持内建的标量类型。内建的标量类型是“原有”且“简单”的。它们是原有的意义是,用户不能定义他们自己的类型;它们是简单的意义是,用户不能封装复杂的结构。用户定义的类型(下文称为UDT)通过使用户能通过定义复杂的结构化类型来扩展类型系统,提供了一种用于超过或超越原有的标量类型系统的类型可扩展性的机制。一旦由用户定义,UDT能用于可以使用内建标量类型的类型系统中的任何地方。In this embodiment, the relational database engine 314, which in one embodiment includes the Microsoft SQL Server engine, supports built-in scalar types. The built-in scalar types are "old" and "simple". They are primitive in the sense that users cannot define their own types; they are simple in the sense that users cannot encapsulate complex structures. User-defined types (hereinafter referred to as UDTs) provide a mechanism for type extensibility beyond or beyond the original scalar type system by enabling users to extend the type system by defining complex structured types. Once defined by the user, UDTs can be used anywhere in the type system where built-in scalar types can be used.
按本发明的一个方面,存储平台模式被映射到数据库引擎存储中的UDT类。数据存储项目被映射到从Base.Item类型导出的UDT类。类似于项目,扩展也能映射到UDT类并使用继承。根扩展类型是Base.Extension,从它导出所有扩展类型。According to one aspect of the invention, storage platform schemas are mapped to UDT classes in database engine storage. Data store items are mapped to UDT classes derived from the Base.Item type. Similar to projects, extensions can also be mapped to UDT classes and use inheritance. The root extension type is Base.Extension, from which all extension types are derived.
UDT是CLR类,它具有状态(即数据字段)和行为(即例程)。使用任何受管语言(c#、VB.NET等)定义UDT。UDT方法和操作符能在T-SQL中针对该类型的实例调用。UDT能是:行中列的类型、T-SQL中例程的参数的类型、或在T-SQL中变量的类型。A UDT is a CLR class that has state (ie data fields) and behavior (ie routines). Define UDTs using any managed language (c#, VB.NET, etc.). UDT methods and operators can be invoked on instances of this type in Transact-SQL. A UDT can be: the type of a column in a row, the type of a parameter of a routine in T-SQL, or the type of a variable in T-SQL.
以下示例示出了UDT的基础。假定MapLib.dll具有称为MapLib的程序集。在该程序集中,在名字空间BaseTypes下,存在称为Point的类:The following example shows the basics of a UDT. Assume MapLib.dll has an assembly called MapLib. In that assembly, under the namespace BaseTypes, there is a class called Point:
namespace BaseTypesnamespace BaseTypes
{{
public class Pointpublic class Point
{{
//返回离指定点的距离。// Returns the distance from the specified point.
public double Distance(Point p)public double Distance(Point p)
{{
//返回点p和该点之间的距离//Returns the distance between point p and this point
}}
//该类中的其它内容//Other content in this class
}}
}}
以下T-SQL代码将类Point绑定到称为Point的SQL Server UDT。第一步调用“Create Assembly”(创建程序集),它将MapLib程序集加载到数据库。第二步调用“Create Type”(创建类型),以创建用户定义类型“Point”,并将其绑定到受管类型BastTypes.Point:The following T-SQL code binds the class Point to a SQL Server UDT called Point. The first step calls "Create Assembly", which loads the MapLib assembly into the database. The second step calls "Create Type" to create the user-defined type "Point" and bind it to the managed type BastTypes.Point:
CREATE ASSEMBLY MaplibCREATE ASSEMBLY Maplib
FROM′\\myserv\share\MapLib.dll′FROM'\\myserv\share\MapLib.dll'
gogo
CREATE TYPE PointCREATE TYPE Point
EXTERNAL NAME′BaseTypes.Point′EXTERNAL NAME'BaseTypes.Point'
gogo
一旦被创建,“Point”UDT可用作表中的列,且该方法可以在T-SQL中如下所示地调用:Once created, the "Point" UDT can be used as a column in a table, and the method can be called in T-SQL as follows:
Create table Cities(Create table Cities(
Name varchar(20),Name varchar(20),
State varchar(20),State varchar(20),
Location Point)Location Point)
--检索城市到坐标(32,23)的距离-- Retrieve the distance from the city to coordinates (32, 23)
Declare@p point(32,23),@distance floatDeclare @p point(32, 23), @distance float
Select Location::Distance(@p)Select Location::Distance(@p)
From CitiesFrom Cities
存储平台模式到UDT类的映射在高级别上完全是直接的。一般而言,存储平台模式被映射到CLR名字空间。存储平台类型被映射到CLR类。CLR类的继承镜象了存储平台类型的继承,且存储平台属性被映射到CLR类属性。The mapping of storage platform schemas to UDT classes is completely straightforward at a high level. In general, storage platform schemas are mapped to CLR namespaces. Storage platform types are mapped to CLR classes. CLR class inheritance mirrors storage platform type inheritance, and storage platform attributes are mapped to CLR class attributes.
图29所示的项目分层结构在本文档中用作一个示例。它示出了从其中导出所有项目类型的Base.Item类型,以及一组导出的项目类型(例如,Contact.Person和Contact.Employee),其中继承由箭头指示。The project hierarchy shown in Figure 29 is used as an example in this document. It shows the Base.Item type from which all item types are derived, and a set of exported item types (eg, Contact.Person and Contact.Employee), where inheritance is indicated by arrows.
2.项目映射2. Project Mapping
为了希望项目能够被全局地搜索,并在本实施例的关系型数据中支持继承以及类型可替代性,对在数据库存储中的项目存储的一种可能的实现是在带有类型Base.Item的列的单个表中存储所有项目。使用类型可替代性,能存储所有类型的项目,且可按使用Yukon的“is of(类型)”的操作符的项目类型和子类型来过滤搜索。In order to hope that items can be searched globally, and support inheritance and type substitutability in the relational data of this embodiment, a possible implementation of item storage in database storage is in a class with type Base.Item Store all items in a single table of columns. Using type substitutability, items of all types can be stored and searches can be filtered by item type and subtype using Yukon's "is of(type)" operator.
然而,由于在本实施例中牵涉到与这一方法相关联的额外开销,按顶级类型划分各项目,使得每个类型“家族”的项目存储到单独的表中。在此划分模式中,对每个直接从Base.Item继承的项目类型创建一个表。如上所述,继承下面这些的类型使用类型的可替代性存储在合适的类型家族表中。只有来自Base.Item的第一级继承被专门地处理。对于图29所示的示例项目分层结构,这可得到以下类型家族表:However, due to the overhead involved in this embodiment that is associated with this approach, items are divided by top-level type such that items for each "family" of types are stored into separate tables. In this partitioning schema, a table is created for each item type that directly inherits from Base.Item. As noted above, types inheriting from the following use type substitutability stored in the appropriate type family table. Only the first level of inheritance from Base.Item is handled exclusively. For the example project hierarchy shown in Figure 29, this results in the following type family table:
create tabele Contact.[Table!Person](create tabele Contact. [Table! Person](
_Item Contact.Person not null_Item Contact.Person not null
{Change tracking information}{Change tracking information}
))
create table Doc.[Table!Document](create table Doc. [Table! Document](
_Item Doc.Document not null,_Item Doc. Document not null,
{Change tracking information}{Change tracking information}
))
使用“阴影”表存储所有项目的全局可搜索属性的副本。此表可由存储平台API的Update()方法维护,通过此方法作出所有数据的改变。不象类型家族表,此全局项目表只包含该项目的顶级标量属性,而不是全UDT项目对象。全局项目表的结构如下:Use a "shadow" table to store a copy of all items' globally searchable attributes. This table can be maintained by the Update() method of the storage platform API, through which all data changes are made. Unlike the type family table, the global item table only contains the item's top-level scalar attributes, rather than the full UDT item object. The structure of the global items table is as follows:
create table Base.[Table!Item](create table Base. [Table! Item](
ItemID uniqueidentifier not null constraint[PK_Clu_Item!ItemID]primary key clustered,ItemID uniqueidentifier not null constraint[PK_Clu_Item! ItemID] primary key clustered,
TypeID uniqueidentifier nul null,TypeID uniqueidentifier nul null,
{Additional Properties of Base.Item},{Additional Properties of Base.Item},
{Change tracking information}{Change tracking information}
))
全局项目表允许通过展现ItemID和TypeID(类型ID)导航到存储在类型家族表中的项目对象。ItemID通常唯一地标识数据存储中的项目。可使用这里未予描述的元数据将TypeID映射到类型名和包含该项目的视图。The Global Items table allows navigation to Item objects stored in the Type Family table by exposing ItemID and TypeID. ItemID typically uniquely identifies an item in the data store. Metadata not described here can be used to map a TypeID to a type name and a view containing the item.
由于通过其ItemID寻找项目在全局项目表的上下文及其它情况下都是常用操作,因此给定了项目的ItemId,提供GetItem()函数来检索项目对象。该函数具有以下声明:Since finding an item by its ItemID is a common operation in the context of the global item table as well as in other cases, a GetItem() function is provided to retrieve an item object given an item's ItemId. The function has the following declaration:
Base.Item Base.GetItem(uniqueidentifier ItemID)Base.Item Base.GetItem(uniqueidentifier ItemID)
为便于访问和尽可能地隐藏实现的细节,项目的所有查询可以对照在上述项目的表上构建的视图进行。具体而言,对每个项目类型针对合适类型的家族表创建视图。这些类型视图可选择相关联的类型,包括子类型的所有项目。为方便起见,除了UDT对象,视图能对包括继承字段的该类型的所有顶级域展现列。对图29所示的示例项目分层结构的视图如下:For ease of access and to hide implementation details as much as possible, all queries of a project can be made against views built on the tables of said project. Specifically, for each item type, create a view on the family table of the appropriate type. These type views select the associated type, including all items of subtypes. For convenience, in addition to UDT objects, views can display columns for all top-level fields of that type including inherited fields. A view of the sample project hierarchy shown in Figure 29 is as follows:
create view Contact.Person ascreate view Contact.Person as
select_Item.ItemID,{Base.Item的属性},{Contact.Person的属性},{改变跟踪信息},_Itemselect_Item.ItemID, {Property of Base.Item}, {Property of Contact.Person}, {Change Tracking Information}, _Item
from Contact.[Table!Person]from Contact. [Table! Person]
--注意Contact.Employee视图使用“where″判定-- Note that the Contact.Employee view uses the "where" judgment
--来限制对Contact.Employee的实例的所找到的项目集-- to limit the set of items found to instances of Contact.Employee
create view Contact.Employee ascreate view Contact.Employee as
select_Item.ItemID,{Base.Item的属性},{Contact.Person的属性},{Contact.Employee的属性},select_Item.ItemID, {Attribute of Base.Item}, {Attribute of Contact.Person}, {Attribute of Contact.Employee},
{改变跟踪信息},cast(_Item as Contact.Employee){Change tracking information}, cast(_Item as Contact.Employee)
from Contact.[Table!Person]from Contact. [Table! Person]
where_Item is of(Contact.Employee)where_Item is of(Contact.Employee)
create view Doc.Document ascreate view Doc.Document as
select_Item.ItemID,{Base.Item的属性},{Doc.Document的属性},{改变跟踪信息},_Itemselect_Item.ItemID, {Property of Base.Item}, {Property of Doc.Document}, {Change Tracking Information}, _Item
from Doc[Table!Document]from Doc[Table! Document]
--注意Doc.WordDocument视图使用“where”判定-- Note that the Doc.WordDocument view uses the "where" judgment
--来限制对Doc.WordDocument的实例的所找到的项目集-- to limit the set of found items to instances of Doc.WordDocument
create view Doc.WordDocument ascreate view Doc.WordDocument as
select_Item.ItemID,{Base.Item的属性},{Doc.Document的属性},{Doc.WordDocument的属性},select_Item.ItemID, {Property of Base.Item}, {Property of Doc.Document}, {Property of Doc.WordDocument},
{改变跟踪信息},cast(_Item as Doc.WordDocument){Change Tracking Information}, cast(_Item as Doc.WordDocument)
from Doc.[Table!Document]from Doc. [Table! Document]
where_Item is of(Doc.WordDocument)where_Item is of(Doc.WordDocument)
为完整性起见,视图也可在全局项目表上创建。该视图最初可展示与表相同的列:For completeness, views can also be created on global project tables. The view initially displays the same columns as the table:
create view Base.Item ascreate view Base.Item as
select ItemID,TypeID,{Base.Item的属性},{改变跟踪信息}select ItemID, TypeID, {Base.Item properties}, {change tracking information}
from Base.[Table!Item]from Base. [Table! Item]
3.扩展映射3. Extended mapping
扩展非常类似于项目,且具有某些相同要求。如支持继承性的另一根类型,扩展受到存储中许多同样的考虑和折衷比较。为此,对扩展应用类似的类型家族映射,而不是单个表方法。当然,在其它实施例中,可使用单个表方法。Extensions are very similar to projects and have some of the same requirements. As another root type that supports inheritance, extensions are subject to many of the same considerations and trade-offs compared to storage. For this, a similar type family mapping is applied to extensions, rather than a single table approach. Of course, in other embodiments, a single table approach could be used.
在本实施例中,扩展通过ItemID仅与一个项目关联,并包含在项目的上下文中唯一的ExtensionID。扩展表具有以下定义:In this embodiment, an extension is associated with only one item through an ItemID, and contains an ExtensionID that is unique within the context of the item. An extension table has the following definitions:
create table Base.[Table!Extension](create table Base. [Table! Extension](
ItemID uniqueidentifier not null,ItemID uniqueidentifier not null,
ExtensionID uniqueidentifier not null,ExtensionID uniqueidentifier not null,
TypeID uniqueidentifier not null,TypeID uniqueidentifier not null,
{Base.Extension的属性},{Properties of Base.Extension},
{改变跟踪信息},{CHANGE TRACKING INFO},
constraiint[PK_Clu_Extension!ItemID!ExtensionED]constraint[PK_Clu_Extension! ItemID! ExtensionED]
primary key clustered(ItemID asc,ExtensionID asc)primary key clustered(ItemID asc, ExtensionID asc)
))
如同项目一样,给定包括ItemID和ExtensionID对的身份,可提供一函数用于检索扩展。该函数具有以下声明:As with Items, given an Identity comprising ItemID and ExtensionID pairs, a function may be provided for retrieving Extensions. The function has the following declaration:
Base.Extension Base.GetExtension(uniqueidentifier ItemID,uniqueidentifier ExtensionID)Base.Extension Base.GetExtension(uniqueidentifier ItemID, uniqueidentifier ExtensionID)
类似于项目类型视图,对每个扩展类型可创建视图。假定扩展分层结构与示例项目分层结构平行,具有以下类型:Base.Extension、Contact.PersonExtension、Contact.EmployeeExtension。可创建以下视图:Similar to item type views, views can be created for each extension type. Assume an extension hierarchy parallel to the example project hierarchy, with the following types: Base.Extension, Contact.PersonExtension, Contact.EmployeeExtension. The following views can be created:
create view Base.Extension ascreate view Base.Extension as
select ItemID,ExtensionID,TypeID,{Base.Extension的属性},{改变跟踪信息}select ItemID, ExtensionID, TypeID, {Properties of Base.Extension}, {Change Tracking Information}
from Base.[Table!Extension]from Base. [Table! Extension]
create view Contact.[Extension!PersonExtension]ascreate view Contact. [Extension! PersonExtension]as
select_Extension.ItemID,_Extension.ExtensionID,{Base Extension的属性},select_Extension.ItemID, _Extension.ExtensionID, {Properties of Base Extension},
{Contact.PersonExtension的属性},{Properties of Contact.PersonExtension},
{改变跟踪信息},_Extension{Change Tracking Information}, _Extension
from Base.[Table!PersonExtension]from Base. [Table! PersonExtension]
create view Contact.[Extension!EmployeeExtension]ascreate view Contact. [Extension! EmployeeExtension]as
select_Extension.ItemID,_Extension.ExtensionID,{Base.Extension的属性},select_Extension.ItemID, _Extension.ExtensionID, {Properties of Base.Extension},
{Contact.PersonExtension的属性},{Properties of Contact.PersonExtension},
{Contact.EmployeeExtension的属性},{改变跟踪信息},{Properties of Contact.EmployeeExtension}, {Change Tracking Information},
cast(_Extension as Contact.EmployeeExtension) cast(_Extension as Contact. EmployeeExtension)
from Base.[Table!PersonExtension]from Base. [Table! PersonExtension]
where_Extension is of(Contact.EmployeeExtension)where_Extension is of(Contact.EmployeeExtension)
4.嵌套元素映射4. Nested element mapping
嵌套元素是可嵌入到项目、扩展、关系、或其它嵌套元素以形成深嵌套结构的类型。类似于项目和扩展,嵌套元素作为UDT实现,但它们存储在项目和扩展中。因此,嵌套元素没有超越它们的项目和扩展容器的存储映射。换言之,在系统中没有直接存储NestedElement类型的实例的表,且没有专门用于嵌套元素的视图。Nested elements are types that can be embedded into items, extensions, relationships, or other nested elements to form deeply nested structures. Similar to items and extensions, nested elements are implemented as UDTs, but they are stored in items and extensions. As such, nested elements have no storage mapping beyond their items and expanding containers. In other words, there are no tables in the system that directly store instances of the NestedElement type, and no views dedicated to nested elements.
5.对象身份5. Object identity
在数据模型中的每一实体,即每个项目、扩展和关系具有唯一的键值。一个项目由其ItemId唯一地标识。扩展由合成键(ItemId,ExtensionId)唯一地标识。关系由合成键(ItemId,RelationId)标识。ItemId,ExtensionId和RelationshipId均是GUID值。Every entity in the data model, ie every item, extension and relationship has a unique key. An item is uniquely identified by its ItemId. Extensions are uniquely identified by composite keys (ItemId, ExtensionId). Relations are identified by composite keys (ItemId, RelationId). ItemId, ExtensionId and RelationshipId are all GUID values.
6.SQL对象命名6.SQL object naming
在数据存储中创建的所有对象可存储在从存储平台模式名字导出的SQL模式名字中。例如,存储平台基础模式(常称“Base”)可产生在“[System.Storage]”SQL模式中的类型,如“[System.Storage].Item”。生成的名字可用限定词加前缀以消除命名的冲突。在合适处可使用惊叹号(!)作为名字的每个逻辑部分的分隔符。下面的表概括了在数据存储用于对象的命名约定。与用于访问数据存储中的实例的修饰的命名约定一起列出每个模式元素(项目、扩展、关系和视图)。All objects created in the data store can be stored in a SQL schema name derived from the storage platform schema name. For example, the storage platform base schema (often referred to as "Base") can generate types in the "[System.Storage]" SQL schema, such as "[System.Storage].Item". The generated names can be prefixed with a qualifier to eliminate naming conflicts. Where appropriate, exclamation points (!) can be used as separators for each logical part of the name. The following table summarizes the naming conventions used for objects in the data store. Each schema element (item, extension, relationship, and view) is listed along with the decorated naming convention used to access instances in the data store.
7.列命名7. Column naming
当映射任一对象模型到存储时,由于与应用程序对象一起存储的附加信息,有可能发生命名冲突。为避免命名冲突,所有非类型的特定列(不直接映射到类型声明中的命名的属性的列)用下划线字符(_)加前缀。在本实施例中,下划线字符(_)不允许作为任何标识符属性的开始字符。此外,为统一在CLR和数据存储之间的命名,存储平台类型或模式元素的所有属性(关系等)应具有大写的第一字符。When mapping either object model to storage, naming conflicts may occur due to the additional information stored with application objects. To avoid naming conflicts, all non-type-specific columns (columns that do not map directly to named properties in the type declaration) are prefixed with an underscore character (_). In this embodiment, the underscore character (_) is not allowed as the beginning character of any identifier attribute. Furthermore, to unify naming between the CLR and the datastore, all attributes (relations, etc.) of a storage platform type or schema element shall have an uppercase first character.
8.搜索视图8. Search View
由存储平台提供视图,用于搜索存储的内容。对每个项目和扩展类型提供SQL视图。此外,提供视图以支持关系和视图(由数据模型定义)。所有SQL视图和在存储平台中的底层表是只读的。如下面将更充分描述的,使用存储平台API的Update()方法可存储或改变数据。Views are provided by the storage platform for searching stored content. SQL views are provided for each project and extension type. Additionally, views are provided to support relationships and views (defined by the data model). All SQL views and underlying tables in the storage platform are read-only. As will be described more fully below, data may be stored or changed using the Update( ) method of the storage platform API.
在存储平台模式中明确定义的每个视图(由模式设计者定义,而非由存储平台自动地生成)可由命名的SQL视图[<模式名>].[View!<视图名>]来访问。例如,在模式“AcmePublisher.Books”中名为“BookSales”的视图可使用名字“[AcmePublisher.Books].[View!BookSales]来访问。因为视图的输出格式在每一视图的基础上是自定义的(由定义视图的那一方提供的任意查询定义),列基于模式视图定义被直接映射。Every view explicitly defined in the storage platform schema (defined by the schema designer, not automatically generated by the storage platform) can be named by the SQL view [<schema name>].[View! <view name>] to access. For example, a view named "BookSales" in the schema "AcmePublisher.Books" can be accessed using the name "[AcmePublisher.Books].[View!BookSales]. Because the view's output format is customized on a per-view basis (by any query definition provided by the party defining the view), the columns are mapped directly based on the schema view definition.
存储平台数据存储中的所有SQL搜索视图使用列的下述排序约定:All SQL search views in the storage platform data store use the following collation convention for columns:
1.如ItemId、ElementId、RelationshipId等的视图结果的逻辑“键”列1. Logical "key" columns for view results such as ItemId, ElementId, RelationshipId, etc.
2.如TypeId等关于结果类型的元数据信息。2. Metadata information about the result type such as TypeId.
3.如Create Version(创建版本)、UpdateVersion(更新版本)等改变跟踪列3. Such as Create Version (create version), UpdateVersion (update version) and other change tracking columns
4.类型专用的列(声明的类型的属性)4. Type-specific columns (properties of the declared type)
5.类型专用的视图(家族视图)也包含返回对象的对象列5. Type-specific views (family views) also contain object columns for returned objects
每个类型家族的成员可使用一系列项目视图来搜索,在数据存储中每个项目类型有一个视图。Members of each type family are searchable using a series of item views, one view for each item type in the data store.
a)项目a) project
每个项目搜索视图对特定类型或其子类型的项目的每个实例包含一行。例如,文档的视图能返回Document(文档)、LegalDocument(合法文档)和ReviewDocument(审阅文档)的实例。给定此例,能如图28所示那样概念化项目视图。A per-item search view contains one row for each instance of an item of a particular type or a subtype thereof. For example, a document view can return Document (document), LegalDocument (legal document), and ReviewDocument (review document) instances. Given this example, the project view can be conceptualized as shown in FIG. 28 .
(1)主项目搜索视图(1) Main Item Search View
存储平台数据存储的每个实例定义称为主项目视图(Master Item View)的特殊项目视图。此视图提供关于数据存储中每个项目的综述信息。视图对每个项目类型属性提供一列,其中一列描述项目的类型,若干列用于提供改变跟踪和同步信息。在数据存储中使用名字“[System.Storage].[Master!Item]”来标识主项目视图。Each instance of a storage platform data store defines a special item view called the Master Item View. This view provides overview information about each item in the data store. The view provides one column for each item type attribute, one describing the type of item, and several columns providing change tracking and synchronization information. Use the name "[System.Storage].[Master!Item]" in the data store to identify the master item view.
(2)类型化的项目搜索视图(2) Typed item search view
每个项目类型也具有搜索视图。尽管类似于根项目视图,但此视图还提供通过“_Item”列对项目对象的访问。在数据存储中使用名字[模式名].[项目类型名]标识每个类型化的项目搜索视图。例如[AcmeCorp.Dod].[OfficeDoc]。Each item type also has a search view. Although similar to the root item view, this view also provides access to item objects through the "_Item" column. Each typed item search view is identified in the data store by the name [schema name].[item type name]. For example [AcmeCorp. Dod]. [OfficeDoc].
b)项目扩展b) Project extension
WinFs存储中的所有项目扩展也可使用搜索视图来访问。All project extensions in WinFs storage can also be accessed using the search view.
(1)主扩展搜索视图(1) Main Extended Search View
数据存储的每个实例定义一称为主扩展视图(Master Extension View)的特殊扩展视图。此视图提供关于数据存储中每个扩展的综述信息。该视图对每个扩展属性有一列,其中一列描述扩展的类型,而若干列用于提供改变跟踪和同步信息。使用名字“[System.Storage].[Master!Extension]”在数据存储中标识主扩展视图。Each instance of the data store defines a special extension view called the master extension view (Master Extension View). This view provides overview information about each extent in the datastore. The view has one column for each extension attribute, one describing the type of extension, and several columns providing change tracking and synchronization information. Use the name "[System.Storage].[Master!Extension]" to identify the master extension view in the data store.
(2)类型化的扩展搜索视图(2) Typed extended search view
每个扩展类型还具有搜索视图。尽管类似于主扩展视图,但此视图还提供通过_Extension列对项目对象的访问。在数据存储中使用名字[模式名].[Extension!扩展类型名]标识每个类型化的扩展搜索视图。例如[AcmeCorp.Doc].[Extension!OfficeDocExt]。Each extension type also has a search view. Although similar to the main extensions view, this view also provides access to project objects through the _Extension column. Use the name [schema-name].[Extension! extension_type_name] identifies each typed extension search view. For example [AcmeCorp.Doc].[Extension! OfficeDocExt].
c)嵌套的元素c) nested elements
所有嵌套的元素存储在项目、扩展或关系实例之中。因此,它们能通过查询合适的项目、扩展或关系搜索视图来访问。All nested elements are stored in Item, Extension or Relationship instances. Therefore, they can be accessed by querying the appropriate project, extension or relational search view.
d)关系d) relationship
如上讨论,关系形成在存储平台数据存储中各项目之间链接的基本单元。As discussed above, relationships form the basic unit of linking between items in a storage platform data store.
(1)主关系搜索视图(1) Main relation search view
每个数据存储提供一主关系视图。此视图提供关于数据存储中所有关系实例的信息。在数据存储中使用名字“[System.Storage].[Master!Relationship]”来标识主关系视图。Each data store provides a master relational view. This view provides information about all relational instances in the datastore. Use the name "[System.Storage].[Master!Relationship]" in the data store to identify the master relational view.
(2)关系实例搜索视图(2) Relation instance search view
每个声明的关系也有返回该特定关系的所有实例的搜索视图。尽管类似于主关系视图,但此视图对该关系数据的每个属性提供命名的列。在数据存储中使用名字[模式名].[Relationship!关系名]来标识每个关系实例搜索视图。例如[AcmeCorp.Doc].[Relationship!DocumentAuthor]。Each declared relationship also has a search view that returns all instances of that particular relationship. Although similar to the main relational view, this view provides named columns for each attribute of the relational data. Use the name [schema-name].[Relationship! relation name] to identify each relation instance in the search view. For example [AcmeCorp.Doc].[Relationship! DocumentAuthor].
9.更新9. Update
存储平台数据存储中所有视图是只读的。为创建数据模型元素(项目、扩展或关系)的新实例,或更新现有的实例,必须使用存储平台API的ProcessOperation或ProcessUpdategram方法。ProcessOperation方法是单个存储的过程,它是由消费细化要执行的动作的“操作”的数据存储定义的。ProcessUpdategram方法是存储的过程,它采取称为“更新元素(updategram)”的一组有序的操作,它们共同细化要执行的一组动作。All views in the storage platform data store are read-only. To create new instances of data model elements (items, extensions, or relationships), or to update existing instances, the ProcessOperation or ProcessUpdategram methods of the storage platform API must be used. A ProcessOperation method is a single stored procedure defined by a datastore that consumes an "operation" that refines the action to be performed. The ProcessUpdategram method is a stored procedure that takes an ordered set of operations called "updategrams" that together refine the set of actions to be performed.
操作格式是可扩展的,并提供在模式元素上的各种操作。某些常见操作包括:The operation format is extensible and provides various operations on schema elements. Some common operations include:
1.项目操作:1. Project operation:
a.CreateItem(在嵌入或持有关系的上下文中创建一新的项目)a.CreateItem (create a new item in the context of embedding or holding a relationship)
b.UpdateItem(更新一现有的项目)b.UpdateItem (update an existing item)
2.关系操作:2. Relational operations:
a.CreateRelationship(创建引用或持有关系的实例)a.CreateRelationship (create a reference or hold an instance of the relationship)
b.UpdateRelationship(更新一关系实例)b.UpdateRelationship (update a relationship instance)
c.DeleteRelationship(移除一关系实例)c.DeleteRelationship (remove a relationship instance)
3.扩展操作3. Extended operation
a.CreateExtension(添加一扩展到现有的项目)a.CreateExtension (add an extension to an existing project)
b.UpdateExtension(更新一现有的扩展)b.UpdateExtension (update an existing extension)
c.DeleteExtension(删除一扩展)c.DeleteExtension (delete an extension)
10.改变跟踪及墓碑10. Change tracking and tombstones
如下面更充分讨论的,由数据存储提供改变跟踪和墓碑服务。本节提供在数据存储中展现的改变跟踪信息的概述As discussed more fully below, change tracking and tombstone services are provided by the data store. This section provides an overview of the change tracking information presented in the data store
a)改变跟踪a) change tracking
由数据存储提供的每个搜索视图包含用于提供改变跟踪信息的列;那些列对所有项目、扩展和关系视图是公用的。由模式设计者明确地定义的存储平台模式视图不自动地提供改变跟踪信息-该信息是通过在其上构建视图本身的搜索视图来间接提供的。Each search view provided by the data store contains columns for providing change tracking information; those columns are common to all project, extension and relational views. A storage platform schema view explicitly defined by the schema designer does not automatically provide change tracking information - this information is provided indirectly through the search view upon which the view itself is built.
对数据存储中的每个元素,可从两个地方得到改变跟踪信息:“主”元素视图和“类型化的”元素视图。例如,可从主项目视图“[System.Storage].[Master!Item]”和类型化的项目视图[AcmeCorp.Document].[Document]中得到关于AcmeCorp.Document.Document项目类型的改变跟踪信息。For each element in the data store, change tracking information is available from two places: the "main" element view and the "typed" element view. For example, change tracking information on the AcmeCorp.Document.Document item type is available from the master item view '[System.Storage].[Master!Item]' and the typed item view [AcmeCorp.Document].[Document].
(1)“主”搜索视图中的改变跟踪(1) Change tracking in the "main" search view
主搜索视图中的改变跟踪信息提供关于元素的创建和更新版本的信息、关于哪个同步伙伴创建该元素的信息、关于哪个同步伙伴最后一次更新该元素的信息、以及来自每个伙伴的用于创建和更新的版本号。用伙伴键来标识同步关系中的伙伴(下面描述)。类型[System.Storge.Store].ChangeTrackingInfo的名为_ChangeTrackingInfo的单个UDT对象包含所有这些信息。在System.Storage模式中定义类型。在项目、扩展和关系的所有全局搜索视图中可得到_ChangeTrackingInfo。_ChangeTrackingInfo的类型定义是:The change tracking information in the main search view provides information about the created and updated versions of an element, information about which sync partner created the element, information about which sync partner last updated the element, and information from each partner for creating and the updated version number. A partner key is used to identify a partner in a synchronization relationship (described below). A single UDT object named _ChangeTrackingInfo of type [System.Storge.Store].ChangeTrackingInfo contains all this information. Define types in the System.Storage schema. _ChangeTrackingInfo is available in all global search views for projects, extensions, and relationships. The type definition of _ChangeTrackingInfo is:
<Type Name=″ChangeTrackingInfo″BaseType=″Base.NestedElement″><Type Name="ChangeTrackingInfo"BaseType="Base.NestedElement">
<FieldProperty Name=″CreationLocalTS″Type=″SqlTypes.SqlInt64″<FieldProperty Name="CreationLocalTS"Type="SqlTypes.SqlInt64"
Nullable=″False″/>Nullable="False"/>
<FieldProperty Name=″CreatingpartnerKey″Type=″SqlTypes.SqlInt32″<FieldProperty Name="CreatingpartnerKey"Type="SqlTypes.SqlInt32"
Nullable=″False″/>Nullable="False"/>
<FieldProperty Name=″CreatingPartnerTS″Type=″SqlTypes.SqlInt64″<FieldProperty Name="CreatingPartnerTS"Type="SqlTypes.SqlInt64"
Nullable=″False″/>Nullable="False"/>
<FieldProperty Name=″LastUpdateLocalTS″Type=″SqlTypes.SqlInt64″<FieldProperty Name="LastUpdateLocalTS"Type="SqlTypes.SqlInt64"
Nullable=″False″/>Nullable="False"/>
<FieldProperty Name=″LastUpdatingPartnerKey″Type=″SqlTypes.SqlInt32″<FieldProperty Name="LastUpdatingPartnerKey"Type="SqlTypes.SqlInt32"
Nullable=″False″/>Nullable="False"/>
<FieldProperty Name=″LastUpdatingPartnerTS″Type=″SqlTypes.SqlInt64″<FieldProperty Name="LastUpdatingPartnerTS"Type="SqlTypes.SqlInt64"
Nullable=″False″/>Nullable="False"/>
</Type></Type>
这些属性包含下述信息:These properties contain the following information:
(2)“类型化的”搜索视图中的改变跟踪(2) Change Tracking in "Typed" Search Views
除了提供与全局搜索视图相同信息外,每个类型化的搜索视图提供记录在同步拓扑中每个元素的同步状态的附加信息。In addition to providing the same information as the global search view, each typed search view provides additional information about the synchronization status of each element recorded in the synchronization topology.
b)墓碑b) tombstone
数据存储为项目、扩展和关系提供墓碑信息。墓碑视图提供一个地方中有关活和墓碑实体两者(项目、扩展和关系)的信息。项目和扩展墓碑视图不提供对对应对象的访问,而关系墓碑视图提供对关系对象的访问(在墓碑关系的情况下关系对象为空)。Datastores provide tombstone information for projects, extensions, and relationships. The tombstone view provides information about both live and tombstone entities (items, extensions and relationships) in one place. Project and extension tombstone views provide no access to corresponding objects, while relational tombstone views provide access to relational objects (relational objects are null in case of tombstoned relations).
(1)项目墓碑(1) Project Tombstone
通过视图[System.Storage].[Tombstone!item]从系统检索项目墓碑。Via view[System.Storage].[Tombstone! item] Retrieves the item tombstone from the system.
(2)扩展墓碑(2) Extended Tombstone
使用视图[System.Storage].[Tombstone!Extension]从系统检索扩展墓碑。扩展改变跟踪信息类似于为项目提供的添加了ExtensionId属性的信息。Use the view [System.Storage].[Tombstone! Extension] Retrieves the extension tombstone from the system. Extension change tracking information is similar to that provided for projects with the addition of the ExtensionId property.
(3)关系墓碑(3) Relationship Tombstone
通过视图[System.Storage].[Tombstone!Relationship]从系统检索关系墓碑。关系墓碑信息类似于对扩展提供的信息。然而,在关系实例的目标ItemRef上提供附加信息。此外,还选择关系对象。Via view[System.Storage].[Tombstone! Relationship] Retrieves relationship tombstones from the system. Relationship tombstone information is similar to the information provided for extensions. However, additional information is provided on the target ItemRef of the relation instance. Also, select the relationship object.
(4)墓碑清除(4) Tombstone removal
为防止墓碑信息无限制地增长,数据存储提供墓碑清除任务。此任务确定什么时候可以舍弃墓碑信息。该任务计算本地创建/更新版本的界限,并随后通过舍弃所有更早的墓碑版本而截断墓碑信息。To prevent unlimited growth of tombstone information, the data store provides a tombstone removal task. This task determines when tombstone information can be discarded. This task computes the locally created/updated version bounds and then truncates the tombstone information by discarding all earlier tombstone versions.
11.助手API和函数11. Helper API and functions
基础映射还提供若干助手函数。提供这些函数以帮助在该数据模型上的公用操作。The base map also provides several helper functions. These functions are provided to facilitate common operations on this data model.
a)函数[System.Storage].GetItema) Function [System.Storage].GetItem
//给定ItemId返回一项目对象//Given ItemId returns an item object
Item GetItem(ItemId ItemId)Item GetItem(ItemId ItemId)
b)函数[System.Storage].GetExtensionb) Function [System.Storage].GetExtension
//给定ItemId和ExtensionId返回一扩展对象//Given ItemId and ExtensionId return an extension object
Extension GetExtension(ItemId ItemId,ExtensionId ExtensionId)Extension GetExtension(ItemId ItemId, ExtensionId ExtensionId)
c)函数[System.Storage].GetRelationshipc) Function [System.Storage].GetRelationship
//给定ItemId和RelationshipId返回-关系对象//Given ItemId and RelationshipId returns -Relationship object
Relationship GetRelationship(ItemId ItemId,RelationshipId RelationshipId)Relationship GetRelationship(ItemId ItemId, RelationshipId RelationshipId)
12.元数据12. Metadata
有两类在存储中表示的元数据:实例元数据(项目的类型等),和类型元数据。There are two types of metadata represented in the store: instance metadata (type of item, etc.), and type metadata.
a)模式元数据a) schema metadata
模式元数据作为来自元模式的项目类型的实例存储在数据存储中。Schema metadata is stored in the data store as instances of item types from the meta-schema.
b)实例元数据b) instance metadata
应用程序使用实例元数据来查询项目的类型,并寻找与项目相关联的扩展。给定项目的ItemId,应用程序可查询全局项目视图,以返回该项目的类型,并使用此值来查询Meta.Type视图以返回关于该项目的声明的类型的信息。例如,Applications use instance metadata to query an item's type and to find extensions associated with the item. Given an item's ItemId, an application can query the global item view to return the item's type, and use this value to query the Meta.Type view to return information about the item's declared type. For example,
//对给定的项目实例返回元数据项目对象// Returns the metadata item object for the given item instance
SELECT m._Item AS metadataInfoObjSELECT m._Item AS metadataInfoObj
FROM[System.Storage].[Item]i INNER JOIN[Meta].[Type]m ON i._TypeId=m.ItemIdFROM[System.Storage].[Item]i INNER JOIN[Meta].[Type]m ON i._TypeId=m.ItemId
WHERE i.ItemId=@ItemIdWHERE i.ItemId = @ItemId
E.安全性E. Security
本节描述了依照一个实施例用于本发明的存储平台的安全模型。This section describes the security model for the storage platform of the present invention according to one embodiment.
1.综述1. Overview
依照本实施例,指定和强制实施存储平台的安全策略的粒度是在给定数据存储中的项目上的各种操作级上;没有从整体中分离地保护项目的各部分的能力。该安全模型通过访问控制列表(ACL)指定了可以被授予或拒绝访问以在项目上执行这些操作的主体集。每一ACL是访问控制条目(ACE)的有序集合。According to the present embodiment, the granularity of specifying and enforcing the storage platform's security policy is at the level of various operations on items in a given data store; there is no ability to secure parts of an item separately from the whole. This security model specifies, through access control lists (ACLs), the subjects that can be granted or denied access to perform these operations on items. Each ACL is an ordered collection of Access Control Entries (ACEs).
用于项目的安全策略可以完全由自由选择的访问控制策略和系统访问控制策略来描述。这些的每一个是一组ACL。第一组(DACL)描述了由项目的所有者授予各种主体的自由选择的访问权限,而第二组ACL被称为SACL(系统访问控制列表),它指定了当以某些方式操纵对象时如何完成系统监察。除这些之外,数据存储中的每一项目与对应于项目的所有者的SID(所有者SID)相关联。The security policy for a project can be fully described by freely selected access control policies and system access control policies. Each of these is a set of ACLs. The first set (DACL) describes the discretionary access rights granted to various principals by the project's owner, while the second set of ACLs is known as the SACL (System Access Control List), which specifies when objects are manipulated in certain ways How to complete system monitoring. In addition to these, each item in the data store is associated with a SID corresponding to the owner of the item (owner SID).
用于在存储平台数据存储中组织项目的主要机制是包含分层结构的机制。包含分层结构是使用项目之间的持有关系来实现的。两个项目A和B之间被表达为“A包含B”的持有关系使得项目A能够影响项目B的生命周期。一般而言,数据存储中的项目在具有从另一项目到该项目的持有关系之前无法存在。除控制项目的生命周期之外,持有关系提供了传播项目的安全策略所必需的机制。The primary mechanism used to organize items in a storage platform data store is the one that includes a hierarchical structure. Containment hierarchies are implemented using holding relationships between items. A holding relationship expressed as "A contains B" between two projects A and B enables project A to influence the lifecycle of project B. In general, an item in a data store cannot exist until it has a holding relationship from another item to it. In addition to controlling the lifecycle of an item, the holding relationship provides the mechanism necessary to propagate the item's security policy.
为每一项目指定的安全策略由两个部分组成-为该项目明确指定的部分以及在数据存储中从该项目的父项目继承的部分。任何项目的明确定义的安全策略由两个部分组成-支配对考虑中的项目的访问的部分,以及影响由包含分层结构中所有其子孙继承的安全策略的部分。由子孙继承的安全策略是由明确定义的策略和继承的策略来决定的。The security policy specified for each project consists of two parts - the part explicitly specified for that project and the part inherited from the project's parent project in the data store. A well-defined security policy for any item consists of two parts - the part that governs access to the item under consideration, and the part that affects the security policy inherited by all its descendants in the containing hierarchy. Security policies inherited by descendants are determined by well-defined policies and inherited policies.
由于安全策略是通过持有关系来传播的,且也可在任何项目处被覆盖,因此有必要指定如何确定项目的有效安全策略。在本实施例中,数据存储包含分层结构中的项目沿从存储的根到该项目的每一路径继承ACL。Since security policies are propagated through holding relationships and can also be overridden at any project, it is necessary to specify how to determine the project's effective security policy. In this embodiment, the data store contains items in the hierarchy that inherit the ACL along each path from the root of the store to the item.
在对任何给定路径继承的ACL中,ACL中的各ACE的排序确定了强制实时的最终安全策略。以下表示法用于描述ACL中ACE的排序。ACL中由项目继承的ACE的排序是由以下两条规则来确定的-In an ACL inherited for any given path, the ordering of the ACEs in the ACL determines the final security policy that is enforced in real time. The following notation is used to describe the ordering of ACEs in an ACL. The ordering of ACEs in an ACL inherited by items is determined by the following two rules −
第一条规则满足了在从包含分层结构的根到项目I的路径中从各项目继承的ACE。从较接近的容器继承的ACE优先于从较远的容器继承的条目。直观上,这允许管理员能够覆盖从包含分层结构中较远处继承的ACE。该规则如下:The first rule satisfies the ACEs inherited from each item in the path from the root containing the hierarchy to item I. ACEs inherited from closer containers take precedence over entries inherited from farther containers. Intuitively, this allows administrators to override inherited ACEs from further down the containment hierarchy. The rule is as follows:
对于项目I上所有继承的ACL LFor all inherited ACL L on project I
对于所有项目I1、I2For all items I1, I2
对于L中所有ACE A1和A2For all ACEs A1 and A2 in L
I1是I2的祖先,以及I1 is an ancestor of I2, and
I2是I3的祖先,以及I2 is an ancestor of I3, and
A1是从I1继承的ACE,以及A1 is an ACE inherited from I1, and
A2是从I2继承的ACEA2 is an ACE inherited from I2
意味着mean
A2在L中优先于A1A2 takes precedence over A1 in L
第二条规则将拒绝对项目的访问的ACE排序在授予对项目的访问的ACE之前。The second rule orders ACEs that deny access to an item before ACEs that grant access to an item.
对于项目I上所有继承的ACL LFor all inherited ACL L on project I
对于所有项目I1For all items I1
对于L中所有ACE A1和A2,For all ACEs A1 and A2 in L,
I1是I2的祖先,以及I1 is an ancestor of I2, and
A1是从I1继承的ACCESS_DENIED_ACE,以及A1 is ACCESS_DENIED_ACE inherited from I1, and
A2是从I1继承的ACCESS_GRANTED_ACEA2 is ACCESS_GRANTED_ACE inherited from I1
意味着mean
A1在L中优先于A2A1 takes precedence over A2 in L
在包含分层结构为树的情况下,从树的根到该项目只有一条路径,且该项目只有一个继承的ACL。在这些情况下,按照其中ACE的相对排序,由项目继承的ACL与由现有Windows安全模型中的文件(项目)继承的ACL相匹配。In the case where the containment hierarchy is a tree, there is only one path from the root of the tree to the item, and the item has only one inherited ACL. In these cases, the ACLs inherited by the project match the ACLs inherited by the file (project) in the existing Windows security model, by the relative ordering of the ACEs therein.
然而,数据存储中的包含分层结构是有向非循环图(DAG),因为对项目允许多个持有关系。在这些情况下,从包含分层结构的根节点到项目有多条路径。由于项目沿每一路径承ACL,因此每一项目与ACL的集合而非单个ACL相关联。注意,这与传统的文件系统模型不同,在该模型中,只有一个ACL与文件或文件夹相关联。However, the containment hierarchy in the data store is a directed acyclic graph (DAG), since multiple holding relationships are allowed for items. In these cases, there are multiple paths from the root node containing the hierarchy to the item. Since items bear an ACL along each path, each item is associated with a set of ACLs rather than a single ACL. Note that this differs from the traditional filesystem model, where only one ACL is associated with a file or folder.
当包含分层结构是DAG而非树时,通常有两个方面要详细阐述。需要描述关于当项目从其父节点继承一个以上ACL时如何为其计算有效安全策略,并且如何组织和表示项目对于存储平台数据存储的安全模型的管理有直接的意义。When the containing hierarchy is a DAG rather than a tree, there are usually two aspects to elaborate. There needs to be a description of how the effective security policy is computed for an item when it inherits more than one ACL from its parent, and how the organization and representation of items has direct implications for the management of the security model of a storage platform data store.
以下算法评估一给定主体对给定项目的访问权限。在整篇文档中,以下表示法用于描述与项目相关联的ACL。The following algorithm evaluates the access rights of a given principal to a given item. Throughout this document, the following notation is used to describe ACLs associated with items.
Inherited_ACLs(ItemId)-由其项目身份为ItemId的项目从存储中其父项目继承的一组ACL。Inherited_ACLs (ItemId) - A set of ACLs inherited by the item whose item identity is ItemId from its parent item in the store.
Explicit_ACL(ItemId)-为其身份为ItemID的项目明确地定义的ACL。Explicit_ACL(ItemId) - ACL explicitly defined for the item whose identity is ItemID.
NTSTATUSNTSTATUS
ACLAccessCheck(ACLAccessCheck(
PSID pOwnerSid,PSID pOwnerSid,
PDACL pDacl,PDACL pDacl,
DWORD DesiredAccess,DWORD DesiredAccess,
HANDLE ClientToken,HANDLE ClientToken,
PPRIVILEGE_SET pPrivilegeSet,PPRIVILEGE_SET pPrivilegeSet,
DWORD *pGrantedAccess)DWORD *pGrantedAccess)
如果期望的访问权限未被明确地拒绝,则上述例程返回STATUS_SUCCESS,且pGrantedAccess确定用户期望的权限中的哪些由该指定的ACL授予。如果期望访问权限被明确地拒绝,则该例程返回STATUS_ACCESS_DENIED。If the desired access rights are not explicitly denied, the above routine returns STATUS_SUCCESS, and pGrantedAccess determines which of the user's desired rights are granted by the specified ACL. If the desired access is explicitly denied, this routine returns STATUS_ACCESS_DENIED.
NTSTATUSNTSTATUS
ItemAccess Check(ItemAccessCheck(
OS_ITEMID ItemId,OS_ITEMID ItemId,
DWORD DesiredAccess,DWORD DesiredAccess,
HANDLE ClientToken,HANDLE ClientToken,
PPRIVILEGE_SET pPrivilegeSet)PPRIVILEGE_SET pPrivilegeSet)
{{
STATUS Status;STATUS Status;
PDACL pExplicitACL=NULL;PDACL pExplicitACL=NULL;
PDACL pInheritedACLs=NULL;PDACL pInheritedACLs=NULL;
DWORD NumberOfInheritedACLs=0;DWORD NumberOfInheritedACLs=0;
pExplicitACL=GetExplicitACLForItem(ItemId);pExplicitACL = GetExplicitACLForItem(ItemId);
GetInheritedACLsForItem(ItemId,&pInheritedACLs,&NumberOfInheritedACLs)GetInheritedACLsForItem(ItemId, &pInheritedACLs, &NumberOfInheritedACLs)
Status=ACLAccessCheck(Status=ACLAccessCheck(
pOwnerSid,pOwnerSid,
pExplicitACL,pExplicitACL,
DesiredAccess,DesiredAccess,
ClientToken,ClientToken,
pPrivilegeSet,pPrivilegeSet,
&GrantedAccess);&GrantedAccess);
if(Status!=STATUS_SUCCESS)if(Status!=STATUS_SUCCESS)
return Status;return Status;
if(DesiredAccess==GrantedAccess)if(DesiredAccess==GrantedAccess)
return STATUS_SUCCESS;return STATUS_SUCCESS;
for(for(
i=0;i=0;
(i<NumberOfInheritedACLs&&Status==STATUS_SUCCESS);(i<NumberOfInheritedACLs&&Status==STATUS_SUCCESS);
i++){i++){
GrantedAccessForACL=0;GrantedAccessForACL=0;
Status=ACLAccessCheck(Status=ACLAccessCheck(
pOwnerSid,pOwnerSid,
pExplicitACL,pExplicitACL,
DesiredAccess,DesiredAccess,
ClientToken,ClientToken,
pPrivilegeSet,pPrivilegeSet,
&GrantedAccessForACL);&GrantedAccessForACL);
if(Status==STATUS_SUCCESS){if(Status==STATUS_SUCCESS){
GrantedAccess|=GrantedAccessForACL;GrantedAccess|=GrantedAccessForACL;
}}
}}
If((Status==STATUS_SUCCESS)&&If((Status==STATUS_SUCCESS)&&
(GrantedAccess!=DesiredAccess)){(GrantedAccess!=DesiredAccess)){
Status=STATUS_ACCESS_DENIED;Status = STATUS_ACCESS_DENIED;
}}
return Status;return Status;
}}
在任一项目处定义的安全策略的影响范围覆盖在数据存储上定义的包含分层结构中该项目的子孙。对于定义了显式策略的所有项目,则效果类似于定义由包含分层结构中其所有子孙所继承的策略。由所有子孙继承的有效ACL可通过取由该项目继承的ACL,并将显式ACL中可继承的ACE添加到该ACL的开头来获得。这被称作与该项目相关联的可继承ACL集。A security policy defined at any project extends to descendants of that project in the containment hierarchy defined on the datastore. For all items that define an explicit policy, the effect is as if defining a policy that is inherited by all of its descendants in the containing hierarchy. An effective ACL inherited by all descendants can be obtained by taking the ACL inherited by the project and adding the inheritable ACEs from the explicit ACL to the beginning of the ACL. This is known as the set of inheritable ACLs associated with the project.
当根节点在文件夹项目处的包含分层结构中缺少安全性的显式指定时,文件夹的安全性指定应用于包含分层结构中该项目的所有子孙。因而,对其提供了显式安全策略指定的每一项目定义了类似地受保护的项目的区域,且对于该区域内的所有项目的有效ACL是该项目的可继承ACL集。在包含分层结构是树的情况下,这将完整地定义区域。如果每个区域都要与一号码相关联,那么仅将项目所属的区域随该项目一起包括在内就足够了。When the root node lacks an explicit specification of security in the containing hierarchy at a folder item, the folder's security specification applies to all descendants of that item in the containing hierarchy. Thus, each item for which an explicit security policy designation is provided defines a similarly protected area of items, and the effective ACL for all items within that area is the set of inheritable ACLs for that item. In cases where the containing hierarchy is a tree, this will completely define the region. If each area is to be associated with a number, it is sufficient to include with the item only the area to which the item belongs.
然而,对于是DAG的包含分层结构,包含分层结构中有效安全策略改变所处的点一般由两类项目确定。第一类是已对其指定显式ACL的项目。通常,这些是包含分层结构中管理员显式地指定ACL的点。第二类是具有一个以上父节点,且各个父节点具有与其相关联的不同安全策略的项目。通常,这些是为卷指定的安全策略的汇合点的项目,并指示了一新安全策略的开始。However, for a containment hierarchy that is a DAG, the point in the containment hierarchy at which the effective security policy changes is generally determined by two types of items. The first category is projects that have an explicit ACL assigned to them. Typically, these are the points in the containment hierarchy at which ACLs are explicitly specified by the administrator. The second category is items that have more than one parent node, each parent node having a different security policy associated with it. Typically, these are entries at the convergence point of the security policy specified for the volume, and indicate the start of a new security policy.
采用该定义,数据存储中的各项目落入两个类别之一-是类似地受保护的安全区域的根节点的那些项目,以及不是该根节点的那些项目。未定义安全区域的项目一般仅属于一个安全区域。如在树的情况下,项目的有效安全性可通过指定项目所属的区域以及该项目来指定。这导致一种用于基于存储中各个类似地受保护的区域来管理存储平台数据存储的安全性的直截了当的模型。Using this definition, items in the data store fall into one of two categories - those items that are the root node of a similarly protected security area, and those items that are not the root node. Projects that do not define a security zone generally belong to only one security zone. As in the case of trees, the effective security of an item can be specified by specifying the zone to which the item belongs and the item. This leads to a straightforward model for managing the security of storage platform data storage based on each similarly protected area in storage.
2.安全模型的详细描述2. Detailed description of the security model
本节通过描述安全描述符及其包含的ACL内的各个权限如何影响各种操作提供了关于项目如何被保护的细节。This section provides details on how items are secured by describing how individual permissions within security descriptors and the ACLs they contain affect various operations.
a)安全描述符结构a) Security Descriptor Structure
在描述安全模型的细节之前,关于安全描述符的基本讨论是有帮助的。安全描述符包含与可保护对象相关联的安全信息。安全描述符由SECURITY_DESCRIPTOR(安全描述符)结构及其相关联的安全信息构成。安全描述符可包括下列安全信息:Before describing the details of the security model, a basic discussion of security descriptors is helpful. A security descriptor contains security information associated with a securable object. A security descriptor consists of a SECURITY_DESCRIPTOR (security descriptor) structure and its associated security information. A security descriptor can include the following security information:
1.对象的所有者及主要群组的SID。1. The owner of the object and the SID of the primary group.
2.指定对特定用户或用户组允许或拒绝的访问权限的DACL。2. A DACL that specifies the access rights that are allowed or denied to specific users or groups of users.
3.指定为对象生成监察记录的访问尝试的类型的SACL。3. A SACL that specifies the type of access attempt that generates an inspection record for the object.
4.限定安全描述符或其个别成员含义的一组控制位。4. A set of control bits that define the meaning of a security descriptor or its individual members.
较佳地,应用程序不能直接操纵安全描述符的内容。存在用于设置和检索对象的安全描述符中的安全信息的函数。另外,存在用于为新对象创建及初始化安全描述符的函数。Preferably, applications cannot directly manipulate the contents of the security descriptor. Functions exist for setting and retrieving security information in an object's security descriptor. In addition, functions exist for creating and initializing security descriptors for new objects.
自由选择的访问控制列表(DACL)标识了被允许或拒绝访问可保护对象的受托者。当进程企图访问可保护对象时,系统核查该对象的DACL中的ACE,来确定是否对其授予访问权限。如果该对象没有DACL,则系统可对每个人授予完全访问权限。如果该对象的DACL没有ACE,则系统拒绝访问该对象的企图,因为该DACL不允许任何访问权限。系统依次核查ACE,直到找到允许所请求的所有访问权限的一个或多个ACE,或直到任一所请求的访问权限被拒绝。A discretionary access control list (DACL) identifies trustees who are allowed or denied access to a protectable object. When a process attempts to access a protectable object, the system checks the ACE in the object's DACL to determine whether to grant access to it. If the object has no DACL, the system grants full access to everyone. If the object's DACL does not have an ACE, the system denies the attempt to access the object because the DACL does not allow any access rights. The system checks the ACEs in turn until it finds one or more ACEs that allow all of the requested access rights, or until any of the requested access rights are denied.
系统访问控制列表(SACL)使管理员能将访问受保护对象的企图记入日志。每个ACE指定了一指定受托者的访问企图的类型,该访问企图使得系统在安全事件日志中生成一个记录。当访问企图失败、当它成功或两者,SACL中的ACE可生成监察记录。当未经授权的用户企图获得对于对象的访问权限时,SACL提出警报。System Access Control Lists (SACLs) enable administrators to log attempts to access protected objects. Each ACE specifies the type of access attempt for a given trustee that causes the system to generate a record in the security event log. ACEs in a SACL can generate audit records when an access attempt fails, when it succeeds, or both. SACL alerts when an unauthorized user attempts to gain access to an object.
所有类型的ACE包含下面的访问控制信息:All types of ACEs contain the following access control information:
1.标识向其应用ACE的受托者的安全标识符(SID)。1. A security identifier (SID) identifying the trustee to which the ACE is applied.
2.指定由该ACE控制的访问权限的访问掩码。2. Specify the access mask for the access rights controlled by this ACE.
3.指示该ACE的类型的标志。3. A flag indicating the type of the ACE.
4.确定子容器或对象能否从ACL所附的主要对象继承ACE的一组位标志。4. A set of bit flags that determine whether a child container or object can inherit an ACE from the main object to which the ACL is attached.
下面的表格列出由所有可保护对象所支持的三种ACE类型。The table below lists the three ACE types supported by all protectable objects.
(1)访问掩码格式(1) Access mask format
所有可保护对象可使用在图26中所示的访问掩码格式来安排其访问权限。在此格式中,较低的16位用于对象专用访问权限,接下来的7位用于应用于大多数类型对象的标准访问权限,最高的4位用于指定每一对象类型可映射到一组标准和对象专用权限的类属访问权。ACCESS_SYSTEM_SECURITY(访问系统安全)位对应于访问该对象的SACL的权限。All protectable objects can have their access rights assigned using the access mask format shown in FIG. 26 . In this format, the lower 16 bits are used for object-specific access rights, the next 7 bits are used for standard access rights that apply to most types of objects, and the highest 4 bits are used to specify that each object type can be mapped to a Generic access for group-standard and object-specific permissions. The ACCESS_SYSTEM_SECURITY (Access System Security) bit corresponds to the permission to access the object's SACL.
(2)类属访问权限(2) Generic Access Rights
类属权限在掩码内的4个最高位中指定。每一类可护对象将这些位映射到其一组标准和对象专用访问权限。例如,一文件对象可将GENERIC_READ位映射到READ_CONTROL和SYNCHRONIZE标准访问权限,及映射到FILE_READ_DATA、FILE_READ_EA和FILE_READ_ATTRIBUTES对象专用访问权限。其它类型的对象将GENERIC_READ位映射到适用于该类对象的访问权限组。Generic permissions are specified in the 4 most significant bits within the mask. Each class of manageable objects maps these bits to its set of standard and object-specific access rights. For example, a file object may map GENERIC_READ bits to READ_CONTROL and SYNCHRONIZE standard access rights, and to FILE_READ_DATA, FILE_READ_EA, and FILE_READ_ATTRIBUTES object-specific access rights. Objects of other types map the GENERIC_READ bits to the access rights groups applicable to objects of that type.
当打开对象的句柄时,类属访问权限可用于指定所需的访问类型。这通常比指定所有对应的标准和专用权限要简单。下面的表格示出了为类属访问权限定义的常量。Generic access can be used to specify the type of access required when opening a handle to an object. This is usually simpler than specifying all corresponding standard and private permissions. The table below shows the constants defined for generic access rights.
(3)标准访问权限(3) Standard Access Rights
每一类可护对象有一组对应于对该类对象专用的操作的访问权限。除了这些对象专用访问权限之外,还有一组对应于对大多数类型的可保护对象公用的操作的标准访问权限。下面的表格示出了为标准访问权限定义的常量。Each class of maintainable objects has a set of access rights that correspond to operations specific to that class of objects. In addition to these object-specific access rights, there is a set of standard access rights corresponding to operations common to most types of securable objects. The table below shows the constants defined for standard access rights.
b)项目专用权限b) Project-specific permissions
在图26的访问掩码结构中,项目专用权限被放置在对象专用权限段(较低的16位)中。由于在本实施例中,存储平台展现了两组API来管理安全性-Win32和存储平台API,因此必须考虑文件系统对象专用权限以激发对存储平台对象专用权限的设计。In the access mask structure of FIG. 26, item-specific rights are placed in the object-specific rights field (lower 16 bits). Since, in this embodiment, the storage platform exposes two sets of APIs to manage security—Win32 and the storage platform API, file system object-specific permissions must be considered to motivate the design of storage platform object-specific permissions.
(1)文件和目录对象专用权限(1) File and directory object-specific permissions
考虑下表:Consider the following table:
参考上表,注意文件系统在文件和目录之间做出了基本的差别,这就是文件和目录权限为何能在相同的位上重叠的原因。文件系统定义了非常粒度化的权限,从而允许应用程序控制在这些对象上的行为。例如,它们允许应用程序在与文件相关联的属性(FILE_READ/WRITE_ATTRIBUTES)、扩展属性和数据流之间进行区分。Referring to the above table, note that the file system makes a fundamental difference between files and directories, which is why file and directory permissions can overlap at the same bit. The file system defines very granular permissions, allowing applications to control behavior on these objects. For example, they allow applications to distinguish between attributes associated with files (FILE_READ/WRITE_ATTRIBUTES), extended attributes, and data streams.
本发明的存储平台的安全模型的目标是简化权限分配模型,因此例如在数据存储项目(联系人、电子邮件等)上操作的应用程序一般无需在属性、扩展属性和数据流之间区分。然而,对于文件和文件夹,粒度Win32权限被保存,且定义了通过存储平台的访问语义,使得可提供与Win32应用程序的兼容性。这一映射对以下指定的每一项目权限讨论。The goal of the security model of the storage platform of the present invention is to simplify the rights assignment model, so that for example applications operating on data storage items (contacts, emails, etc.) generally do not need to distinguish between attributes, extended attributes and data streams. However, for files and folders, granular Win32 permissions are preserved and access semantics through the storage platform are defined so that compatibility with Win32 applications can be provided. This mapping is discussed for each project authority specified below.
以下项目权限是用其相关联的可允许操作来指定的。也提供了这些项目权限的每一个背后的等效的Win32权限。The following project permissions are specified with their associated allowable actions. The equivalent Win32 permissions behind each of these project permissions are also provided.
(2)WinFSItemRead(2)WinFSItemRead
该权限允许对项目的所有元素的读访问,包括通过嵌入关系链接到项目的项目。它也允许枚举通过持有关系链接到该项目的项目(也称为目录清单)。这包括通过引用关系链接的项目的名称。这一权限映射到:This permission allows read access to all elements of an item, including items linked to the item via an embedding relationship. It also allows enumeration of items linked to the item by holding relationships (also known as directory listings). This includes the names of items linked through reference relationships. This permission maps to:
文件:document:
(FILE_READ_DATA|SYNCHRONIZA)(FILE_READ_DATA|SYNCHRONIZA)
文件夹:folder:
(FILE_LIST_DIRECTORY|SYNCHRONIZE)(FILE_LIST_DIRECTORY|SYNCHRONIZE)
语义是安全应用程序可设置WinFSItemReadData(WinFS项目读数据),并指定权限掩码为以上指定的文件权限的组合。The semantics are that the security application can set WinFSItemReadData (WinFS item read data), and specify the permission mask as a combination of the file permissions specified above.
(3)WinFSItemReadAttributes(3)WinFSItemReadAttributes
该权限允许对项目的基本属性的读访问,这非常象基本文件属性和数据流之间的文件系统区分。较佳地,这些基本属性是驻留在从中导出所有项目的基本项目中的那些属性。该权限映射到:This permission allows read access to basic attributes of the item, much like the file system distinction between basic file attributes and data streams. Preferably, these base properties are those properties residing in the base item from which all items are derived. This permission maps to:
文件:document:
(FILE_READ_ATTRIBUTES)(FILE_READ_ATTRIBUTES)
文件夹:folder:
(FILE_READ_ATTRIBUTES)(FILE_READ_ATTRIBUTES)
(4)WinFSItemWriteAttributes(4)WinFSItemWriteAttributes
该权限允许对项目的基本属性的写访问,这非常象基本文件属性和数据流之间的文件系统区分。较佳地,这些基本属性驻留在从中导出所有项目的基本项目中的那些属性。该权限映射到:This permission allows write access to basic attributes of the item, much like the file system distinction between basic file attributes and data streams. Preferably, these base properties reside in those properties in the base item from which all items are derived. This permission maps to:
文件:document:
(FILE_WRITE_ATTRIBUTES)(FILE_WRITE_ATTRIBUTES)
文件夹:folder:
(FILE_WRITE_ATTRIBUTES)(FILE_WRITE_ATTRIBUTES)
(5)WinFSItemWrite(5)WinFSItemWrite
该权限允许对项目的所有元素进行写的能力,包括通过嵌入关系链接的项目。该权限也允许添加或删除到其它项目的嵌入关系的能力。该权限映射到:This permission allows the ability to write on all elements of an item, including items linked by embedding relationships. This permission also allows the ability to add or remove embedded relationships to other items. This permission maps to:
文件:document:
(FILE_WRITE_DATA)(FILE_WRITE_DATA)
文件夹:folder:
(FILE_ADD_FILE)(FILE_ADD_FILE)
在存储平台数据存储中,在项目和文件夹之间没有区别,因为项目也可以具有到数据存储中的其它项目的持有关系。因此,如果具有FILE_ADD_SUBDIRECTORY(或FILE_APPEND_DATA)权限,则可使项目为到其它项目的关系的源。In a storage platform data store, there is no distinction between items and folders, since items can also have holding relationships to other items in the data store. Thus, if you have the FILE_ADD_SUBDIRECTORY (or FILE_APPEND_DATA) permission, you can make a project the source of relationships to other projects.
(6)WinFSItemAddLink(6)WinFSItemAddLink
该权限允许添加到存储中的项目的持有关系的能力。应当注意,由于用于多个持有关系的安全模型改变项目上的安全性,且如果是来自分层结构中的较高点,则改变可绕过WRITE_DAC,因此在目的地项目上要求WRITE_DAC以能够创建到其的关系。该权限映射到:This permission allows the ability to add hold relationships to items in the store. It should be noted that WRITE_DAC is required on the destination item due to the security model for multiple holding relationships changing security on the item, and if coming from a higher point in the hierarchy, the change can bypass WRITE_DAC Ability to create relationships to it. This permission maps to:
文件:document:
(FILE_APPEND_DATA)(FILE_APPEND_DATA)
文件夹:folder:
(FILE_ADD_SUBSIRECTORY)(FILE_ADD_SUBSIRECTORY)
(7)WinFSItemDeleteLink(7)WinFSItemDeleteLink
该权限即使在未向主体授予删除项目的权限时也允许删除到该项目的持有关系的能力。这与文件系统模型相一致,且有助于清除。该权限映射到:This permission allows the ability to delete a holding relationship to an item even when the principal is not granted permission to delete the item. This is consistent with the file system model and facilitates cleanup. This permission maps to:
文件:document:
(FILE_DELETE_CHILD)-注意,文件系统没有等效于该权限的文件,但是有了具有到其它项目的持有关系的概念,并因此也可对非文件夹实现该权限。(FILE_DELETE_CHILD) - Note that the filesystem has no equivalent of this permission for files, but has the notion of having a holding relationship to other items, and thus implements this permission for non-folders as well.
文件夹:folder:
(FILE_DELETE_CHILD)(FILE_DELETE_CHILD)
(8)删除项目的权限(8) Permission to delete items
如果到项目的最后一个持有关系消失,则该项目被删除。没有对删除项目的显式表示法。存在删除到项目的所有持有关系的清除操作,但是它是较高级工具且不是系统原语。If the last holding relationship to an item disappears, the item is deleted. There is no explicit notation for removing an item. There is a cleanup operation that removes all holding relationships to items, but it is a higher level tool and not a system primitive.
如果满足以下两个条件之一,则使用路径指定的任何项目可被取消链接:(1)沿该路径的父项目向该项目授予写权限,或者(2)该项目本身上的标准权限授权DELETE。当移除最后一个关系时,该项目从系统中消失。如果项目本身上的标准权限授权DELETE,则使用ItemID指定的任何项目可被取消链接。Any item specified with a path can be unlinked if either (1) a parent item along that path grants write permission to the item, or (2) standard permissions on the item itself authorize DELETE . When the last relationship is removed, the item disappears from the system. Any item specified with an ItemID can be unlinked if the standard permissions on the item itself authorize DELETE.
(9)复制项目的权限(9) Permission to copy items
如果主体被授权项目上的WinFSItemRead和目的地文件夹上的WinFSItemWrite,则项目可从源复制到目的地文件夹。Items can be copied from the source to the destination folder if the principal is authorized for WinFSItemRead on the item and WinFSItemWrite on the destination folder.
(10)移动项目的权限(10) Permission to move items
在文件系统中移动文件仅要求源文件上的DELETE权限和目的地目录上的FILE_ADD_FILE,因为它保存了目的地上的ACL。然而,可在MoveFileEx调用(MOVEFILE_COPY_ALLOWED)中指定让应用程序指定在跨卷移动的情况下可容忍CopyFile语义的标志。对于在移动之后对安全描述符发生了什么有四个可能的选择:Moving a file in the file system requires only DELETE permission on the source file and FILE_ADD_FILE on the destination directory, since it preserves the ACL on the destination. However, a flag can be specified in the MoveFileEx call (MOVEFILE_COPY_ALLOWED) that lets the application specify that CopyFile semantics are tolerated in the case of moves across volumes. There are four possible options for what happens to the security descriptor after the move:
1.与文件一起携带整个ACL-默认的卷内移动语义。1. Carry the entire ACL along with the file - the default intra-volume move semantics.
2.与文件一起携带整个ACL并将ACL标记为受保护的。2. Carry the entire ACL along with the file and mark the ACL as protected.
3.仅携带显式ACE跨越,并在目的地上重新继承。3. Only carry explicit ACE spans and re-inherit on the destination.
4.不携带任何东西,并在目的地上重新继承-默认的卷间移动语义-与复制文件一样。4. Carry nothing and re-inherit on the destination - the default inter-volume move semantics - as if copying the file.
在本安全模型中,如果应用程序指定了MOVEFILE_COPY_ALLOWED标志,则对卷内和卷间两种情况都执行第四个选项。如果该标志未指定,则执行第二个选项,除非目的地也在同一安全区域中(即,同一继承语义)。存储平台级移动也实现第四个选项,且要求源上的READ_DATA,与复制所要求的一样。In this security model, if the application specifies the MOVEFILE_COPY_ALLOWED flag, the fourth option is enforced for both intra-volume and inter-volume cases. If this flag is not specified, the second option is executed unless the destination is also in the same security zone (ie, same inheritance semantics). Storage platform-level moves also implement a fourth option, and require READ_DATA on the source, as does copying.
(11)查看项目上的安全策略的权限(11) View the permissions of the security policy on the project
如果项目向主体授予标准权限READ_CONTROL,则可查看项目的安全性。View security for a project if the project grants the standard permission READ_CONTROL to the principal.
(12)改变项目上的安全策略的权限(12) Change the permissions of the security policy on the project
如果项目向主体授予标准权限WRITE_DAC,则可改变项目的安全性。然而,由于数据存储提供隐式继承,因此这具有可以如何在分层结构上改变安全性的含意。规则是如果分层结构的根授权WRTIE_DAC,则在整个分层结构上改变安全策略,而不论分层结构(或DAG)中的特定项目是否不向主体授权WRITE_DAC。If the project grants the standard permission WRITE_DAC to the principal, the security of the project can be changed. However, since the data store provides implicit inheritance, this has implications for how security can vary hierarchically. The rule is that if the root of the hierarchy authorizes WRTIE_DAC, then the security policy is changed across the entire hierarchy, regardless of whether a particular item in the hierarchy (or DAG) does not authorize WRITE_DAC to the principal.
(13)没有直接等效物的权限(13) Authority without direct equivalent
在本实施例中,FILE_EXECUTE(用于目录的FILE_TRAVERSE)在存储平台中没有直接等效物。该模型为Win32兼容性保存这些权限,但是没有基于这些权限为项目做出任何访问决策。如同FILE_READ/WRITE_EA一样,由于数据存储项目没有扩展属性的表示法,因此未提供该位的语义。然而,为Win32兼容性保留该位。In this embodiment, FILE_EXECUTE (FILE_TRAVERSE for directories) has no direct equivalent in storage platforms. The model preserves these permissions for Win32 compatibility, but does not make any access decisions for projects based on these permissions. As with FILE_READ/WRITE_EA, the semantics of this bit are not provided since data store items do not have a notation for extended attributes. However, this bit is reserved for Win32 compatibility.
3.实现3. Realize
定义同样受保护的区域的所有项目在安全表中具有与其相关联的条目。安全表定义如下:All items that define areas that are also protected have an entry associated with them in the security table. The security table is defined as follows:
项目身份条目是同样受保护的安全区域的根的项目身份。项目有序路径是与同样受保护的安全区域的根相关联的有序路径(ordpath)。显式项目ACL条目是为同样受保护的安全区域的根定义的显式ACL。在某些情况下,这可以为空,例如,当由于项目具有属于不同区域的多个父项目而定义新安全区域时。路径ACL是由项目继承的ACL集,区域ACL条目是为与项目相关联的同样受保护的安全区域定义的ACL集。The project identity entry is the project identity of the root of the security area that is also protected. An item ordered path is an ordered path (ordpath) associated with the root of a security area that is also protected. An explicit project ACL entry is an explicit ACL defined for the root of a security zone that is also protected. This can be empty in some cases, for example when defining a new security area because the project has multiple parent projects belonging to different areas. Path ACLs are the set of ACLs inherited by the project, and zone ACL entries are the set of ACLs defined for similarly protected security zones associated with the project.
对给定存储中的任何项目的有效安全性的计算充分利用了该表。为确定与项目相关联的安全策略,获取与项目相关联的安全区域,并检索与该区域相关联的ACL。Computation of the effective security for any item in a given store makes full use of this table. To determine the security policy associated with a project, get the security zone associated with the project and retrieve the ACL associated with that zone.
当通过直接添加显式ACL或通过间接添加导致形成新安全区域的持有关系来改变与项目相关联的安全策略时,使该安全表保持最新,以确保上述用于确定项目的有效安全性的算法是有效的。This security table is kept up-to-date when the security policy associated with a project is changed, either directly by adding explicit ACLs or by indirectly adding holding relationships that result in the formation of new security zones, to ensure the Algorithms work.
对存储的各种改变以及维护安全表的随附算法如下:The various changes to storage and accompanying algorithms for maintaining the safety table are as follows:
a)在容器中创建新项目a) Create a new project in the container
当在容器中新创建项目时,它继承与该容器相关联的所有ACL。由于新创建的项目只有一个父项目,因此它与其父项目属于同一区域。由此,无需在安全表中创建新条目。When an item is newly created in a container, it inherits all ACLs associated with that container. Since the newly created project has only one parent project, it belongs to the same region as its parent project. As a result, no new entries need to be created in the security table.
b)向项目添加显式ACLb) Add an explicit ACL to the project
当ACL被添加到项目时,它为包含分层结构中属于与给定项目本身相同的安全区域的所有其子孙定义新安全区域。对于包含分层结构中属于其它安全区域但是为给定项目的子孙的所有项目,安全区域保持不变,但是与该区域相关联的有效ACL被改变,以反映新ACL的添加。When an ACL is added to a project, it defines new security zones for all of its descendants in the containing hierarchy that belong to the same security zone as the given project itself. For all items in the containment hierarchy that belong to other security areas but are descendants of the given item, the security area remains unchanged, but the effective ACL associated with that area is changed to reflect the addition of the new ACL.
对该新安全区域的引入可触发对具有与跨越旧安全区域和新定义的安全区域的祖先的多个持有关系的所有项目进一步定义区域。对于所有这样的项目,需要定义新的安全区域,并重复该过程。The introduction of this new security zone may trigger further definition of zones for all items that have multiple holding relationships with ancestors spanning the old security zone and the newly defined security zone. For all such projects, new security zones need to be defined and the process repeated.
图27(a)、(b)和(c)描绘了通过引入新的显式ACL从现有安全区域中划分出来的新的同样受保护的安全区域。这是由标记为2的节点指示的。然而,对该新区域的引入导致创建另外的区域3,因为项目具有多个持有关系。Figures 27(a), (b) and (c) depict new security zones that are also protected from existing security zones by introducing new explicit ACLs. This is indicated by the node labeled 2. However, the introduction of this new area results in the creation of an
以下对安全表的更新序列反映了对同样受保护的安全区域的分解。The following sequence of updates to the security table reflects a breakdown of the security regions that are also protected.
c)向项目添加持有关系c) Add a holding relationship to the project
当向项目添加持有关系时,它引发三种可能性之一。如果持有关系的目标,即考虑中的项目是安全区域的根,则与该区域相关联的有效ACL被改变,且无需对该安全表的进一步修改。如果新持有关系的源的安全区域与项目的现有父项目的安全区域相同,则无需任何改变。然而,如果项目现在具有属于不同安全区域的父项目,则形成新的安全区域,以给定项目作为该安全区域的根。这一改变通过修改与该项目相关联的安全区域被传播到包含分层结构中的所有项目。属于与考虑中的项目相同的安全区域的所有项目及其在包含分层结构中的子孙都需要改变。一旦做出了改变,需要检查具有多个持有关系的所有项目以确定是否需要进一步的改变。如果这些项目中的任一个具有不同安全区域的父项目,则需要进一步的改变。When adding a holding relationship to a project, it raises one of three possibilities. If the target of the holding relationship, ie the item under consideration, is the root of a security zone, the effective ACL associated with that zone is changed and no further modification of the security table is required. If the security zone of the source of the new holding relationship is the same as the security zone of the project's existing parent project, no changes are required. However, if the project now has a parent project that belongs to a different security area, a new security area is formed with the given project as the root of that security area. This change is propagated to all items in the containing hierarchy by modifying the security zone associated with that item. All items and their descendants in the containment hierarchy that belong to the same security area as the item under consideration need to be changed. Once a change is made, all projects with multiple holding relationships need to be checked to determine if further changes are required. If any of these projects have parent projects with different security zones, further changes are required.
d)从项目删除持有关系d) Remove the holding relationship from the project
当从项目删除持有关系时,如果满足某些条件,可能用其父区域来折叠安全区域。更精确地,这可以在以下条件下完成:(1)如果持有关系的移除导致有一个父项目的项目且没有为该项目指定显式ACL;(2)如果持有关系的移除导致其父项目都在同一安全区域内的项目,且没有为该项目定义显式ACL。在这些情况下,这些安全区域可被标记为与父项目相同。这一标记需要应用于其安全区域对应于所折叠的区域的所有项目。When removing a holding relationship from a project, it is possible to collapse a security area with its parent area if certain conditions are met. More precisely, this can be done under the following conditions: (1) if the removal of the holding relationship results in an item that has a parent item and no explicit ACL is specified for that item; (2) if the removal of the holding relationship results in A project whose parents are both in the same security zone and for which no explicit ACL is defined. In these cases, these security areas can be marked the same as the parent project. This flag needs to be applied to all items whose safe area corresponds to the collapsed area.
e)从项目中删除显式ACLe) Remove the explicit ACL from the project
当从项目中删除显式ACL时,可能用其父项目的安全区域来折叠根为该项目的安全区域。更精确地,如果显式ACL的移除导致其在包含分层结构中的父项目属于同一安全区域的项目,则可实现这一过程。在这些情况下,可将安全区域标记为与父项目相同,且改变被应用于其安全区域对应于所折叠的区域的所有项目。When explicit ACLs are removed from a project, it is possible to collapse the security zone rooted at that project with the security zone of its parent project. More precisely, this process can be achieved if the removal of the explicit ACL results in an item whose parent item in the containment hierarchy belongs to the same security area. In these cases, the safe area can be marked the same as the parent item, and the change is applied to all items whose safe area corresponds to the collapsed area.
f)修改与项目相关联的ACLf) Modify the ACL associated with the project
在这一情形中,不需要对安全表进行任何新的添加。与该区域相关联的有效ACL被更新,且将该新的ACL改变传播到被它所影响的安全区域。In this case, no new additions to the security table are required. The effective ACL associated with the zone is updated, and the new ACL change is propagated to the security zones affected by it.
F.通知和改变跟踪F. Notifications and Change Tracking
按本发明的另一方面,存储平台提供允许应用程序跟踪数据改变的通知能力。此特征主要供保持易失状态或执行数据改变事件上的业务逻辑的应用程序使用。应用程序注册在项目、项目扩展及项目关系上的通知。在提交了数据改变之后通知被异步地传送。应用程序可按项目、扩展和关系类型以及操作类型来过滤通知。According to another aspect of the invention, the storage platform provides notification capabilities that allow applications to track data changes. This trait is primarily intended for use by applications that maintain volatile state or perform business logic on data change events. Applications register for notifications on items, item extensions, and item relationships. Notifications are delivered asynchronously after data changes are committed. Applications can filter notifications by project, extension and relationship type, and action type.
按一个实施例,存储平台API 322为通知提供两类接口。第一,应用程序注册由对项目、项目扩展和项目关系的改变触发的简单数据改变事件。第二,应用程序创建“监视程序”对象来监视项目、项目扩展和项目之间关系的组。在系统失败或系统离线超过延长的时间段之后,可保存和重新创建监视程序对象的状态。单个通知可反映多个更新。According to one embodiment, the
1.存储改变事件1. Storage change event
本节提供了如何使用由存储平台API 322提供的通知接口的若干示例。This section provides several examples of how to use the notification interfaces provided by
a)事件a) event
项目、项目扩展和项目关系展现了由应用程序用于注册数据改变通知的数据改变事件。以下代码示例示出了Item基类上ItemModified(项目修改)和ItemRemoved(项目移除)事件处理程序的定义。Items, Item Extensions, and Item Relationships represent data change events used by applications to register for data change notifications. The following code example shows the definition of the ItemModified (item modified) and ItemRemoved (item removed) event handlers on the Item base class.
//事件//event
public event ItemModifiedEventHandler Item ItemModified;public event ItemModifiedEventHandler Item ItemModified ;
public event ItemRemovedEventHandler Item ItemRemoved;public event ItemRemovedEventHandler Item ItemRemoved ;
所有通知都携带足够的数据以从数据存储中检索改变的项目。以下代码示例示出了如何注册项目、项目扩展或项目关系上的事件:All notifications carry enough data to retrieve changed items from the data store. The following code samples show how to register for events on items, item extensions, or item relationships:
myItem.ItemModified+=new ItemModifiedEventHandler(this.onItemUpdate);myItem.ItemModified+=new ItemModifiedEventHandler(this.onItemUpdate);
myItem.ItemRemoved+=new ItemRemovedEventHandler(this.onItemDelete);myItem.ItemRemoved+=new ItemRemovedEventHandler(this.onItemDelete);
在本实施例中,存储平台确保如果自从最后一次传送通知以来相应的项目被修改或删除,或在自从最后一次从数据存储中取出以来的新注册的情况下将通知应用程序。In this embodiment, the storage platform ensures that the application will be notified if the corresponding item has been modified or deleted since the last notification was delivered, or in the case of a new registration since the last fetch from the data store.
b)监视程序b) Monitoring program
在本实施例中,存储平台定义了用于监视与(I)文件夹或文件夹分层结构,(2)项目上下文,或(3)特定项目相关联的对象的监视程序类。对于这三个类别中的每一个,存储平台提供了监视相关联的项目、项目扩展或项目关系的特定监视程序类,例如,存储平台提供相应的FolderItemWatcher(文件夹项目监视程序)、FolderRelationshipWatcher(文件夹关系监视程序)以及FolderExtensionWatcher(文件夹扩展监视程序)类。In this embodiment, the storage platform defines watcher classes for monitoring objects associated with (1) folders or folder hierarchies, (2) project contexts, or (3) specific projects. For each of these three categories, the storage platform provides specific watcher classes that monitor associated items, item extensions, or item relationships, for example, the storage platform provides corresponding FolderItemWatcher (folder item watcher), FolderRelationshipWatcher (file Folder relationship monitor) and FolderExtensionWatcher (folder extension monitor) class.
当创建监视程序时,应用程序可对预先存在的项目,即项目、扩展或关系请求通知。该选项大多数用于维护专用项目高速缓存的应用程序。如果未请求,则应用程序接收对发生在创建了监视程序对象之后的所有更新的通知。When creating a watcher, an application can request notifications on pre-existing items, ie, items, extensions, or relationships. This option is mostly used by applications that maintain a private item cache. If not requested, the application receives notifications of all updates that have occurred since the watcher object was created.
连同传送通知一起,存储平台提供“WatcherState(监视程序状态)”对象。WatcherState可被串行化并保存在磁盘上。监视程序状态随后可用于在失败或当在离线之后重新连接时重新创建相应的监视程序。新的重新创建的监视程序将重新生成未确认的通知。应用程序通过在相应的监视程序状态上调用提供对通知的引用的“Exclude(排除)”方法来指示通知的送达。Along with delivery notifications, the storage platform provides a "WatcherState" object. WatcherState can be serialized and saved on disk. The watchdog state can then be used to recreate the corresponding watchdog on failure or when reconnecting after going offline. A new recreated watcher will regenerate unacknowledged notifications. The application indicates delivery of a notification by calling an "Exclude" method on the corresponding watchdog state providing a reference to the notification.
存储平台向每一事件处理程序传送监视程序状态的单独副本。在同一事件处理程序的随后的调用上接收到的监视程序状态假定所有先前接收的通知的送达。The storage platform delivers a separate copy of the watchdog state to each event handler. Received watchdog state on subsequent invocations of the same event handler assumes delivery of all previously received notifications.
作为示例,以下代码示例示出了FolderItemWatcher的定义。As an example, the following code sample shows the definition of FolderItemWatcher.
public class FolderItemWatcher:Watcherpublic class FolderItemWatcher:Watcher
{{
//构造函数 //Constructor
public FolderItemWatcher_Constructor(Folder folder);public FolderItemWatcher_Constructor(Folder folder);
public FolderItemWatcher_Constructor1(Folder folder,Type itemType); public FolderItemWatcher_Constructor1(Folder folder, Type itemType);
public FolderItemWatcher_Constructor2(ItemContext context,ItemId folderId); public FolderItemWatcher_Constructor2(ItemContext context, ItemId folderId);
public FolderItemWatcher_Constructor3(Folder folder,Type itemType, public FolderItemWatcher_Constructor3(Folder folder, Type itemType,
FolderItemWatcherOptions options);FolderItemWatcherOptions options);
public FolderItemWatcher_Constructor4(ItemContext context,ItemId folderId,Type itemType); public FolderItemWatcher_Constructor4(ItemContext context, ItemId folderId, Type itemType);
public FolderItemWatcher_Constructor5(ItemContext context,ItemId,folderId,Type itemType, public FolderItemWatcher_Constructor5(ItemContext context, ItemId, folderId, Type itemType,
FolderItemWatcherOptions options);FolderItemWatcherOptions options);
//属性 //Attributes
public ItemId FolderItemWatcher_Folderld{get;} public ItemId FolderItemWatcher_Folderld{get;}
public Type FolderItemWatcher_ItemType{get;} public Type FolderItemWatcher_ItemType{get;}
public FolderItemWatcherOptions FolderItemWatcher_Options{get;} public FolderItemWatcherOptions FolderItemWatcher_Options{get;}
//事件 //event
public event ItemChangedEventHandler FolderItemWatcher_ItemChanged;public event ItemChangedEventHandler FolderItemWatcher_ItemChanged;
}}
以下代码示例示出了如何创建用于监视文件夹的内容的文件夹监视程序对象。监视程序在添加新音乐项目或更新或删除现有音乐项目时生成通知,即事件。文件夹监视程序监视文件夹分层结构中的特定文件夹或所有文件夹。The following code example shows how to create a folder watcher object for monitoring the contents of a folder. The watchdog generates notifications, ie events, when new music items are added or existing music items are updated or deleted. Folder Watcher monitors a specific folder or all folders in a folder hierarchy.
myFolderItemWatcher=new FolderItemWatcher(myFolder,typeof(Music));myFolderItemWatcher = new FolderItemWatcher(myFolder, typeof(Music));
myFolderItemWatcher.ItemChanged+=new ItemChangedEventHandler(this.onItemChanged);myFolderItemWatcher.ItemChanged+=new ItemChangedEventHandler(this.onItemChanged);
2.改变跟踪和通知生成机制2. Change tracking and notification generation mechanism
该存储平台提供了一种简单而有效的机制来跟踪数据改变和生成通知。客户机在用于检索数据的同一连接上检索通知。这极大程度上简化了安全检查、移除了可能网络配置上的延时和约束。通知是通过发出选择语句来检索的。为防止轮询,客户机可使用由数据库引擎314提供的“等待(wairfor)”特征。图13示出了基本存储平台通知概念。等待查询可同步地执行,在该情况下,调用线程被阻断,直到结果可用;或者可异步地执行,在该情况下,线程不被阻断,且当结果可用时在单独的线程上返回结果。The storage platform provides a simple and efficient mechanism to track data changes and generate notifications. Clients retrieve notifications on the same connection used to retrieve data. This greatly simplifies security checks, removing delays and constraints on possible network configurations. Notifications are retrieved by issuing a select statement. To prevent polling, clients can use a "wait for" feature provided by database engine 314 . Figure 13 illustrates the basic storage platform notification concept. Awaiting queries can be executed synchronously, in which case the calling thread is blocked until the result is available, or asynchronously, in which case the thread is not blocked and returns on a separate thread when the result is available result.
“等待”和“选择”的组合对于监视适合特定数据范围的数据改变是有吸引力的,因为改变可通过在相应的数据范围上设置通知锁来监视。这适用于许多常见的存储平台情形。对于个别项目的改变可以通过在相应的数据范围上设置通知锁来监视。对文件夹和文件夹树的改变可通过在路径范围上设置通知锁来监视。对类型及其子类型的改变可通过在类型范围上设置通知锁来监视。The combination of "wait" and "select" is attractive for monitoring data changes appropriate for a particular data range, since changes can be monitored by setting a notification lock on the corresponding data range. This applies to many common storage platform scenarios. Changes to individual items can be monitored by setting notification locks on the corresponding data ranges. Changes to folders and folder trees can be monitored by setting notification locks on path scopes. Changes to a type and its subtypes can be monitored by setting a notification lock on the type scope.
一般而言,有三个与处理通知相关联的不同阶段:(1)数据改变或甚至检测,(2)订阅匹配,以及(3)通知送达。排除同步通知送达,即作为执行数据改变的事务的一部分的通知送达,存储平台可实现以下两种形式的通知送达:In general, there are three distinct phases associated with processing notifications: (1) data change or even detection, (2) subscription matching, and (3) notification delivery. Excluding synchronous notification delivery, that is, notification delivery as part of a transaction that performs data changes, storage platforms can implement the following two forms of notification delivery:
1)直接事件检测:执行事件检测和订阅匹配作为更新事务的一部分。通知被插入到由订户监视的表中;以及1) Direct event detection: Perform event detection and subscription matching as part of an update transaction. Notifications are inserted into tables monitored by subscribers; and
2)推迟的事件检测:在提交了更新事务之后执行事件检测和订阅匹配。随后实际的订户或中介检测事件并生成通知。2) Deferred event detection: Event detection and subscription matching are performed after the update transaction is committed. The actual subscriber or intermediary then detects the event and generates a notification.
直接事件检测要求执行额外的代码作为更新操作的一部分。这允许捕捉所有感兴趣的事件,包括指示相对状态改变的事件。Direct event detection requires additional code to be executed as part of the update operation. This allows capturing all events of interest, including events indicating relative state changes.
推迟的事件检测移除向更新操作添加额外代码的要求。事件检测是由最终订户来完成的。推迟的事件检测通常对事件检测和事件送达进行批处理,且很好地适用于数据库引擎314(例如,SQL Server)的查询执行基础结构。Deferred event detection removes the requirement to add extra code to update operations. Event detection is done by the end subscriber. Deferred event detection typically batches event detection and event delivery, and is well suited to the query execution infrastructure of a database engine 314 (eg, SQL Server).
推迟的事件检测依赖于更新操作留下的日志或跟踪。存储平台为删除的数据项目维护一组逻辑时间标记以及墓碑。当扫描数据存储中的改变时,客户机提供定义用于检测改变的低水印的时间标记以及防止重复通知的一组时间标记。应用程序可能接收到对在由低水印指示的时间之后发生的所有改变的通知。Deferred event detection relies on logs or traces left by update operations. The storage platform maintains a set of logical timestamps and tombstones for deleted data items. When scanning for changes in a data store, the client provides a set of timestamps that define a low watermark for detecting changes as well as a set of timestamps that prevent duplicate notifications. The application may receive notifications of all changes that occurred after the time indicated by the low watermark.
能够访问核心视图的复杂应用程序还可通过创建专用参数和重复过滤器表,来优化和减少监视一组可能很大的项目所需的SQL语句的数量。具有特殊需求的应用程序,诸如必须支持丰富视图的应用程序可使用可用的改变跟踪框架来监视数据改变并刷新其专用快照。Complex applications that have access to core views can also optimize and reduce the number of SQL statements required to monitor a potentially large set of items by creating dedicated parameter and repeat filter tables. Applications with special needs, such as those that must support rich views, can use the available change tracking framework to monitor data changes and refresh their private snapshots.
因此,较佳地,在一个实施例中,存储平台实现推迟的时间检测方法,如下文更完整地描述的。Therefore, preferably, in one embodiment, the storage platform implements a deferred time detection method, as described more fully below.
a)改变跟踪a) change tracking
所有项目、扩展和项目关系定义携带唯一的标识符。改变跟踪为所有数据项目维护一组逻辑时间标记来记录创建、更新和删除时间。墓碑条目用于表示删除的数据项目。All project, extension and project relationship definitions carry a unique identifier. Change Tracking maintains a set of logical timestamps for all data items to record creation, update and deletion times. Tombstone entries are used to represent deleted data items.
应用程序使用该信息来有效地监视自从应用程序最后一次访问数据存储以来是否新添加、更新或删除了特定的项目、项目扩展或项目关系。以下示例示出了该机制。Applications use this information to efficiently monitor whether specific items, item extensions, or item relationships have been newly added, updated, or deleted since the application last accessed the data store. The following example shows the mechanism.
create table[item-extension-relationship-table-template](create table[item-extension-relationship-table-template](
identifier uniqueidentifier not null default newid()identifier uniqueidentifier not null default newid()
created bigint,not null,--@@当创建时存入created bigint, not null, --@@stored when created
updated bignit,not null,--@@当最后一次更新时存入updated bignit, not null, --@@stored when last updated
.........
))
所有删除的项目、项目扩展和关系被记录在对应的墓碑表中。一个模板示出如下。All deleted items, item extensions and relationships are recorded in the corresponding tombstone tables. A template is shown below.
create table[item-extension-relationship-tombstone table-template](create table[item-extension-relationship-tombstone table-template](
identifier uniqueidentifier not null,identifier uniqueidentifier not null,
deleted bigint,not null,--@@当删除时存入,Deleted bigint, not null, --@@stored when deleted,
created bigint,not null,--@@当创建时存入,created bigint, not null, --@@ stored when created,
updated bigint,not null,--@@当最后一次更新时存入updated bigint, not null, --@@stored when last updated
.........
))
为效率原因,存储平台为项目、项目扩展、关系和路径名维护一组全局表。这些全局查找表可以由应用程序用于有效地监视数据范围和检索相关联的时间标记和类型信息。For efficiency reasons, the storage platform maintains a set of global tables for items, item extensions, relationships, and pathnames. These global lookup tables can be used by applications to efficiently monitor data ranges and retrieve associated timestamp and type information.
b)时间标记管理b) Time stamp management
逻辑时间标记对于数据库存储,即存储平台卷是“本地的”。时间标记是单调递增的64位值。保留单个时间标记通常足以检测在最后一次连接到存储平台卷之后是否发生了数据改变。然而,在最真实的情形中,需要保存稍多一些的时间标记来检查重复。原因解释如下。Logical time stamps are "local" to database storage, ie storage platform volumes. Timestamps are monotonically increasing 64-bit values. Retaining a single timestamp is usually sufficient to detect whether data has changed since the last connection to the storage platform volume. However, in the most realistic case, slightly more timestamps need to be saved to check for duplicates. The reason is explained below.
关系型数据库表是构建在一组物理数据结构上的逻辑抽象,即B树、堆等。向新创建或更新的记录分配时间标记不是原子动作。将该记录插入到底层数据结构可能在不同的时刻发生,由此应用程序可能会看到记录是无序的。A relational database table is a logical abstraction built on a set of physical data structures, such as B-trees, heaps, etc. Assigning a timestamp to a newly created or updated record is not an atomic action. Inserting the record into the underlying data structure may occur at a different time, whereby the application may see the records as being out of order.
图14示出了将新记录插入到同一B树中的两个事务。由于事务T3在调度事务T2的插入之前插入其记录,因此扫描B树的应用程序可能会看到由事务T3插入的记录在由T2插入的事务之前。由此,读者可能不正确地假定他看到了在时刻“10”之前创建的所有记录。为解决这一问题,数据库引擎314提供了一种返回低水印的功能,在该低水印之前,提交了所有的更新且所有更新都被插入到各自的底层数据结构中。在上述示例中,返回的低水印是“5”,假定读者在提交事务T2之前启动。由数据库引擎314提供的低水印允许应用程序在扫描数据库或数据范围内的数据改变时有效地确定要忽略哪些项目。一般而言,ACID事务被假定为持续非常短的时间,由此,预期低水印非常接近于最近分发的时间标记。在存在长持续时间的事务的情况下,应用程序可能必须保存个别的时间标记来检测和丢弃重复。Figure 14 shows two transactions inserting new records into the same B-tree. Since transaction T3 inserts its records before transaction T2's insert is scheduled, an application scanning the B-tree may see that records inserted by transaction T3 precede those inserted by T2. Thus, the reader may incorrectly assume that he saw all records created before time "10." To solve this problem, the database engine 314 provides a function to return a low watermark before which all updates are committed and all updates are inserted into the respective underlying data structures. In the above example, the returned low watermark is "5", assuming the reader started before committing transaction T2. The low watermark provided by the database engine 314 allows an application to efficiently determine which items to ignore when scanning a database or range of data for data changes. In general, ACID transactions are assumed to last for a very short time, and thus a low watermark is expected to be very close to the most recently distributed timestamp. In the presence of long-duration transactions, applications may have to keep individual timestamps to detect and discard duplicates.
c)数据改变检测-事件检测c) Data Change Detection - Event Detection
当查询数据存储时,应用程序获得低水印。随后,应用程序使用该水印来扫描数据存储中其创建、更新或删除时间标记大于返回的低水印的条目。图15示出了该过程。Applications get a low watermark when querying the data store. The application then uses this watermark to scan the data store for entries whose creation, update, or deletion timestamps are greater than the returned low watermark. Figure 15 illustrates this process.
为防止重复通知,应用程序记住大于返回的低水印的时间标记,并使用这些时间标记来滤除重复。应用程序创建会话本地临时表,以有效低处理一大组重复时间标记。在发出选择语句之前,应用程序插入所有先前返回的重复时间标记,并删除比返回的最后一个低水印更老的时间标记,如下所示。To prevent duplicate notifications, the app remembers timestamps greater than the returned low watermark and uses these to filter out duplicates. Applications create session-local temporary tables to efficiently handle large sets of repeating timestamps. Before issuing a select statement, the application inserts all previously returned duplicate timestamps and removes timestamps older than the last low watermark returned, as shown below.
delete from$dupilcates where ts<@oldLowWaterMarkldelete from $dupilcates where ts<@oldLowWaterMarkl
insert into$duplicates(ts)values(...),...,(...);insert into $duplicates(ts)values(...),...,(...);
waitfor(select*,getLowWaterMark()as newLowWaterMarkwaitfor(select*, getLowWaterMark() as newLowWaterMark
from[global!items]from[global! items]
where updated>=@oldLowWaterMarkwhere updated>=@oldLowWaterMark
and updated not in(select*from$duplicates))and updated not in(select*from$duplicates))
G.同步G. Synchronization
依照本发明的另一方面,该存储平台提供同步服务330,它(I)允许存储平台的多个实例(每个有自己的数据存储302)按一组灵活的规则来同步它们的内容的各部分,以及(ii)为第三方提供基础结构以将本发明的存储平台的数据存储与实现专有协议的其它数据源同步。According to another aspect of the invention, the storage platform provides a synchronization service 330 which (1) allows multiple instances of the storage platform (each with its own data store 302) to synchronize individual instances of their content according to a flexible set of rules. part, and (ii) provide an infrastructure for third parties to synchronize data storage of the storage platform of the present invention with other data sources implementing proprietary protocols.
存储平台到存储平台的同步在一组参与的复制品之间发生。例如,参考图3,希望在多半是在不同的计算机系统上运行的存储平台的另一实例的控制下提供在存储平台300的数据存储302和另一远程数据存储338之间的同步。该组的总成员资格不必在任何给定时间被任何给定复制品知道。Storage platform-to-storage platform synchronization occurs across a set of participating replicas. For example, referring to FIG. 3 , it is desirable to provide synchronization between data store 302 of
不同的复制可以独立地(即并发地)作出改变。将同步过程定义成使每个复制品知道由其它复制品作出的改变。此同步能力本质上是多主的(multi-master)。Different replicas can make changes independently (ie, concurrently). A synchronization process is defined to make each replica aware of changes made by other replicas. This synchronization capability is multi-master in nature.
本发明的同步能力允许各复制品:The synchronization capabilities of the present invention allow each replica to:
·确定另一复制品知道什么改变;Determine what changes the other replica knows about;
·请求关于此复制品不知道的改变的信息;Request information about changes not known to this replica;
·传达关于其它复制品不知道的改变的信息;· convey information about changes unknown to other replicas;
·确定两个改变何时互相冲突;Determine when two changes conflict with each other;
·本地应用改变;· Local application changes;
·传达冲突分解到其它复制品以确保收敛性;以及· Communicate conflict resolution to other replicas to ensure convergence; and
·基于对冲突分解指定的策略分解冲突。• Decompose conflicts based on policies specified for conflict resolution.
1.存储平台到存储平台的同步1. Synchronization from storage platform to storage platform
本发明的存储平台的同步服务300的主要应用是同步存储平台(每个带有它自己的数据存储)的多个实例。同步服务在存储平台模式级上操作(而不是在数据库引擎314的底层表中)。因此,例如“范围(Scope)”用于定义下面讨论的同步组。The main application of the
同步服务按“纯改变(net change)”的原则操作。不是记录和发送各个操作(如事务复制那样),同步服务而是发送这些操作的最终结果,因此常将多个操作的结果合并成单个最终结果。Synchronization services operate on the principle of "net change". Instead of recording and sending individual operations (as transactional replication does), the synchronization service sends the final results of those operations, thus often combining the results of multiple operations into a single final result.
同步服务通常不考虑事务边界。换言之,若在单个事务中对存储平台数据存储作出两个改变,不保证这些改变原子地应用到所有其它复制品上-可以示出一个改变而不示出其它改变。此原则的例外是,若在同一事务中对同一项目作出两个改变,则这些改变保证被原子地发送和应用到其它复制品。因此,项目是同步服务的一致性单元。Synchronization services generally do not respect transaction boundaries. In other words, if two changes are made to a storage platform data store in a single transaction, there is no guarantee that these changes are applied atomically to all other replicas - one change can be shown without the other. The exception to this principle is that if two changes are made to the same item in the same transaction, those changes are guaranteed to be sent and applied to the other replicas atomically. Thus, a project is a unit of consistency for the synchronization service.
a)同步(Sync)控制应用程序a) Sync control application
任一应用程序可连接到同步服务并启动同步操作。那样的应用程序提供执行同步(见下面同步概况)所需的所有参数。那样的应用程序在这里被称为同步控制应用程序(SCA)。Any application can connect to the sync service and initiate a sync operation. That application provides all the parameters needed to perform a synchronization (see Synchronization Overview below). Such applications are referred to herein as Synchronous Control Applications (SCA).
在同步两个存储平台实例时,在一侧由SCA启动同步。该SCA通知本地同步服务与远程伙伴同步。在另一侧,同步服务通过由来自发起机器的同步服务发出的消息唤醒。它基于在目标机器上存在的持久配置信息(见下文的映射)作出响应。同步服务能按时间表或响应于事件运行。在这些情况下,实现时间表的同步服务成为SCA。When synchronizing two storage platform instances, the synchronization is initiated by SCA on one side. The SCA notifies the local synchronization service to synchronize with the remote partner. On the other side, the sync service is woken up by a message sent by the sync service from the originating machine. It responds based on persistent configuration information (see mapping below) that exists on the target machine. Synchronization services can run on a schedule or in response to events. In these cases, the synchronization service that implements the schedule becomes the SCA.
为启用同步,需要采取两个步骤。首先,模式设计者必须用合适的同步语义注释存储平台模式(如下文所述的指定改变单元)。其次,同步必须在具有参与同步的存储平台的实例的所有机器上正确地配置(如下所述)。To enable synchronization, two steps need to be taken. First, schema designers must annotate storage platform schemas with appropriate synchronization semantics (specifying change units as described below). Second, synchronization must be properly configured on all machines with instances of the storage platform participating in the synchronization (described below).
b)模式注释b) schema annotation
同步服务的基本概念是改变单元(Change Unit)的概念。改变单元是由存储平台个别地跟踪的最小的模式片段。对每个改变单元,同步服务能确定自从最后一次同步以来它是被改变还是未被改变。The basic concept of synchronization service is the concept of change unit (Change Unit). A unit of change is the smallest schema fragment tracked individually by the storage platform. For each unit of change, the synchronization service can determine whether it has changed or remained unchanged since the last synchronization.
指定模式中的改变单元达到若干目的。首先,它确定了在线的同步服务如何罗嗦。当在改变单元内作出改变时,整个改变单元被发送到其它复制品,因为同步服务不知道改变单元的哪部分被改变。其次,它确定了冲突检测的粒度。当对同一改变单元作出两个并发的改变(这些术语在后继章节中详细定义),同步服务引起冲突;另一方面,若对不同改变单元作出并发改变,则无冲突发生,且改变被自动地合并。第三,它严重地影响了由系统保持的元数据的量。对每个改变单元保持许多同步服务元数据;因此,使改变单元更小会增加同步的额外开销。Changing elements in the specified schema serves several purposes. First, it establishes how wordy the online sync service is. When a change is made within a change unit, the entire change unit is sent to the other replicas because the synchronization service does not know which part of the change unit was changed. Second, it determines the granularity of collision detection. When two concurrent changes are made to the same change unit (these terms are defined in detail in subsequent chapters), the synchronization service causes a conflict; on the other hand, if concurrent changes are made to different change units, no conflict occurs and the changes are automatically merge. Third, it severely affects the amount of metadata maintained by the system. A lot of sync service metadata is maintained for each unit of change; therefore, making the unit of change smaller increases the overhead of synchronization.
定义改变单元需要找出正确的折衷。为此,同步服务允许模式设计者参与此过程。Defining the changing unit requires finding the right tradeoff. To this end, Synchronization Services allows schema designers to participate in the process.
在一个实施例中,同步服务不支持大于一个元素的改变单元。然而,它支持让模式设计者指定比一个元素更小的改变单元的能力-即,将一个元素的多个属性组合到单独的改变单元中。在该实施例中,这是使用下述句法实现的:In one embodiment, the synchronization service does not support change units larger than one element. However, it supports the ability for schema designers to specify units of change smaller than an element - that is, to combine multiple attributes of an element into a single unit of change. In this embodiment, this is accomplished using the following syntax:
<Type Name=″Appointment″MajorVersion=″1″MinorVersion=″0″ExtendsType=″Base.Item″<Type Name="Appointment" MajorVersion="1"MinorVersion="0"ExtendsType="Base.Item"
ExtendsVersion=″1″>ExtendsVersion="1">
<Field Name=″MeetingStatus″Type=″the storage platformTypes uniqueidentifier Nullable=″False″/><Field Name="MeetingStatus"Type="the storage platformTypes uniqueidentifier Nullable="False"/>
<Fileld Name=″OrganizerName″Type=″the storage platformTypes.nvarchar(512)″Nullable=″False″/><Fileld Name="OrganizerName"Type="the storage platformTypes.nvarchar(512)"Nullable="False"/>
<Filed Name=″OrganizerEmail″Type=″the storage platformTypes.nvarchar(512)″<Filed Name="OrganizerEmail"Type="the storage platformTypes.nvarchar(512)"
TypeMajorVersion=″1″ MultiValued=″True″/>TypeMajorVersion="1" MultiValued="True"/>
......
<ChangeUnit Name=″CU_Status″><ChangeUnit Name="CU_Status">
<Field Name=″MeetingStatus″/><Field Name="MeetingStatus"/>
</ChangeUnit></ChangeUnit>
<ChangeUnit Name=″CU_Organizer″/><ChangeUnit Name="CU_Organizer"/>
<Field Name=″OrganizerName″/><Field Name="OrganizerName"/>
<Field Name=″OrganizerEmail″/><Field Name="OrganizerEmail"/>
</ChangeUnit></ChangeUnit>
......
</Type></Type>
c)同步配置c) Synchronization configuration
希望保持它们数据的某些部分同步的一组存储平台伙伴被称为同步共同体。虽然共同体的成员希望保持同步,它们不需要以完全相同的方式表示数据;换言之,同步伙伴可转换他们正在同步的数据。A group of storage platform partners who wish to keep some parts of their data in sync is called a sync community. Although members of the community wish to remain in sync, they do not need to represent the data in exactly the same way; in other words, sync partners can transform the data they are synchronizing.
在对等情况下,让对等方对所有它们的伙伴维持转换映射是不现实的。相反,同步服务采取定义“共同体文件夹”的方法。共同体文件夹是代表所有共同体成员正在与之同步的假设的“共享文件夹”的抽象。In a peer-to-peer situation, it is impractical for peers to maintain translation maps for all their partners. Instead, the sync service takes the approach of defining "community folders". A community folder is an abstraction that represents a hypothetical "shared folder" that all community members are syncing with.
此概念最好用一例子说明。若Joe希望保持他的若干计算机的My Documents(我的文档)文件夹同步,Joe定义一共同体文件夹,如称为JoeDocuments。随后在每台计算机上,Joe在假设的JoeDocuments文件夹和本地My Documents文件夹之间配置一映射。从这点出发,当Joe的计算机彼此同步时,它们借助JoeDocuments中的文档而不是它们的本地项目来交谈。以此方法,所有Joe的计算机互相理解,而不必知道其它人是谁一共同体文件夹成为同步共同体的通用语。This concept is best illustrated with an example. If Joe wants to keep the My Documents (My Documents) folders of several of his computers synchronized, Joe defines a community folder, such as called JoeDocuments. Then on each computer, Joe configures a mapping between the hypothetical JoeDocuments folder and the local My Documents folder. From this point on, when Joe's computers synchronize with each other, they talk by means of documents in JoeDocuments rather than their local projects. In this way, all Joe's computers understand each other without having to know who the others are—the community folder becomes the lingua franca of the sync community.
配置同步服务包括三个步骤:(1)定义在本地文件夹和共同体文件夹之间的映射;(2)定义确定哪个得到同步的同步概况(如与谁同步,以及哪个子集应当被发送、哪个被接收);以及(3)定义不同的同步概况应当运行的时间表,或手动运行它们。Configuring the synchronization service consists of three steps: (1) defining the mapping between local folders and community folders; (2) defining the synchronization profiles that determine which gets synchronized (such as who to synchronize with, and which subset should be sent, which is received); and (3) define a schedule on which the different synchronization profiles should run, or run them manually.
(1)共同体文件夹-映射(1) Community Folder - Mapping
共同体文件夹映射作为XML配置文件被存储在个别机器上。每个映射具有以下模式:Community folder maps are stored on individual machines as XML configuration files. Each map has the following schema:
/mappings/communityFolder/mappings/communityFolder
此元素命名映射的共同体文件夹。名字遵循文件夹的句法规则。This element names the mapped community folder. The names follow the syntax of folders.
/mappings/localFolder/mappings/localFolder
此元素命名映射所转换到的本地文件夹。此名字遵循文件夹的句法规则。为了使映射有效,文件夹必须已存在。此文件夹中的项目被看作对每一此映射的同步。This element names the local folder to which the mapping is translated. This name follows the syntax rules for folders. For the mapping to work, the folder must already exist. Items in this folder are considered for each synchronization of this mapping.
/mappings/transformations/mappings/transformations
此元素定义如何将项目从共同体文件夹转换到本地文件夹以及如何反向转换。若缺少或为空,不执行转换。具体说来,这意味着无ID被映射。此配置主要用于创建文件夹的高速缓存。This element defines how to convert projects from community folders to local folders and vice versa. If missing or empty, no conversion is performed. Specifically, this means that no IDs are mapped. This configuration is mainly used to create a cache of folders.
/mappings/transformations/mapIDs/mappings/transformations/mapIDs
此元素请求新生成的本地ID被赋予所有从共同体文件夹映射的项目,而不是重新使用共同体ID。同步运行库维护ID映射,以来回转换项目。This element requests that a newly generated local ID be given to all projects mapped from the community folder, rather than reusing the community ID. The sync runtime maintains ID mappings to convert items back and forth.
/mappings/transformations/localRoot/mappings/transformations/localRoot
此元素请求共同体文件夹中的所有根项目作为指定根的子项目。This element requests all root items in the community folder to be children of the specified root.
/mappings/runAs/mappings/runAs
此元素控制在谁的授权下处理针对此映射的请求。若不存在,则假设发送者。This element controls under whose authority requests for this map are processed. If not present, the sender is assumed.
/mappings/runAs/sender/mappings/runAs/sender
存在此元素表明对此映射的消息发送者必须是人格化的,且在他的凭证下处理请求。The presence of this element indicates that the message sender for this mapping must be impersonal and process requests under his credentials.
(2)概况(2) Overview
同步概况是分离同步所需的总的参数集。由SCA将其提供给同步运行库以启动同步。存储平台到存储平台的同步的同步概况包含以下信息:A synchronization profile is the overall set of parameters required for a separation synchronization. It is provided by SCA to the sync runtime to start the sync. The synchronization profile for storage platform-to-storage platform synchronization contains the following information:
·本地文件夹,用作改变的源和目标;· Local folders, used as source and target for changes;
·与之同步的远程文件夹名-此文件夹必须通过如上定义的映射从远程伙伴发布;The name of the remote folder to synchronize with - this folder must be published from the remote partner via the mapping defined above;
·方向-同步服务支持只发送、只接收以及发送-接收同步;· Direction-sync service supports send-only, receive-only, and send-receive synchronization;
·本地过滤器-选择发送什么本地信息到远程伙伴。表示成本地文件夹上的存储平台查询;• Local Filter - Select what local information to send to the remote partner. Expressed as a storage platform query on a local folder;
·远程过滤器-选择从远程伙伴检索什么远程信息-表示成共同体文件夹上的存储平台查询;Remote Filters - select what remote information to retrieve from remote partners - expressed as storage platform queries on community folders;
·转换-定义如何在项目和本地格式间转换;Conversion - define how to convert between project and native formats;
·本地安全性-指定是在远程端点(人格化)的许可下应用从远程端点检索的改变,还是用户在本地启动同步;以及· Local Security - specifies whether changes retrieved from the remote endpoint are applied with the permission of the remote endpoint (personalization), or whether the user initiates the sync locally; and
·冲突分解策略-指定冲突是应被拒绝、记入日志还是自动分解-在后一种情况下,指定使用哪个冲突分解器以及它的配置参数。• Conflict Resolution Policy - specifies whether conflicts should be rejected, logged, or automatically resolved - in the latter case, which conflict resolver to use and its configuration parameters.
同步服务提供允许简单构建同步概况的运行库CLR类。概况可被串行化成XML文件或从XML文件串行化,以便容易存储(常与时间表一起)。然而,在存储平台中没有存储所有概况的标准地方;欢迎SCA在不必永久保持的点上构建概况。注意,不需要具有本地映射来启动同步。能在概况中指定所有同步信息。然而为响应于由远程方启动的同步请求,需要映射。The synchronization service provides runtime CLR classes that allow easy construction of synchronization profiles. Profiles can be serialized to and from XML files for easy storage (often along with timetables). However, there is no standard place to store all profiles in a storage platform; SCA is welcome to build profiles at points that do not have to be persistent. Note that it is not necessary to have a local mapping to initiate a sync. All synchronization information can be specified in the profile. However, to respond to a synchronization request initiated by a remote party, a mapping is required.
(3)时间表(3) Schedule
在一个实施例中,同步服务不提供它自己的调度基础结构。相反,它依赖于另一组件来完成此任务-在Microsoft Windows操作系统中可得到的WindowsScheduler。同步服务包括命令行实用程序,它担当SCA并基于保存在XML文件中的同步概况触发同步。该实用程序使得按时间表或者响应于如用户登录或登出等事件来配置Windows Scheduler运行同步变得非常容易。In one embodiment, the synchronization service does not provide its own scheduling infrastructure. Instead, it relies on another component to accomplish this task - the WindowsScheduler available in the Microsoft Windows operating system. The sync service includes a command line utility that acts as an SCA and triggers syncs based on sync profiles saved in XML files. This utility makes it easy to configure Windows Scheduler to run synchronizations on a schedule or in response to events such as user logon or logout.
d)冲突处理d) Conflict handling
同步服务中的冲突处理被划分成三个阶段:(1)发生在改变应用时的冲突检测-此步骤判断是否可安全地应用改变;(2)自动冲突分解并记入日志-在此步骤(发生在紧接着冲突检测之后)资咨询自动冲突分解器以查看冲突是否能被分解-若不能,可选地将冲突记入日志;以及(3)冲突检查与分解-若某些冲突已被记入日志,且发生在同步会话的环境之外,则采取此步骤-此时,被记入日志的冲突能被分解并从日志中移除。Conflict handling in the synchronization service is divided into three phases: (1) conflict detection that occurs when changes are applied - this step determines whether the changes can be safely applied; (2) automatic conflict resolution and logging - this step ( Occurs immediately after conflict detection) consults the automatic conflict resolver to see if the conflict can be resolved - if not, optionally logs the conflict; and (3) conflict checking and resolution - if some conflicts have been logged is logged, and occurs outside the context of a sync session, this step is taken - at this point, the logged conflict can be resolved and removed from the log.
(1)冲突检测(1) Conflict detection
在本实施例中,同步服务检测两种类型的冲突:基于知识的冲突和基于约束的冲突。In this embodiment, the synchronization service detects two types of conflicts: knowledge-based conflicts and constraint-based conflicts.
(a)基于知识的冲突(a) Knowledge-Based Conflict
当两个复制品对同一改变单元进行独立的改变时,会造成基于知识的冲突。如果两个改变是在彼此没有知识的情况下进行的,则这两个改变被称作为是独立的-换言之,第一个的版本没有被第二个的知识覆盖,反之亦然。基于如以上所述的复制品的知识,所述同步服务自动地检测所有的这种冲突,并且处理这些冲突,在此如下面所述。Knowledge-based conflicts arise when two replicas make independent changes to the same change unit. Two changes are said to be independent if they were made without knowledge of each other—in other words, the version of the first was not overwritten by knowledge of the second, and vice versa. Based on knowledge of replicas as described above, the synchronization service automatically detects all such conflicts and handles them as described herein below.
有时,将冲突认为是改变单元的版本历史中的分叉是有帮助的。如果在改变单元的生命中没有冲突发生,则其版本历史就是一个简单的链-每个改变都在之前的一个后面发生。在基于知识的冲突的情况中,两个改变并行发生,使得所述链分裂并且变成版本树。Sometimes it's helpful to think of conflicts as forks in the version history that change a unit. If no conflicts occur during the life of a changing unit, its version history is a simple chain - each change happens after the previous one. In the case of a knowledge-based conflict, two changes happen in parallel, causing the chain to split and become a version tree.
(b)基于约束的冲突(b) Constraint-based conflicts
存在一些情况,在这些情况下,当一起被应用时,独立的改变违反了完整性约束。例如,在相同目录中创建具有相同名称的文件的两个复制品会使得这样的冲突发生。There are cases where independent changes violate integrity constraints when applied together. For example, creating two copies of a file with the same name in the same directory would cause such a conflict to occur.
基于约束的冲突涉及两个独立的改变(正如用于基于知识的冲突一样);然而,它们不影响相同改变单元。相反,它们影响不同改变单元,但在它们之间存在约束。Constraint-based conflicts involve two separate changes (as for knowledge-based conflicts); however, they do not affect the same change unit. Instead, they affect different change units, but there are constraints between them.
同步服务在改变应用时检测约束违反,并自动引发基于约束的冲突。分解基于约束的冲突通常要求以不违反约束的方式来修改改变的自定义代码;同步服务不提供用于完成此过程的通用机制。The synchronization service detects constraint violations when changing the application and automatically raises constraint-based conflicts. Resolving constraint-based conflicts typically requires modifying the changed custom code in a way that does not violate the constraints; the synchronization service does not provide a general mechanism for doing this.
(2)冲突处理(2) Conflict handling
当检测到冲突时,同步服务可以采取3个动作中的一个(由同步概况中的同步启动器选择):(1)拒绝改变,将其返回给发送者;(2)将冲突记录到冲突日志中;或者(3)自动分解冲突。When a conflict is detected, the sync service can take one of 3 actions (chosen by the sync initiator in the sync profile): (1) reject the change, returning it to the sender; (2) log the conflict to the conflict log or (3) Automatically resolve conflicts.
如果拒绝改变,那么如果改变没有到达所述复制品,则同步服务起作用。否定确认被发送回启动器。这种分解策略主要在无头复制品(例如文件服务器)上有用,其中冲突日志记录是不可行的。相反,这种复制品强迫其它复制品通过拒绝改变来处理冲突。If the change is rejected, then the synchronization service works if the change does not reach the replica. A negative acknowledgment is sent back to the initiator. This decomposition strategy is mainly useful on headless replicas (such as file servers) where conflict logging is not feasible. Instead, such replicas force other replicas to handle conflicts by rejecting changes.
同步启动器配置其同步概况中的冲突分解。同步服务支持在单个概况中通过以下方法来组合多个冲突分解器-首先,指定冲突处理器列表一个接一个地进行尝试,直到其中一个成功为止;其次,将冲突处理器与冲突类型相关联,例如,将更新-更新基于知识的冲突指向一个冲突处理器,而将所有其它冲突指向日志。A sync initiator configures conflict resolution in its sync profile. The synchronization service supports combining multiple conflict resolvers in a single profile by - first, specifying a list of conflict handlers to try one after the other until one succeeds; second, associating a conflict handler with a conflict type, For example, point update-update knowledge-based conflicts to one conflict handler, and all other conflicts to the log.
(a)自动冲突分解(a) Automatic Conflict Resolution
同步服务提供多种默认的冲突分解器。该列表包括:The synchronization service provides various default conflict resolvers. The list includes:
·本地优胜:如果与本地储存的数据冲突,则丢弃传入改变;Local wins: discards incoming changes if they conflict with locally stored data;
·远程优胜:如果与传入改变冲突,则丢弃本地数据;Remote wins: local data is discarded if it conflicts with an incoming change;
·最后写入者优胜:基于改变的时间标记挑选本地优胜者或者远程优胜者的任一个(注意,通常同步服务不依赖于时钟值;这种冲突分解器对于那个规则是惟一例外);Last Writer Wins: picks either a local winner or a remote winner based on the changed timestamp (note that in general sync services do not depend on clock values; this conflict resolver is the only exception to that rule);
·确定性的:以保证在所有复制品上相同的方式挑选优胜者,但不是另外有意义的-同步服务的一个实施例可能使用伙伴ID的字典式比较来实现这个特征。• Deterministic: Winners are picked in a way that is guaranteed to be the same across all replicas, but not otherwise meaningful - one embodiment of the synchronization service might implement this feature using a lexicographic comparison of partner IDs.
另外,ISV可以实现并且安装其自己的冲突处理器。自定义冲突处理器可以接受配置参数;这种参数必须由同步概况的冲突分解部分中的SCA来指定。Additionally, ISVs can implement and install their own conflict handlers. Custom conflict handlers can accept configuration parameters; such parameters must be specified by the SCA in the conflict resolution section of the synchronization profile.
当冲突分解器处理冲突时,它将需要执行的操作的列表(代替冲突改变)返回给运行时间。然后,同步服务应用这些操作,适当地调整远程知识,以便包括冲突处理器已经考虑过的信息。When the conflict resolver resolves a conflict, it returns a list of operations that need to be performed (instead of conflicting changes) to the runtime. The synchronization service then applies these operations, adjusting the remote knowledge appropriately to include information already considered by the conflict handler.
可能在应用分解的同时检测到了另一个冲突。在这种情况下,在重新进行原始处理之前,新的冲突必须被分解。Another conflict may have been detected while the decomposition was being applied. In this case, the new conflict must be resolved before the original processing can be rerun.
当将冲突看作项目的版本历史中的分支时,冲突分解可以被看作接点-组合两个分支以便形成单独的点。因此,冲突分解将版本历史转为有向非循环图(DAG)。When viewing conflicts as branches in a project's version history, conflict resolution can be viewed as a junction - combining two branches to form a single point. Thus, conflict resolution turns the version history into a directed acyclic graph (DAG).
(b)冲突日志记录(b) Conflict logging
一种非常特定类型的冲突处理器是冲突日志记录器。同步服务将冲突记录在日志中作为类型ConflictRecord的项目。这些记录反过来与冲突的项目有关(除非项目本身已经被删除)。每个冲突记录包含:引发冲突的传入改变;冲突的类型:更新-更新、更新-删除、删除-更新、插入-插入,或者约束;以及传入改变的版本和发送它的复制品的知识。记入日志的冲突可用于如下所述的检查和分解。A very specific type of conflict handler is a conflict logger. The synchronization service logs conflicts as items of type ConflictRecord. These records are in turn related to the conflicting project (unless the project itself has been deleted). Each conflict record contains: the incoming change that caused the conflict; the type of conflict: update-update, update-delete, delete-update, insert-insert, or constraint; and knowledge of the version of the incoming change and the replica that sent it . Logged conflicts are available for inspection and resolution as described below.
(c)冲突检查和分解(c) Conflict checking and resolution
同步服务提供用于应用程序检查冲突日志并且建议对其中的冲突的分解方法的API。API允许应用程序枚举所有冲突或者与给定的项目有关的冲突。它还允许这些应用程序以3种方式中的一种来分解被记入日志的冲突:(1)远程优胜-接受被记入日志的改变并且覆盖相冲突的本地改变;(2)本地优胜-忽略被记入日志的改变的冲突部分;以及(3)建议新的改变-其中应用程序建议一种合并,该合并在其看法中分解所述冲突。一旦由应用程序分解了冲突,同步服务就将它们从日志中删除。The synchronization service provides an API for applications to examine the conflict log and suggest resolution methods for conflicts therein. The API allows an application to enumerate all conflicts or conflicts related to a given item. It also allows these applications to resolve logged conflicts in one of 3 ways: (1) remote wins - accepts the logged changes and overrides conflicting local changes; (2) local wins - ignoring conflicting parts of the logged changes; and (3) proposing new changes - where the application proposes a merge that resolves the conflicts in its view. Once conflicts are resolved by the application, the synchronization service removes them from the log.
(d)复制品的收敛和冲突分解的传播(d) Convergence of replicas and propagation of conflict resolution
在复杂的同步情形中,在多个复制品上可以检测到相同的冲突。如果发生了这种情形,则许多事情都可能发生:(1)在一个复制品上分解冲突,而分解被发送给另一个;(2)在两个复制品上自动分解冲突;或者(3)在两个复制品上手动分解冲突(通过冲突检查API)。In complex synchronization situations, the same conflict can be detected on multiple replicas. If this happens, a number of things can happen: (1) conflicts are resolved on one replica and the resolution is sent to the other; (2) conflicts are automatically resolved on both replicas; or (3) Manually resolve conflicts on both replicas (via the conflict checking API).
为了确保收敛,同步服务将冲突分解传递给其它复制品。当分解冲突的改变到达复制品时,同步服务自动地找到日志中通过该更新分解的任意冲突记录,并且删除它们。在这种情况下,一个复制品上的冲突分解将绑定在所有其它复制品上。To ensure convergence, the synchronization service passes conflict resolution to other replicas. When changes that resolve conflicts arrive at replicas, the sync service automatically finds any conflicting records in the log that were resolved by the update, and deletes them. In this case, conflict resolution on one replica will be bound on all other replicas.
如果对于相同的冲突,由不同的复制品选择不同的优胜者,则同步服务应用绑定冲突分解的原理,并且自动地挑选两种分解中优于另一种的一种分解。以确定的方式挑选出优胜者,该确定方式保证在所有的时候都产生相同的结果(一个实施例使用复制品ID字典式比较)。If different replicas choose different winners for the same conflict, the synchronization service applies the principles of bound conflict resolution and automatically picks one of the two resolutions over the other. The winner is picked in a deterministic manner that is guaranteed to produce the same result all the time (one embodiment uses replica ID dictionary comparison).
如果对相同的冲突,不同的复制品建议不同的“新改变”,则同步服务将这种新的冲突看作特殊的冲突,并且使用冲突日志记录器来防止它传播到其它复制品。这种情况通常会引起手动冲突分解。If different replicas propose different "new changes" for the same conflict, the sync service treats this new conflict as a special conflict and uses the conflict logger to prevent it from propagating to other replicas. This situation often leads to manual conflict resolution.
2.对非存储平台数据存储的同步2. Synchronization of non-storage platform data storage
按本发明的存储平台的另一方面,存储平台提供ISV用于实现同步适配器的体系结构,同步适配器使存储平台能与如Microsoft Exchange、AD、Hotmail等传统系统同步。同步适配器得益于由下述同步服务提供的许多同步服务。According to another aspect of the storage platform of the present invention, the storage platform provides an architecture for the ISV to implement a sync adapter that enables the storage platform to synchronize with legacy systems such as Microsoft Exchange, AD, Hotmail, etc. A sync adapter benefits from a number of synchronization services provided by the synchronization services described below.
不管其名称如何,同步适配器不需要作为某个存储平台体系结构的插件来实现。在需要时,“同步适配器”能简单地是利用同步服务运行库接口来获得如改变枚举和应用等服务的任何应用程序。Despite its name, a sync adapter does not need to be implemented as a plug-in to a storage platform architecture. A "sync adapter" can simply be any application that utilizes the sync service runtime interface to obtain services such as change enumeration and application when needed.
为了使其他人能更容易地配置和运行到给定后端的同步,鼓励同步适配器的编写者展现标准同步适配器接口,它在给定上述的同步概况时运行同步。概况提供配置信息给适配器,适配器将某些信息传送到同步运行库以控制运行库服务(如,要同步的文件夹)。To make it easier for others to configure and run synchronization to a given backend, writers of sync adapters are encouraged to expose a standard sync adapter interface that performs synchronization given the synchronization profile above. The profile provides configuration information to the adapter, and the adapter passes certain information to the synchronization runtime to control runtime services (eg, folders to synchronize).
a)同步服务a) Synchronization service
同步服务向适配器编写者提供若干同步服务。在本节余下部分,方便地将存储平台在其上完成同步的机器称为“客户机”,而适配器正与其对话的非存储平台后端称为“服务器”。Synchronization Services Provides several synchronization services to adapter writers. In the remainder of this section, it is convenient to refer to the machine on which the storage platform is synchronizing as the "client", and the non-storage platform backend that the adapter is talking to as the "server".
(1)改变枚举(1) Change the enumeration
基于由同步服务维持的改变跟踪数据,改变枚举允许同步适配器容易地枚举自从最后一次与该伙伴试图作出同步以来对数据存储文件夹发生的改变。Based on the change tracking data maintained by the sync service, change enumeration allows the sync adapter to easily enumerate the changes that have occurred to the data store folder since the last sync attempt with the partner was made.
基于“定位点”的概念来枚举改变-这是表示有关最后一次同步的信息的不透明的结构。如以前章节所述,定位点采取存储平台知识的形式。利用改变枚举服务的同步适配器落入两大类别:使用“存储的定位点”的适配器和使用“提供的定位点”的适配器。Changes are enumerated based on the concept of an "anchor" - an opaque structure representing information about the last synchronization. As mentioned in previous chapters, anchors take the form of storing platform knowledge. Synchronization adapters that utilize change enumeration services fall into two broad categories: adapters that use "stored anchors" and adapters that use "provided anchors".
区别基于关于最后一次同步的信息存储在哪里-在客户机上还是在服务器上。适配器常常容易地存储此信息在客户机上-后端往往不能容易地存储此信息。另一方面,若多个客户机与同一后端同步,则将此信息存储在客户机上是低效且在某些情况下是不正确的-这使一个客户机不知道其它客户机已推到服务器的改变。若适配器希望使用服务器存储的定位点,则适配器需要在改变枚举时将其送回到存储平台。The distinction is based on where the information about the last sync is stored - on the client or on the server. Adapters often easily store this information on the client - backends often cannot. On the other hand, if multiple clients are syncing with the same backend, storing this information on the client is inefficient and in some cases incorrect - it keeps one client from knowing that other clients have pushed to Server changes. If the adapter wishes to use the server stored anchor, the adapter needs to send it back to the storage platform when changing the enumeration.
为了让存储平台维护定位点(用于本地或远程存储),存储平台需要知道成功地应用在服务器上的改变。这些且只有这些改变能包括在定位点中。在改变枚举期间,同步适配器使用确认(Acknowledgement)接口,以报告哪个改变已被成功地应用。在同步结束时,使用提供的定位点的适配器必须读出新定位点(它结合了所有成功应用的改变)并将其发送到它们的后端。In order for the storage platform to maintain anchors (for local or remote storage), the storage platform needs to know about changes that were successfully applied on the server. These and only these changes can be included in the anchor point. During change enumeration, the sync adapter uses the Acknowledgment interface to report which changes have been successfully applied. At the end of the synchronization, adapters using the provided anchor must read the new anchor (which incorporates all successfully applied changes) and send it to their backends.
各适配器常常需要存储适配器专用数据以及插入到存储平台数据存储中的各项目。该数据存储的常见例子是远程ID和远程版本(时间标记)。同步服务提供用于存储此数据的机制,而改变枚举提供接收此额外数据以及要返回的改变的机制。在大多数情况下,这消除了适配器重新查询数据库的需求。Each adapter often needs to store adapter specific data as well as items that are inserted into the storage platform data store. Common examples of this data store are remote IDs and remote versions (time stamps). The sync service provides the mechanism for storing this data, while the change enumeration provides the mechanism for receiving this additional data and the changes to return. In most cases, this eliminates the need for the adapter to re-query the database.
(2)改变应用(2) Change application
改变应用允许同步适配器将从它们的后端接收的改变应用到本地存储平台。期望适配器将改变转换到存储平台模式。Change Apply allows sync adapters to apply changes received from their backends to the local storage platform. The adapter is expected to transition the change to storage platform mode.
改变应用的主要功能是自动检测冲突。如在存储平台到存储平台同步的情况下,冲突被定义成在互相不知道时作出的两个重叠的改变。当适配器使用改变应用时,它们必须指定对其执行冲突检测的定位点。若检测到未被适配器的知识覆盖的重叠的本地改变,则改变应用引起冲突。类似于改变枚举,适配器可使用存储的或提供的定位点。改变应用程序支持适配器专用元数据的有效存储。那样的数据可由适配器将其附加到要应用的改变上,且可被同步服务存储。数据可在下次改变枚举时返回。The main function of the change application is to automatically detect conflicts. As in the case of storage platform-to-storage platform synchronization, a conflict is defined as two overlapping changes made without mutual knowledge. When adapters use changes to apply, they must specify an anchor on which to perform conflict detection. If overlapping local changes not covered by the adapter's knowledge are detected, the change application causes a conflict. Similar to changing enumerations, adapters can use stored or provided anchors. Changes the application to support efficient storage of adapter-specific metadata. Such data can be appended by the adapter to the changes to be applied, and can be stored by the synchronization service. Data can be returned the next time the enumeration is changed.
(3)冲突分解(3) Conflict resolution
上述冲突分解机制(包括日志记录和自动分解选项)也对同步适配器可用。在应用改变时,同步适配器能指定用于冲突分解的策略。若指定,则冲突可被传递到指定的冲突处理程序并予以分解(若可能)。冲突也能被记入日志。当试图将本地改变应用到后端时,适配器可检测冲突。在那样情况下,适配器仍可以将冲突传递到同步运行库,以按策略分解。此外,同步适配器可请求任何由同步服务检测的冲突发回给它们以便处理。在后端能存储或分解冲突的情况下这特别方便。The conflict resolution mechanisms described above, including logging and automatic resolution options, are also available for sync adapters. A sync adapter can specify a strategy for conflict resolution when applying changes. If specified, conflicts can be passed to the specified conflict handler and resolved (if possible). Conflicts can also be logged. The adapter can detect conflicts when attempting to apply local changes to the backend. In that case, the adapter can still pass conflicts to the synchronization runtime for resolution by policy. Additionally, sync adapters can request that any conflicts detected by sync services be sent back to them for processing. This is especially handy in cases where the backend can store or resolve conflicts.
b)适配器实现b) Adapter implementation
虽然某些“适配器”简单地是利用运行库接口的应用程序,然而鼓励适配器实现标准的适配器接口。这些接口允许同步控制应用程序:请求适配器按给定的同步概况执行同步;取消正进行的同步;以及接收关于正进行同步的进展报告(完成百分比)。While some "adapters" are simply applications that utilize the runtime interface, adapters are encouraged to implement the standard adapter interface. These interfaces allow a synchronization control application to: request that the adapter perform a synchronization for a given synchronization profile; cancel an ongoing synchronization; and receive a progress report (percent complete) on the ongoing synchronization.
3.安全性3. Security
同步服务努力将尽可能少的同步引入到由存储平台实现的安全模式中。不是对同步定义新的权限,而是使用现有的权限。具体地,The synchronization service strives to introduce as little synchronization as possible into the security model implemented by the storage platform. Instead of defining new permissions for synchronization, existing permissions are used. specifically,
·能读数据存储项目的任何人可枚举对该项目的改变;Anyone who can read a datastore item can enumerate changes to that item;
·能写到数据存储项目的任何人可向该项目应用改变;以及Anyone who can write to a datastore item can apply changes to that item; and
·能扩展数据存储项目的任何人可将同步元数据与该项目关联。• Anyone who can extend a data storage item can associate synchronization metadata with that item.
同步服务不维护安全授权信息。当在复制品A由用户U作出改变,且将其转发到复制品B时,该改变最初在A处(由U)作出的事实丢失了。若B将此改变转发到复制品C,则这是在B的授权而不是在A的授权下完成的。这就导致下述限制:若不信任一个复制品对一个项目作出它自己的改变,它不能转发由其它复制品作出的改变。The synchronization service does not maintain security authorization information. When a change is made by user U at replica A, and forwarded to replica B, the fact that the change was originally made at A (by U) is lost. If B forwards this change to replica C, this is done under B's authority, not A's. This leads to the restriction that if a replica is not trusted to make its own changes to an item, it cannot forward changes made by other replicas.
在启动同步服务时,由同步控制应用程序完成。同步服务人格化SCA的身份,并在该身份下完成所有操作(本地的和远程的)。作为说明,观察到用户U不能使本地同步服务从远程存储平台检索对用户U不具有读访问的项目的改变。This is done by the sync control application when the sync service is started. The synchronization service personifies the identity of the SCA and completes all operations (local and remote) under that identity. As an illustration, observe that user U cannot cause the local synchronization service to retrieve changes to items for which user U does not have read access from the remote storage platform.
4.可管理性4. Manageability
监视复制品的分布式共同体是复杂的问题。同步服务可使用“扫描”算法来收集和分发关于该复制品的状态的信息。扫描算法的属性确保关于所有所配置的复制品的信息最终被收集,且检测到该失败(无响应)的复制品。Monitoring a distributed community of replicas is a complex problem. The synchronization service may use a "scan" algorithm to collect and distribute information about the state of the replica. The properties of the scanning algorithm ensure that information about all configured replicas is eventually collected and the failed (non-responsive) replica is detected.
在每个复制品上可得到共同体范围的监视信息。可在任意选取的复制品上运行监视工具,以检查此监视信息并作出管理决策。在受影响的复制品上必须直接作出配置改变。Community-wide surveillance information is available on each replica. Monitoring tools can be run on any chosen replica to examine this monitoring information and make management decisions. Configuration changes must be made directly on the affected replica.
G.传统文件互操作性G. Legacy Document Interoperability
如上提到,至少在某些实施例中,本发明的存储平台旨在被实施为计算机系统的硬件/软件接口系统的整体部分。例如,本发明的存储平台可被实施为如Microsoft Windows家族操作系统的操作系统整体部分。在这方面,存储平台API成为操作系统API的一部分,应用程序通过它与操作系统交互。因此,存储平台成为装置,应用程序通过它将信息存到操作系统上,且从而基于项目的存储平台的数据模型替代了这一操作系统的传统文件系统。例如,当在Microsoft Windows家族操作系统中实施时,存储平台可替代在该操作系统中实现的NTFS文件系统。当前,应用程序通过由Windows家族操作系统展现的Win32 API来访问NTFS文件系统的服务。As mentioned above, at least in some embodiments, the storage platform of the present invention is intended to be implemented as an integral part of the hardware/software interface system of a computer system. For example, the storage platform of the present invention may be implemented as an integral part of an operating system such as the Microsoft Windows family of operating systems. In this respect, the storage platform API becomes part of the operating system API through which applications interact with the operating system. Thus, the storage platform becomes the device by which applications store information on the operating system, and thus the item-based data model of the storage platform replaces the traditional file system of this operating system. For example, when implemented in the Microsoft Windows family of operating systems, the storage platform can replace the NTFS file system implemented in that operating system. Currently, applications access the services of the NTFS file system through the Win32 API exposed by the Windows family of operating systems.
然而,应认识到,完全用本发明的存储平台替代NTFS文件系统需要重新编码现有的基于Win32的应用程序,且那样的重新编码可能是不合需要的,因此本发明的存储平台提供与如NTFS等现有文件系统的某种互操作性是有益的。从而,在本发明的一个实施例中,存储平台使依赖于Win32编程模型的应用程序能同时访问存储平台的数据存储以及传统的NTFS文件系统的内容。为此,存储平台使用作为Win32命名约定的超集的命名约定以便于容易的互操作性。此外,存储平台支持通过Win32API访问存储在存储平台卷中的文件和目录。However, it should be recognized that completely replacing the NTFS file system with the storage platform of the present invention requires recoding existing Win32-based applications, and that such recoding may be undesirable, so the storage platform of the present invention provides Some kind of interoperability with existing filesystems would be beneficial. Thus, in one embodiment of the present invention, the storage platform enables applications relying on the Win32 programming model to simultaneously access the data storage of the storage platform as well as the content of the traditional NTFS file system. To this end, the storage platform uses a naming convention that is a superset of the Win32 naming convention to facilitate easy interoperability. In addition, the storage platform supports accessing files and directories stored in storage platform volumes through Win32API.
1.互操作性模型1. Interoperability Model
依照本发明的这一方面,且依照上述示例性实施例,存储平台实现了一种名字空间,其中可组织非文件和文件项目。采用该模型,可获得以下优点:In accordance with this aspect of the invention, and in accordance with the exemplary embodiments described above, a storage platform implements a namespace in which non-file and file items can be organized. Using this model, the following advantages can be obtained:
1.数据存储中的文件夹可包含文件和非文件项目,由此为文件和模式化的数据呈现了单个名字空间。此外,它也为所有用户数据提供了同一的安全、共享和管理模型。1. Folders in a data store can contain both file and non-file items, thereby presenting a single namespace for both file and schematized data. In addition, it provides the same security, sharing and management model for all user data.
2.由于文件和非文件项目都可使用存储平台API来访问,且该方法中没有为文件施加特殊规则,因此它为应用程序开发者提出了一种更清楚的编程模型来工作。2. Since both file and non-file items can be accessed using the storage platform API, and no special rules are imposed for files in this approach, it presents a clearer programming model for application developers to work with.
3.所有名字空间操作都通过存储平台,且因此被同步地处理。重要的是注意,深层的属性升级(文件内容的驱散)仍异步地发生,但是同步操作为用户和应用程序提供了更可预测的环境。3. All namespace operations go through the storage platform and are therefore processed synchronously. It's important to note that deep attribute upgrades (expansion of file contents) still happen asynchronously, but synchronous operations provide a more predictable environment for users and applications.
作为该模型的结果,在本实施例中,可能不在被合并到存储平台数据存储的数据源上提供搜索能力。这包括可移动媒体、远程服务器和本地磁盘上的文件。提供了为驻留在外部文件系统中的项目显示存储平台中的代理服务器项目(快捷方式+升级的元数据)的同步适配器。代理服务器项目不试图按照数据源的名字空间层次或安全性来模仿文件。As a result of this model, in this embodiment, search capabilities may not be provided on data sources that are incorporated into the storage platform data store. This includes files on removable media, remote servers, and local disks. Provides a sync adapter that displays proxy server items (shortcuts + promoted metadata) in storage platforms for items residing in external filesystems. The Proxy Server project does not attempt to mimic files according to the namespace hierarchy or security of the data source.
在文件和非文件内容之间的名字空间和编程模型上实现的对称性提供了应用程序用于随时间的推移将来自文件系统的内容移植到存储平台数据存储中的更结构化的项目的更好路径。通过提供存储平台数据存储中的本机文件项目类型,应用程序可将文件数据转移到存储平台,同时仍能够通过Win32来操纵该数据。最终,应用程序可能完全移植到存储平台API,且按照存储平台项目而非文件来结构化其数据。The symmetry achieved in the namespace and programming model between file and non-file content provides a more structured project for applications to migrate content from the file system to storage platform data stores over time. good path. By providing a native file item type in the storage platform's data store, an application can transfer file data to the storage platform while still being able to manipulate that data through Win32. Eventually, applications may be fully ported to the storage platform API and structure their data in terms of storage platform items rather than files.
2.数据存储特征2. Data storage characteristics
为提供期望的互操作性等级,在一个实施例中,实现存储平台数据存储的以下特征。To provide the desired level of interoperability, in one embodiment, the following features of storage platform datastores are implemented.
a)非卷a) Non-volume
存储平台数据存储不被展现为单独的文件系统卷。存储平台充分利用了直接主存在NTFS上的FILESTREAM。由此,没有对盘上格式的改变,由此消除了在卷级将存储平台展现为新文件系统的需求。Storage platform datastores are not exposed as separate file system volumes. The storage platform takes full advantage of FILESTREAM hosted directly on NTFS. Thus, there are no changes to the on-disk format, thereby eliminating the need to expose the storage platform as a new file system at the volume level.
相反,数据存储(名字空间)是对应于NTFS卷来构造的。后退名字空间的该部分的数据库和FILESTREAM位于与存储平台数据存储相关联的NTFS卷上。也提供了对应于系统卷的数据存储。Instead, data stores (namespaces) are structured corresponding to NTFS volumes. The database and FILESTREAM for this portion of the fallback namespace reside on NTFS volumes associated with the storage platform datastore. Data storage corresponding to system volumes is also provided.
b)存储结构b) storage structure
存储的结构最好用一个示例来说明。作为一个示例,考虑名为HomeMachine的机器的系统卷上的目录树,如图16所示。依照本发明的文件系统互操作性特征,对应于c:\drive,存在通过例如称为“WiinFSOnC”的UNC共享展现给Win32 API的存储平台数据存储。这使得相关联的数据存储可通过以下UNC名来访问:The structure of storage is best illustrated with an example. As an example, consider the directory tree on the system volume of a machine named HomeMachine, shown in Figure 16. According to the file system interoperability feature of the present invention, corresponding to the c:\ drive, there is a storage platform data store exposed to the Win32 API through a UNC share, for example called "WinFSOnC". This makes the associated datastore accessible by the following UNC names:
\\HomeMachine\WinFSOnC。\\HomeMachine\WinFSOnC.
在该实施例中,文件和/或文件夹需要从NTFS显式地移植到存储平台。因此,如果用户希望将My Documents文件夹移至存储平台数据存储以利用由存储平台提供的所有额外的搜索/分类特征,则该分层结构将如图17所示。重要的是注意,这些文件夹在本示例中实际移动。另一点要注意的是,名字空间移至存储平台中,实际的流被重命名为FILESTREAM,在存储平台内挂钩适当的指针。In this embodiment, files and/or folders need to be explicitly migrated from NTFS to the storage platform. Therefore, if the user wishes to move the My Documents folder to the storage platform data store to take advantage of all the additional search/categorization features provided by the storage platform, the hierarchy would be as shown in Figure 17. It is important to note that these folders are actually moved in this example. Another point to note is that the namespace was moved into the storage platform, the actual stream was renamed to FILESTREAM, and the appropriate pointers were hooked into the storage platform.
c)不移植所有文件c) do not migrate all files
对应于用户数据或需要存储平台提供的搜索/分类的文件是移植到存储平台数据存储的候选者。较佳地,为限制与存储平台的应用程序兼容性问题,在MicrosoftWindows操作系统的上下文中,移植到本发明的存储平台的该组文件被限于MyDocuments文件夹中的文件、Internet Explorer(IE)Favorites、IE History和Documents and Settings目录中的Desktop.ini文件。较佳地,移植Windows系统文件是不允许的。Files that correspond to user data or require search/categorization provided by the storage platform are candidates for porting to storage platform data storage. Preferably, in order to limit the application compatibility problem with the storage platform, in the context of the Microsoft Windows operating system, the group of files transplanted to the storage platform of the present invention is limited to files in the MyDocuments folder, Internet Explorer (IE) Favorites , IE History, and the Desktop.ini file in the Documents and Settings directory. Preferably, transplantation of Windows system files is not allowed.
d)对存储平台文件的NTFS名字空间访问d) NTFS namespace access to storage platform files
在此处所描述的实施例中,期望移植到存储平台的文件不能通过NTFS名字空间来访问,即使实际文件流是以NTFS储存的。以此方式,避免了由多线程实现引起的复杂锁定和安全性问题。In the embodiments described herein, files intended to be migrated to the storage platform cannot be accessed through the NTFS namespace, even though the actual file stream is stored in NTFS. In this way, complex locking and security issues caused by multi-threaded implementations are avoided.
e)期望的名字空间/驱动器字母e) expected namespace/drive letter
对存储平台中的文件和文件夹的访问是通过\\<机器名>\<WinFS共享名>形式的UNC名来提供的。对于需要驱动器字母用于操作的应用程序类,可将驱动器字母映射到该UNC名。Access to files and folders in the storage platform is provided through UNC names of the form \\<machine name>\<WinFS share name>. For application classes that require a drive letter for operation, a drive letter can be mapped to this UNC name.
I.存储平台APII. Storage Platform API
如上所述,存储平台包括API,它使应用程序能访问上面讨论的存储平台的特征和能力,并访问存储在数据存储中的项目。本节描述本发明的存储平台的存储平台API的一个实施例。As noted above, the storage platform includes APIs that enable applications to access the features and capabilities of the storage platform discussed above, and to access items stored in the data store. This section describes one embodiment of the storage platform API of the storage platform of the present invention.
图19示出按本实施例的存储平台API的基本体系结构。存储平台API使用SQL客户机1900与本地数据存储302对话,并还使用SQL客户机1900与远程数存储(如数据存储340)对话。本地存储还可使用DQP(分布式查询处理器)或通过上述的存储平台同步服务(“Sync”)与远程数据存储340对话。存储平台API322还担当数据存储通知的桥接器API,将应用程序的下标传送到通知引擎332,并如上所述将通知路由到应用程序(如应用程序350a、350b或350c)。在一个实施例中,存储平台API 322还定义受限制的“提供者”体系结构,使得它能访问Microsoft Exchange和AD中的数据。FIG. 19 shows the basic architecture of the storage platform API according to this embodiment. The storage platform API uses SQL client 1900 to talk to local data store 302 and also uses SQL client 1900 to talk to remote data stores such as
1.综述1. Overview
本发明的存储平台API的本实施例的数据访问机制解决了四个领域:查询、导航、动作、事件。The data access mechanism of this embodiment of the storage platform API of the present invention addresses four areas: query, navigation, action, and event.
查询Inquire
在一个实施例中,存储平台数据存储是在关系型数据库引擎314上实现的;结果,SQL语言的完全表达性能力在存储平台中是固有的。较高级查询对象提供了用于查询存储的简化模型,但是可能不封装存储的完全表达性能力。In one embodiment, the storage platform data store is implemented on the relational database engine 314; as a result, the full expressive capabilities of the SQL language are inherent in the storage platform. Higher-level query objects provide a simplified model for querying the store, but may not encapsulate the full expressive capabilities of the store.
导航navigation
存储平台数据模型在底层数据库抽象上构建了一种丰富的、可扩展的类型系统。对于开发者而言,存储平台数据是项目的网。存储平台API允许通过过滤、关系、文件夹等在项目之间导航。这是比基本SQL查询更高级的抽象;同时,它允许对熟悉的CLR编码模式使用丰富的过滤和导航能力。The storage platform data model builds a rich, extensible type system on top of the underlying database abstraction. For developers, storing platform data is the network of the project. The storage platform API allows navigation between projects via filtering, relationships, folders, etc. This is a higher-level abstraction than basic SQL queries; at the same time, it allows the use of rich filtering and navigation capabilities over familiar CLR coding patterns.
动作action
存储平台API展现所有项目上公用的动作-Create(创建)、Delete(删除)、Update(更新);这些被展现为对象上的方法。另外,诸如SendMail(发送邮件)、CheckFreeBusy(检查空闲和忙碌)等域专用动作也作为方法可用。API框架使用ISV可用于通过定义附加动作来添加值的良好定义的模式。The storage platform API exposes actions common to all items - Create, Delete, Update; these are exposed as methods on objects. In addition, domain-specific actions such as SendMail (send mail), CheckFreeBusy (check free and busy), etc. are also available as methods. The API framework uses well-defined patterns that ISVs can use to add value by defining additional actions.
事件event
存储平台中的数据是动态的。为使应用程序在存储中的数据改变时做出反应,API向开发者展现了丰富的事件、订阅和通知能力。Data in the storage platform is dynamic. To enable applications to react when data in storage changes, the API exposes developers to rich event, subscription, and notification capabilities.
2.命名和范围2. Naming and scope
在名字空间和命名之间进行区分是有用的。如常用的,术语名字空间指的是某一系统中可用的所有名字的集合。系统可以是XML模式、程序、web、所有ftp站点(及其内容)的集合等等。命名是用于向名字空间内所有感兴趣的条目分配唯一名字的过程或算法。由此,命名是感兴趣的,因为期望无岐义地涉及名字空间内的给定单元。由此,如此处所使用的,术语“名字空间”指的是全域中所有存储平台示例中可用的所有名字的集合。项目是存储平台名字空间中的命名实体。UNC命名约定用于确保项目名字的唯一性。全域中每一存储平台存储中的每一项目可通过UNC名字来寻址。It is useful to distinguish between namespaces and naming. As is often used, the term namespace refers to the set of all names available in a system. A system can be an XML schema, a program, a web, a collection of all ftp sites (and their content), etc. Naming is the process or algorithm used to assign unique names to all entries of interest within a namespace. Thus, the naming is of interest because it is expected to unambiguously refer to a given unit within the namespace. Thus, as used herein, the term "namespace" refers to the set of all names available across all storage platform instances in the universe. Projects are named entities in the namespace of the storage platform. The UNC naming convention is used to ensure unique project names. Each item in each storage platform's storage in the universe is addressable by a UNC name.
存储平台名字空间中的最高组织级别是服务-它仅仅是存储平台的一个实例。组织的下一级是卷。卷是项目的最大匿名容器。每一存储平台实例包含一个或多个卷。在卷内的是项目。项目是存储平台中的数据原子。The highest organizational level in the storage platform namespace is a service - which is simply an instance of a storage platform. The next level of organization is volumes. A volume is the largest anonymous container for a project. Each storage platform instance contains one or more volumes. Inside the volume are the projects. Items are data atoms in the storage platform.
真实世界中的数据几乎总是依照在给定领域中有意义的某一系统来组织。在所有这样的数据组织模式下的是将数据的全域划分成命名组的概念。如上所述,这一概念在存储平台中由文件夹的概念来建模。文件夹是一种特殊类型的项目;有两种类型的文件夹:包含文件夹和虚拟文件夹。Data in the real world is almost always organized according to some system that makes sense in a given domain. Underlying all such data organization patterns is the concept of dividing the universe of data into named groups. As mentioned above, this concept is modeled in the storage platform by the concept of folders. Folders are a special type of item; there are two types of folders: containing folders and virtual folders.
参考图18,包含文件夹是一个项目,它包含与其它项目的持有关系,且与通常概念的文件系统文件夹等价。每个项目“包含”在至少一个包含文件夹中。Referring to FIG. 18, a containing folder is an item that contains a holding relationship with other items, and is equivalent to a file system folder of a general concept. Every project is "contained" in at least one containing folder.
虚拟文件夹是组织项目集合的更动态方法;它仅仅是给定一组项目的名字-该组项目是显式地枚举或通过查询指定的。虚拟文件夹本身是项目,且可以被认为是表示与一组项目的一组(非持有)关系。A virtual folder is a more dynamic way of organizing a collection of items; it is simply the name of a given set of items - either explicitly enumerated or specified via a query. A virtual folder is itself an item, and can be thought of as representing a set of (non-holding) relationships with a set of items.
有时候,需要对包含的更紧密概念进行建模;例如,嵌入在电子邮件消息中的Word文档在某种意义上比例如包含在文件夹中的文件更紧密地绑定到其容器。这一概念是由嵌入项目的概念来表达的。嵌入项目具有一种特殊的关系,它引用另一项目;引用的项目可仅绑定到包含项目或仅在包含项目的上下文中操纵。Sometimes, a tighter concept of containment needs to be modeled; for example, a Word document embedded in an email message is in some sense more tightly bound to its container than, for example, a file contained in a folder. This concept is expressed by the concept of embedded items. An embedded item has a special relationship that refers to another item; the referenced item can only be bound to the containing item or manipulated only within the context of the containing item.
最后,存储平台提供了类别的概念作为对项目和元素的分类的方式。存储平台中的每一项目或元素可具有与其相关联的一个或多个类别。类别本质上只是被标记到项目/元素上的名字。该名字可以在搜索中使用。存储平台数据模型允许定义类别的分层结构,从而允许数据的树状分类。Finally, the storage platform provides the concept of categories as a way of categorizing items and elements. Each item or element in the storage platform may have one or more categories associated with it. Categories are essentially just names that are tagged to items/elements. This name can be used in searches. The storage platform data model allows the definition of a hierarchy of categories, thus allowing a tree-like classification of data.
项目的一种无岐义的名字是三元组:(<服务名>,<卷ID>,<项目ID>)。某些项目(尤其是文件夹和虚拟文件夹)是其它项目的集合。这引起一种标识项目的替换方式:(<服务名>,<卷ID>,<项目路径>)。An unambiguous name for a project is the triplet: (<service name>, <volume ID>, <project ID>). Some items (notably folders and virtual folders) are collections of other items. This leads to an alternate way of identifying projects: (<service name>, <volume ID>, <project path>).
存储平台名字包括服务上下文的概念:服务上下文是映射到(<卷名>,<路径>)对的名字。它标识了一个项目或一组项目-例如,文件夹、虚拟文件夹等。对于服务上下文,用于存储平台名字空间中的任何项目的UNC名成为:Storage platform names include the notion of a service context: a service context is a name that maps to (<volume name>, <path>) pairs. It identifies an item or group of items - for example, a folder, virtual folder, etc. For service contexts, the UNC name used to store any item in the platform namespace becomes:
\\<服务名>\<服务上下文>\<项目路径>\\<service name>\<service context>\<project path>
用户可创建和删除服务上下文。同样,每一卷中的根目录具有预定义的上下文:卷名$。Users can create and delete service contexts. Likewise, the root directory within each volume has a predefined context: volumename$.
项目上下文通过限制返回给存活在指定路径中的项目的结果来定查询(例如,查找操作)的范围。The item context scopes queries (eg, find operations) by limiting the results returned to items that live in the specified path.
3.存储平台API组件3. Storage platform API components
图20示意性地表示依照本发明的本实施例的存储平台API的各种组件。存储平台API包括下列组件:(1)数据类2002,它代表存储平台元素和项目类型;(2)运行库架构2004,它管理对象的持久性并提供支持类2006;以及(3)工具2008,它用于从存储平台模式生成CLR类。Figure 20 schematically represents various components of the storage platform API in accordance with this embodiment of the invention. The storage platform API includes the following components: (1)
依照本发明的一个方面,在设计时,模式作者向一组存储平台API设计时向工具2008提交模式文档2010以及用于域方法的代码2012。这些工具生成客户机方数据类2002和存储模式2014以及该模式的存储类定义2016。“域”指的是特定的模式;例如,谈论联系人模式中的类的域方法等等。这些数据类2002在运行时由应用程序开发者与存储平台API运行库架构类2006协作使用来操纵存储平台数据。According to one aspect of the invention, at design time, a schema author submits schema documents 2010 and
为说明本发明的存储平台API的各方面,基于示例性联系人模式呈现了若干示例。该示例性模式的图示表示在图21A和21B中示出。To illustrate aspects of the storage platform API of the present invention, several examples are presented based on an exemplary contact schema. Pictorial representations of this exemplary mode are shown in Figures 21A and 21B.
4.数据类4. Data class
依照本发明的一方面,存储平台数据存储中的每一项目、项目扩展和元素类型以及每一关系在存储平台API中具有对应的类。大致上,类型的字段映射到类的字段。存储平台中的每一项目、项目扩展和元素作为存储平台API中的对应类的对象可用。开发者可查询、创建、修改或删除这些对象。According to an aspect of the invention, each item, item extension and element type, and each relationship in the storage platform data store has a corresponding class in the storage platform API. Roughly, the fields of a type map to the fields of a class. Every item, item extension, and element in the storage platform is available as an object of a corresponding class in the storage platform API. Developers can query, create, modify or delete these objects.
存储平台包括一组初始模式。每一模式定义了一组项目和元素类型,以及一组关系。以下是用于从这些模式实体生成数据类的算法的一个实施例:The storage platform includes an initial set of schemas. Each schema defines a set of item and element types, and a set of relationships. The following is one embodiment of an algorithm for generating data classes from these schema entities:
对于每一模式S:For each mode S:
对于S中的每一项目I,生成名为System.Storage.S.I的类。该类具有以下成员:For each item I in S, a class named System.Storage.S.I is generated. This class has the following members:
·重载的构造函数,包括允许指定新项目的初始文件夹和名字的构造函数。Overloaded constructors, including ones that allow specifying the initial folder and name of the new project.
·I中每一字段的属性。如果字段是多值的,则属性将是对应的元素类型的集合。• Attributes for each field in I. If the field is multivalued, the attribute will be a collection of the corresponding element type.
·找出匹配过滤器的多个项目的重载的静态方法(例如,名为“FindAll”的方法)。• An overloaded static method (eg, a method named "FindAll") that finds multiple items matching the filter.
·找出匹配过滤器的单个项目的重载的静态方法(例如,名为“FindOne”的方法)。• An overloaded static method (eg, a method named "FindOne") that finds a single item matching the filter.
·给定其ID找出项目的静态方法(例如,名为“FindByID”的方法)。• A static method to find an item given its ID (eg a method named "FindByID").
·给定其相对于项目上下文的名字找出项目的静态方法(例如,名为“FindByName”的方法)。• Find a static method of an item given its name relative to the item context (eg, a method named "FindByName").
·保存对项目的改变的方法(例如,名为“Update”的方法)。• A method to save changes to the item (eg, a method named "Update").
·创建项目的新实例的重载的静态Create方法。这些方法允许以各种方式指定项目的初始文件夹。· An overloaded static Create method that creates a new instance of an item. These methods allow specifying the project's initial folder in various ways.
对于S中的每一元素E,生成名为System.Storage.S.E的类。该类具有以下成员:For each element E in S, generate a class named System.Storage.S.E. This class has the following members:
·E中的每一字段的属性。如果字段是多值的,则属性将是对应的元素类型的集合。• Attributes for each field in E. If the field is multivalued, the attribute will be a collection of the corresponding element type.
对于S中的每一元素E,生成名为System.Storage.S.ECollection的类。该类遵循用于强类型化的集合类的通用.NET构架方针。对于基于关系的元素类型,该类还将包括以下成员:For each element E in S, generate a class named System.Storage.S.ECollection. This class follows the general .NET Framework guidelines for strongly typed collection classes. For relationship-based element types, the class will also include the following members:
·找出匹配隐式地包括其中集合在源角色中出现的项目的过滤器的项目的多个对象的重载的方法。重载包括允许基于项目子类型的过滤的某些方法(例如,名为“FindAllTargetItems”的方法)。- Find an overloaded method for multiple objects that match items that implicitly include a filter where the collection appears in the source role. Overloads include certain methods that allow filtering based on item subtypes (eg, a method named "FindAllTargetItems").
·找出匹配隐式地包括其中集合在源角色中出现的项目的过滤器的单个项目对象的重载的方法。重载包括允许基于项目子类型来过滤的某些方法(例如,名为“FindOneTargetItem”的方法)。• Find an overloaded method for a single item object that matches a filter that implicitly includes items where the set appears in the source role. Overloads include certain methods that allow filtering based on item subtypes (eg, a method named "FindOneTargetItem").
·找出匹配隐式地包括其中集合在源角色中出现的项目的过滤器的嵌套元素类型的对象的重载的方法(例如,名为“FindAllRelationships”的方法)。• Find an overloaded method (eg, a method named "FindAllRelationships") that matches objects of nested element types that implicitly include a filter for items where the collection occurs in the source role.
·找出匹配隐式地包括其中集合在源角色中出现的项目的过滤器的嵌套元素类型的对象的重载的方法(例如,名为“FindAllRelationshipsForTarget”方法)。• Find an overloaded method (eg, a method named "FindAllRelationshipsForTarget") that matches objects of nested element types that implicitly include a filter for items where the collection occurs in the source role.
·找出匹配隐式地包括其中集合在源角色中出现的项目的过滤器的嵌套元素类型的单个对象的重载的方法(例如,名为“FindOneRelationship”的方法)。• Find an overloaded method (eg, a method named "FindOneRelationship") that matches a single object of a nested element type that implicitly includes a filter of items where the collection occurs in the source role.
·找出匹配隐式地包括其中集合在源角色中出现的项目的过滤器的嵌套元素类型的单个对象的重载的方法(例如,名为“FindOneRelationshipForTarget”的方法)。• Find an overloaded method (eg, a method named "FindOneRelationshipForTarget") that matches a single object of a nested element type that implicitly includes a filter of items where the collection occurs in the source role.
对于S中的关系R,生成名为System.Storage.S.R的类。该类具有一个或两个子类,取决于是一个还是两个关系角色指定了端点字段。For a relation R in S, a class named System.Storage.S.R is generated. This class has one or two subclasses, depending on whether one or two relationship roles specify endpoint fields.
也可以此方式为所创建的每一项目扩展创建类。You can also extend the Create class for each project you create in this way.
数据类存在于System.Storage.<模式名>名字空间中,其中<模式名>是对应的模式的名字-诸如Contacts(联系人)、Files(文件)等。例如,对应于联系人模式的所有类在System.Storage.Contacts名字空间中。Data classes exist in the System.Storage.<schema name> namespace, where <schema name> is the name of the corresponding schema - such as Contacts, Files, etc. For example, all classes corresponding to the Contacts schema are in the System.Storage.Contacts namespace.
作为示例,参考图21A和21B,联系人模式导致包含在System.Storage.Contact名字空间中的以下类:As an example, referring to Figures 21A and 21B, the Contact schema results in the following classes contained in the System.Storage.Contact namespace:
·项目:Item、Folder、WellKnownFolder、LocalMachineDataFolder、UserDataFolder、Principal、Service、GroupService、PersonService、PresenceService、ContactService、ADService、Person、User、Group、Organization、HouseHoldItems: Item, Folder, WellKnownFolder, LocalMachineDataFolder, UserDataFolder, Principal, Service, GroupService, PersonService, PresenceService, ContactService, ADService, Person, User, Group, Organization, HouseHold
·元素:NestedElementBase、NestedElement、IdentityKey、SecurityID、EAddress、ContactEAddress、TelephoneNumber、SMTPEAddress、InstantMessagingAddress、Template、TemplateRelationship、LocationRelationship、FamilyEventLocationRelationship、HouseHoldLocationRelationship、RoleOccupancy、EmployeeData、GroupMemberShip、OrganizationLocationRelationship、HouseHoldMemberData、FamilyData、SpouseData、ChildData·元素:NestedElementBase、NestedElement、IdentityKey、SecurityID、EAddress、ContactEAddress、TelephoneNumber、SMTPEAddress、InstantMessagingAddress、Template、TemplateRelationship、LocationRelationship、FamilyEventLocationRelationship、HouseHoldLocationRelationship、RoleOccupancy、EmployeeData、GroupMemberShip、OrganizationLocationRelationship、HouseHoldMemberData、FamilyData、SpouseData、ChildData
作为另一示例,如在联系人模式中定义的Person类型的详细结构以XML示出如下:As another example, the detailed structure of the Person type as defined in the Contacts schema is shown in XML as follows:
<Type Name=″Person″MajorVersion=″1″MinorVersion=″0″<Type Name="Person" MajorVersion="1" MinorVersion="0"
ExtendsType=″Core.Principal″ExtendsVersion=″1″>ExtendsType="Core.Principal"ExtendsVersion="1">
<Field Name=″Birthdate″Type=″the storage platformTypes.datetime″<Field Name="Birthdate"Type="the storage platformTypes.datetime"
Nullable=″true″TypeMajorVersion=″1″/>Nullable="true"TypeMajorVersion="1"/>
<Field Name=″Gender″Type=″Base.CategoryRef″<Field Name="Gender"Type="Base.CategoryRef"
Nullable=″true″MultiValued=″false″Nullable="true"MultiValued="false"
TypeMajorVersion=″1″/>TypeMajorVersion="1"/>
<Field Name=″PersonalNames″Type=″Contact.FullName″<Field Name="PersonalNames"Type="Contact.FullName"
Nullable=″true″MultiValued=″true″Nullable="true"MultiValued="true"
TypeMajorVersion=″1″/> TypeMajorVersion="1"/>
<Field Name=″PersonalEAddresses″Type=″Core.EAddress″<Field Name="PersonalEAddresses"Type="Core.EAddress"
Nullable=″true″MultiValued=″true″Nullable="true"MultiValued="true"
TypeMajorVersion=″1″/> TypeMajorVersion="1"/>
<Field Name=″PersonalPostalAddresses″<Field Name="PersonalPostalAddresses"
Type=″Core.PostalAddress″Nullable=″true″Type = "Core. PostalAddress" Nullable = "true"
MultiValued=″true″TypeMajorVersion=″1″/>MultiValued="true"TypeMajorVersion="1"/>
<Field Name=″PersonalPicture″Type=″the storage platformTypes.image″<Field Name="PersonalPicture"Type="the storage platformTypes.image"
Nullable=″true″TypeMajorVersion=″1″/>Nullable="true"TypeMajorVersion="1"/>
<Field Name=″Notes″Type=″Core.RichText″Nullable=″true″<Field Name="Notes"Type="Core.RichText"Nullable="true"
MultiValued=″true″TypeMajorVersion=″1″/>MultiValued="true"TypeMajorVersion="1"/>
<Field Name=″Profession″Type=″Base.CategoryRef″<Field Name="Profession"Type="Base.CategoryRef"
Nullable=″true″MultiValued=″true″Nullable="true"MultiValued="true"
TypeMajorVersion=″1″/> TypeMajorVersion="1"/>
<Field Name=″DataSource″Type=″Base.IdentityKey″<Field Name="DataSource"Type="Base.IdentityKey"
Nullable=″true″MultiValued=″true″Nullable="true"MultiValued="true"
TypeMajorVersion=″1″/> TypeMajorVersion="1"/>
<Field Name=″ExpirationDate″Type=″the storage platformTypes.datetime″<Field Name="ExpirationDate"Type="the storage platformTypes.datetime"
Nullable=″true″TypeMajorVersion=″1″/>Nullable="true"TypeMajorVersion="1"/>
<Field Name=″HasAllAddressBookData″Type=″the storage platformTypes.bit″<Field Name="HasAllAddressBookData"Type="the storage platformTypes.bit"
Nullable=″true″TypeMajorVersion=″1″/>Nullable="true"TypeMajorVersion="1"/>
<Field Name=″EmployeeOf″Type=″Contact.EmployeeData″<Field Name="EmployeeOf"Type="Contact.EmployeeData"
Nullable=″true″MultiValued=″true″ Nullable = "true" MultiValued = "true"
TypeMajorVersion=″1″/> TypeMajorVersion="1"/>
</Type></Type>
该类型导致以下类(仅示出了公有成员):This type results in the following class (only public members shown):
partial public class Person:partial public class Person:
System.Storage.Core.Principal,System.Storage.Core.Principal,
System.Windows.Data.IDataUnitSystem.Windows.Data.IDataUnit
{{
public System.Data.SqlTypes.SqlDateTime public System.Data.SqlTypes.SqlDateTime
Birthdate{get;set;}Birthdate { get; set; }
public System.Storage.Base.CategoryRef public System.Storage.Base.CategoryRef
Gender{get;set:}Gender{get; set:}
public System.Storage.Contact.FullNameCollectionpublic System.Storage.Contact.FullNameCollection
Person alNames{get;} Person alNames{get;}
public System.Storage.Core.EAddressCollection public System.Storage.Core.EAddressCollection
Personal EAddresses{get;} Personal EAddresses{get;}
public System.Storage.Core.PostalAddressCollection public System.Storage.Core.PostalAddressCollection
PersonalPostalAddresses{get;} PersonalPostalAddresses { get; }
public System.Data.SqlTypes.SqlBinarypublic System.Data.SqlTypes.SqlBinary
PersonalPicture{get;set;} PersonalPicture { get; set; }
public System.Storage.Core.RichTextCollection public System.Storage.Core.RichTextCollection
Notes{get;}Notes { get; }
public System.Storage.Base.CategoryRefCollection public System.Storage.Base.CategoryRefCollection
Profession{get;}Profession{get;}
public System.Storage.Base.IdentityKeyCollection public System.Storage.Base.IdentityKeyCollection
DataSource{get;} DataSource { get; }
public System.Data.SqlTypes.SqlDateTime public System.Data.SqlTypes.SqlDateTime
Expiration Date{get;set;} Expiration Date { get; set; }
public System.Data.SqlTypes.SqlBooleanpublic System.Data.SqlTypes.SqlBoolean
HasAllAddressBookData{get;set;} HasAllAddressBookData { get; set; }
public System.Storage.Contact.EmployeeDataCollectionpublic System.Storage.Contact.EmployeeDataCollection
EmployeeOf{get;}EmployeeOf{get;}
public Person();public Person();
public Person(System.Storage.Base.Folder folder,string name);public Person(System.Storage.Base.Folder folder, string name);
public static new System.Storage.FindResultpublic static new System.Storage.FindResult
FindAll(System.Storage.ItemStore store);FindAll(System.Storage.ItemStore store);
public static new System.Storage.FindResultpublic static new System.Storage.FindResult
FindAll(FindAll(
System.Storage.ItemStore store,System.Storage.ItemStore store,
string filter);string filter);
public static new Personpublic static new Person
FindOne(FindOne(
System.Storage.ItemStore store,System.Storage.ItemStore store,
string filter);string filter);
public new eventpublic new event
System.Windows.Data.PropertyChangedEventHandlerSystem.Windows.Data.PropertyChangedEventHandler
PropertyChangedHandler;PropertyChangedHandler;
public static new Personpublic static new Person
FindByID(FindByID(
System.Storage.ItemStore store,System.Storage.ItemStore store,
long item_key);long long item_key);
}}
作为又一示例,联系人模式中定义的TelephoneNumber类型的详细结构以XML示出如下:As yet another example, the detailed structure of the TelephoneNumber type defined in the contact schema is shown in XML as follows:
<Type Name=″TelephoneNumber″ExtendsType=″Core.EAddress″<Type Name="TelephoneNumber" ExtendsType="Core.EAddress"
MajorVersion=″1″MinorVersion=″0″ExtendsVersion=″1″>MajorVersion="1"MinorVersion="0"ExtendsVersion="1">
<Field Name=″CountryCode″Type=″the storage platformTypes.nvarchar(50)″<Field Name="CountryCode"Type="the storage platformTypes.nvarchar(50)"
Nullable=″true″MultiValued=″false″ Nullable = "true" MultiValued = "false"
TypeMajorVersion=″1″/> TypeMajorVersion="1"/>
<Field Name=″AreaCode″Type=″the storage platformTypes.nvarchar(256)″<Field Name="AreaCode"Type="the storage platformTypes.nvarchar(256)"
Nullable=″true″TypeMajorVersion=″1″/>Nullable="true"TypeMajorVersion="1"/>
<Field Name=″Number″Type=″the storage platformTypes.nvarchar(256)″<Field Name="Number"Type="the storage platformTypes.nvarchar(256)"
Nullable=″true″TypeMajorVersion=″1″/>Nullable="true"TypeMajorVersion="1"/>
<Field Name=″Extension″Type=″the storage platformTypes.nvarchar(256)″<Field Name="Extension"Type="the storage platformTypes.nvarchar(256)"
Nullable=″true″TypeMajorVersion=″1″/>Nullable="true"TypeMajorVersion="1"/>
<Field Name=″PIN″Type=″the storage platformTypes.nvarchar(50)″<Field Name="PIN"Type="the storage platformTypes.nvarchar(50)"
Nullable=″true″TypeMajorVersion=″1″/>Nullable="true"TypeMajorVersion="1"/>
</Type></Type>
该类型导致以下类(仅示出了公有成员):This type results in the following class (only public members shown):
partial public class TelephoneNumber:partial public class TelephoneNumber:
System.Storage.Core.EAddress,System.Storage.Core.EAddress,
System.Windows.Data.IDataUnitSystem.Windows.Data.IDataUnit
{{
public System.Data.SqlTypes.SqlString CountryCode public System.Data.SqlTypes.SqlString CountryCode
{get;set;}{ get; set; }
public System.Data.SqlTypes.SqlString AreaCode public System.Data.SqlTypes.SqlString AreaCode
{get;set;}{ get; set; }
public System.Data.SqlTypes.SqlString Number public System.Data.SqlTypes.SqlString Number
{get;set;}{ get; set; }
public System.Data.SqlTypes.SqlString Extension public System.Data.SqlTypes.SqlString Extension
{get;set;}{ get; set; }
public System.Data.SqlTypes.SqlString PIN public System.Data.SqlTypes.SqlString PIN
{get;set;}{ get; set; }
从给定模式得到的类的分层结构直接反映了该模式中的分层结构。作为一个示例,考虑联系人模式中定义的Item类型(见图21A和21B)。在存储平台API中对应于该类型的类分层结构如下:The resulting class hierarchy for a given schema directly reflects the hierarchy within that schema. As an example, consider the Item type defined in the Contacts schema (see Figures 21A and 21B). The class hierarchy corresponding to this type in the storage platform API is as follows:
ObjectObject
DataClassDataClass
ElementBaseElementBase
RootItemBaseRootItemBase
ItemItem
PrincipalPrincipal
Group
HouseholdHousehold
OrganizationOrganization
PersonPerson
UserUser
ServiceService
PresenceServicePresenceService
ContactServiceContactService
ADServiceADService
RootNestedBaseRootNestedBase
...(元素类)...(element class)
又一模式,即允许表示系统中的所有音频/视频媒体(断开的音频文件、音频CD、DVD、家庭视频等)的模式使用户/应用程序能够存储、组织、搜索和操纵不同种类的音频/视频媒体。基本媒体文档模式足够一般以表示任何媒体,且对该基本模式的扩展被设计成为音频和视频媒体分开处理域专用属性。该模式以及许多其它模式被构想为直接或间接在核心模式下操作。Yet another schema, one that allows representation of all audio/video media in the system (broken audio files, audio CDs, DVDs, home videos, etc.) enables users/applications to store, organize, search, and manipulate audio of different kinds /video media. The basic media document schema is general enough to represent any media, and extensions to this basic schema are designed to handle domain-specific properties separately for audio and video media. This mode, as well as many others, are conceived to operate directly or indirectly under the core mode.
5.运行时架构5. Runtime architecture
基本存储平台API编程模型是对象持久性的。应用程序在存储上执行搜索,并在存储中检索表示数据的对象。应用程序修改检索的对象或创建新对象,然后使其改变被传播到存储。该过程是由ItemContext(项目上下文)对象来管理的。搜索使用ItemSearcher(项目搜索器)对象来执行,且搜索结果可通过FindResult(寻找结果)对象来访问。The basic storage platform API programming model is object persistence. Applications perform searches on storage and retrieve objects representing data from storage. Applications modify retrieved objects or create new ones, then have their changes propagated to storage. The process is managed by the ItemContext (item context) object. Searches are performed using an ItemSearcher object, and search results are accessed through a FindResult object.
a)运行时架构类a) Runtime architecture class
依照本发明的另一发明性方面,运行时架构实现多个类来支持数据类的操作。这些架构类为数据类定义了一组公共的行为,且连同数据类一起为存储平台API提供了基本编程模型。运行时架构中的类属于System.Storage名字空间。在本实施例中,架构类包括以下主要类:ItemContext、ItemSearcher和FindResult。也可提供其它次要类、枚举值以及代表。According to another inventive aspect of the present invention, the runtime framework implements a plurality of classes to support operations on data classes. These architectural classes define a common set of behaviors for the data classes, and together with the data classes provide the basic programming model for the storage platform API. The classes in the runtime framework belong to the System.Storage namespace. In this embodiment, the framework classes include the following main classes: ItemContext, ItemSearcher and FindResult. Other secondary classes, enumeration values, and delegates may also be provided.
(1)ItemContext(1) ItemContext
ItemContext对象(i)表示应用程序希望搜索的一组项目域,(ii)为每一对象维护表示从存储平台中检索的数据的状态的状态信息,以及(iii)管理当与存储平台交互时使用的事务以及可与存储平台互操作的任何文件系统。The ItemContext object (i) represents the set of item domains that the application wishes to search, (ii) maintains for each object state information representing the state of the data retrieved from the storage platform, and (iii) manages the transactions and any file system that interoperates with the storage platform.
作为对象持久性引擎,ItemContext提供了以下服务:As an object persistence engine, ItemContext provides the following services:
1.将从存储中读取的数据反串行化成对象。1. Deserialize the data read from storage into an object.
2.维护对象身份(同一对象用于表示给定的项目,而无论该项目被包括在查询结果中多少次)。2. Maintain object identity (the same object is used to represent a given item, no matter how many times the item is included in the query results).
3.跟踪对象状态。3. Track object state.
ItemContext也执行对存储平台唯一的多个服务:ItemContext also implements several services unique to the storage platform:
1.生成和执行持久保存改变所需的存储平台更新元素操作。1. Generate and execute the storage platform update element operations required to persist changes.
2.创建允许引用关系的无缝导航并允许从多域搜索中检索要修改和保存的对象所需的到多个数据存储的连接。2. Create the connections to multiple data stores required to allow seamless navigation of reference relationships and to allow retrieval of objects to be modified and saved from multi-domain searches.
3.确保当对象的改变表示要保存该项目时支持文件的项目被正确地更新。3. Ensuring that items in backing files are correctly updated when object changes indicate that the item is to be saved.
4.管理跨多个存储平台连接的事务,并且在更新储存在支持文件的项目中的数据以及文件流属性时管理以事务方式处理的文件系统。4. Manage transactions across multiple storage platform connections and manage transactionally processed file systems when updating data stored in file-backed items and file stream attributes.
5.执行将存储平台关系语义、支持文件的项目以及流类型化的属性考虑在内的创建、复制、移动和删除操作。5. Perform create, copy, move, and delete operations that take into account storage platform relational semantics, items that support files, and stream-typed attributes.
附录A提供了依照其一个实施例列出ItemContext类的源代码。Appendix A provides the source code listing the ItemContext class according to one embodiment thereof.
(2)ItemSearcher(2) Item Searcher
ItemSearcher类支持简单的搜索,该搜索返回整个Item对象、Item对象的流、或从Item对象投影的值的流。ItemSearcher封装了对以下所有公共的核心功能:应目标类型的概念以及应用于该目标类型的参数化的过滤器。ItemSearcher也允许预编译或准备搜索器,作为在以多种类型执行同一操作时的优化。附录B提供了依照其一个实施例列出ItemSearcher类和若干紧密相关的类的源代码。The ItemSearcher class supports simple searches that return entire Item objects, streams of Item objects, or streams of values projected from Item objects. ItemSearcher encapsulates all common core functionality to: the concept of a target type and the parameterized filters applied to that target type. ItemSearcher also allows precompiling or preparing searchers as an optimization when performing the same operation with multiple types. Appendix B provides the source code listing the ItemSearcher class and several closely related classes according to one embodiment thereof.
(a)目标类型(a) Target type
搜索目标类型是在构造ItemSearcher时设置的。目标类型是映射到可由数据存储查询的范围的CLR类型。具体地,它是映射到项目、关系和关系扩展类型以及模式化视图的CLR类型。The search target type is set when the ItemSearcher is constructed. Target types are CLR types that map to ranges that can be queried by the data store. Specifically, it is the CLR type that maps to Item, Relationship, and Relationship Extension types, as well as schematized views.
当使用ItemContext.GetSearcher方法检索搜索器时,搜索器的目标类型被指定为参数。当在项目、关系或项目扩展类型上调用静态GetSeacher方法(例如,Person.GetSearcher)时,目标类型是项目、关系或项目扩展类型。When retrieving a searcher using the ItemContext.GetSearcher method, the searcher's target type is specified as a parameter. When calling a static GetSeacher method (for example, Person.GetSearcher) on an Item, Relationship, or ItemExtension type, the target type is the Item, Relationship, or ItemExtension type.
ItemSearcher中提供的搜索表达式(例如,搜索过滤器和通过查询操作,或投影定义)总是相对于搜索目标类型。这些表达式可指定目标类型的属性(包括嵌套元素的属性),并可指定到如别处所描述的关系和项目扩展的联结。Search expressions provided in an ItemSearcher (for example, search filters and pass query operations, or projection definitions) are always relative to the search target type. These expressions may specify properties of the target type (including properties of nested elements), and may specify joins to relationship and item extensions as described elsewhere.
搜索目标类型可通过只读属性(例如,Item.Searcher.Type属性)获得。The search target type is available through a read-only property (for example, the Item.Searcher.Type property).
(b)过滤器(b) filter
ItemSearcher包含指定过滤器的属性(例如,名为“Filters”的属性,作为SearchExpression对象的集合),该过滤器定义了搜索中使用的过滤器。集合中的所有过滤器在执行搜索时使用逻辑和运算符来组合。过滤器可包含参数引用。参数值是通过Parameters属性来指定的。ItemSearcher contains properties that specify filters (for example, a property named "Filters" as a collection of SearchExpression objects) that defines the filters used in the search. All filters in a collection are combined using the logical AND operator when performing a search. Filters can contain parameter references. Parameter values are specified through the Parameters property.
(c)准备搜索(c) Prepare to search
在可能仅用一个参数改变来重复执行同一搜索的情况下,可通过预编译或准备搜索来提高某些性能。这是用ItemSearcher上的一组准备方法(例如,准备返回一个或多个项目的Find(查找)的方法,可能名为“PrepareFind”;以及准备返回投影的Find的方法,可能名为“PrepareProject”)来实现的。例如:In cases where it is possible to perform the same search repeatedly with only one parameter change, some performance can be improved by precompiling or preparing the search. This is done with a set of prepare methods on the ItemSearcher (e.g. a method to prepare a Find that returns one or more items, possibly named "PrepareFind"; and a method to prepare a Find that returns a projection, possibly named "PrepareProject" ) to achieve. For example:
ItemSearcher searcher=...;ItemSearcher searcher = ...;
PreparedFind pf=searcher.PrepareFind();PreparedFind pf = searcher. PrepareFind();
......
result=pf.FindAll();result = pf. FindAll();
......
result=pf.FindAll();result = pf. FindAll();
(d)查找选项(d) Find options
存在可应用于简单搜索的多个选项。这些可在例如FindOptions(查找选项)对象中指定并被传递到Find方法。例如:There are several options available for simple searches. These can be specified, for example, in a FindOptions (find options) object and passed to the Find method. For example:
ItemSearcher searcher=Person.GetSearcher(context);ItemSearcher searcher = Person. GetSearcher(context);
FindOptions options=new FindOptions();FindOptions options = new FindOptions();
options.MaxResults=10;options.MaxResults = 10;
options.SortOptions.Add(“PersonalNames.Surname”,SortOrder.Ascending);options.SortOptions.Add("PersonalNames.Surname", SortOrder.Ascending);
FindResult result=searcher.FindAll(options);FindResult result = searcher. FindAll(options);
作为一种便利,也可将排序选项直接传递给Find方法:As a convenience, sorting options can also be passed directly to the Find method:
ItemSearcher searcher=Person.GetSearcher(context);ItemSearcher searcher = Person. GetSearcher(context);
FindResult result=searcher.FindAll(FindResult result = searcher. FindAll(
new SortOption(“PersonalNames.Surname”,SortOrder.Ascending));new SortOption("PersonalNames. Surname", SortOrder. Ascending));
DelayLoad(延迟负载)选项确定当检索搜索结果时是否加载大二进制属性的值,或者是否将加载延迟到它们被引用之后。MaxResults(最大结果)选项确定了返回的结果的最大数量。这等效于在SQL查询中指定TOP。它通常结合排序来使用。The DelayLoad (delay load) option determines whether to load the values of large binary attributes when retrieving search results, or whether to delay loading until after they are referenced. The MaxResults option determines the maximum number of results returned. This is equivalent to specifying TOP in the SQL query. It is usually used in conjunction with sorting.
SortOption(排序选项)对象的序列可被指定(例如,使用FindOptions.SortOptions属性)。搜索结果将如由第一个SortOption对象所指定的那样排序,然后如由第二个SortOption对象所指定的排序,依此类推。SortOption指定了指示将用于排序的属性的搜索表达式。表达式指定了以下之一:A sequence of SortOption (sort options) objects can be specified (eg, using the FindOptions.SortOptions property). The search results will be sorted as specified by the first SortOption object, then as specified by the second SortOption object, and so on. SortOption specifies a search expression indicating the properties to be used for sorting. The expression specifies one of the following:
1.搜索目标类型中的标量属性;1. Search for scalar properties in the target type;
2.可通过遍历单值属性从搜索目标类型到达的嵌套元素中的标量属性;或者2. A scalar attribute in a nested element reachable from the search target type by traversing the single-valued attribute; or
3.具有有效自变量的集合函数的结果(例如,Max应用于可通过遍历多值属性或关系从搜索目标类型到达的嵌套元素中的标量属性)。3. The result of an aggregate function with valid arguments (eg, Max applied to a scalar attribute in a nested element reachable from a search target type by traversing a multivalued attribute or relationship).
例如,假定搜索目标类型是System.Storage.Contact.Person:For example, assuming the search target type is System.Storage.Contact.Person:
1.“Birthdate”-有效,Birthdate是Person类型的标量属性;1. "Birthdate" - Valid, Birthdate is a scalar property of type Person;
2.“PersonalNames.Surname”-无效,PersonalNames是多值属性,且未使用任何集合函数;2. "PersonalNames.Surname" - Invalid, PersonalNames is a multi-valued attribute and no aggregate functions are used;
3.“Count(PersonalNames)”-有效,PersonalNames的计数;3. "Count(PersonalNames)" - valid, the count of PersonalNames;
4.“Case(Contact.MemberOfHousehold).Household.HouseholdEAddresses.StartDate”-无效,使用了关系和多值属性,而没有集合函数。4. "Case(Contact.MemberOfHousehold).Household.HouseholdEAddresses.StartDate" - Invalid, using relationships and multivalued properties without aggregate functions.
5.“Max(Cast(Contact.MemberOfHousehold).Household.HouseholdEAddresses.StartDate)”-有效,最近的家庭电子地址起始日期。5. "Max(Cast(Contact.MemberOfHousehold).Household.HouseholdEAddresses.StartDate)" - valid, most recent start date of home electronic addresses.
(3)项目结果流(“FindResult”)(3) Item result stream ("FindResult")
ItemSearcher(例如,通过FindAll方法)返回可用于访问由搜索返回的对象的对象(例如,“FindResult”对象)。附录C提供了依照其一个实施例列出FindResult类和若干紧密相关的类的源代码。The ItemSearcher (eg, via the FindAll method) returns an object (eg, a "FindResult" object) that can be used to access the objects returned by the search. Appendix C provides the source code listing the FindResult class and several closely related classes according to one embodiment thereof.
存在用于从FindResult对象获得结果的两种不同的方法:使用由IObjectReader(对象读取器接口)(以及IAsyncObjectReader(异步对象读取器接口))定义的读取器模式,以及使用IEnumerable(可枚举接口)和IEnumerator(枚举器接口)定义的枚举器模式。枚举器模式是CLR中的标准,且支持如C#的foreach等语言构造。例如:There are two different methods for obtaining results from the FindResult object: using the reader pattern defined by IObjectReader (object reader interface) (and IAsyncObjectReader (asynchronous object reader interface)), and using IEnumerable (enumerable Enumeration interface) and the enumerator pattern defined by IEnumerator (enumerator interface). The enumerator pattern is standard in the CLR and supports language constructs such as C#'s foreach. For example:
ItemSearcher searcher=Person.GetSearcher(context);ItemSearcher searcher = Person. GetSearcher(context);
searcher.Filters.Add(“PersonalNames.Surname=‘Smith’”);searcher.Filters.Add("PersonalNames.Surname='Smith'");
FindResult result=searcher.FindAll();FindResult result = searcher. FindAll();
foreach(Person person in result)...;foreach(Person person in result)...;
支持读取器模式,因为它允许通过在某些情况下消除数据副本来更有效地处理结果。例如:The Reader pattern is supported as it allows for more efficient processing of results by eliminating data copies in some cases. For example:
ItemSearcher searcher=Person.GetSearcher(context);ItemSearcher searcher = Person. GetSearcher(context);
searcher.Filters.Add(“PersonalNames.SurName=‘Smith’”);searcher.Filters.Add("PersonalNames.SurName='Smith'");
FindResult result=searcher.FindAll();FindResult result = searcher. FindAll();
while(result.Read())while(result. Read())
{{
Person person=(Person)result.Current;Person person = (Person) result.Current;
......
}}
另外,读取器模式支持异步操作:Additionally, the Reader pattern supports asynchronous operations:
ItemSearcher searcher=Person.GetSearcher(context);ItemSearcher searcher = Person. GetSearcher(context);
searcher.Filters.Add(“PersonalNames.SurName=‘Smith’”);searcher.Filters.Add("PersonalNames.SurName='Smith'");
FindResult result=searcher.FindAll();FindResult result = searcher. FindAll();
IAysncResult asyncResult=result.BeginRead(new AsyncCallback(MyCallback));IAysncResult asyncResult = result.BeginRead(new AsyncCallback(MyCallback));
void MyCallback(IAsyncResult asyncResult)void MyCallback(IAsyncResult asyncResult)
{{
if(result.EndRead(asyncResult))if(result. EndRead(asyncResult))
{{
Person person=(Person)result.Current;Person person = (Person) result.Current;
......
}}
}}
在本实施例中,FindResult在它不再需要时应当被关闭。这可以通过调用Close(关闭)方法或使用诸如C#所使用的语句等语言构造来完成。例如:In this embodiment, FindResult should be closed when it is no longer needed. This can be done by calling the Close method or using a language construct such as the statement used by C#. For example:
ItemSearcher searcher=Person.GetSearcher(context);ItemSearcher searcher = Person. GetSearcher(context);
searcher.Filters.Add(“PersonalNames.SurName=‘Smith’”);searcher.Filters.Add("PersonalNames.SurName='Smith'");
using(FindResult result=searcher.FindAll())using(FindResult result=searcher. FindAll())
{{
while(result.Read())while(result. Read())
{{
Person person=(Person)result.Current;Person person = (Person) result.Current;
......
}}
}}
b)操作中的运行时架构b) Runtime architecture in operation
图22示出了操作中的运行时架构。该运行时架构如下操作:Figure 22 shows the runtime architecture in operation. The runtime architecture operates as follows:
1.应用程序350a、350b或350c绑定到存储平台中的项目。1. The
2.架构2004创建对应于绑定的项目的ItemContext(项目上下文)对象2202,并将其返回给应用程序。2. The
3.应用程序在该ItemContext上提交Find以获得项目集合;所返回的集合在概念上是对象图2204(由于关系)。3. The application submits a Find on this ItemContext to obtain a collection of items; the returned collection is conceptually an object graph 2204 (due to relationships).
4.应用程序改变、删除和插入数据。4. The application changes, deletes and inserts data.
5.应用程序通过调用Update()方法保存改变。5. The application saves the changes by calling the Update() method.
c)公共编程模式c) Common programming mode
本节提供了存储平台API架构类如何能够用于操纵数据存储中的项目的各种示例。This section provides various examples of how the storage platform API schema classes can be used to manipulate items in a data store.
(1)打开和关闭ItemContext对象(1) Open and close the ItemContext object
应用程序例如通过调用静态的ItemContext.Open方法并提供标识将与ItemContext相关联的项目域的一个或多个路径来获得它将用于与数据存储交互的ItemContext对象。项目域定使用ItemContext所执行的搜索的范围,使得仅域项目和包含在该项目中的项目将遭受搜索。示例如下:An application obtains an ItemContext object that it will use to interact with the data store, for example, by calling the static ItemContext.Open method and providing one or more paths identifying the item domains with which the ItemContext will be associated. The item scope scopes searches performed using the ItemContext such that only the domain item and items contained within that item will be subject to the search. Examples are as follows:
打开在本地计算机上具有DefaultStore存储平台共享的ItemContextOpen an ItemContext that has a DefaultStore storage platform share on the local machine
ItemContext ic=ItemContext.Open()ItemContext ic = ItemContext. Open()
打开具有给定存储平台共享的ItemContextOpen an ItemContext with the given storage platform share
ItemContext ic=ItemContext.Open(@″\\myserver1\DefaultStore″);ItemContext ic = ItemContext.Open(@″\\myserver1\DefaultStore″);
打开具有在存储平台共享下的项目的ItemContextOpen the ItemContext with the item under the storage platform share
ItemContext ic=ItemContext.Open(@″\\myserver1\WinFSSpecs\api\m6″);ItemContext ic = ItemContext.Open(@″\\myserver1\WinFSSpecs\api\m6″);
打开具有多个项目域的ItemContextOpen ItemContext with multiple item fields
ItemContext ic=ItemContext.Open(@″\\myserver1\My Documents″,ItemContext ic = ItemContext.Open(@″\\myserver1\My Documents″,
@″\\jane1\My Documents″,@″\\jane1\My Documents″,
@″\\jane2\My Documents″);@"\\jane2\My Documents");
当不再需要ItemContext时,它必须被关闭。When the ItemContext is no longer needed, it must be closed.
显式地关闭ItemContextExplicitly close the ItemContext
ItemContext ic=ItemContext.Open();ItemContext ic = ItemContext. Open();
......
ic.Close();ic.Close();
使用具有ItemContext的语句来关闭Use statement with ItemContext to close
using(ItemContext ic=ItemContext.Open())using(ItemContext ic=ItemContext. Open())
{{
...;...;
}}
(2)搜索对象(2) Search object
依照本发明的另一方面,存储平台API提供了使得应用程序员能够基于数据存储中的项目的各种属性,以将应用程序员与底层数据库引擎的查询语言的细节隔离的方式来形成查询的简化的查询模型。In accordance with another aspect of the present invention, the storage platform API provides features that enable an application programmer to formulate queries based on various attributes of items in the data store in a manner that isolates the application programmer from the details of the query language of the underlying database engine. Simplified query model.
应用程序可跨在使用由ItemContext.GetSearcher方法返回的ItemSearcher对象打开ItemContext时指定的域执行搜索。搜索结果使用FindResult对象来访问。假定对以下示例的以下声明:An application can perform a search across the fields specified when opening the ItemContext using the ItemSearcher object returned by the ItemContext.GetSearcher method. Search results are accessed using the FindResult object. Assume the following declaration for the following example:
ItemContext ic=...;ItemContext ic = ...;
ItemSearcher searcher=null;ItemSearcher searcher = null;
FindResult result=null;FindResult result = null;
Item item=null;Item item = null;
Relationship relationship=null;Relationship relationship=null;
ItemExtension itemExtension=null;ItemExtension itemExtension = null;
基本搜索模式涉及使用通过调用GetSearcher(获得搜索器)方法从ItemContext检索到的ItemSearcher对象。The basic search mode involves using the ItemSearcher object retrieved from the ItemContext by calling the GetSearcher (get searcher) method.
搜索给定类型的所有项目Search for all items of a given type
searcher=ic.GetSearcher(typeof(Person));searcher = ic. GetSearcher(typeof(Person));
result=searcher.FindAll();result = searcher. FindAll();
foreach(结果中的Person p)...;foreach(Person p in result)...;
搜索满足过滤器的给定类型的项目Search for items of a given type that satisfy a filter
searcher=ic.GetSearcher(typeof(Person));searcher = ic. GetSearcher(typeof(Person));
searcher.Filters.Add(″PersonalNames.Surname=′Smith′″);searcher.Filters.Add("PersonalNames.Surname='Smith'");
result=searcher.FindAll();result = searcher. FindAll();
foreach(结果中的Person p)...;foreach(Person p in result)...;
使用过滤器串中的参数Use the parameters in the filter string
searcher=ic.GetSearcher(typeof(Person));searcher = ic. GetSearcher(typeof(Person));
searcher.Filters.Add(″Birthdate<@Date″);searcher.Filters.Add("Birthdate<@Date");
searcher.Parameters[″Date″]=someDate;searcher.Parameters["Date"] = someDate;
result=searcher.FindAll();result = searcher. FindAll();
foreach(结果中的Person p)...;foreach(Person p in result)...;
搜索给定类型且满足过滤器的关系Searches for relations of a given type that satisfy a filter
searcher=ic.GetSearcher(typeof(EmployeeEmployer));searcher=ic.GetSearcher(typeof(EmployeeEmployer));
searcher.Filters.Add(″StartDate<=@Date AND(EndDate>=@Date OR isnull(EndDate))″);searcher.Filters.Add("StartDate<=@Date AND(EndDate>=@Date OR isnull(EndDate))");
searcher.Parameters[″Date″]=someDate;searcher.Parameters["Date"] = someDate;
result=searcher.FindAll();result = searcher. FindAll();
Foreach(结果中的EmployeeEmployer ee)...;Foreach(EmployeeEmployer ee in result)...;
搜索具有给定类型且满足过滤器的关系的项目Searches for items with a relationship of the given type that satisfies the filter
searcher=ic.GetSearcher(typeof(Folder));searcher = ic. GetSearcher(typeof(Folder));
searcher.Filters.Add(″MemberRelationships.Name like′A%′″);//见[ApiRel]searcher.Filters.Add("MemberRelationships.Name like'A%'");//See [ApiRel]
result=searcher.FindAll();result = searcher. FindAll();
Foreach(结果中的Folder f)...;Foreach(Folder f in result)...;
搜索给定类型且满足过滤器的项目扩展Searches for project extensions of a given type that satisfy the filter
searcher=ic.GetSearcher(typeof(ShellExtension));searcher=ic.GetSearcher(typeof(ShellExtension));
searcher.Filters.Add(″Keywords.Value=′Foo′″);searcher.Filters.Add("Keywords.Value='Foo'");
result=searcher.FindAll();result = searcher. FindAll();
foreach(结果中的ShellExtension se)...;foreach(ShellExtension se in result)...;
搜索具有给定类型且满足过滤器的项目扩展的项目Searches for an item with an item extension of the given type that satisfies the filter
searcher=ic.GetSearcher(typeof(Person));searcher = ic. GetSearcher(typeof(Person));
searcher.Filters.Add(″Extensions.Cast(@Type).Keywords.Value=′Foo′″);//见[ApiExt]searcher.Filters.Add("Extensions.Cast(@Type).Keywords.Value='Foo'");//See [ApiExt]
searcher.Parameters[″Type″]=typeof(ShellExtension);searcher.Parameters["Type"] = typeof(ShellExtension);
result=searcher.FindAll();result = searcher. FindAll();
foreach(结果中的Person p)...;foreach(Person p in result)...;
(a)搜索选项(a) Search options
可在执行搜索时指定各种选项,包括排序、延迟加载以及限制结果数。Various options can be specified when performing a search, including sorting, lazy loading, and limiting the number of results.
排序搜索结果sort search results
searcher=ic.GetSearcher(typeof(Person));searcher = ic. GetSearcher(typeof(Person));
searcher.Filters.Add(″PersonalNames.Surname=′Smith′″);searcher.Filters.Add("PersonalNames.Surname='Smith'");
SearchOptions options=new SearchOptions();SearchOptions options = new SearchOptions();
options.SortOptions.Add(new SortOption(″Birthdate″,SortOrder.Ascending));options.SortOptions.Add(new SortOption("Birthdate", SortOrder.Ascending));
result=searcher.FindAll(options);result = searcher. FindAll(options);
foreach(结果中的Person p)...;foreach(Person p in result)...;
//有快捷方式可用// There are shortcuts available
searcher=ic.GetSearcher(typeof(Person));searcher = ic. GetSearcher(typeof(Person));
searcher.Filters.Add(″PersonalNames.Surname=′Smith′″);searcher.Filters.Add("PersonalNames.Surname='Smith'");
result=searcher.FindAll(new SortOption(″Birthdate″,SortOrder.Ascending));result = searcher.FindAll(new SortOption("Birthdate", SortOrder.Ascending));
foreach(结果中的Person p)...;foreach(Person p in result)...;
限制结果计数limit result count
searcher=ic.GetSearcher(typeof(Person));searcher = ic. GetSearcher(typeof(Person));
searcher.Filters.Add(″PersonalNames.Surname=′Smith′″);searcher.Filters.Add("PersonalNames.Surname='Smith'");
SearchOptions options=new SearchOptions();SearchOptions options = new SearchOptions();
options.MaxResults=10;options.MaxResults = 10;
result=searcher.FindAll(options);result = searcher. FindAll(options);
foreach(结果中的Person p)...;foreach(Person p in result)...;
(b)FindOne和FindOnly(b) FindOne and FindOnly
有时仅检索第一个结果是有用的,尤其是当指定排序准则的时候。另外,期望某些搜索仅返回一个对象,且不期望它不返回任何对象。Sometimes it is useful to retrieve only the first result, especially when specifying a sorting criterion. Also, some searches are expected to return only one object, and are not expected to return no objects.
搜索一个对象search for an object
searcher=ic.GetSearcher(typeof(Person));searcher = ic. GetSearcher(typeof(Person));
searcher.Filters.Add(″PersonalNames.Surname=’Smith′″);searcher.Filters.Add("PersonalNames.Surname='Smith'");
Person p=searcher.FindOne(new SortOption(″Birthdate″SortOrder.Ascending))as Person;Person p = searcher.FindOne(new SortOption("Birthdate"SortOrder.Ascending)) as Person;
if(p!=null)...;if(p!=null)...;
搜索期望总是存在的单个对象Search for a single object that is expected to always exist
searcher=ic.GetSearcher(typeof(Person));searcher = ic. GetSearcher(typeof(Person));
searcher.Filters.Add(″PersonalNames[Surname=’Smith’AND Givenname ’John’]″);searcher.Filters.Add("PersonalNames[Surname='Smith'AND Givenname 'John']");
trytry
{{
Person p=searcher.FindOnly();Person p = searcher. FindOnly();
...;...;
}}
catch(Exception e)catch(Exception e)
{{
...;...;
}}
(c)搜索ItemContext上的快捷方式(c) Search for shortcuts on the ItemContext
ItemContext上也有使得简单的搜索尽可能容易的若干快捷方式。There are also several shortcuts on the ItemContext to make simple searches as easy as possible.
使用ItemContext.FindAll快捷方式搜索Search using the ItemContext.FindAll shortcut
result=ic.FindAll(typeof(Person),″PersonalNames.Surname=′Smith′″);result=ic.FindAll(typeof(Person), "PersonalNames.Surname='Smith'");
foreach(结果中的Person p)...;foreach(Person p in result)...;
使用Item.Context.FindOne快捷方式搜索Search using the Item.Context.FindOne shortcut
Person p=ic.FindOne(typeof(Person),″PersonalNames.Surname=′Smith′″)as Person;Person p=ic.FindOne(typeof(Person), "PersonalNames.Surname='Smith'") as Person;
(d)按照ID或路径查找(d) Find by ID or path
另外,可通过提供其id来检索项目、关系以及项目扩展。项目也可按照路径来检索。Additionally, items, relationships, and item extensions can be retrieved by providing their ids. Items can also be retrieved by path.
给定id获得项目、关系以及项目扩展Get an item, relationship, and item extension given an id
item=ic.FindltemByld(iid);item = ic.FindltemByld(iid);
relationship=ic.FindRelationshipByld(iid,rid);relationship=ic.FindRelationshipByld(iid,rid);
itemExtension=ic.FindltemExtensionByld(iid,eid);itemExtension = ic.FindltemExtensionByld(iid, eid);
给定路径获得项目Get an item given a path
//仅单个域// single field only
item=ic.FindltemByPath(@″temp\foo.txt″);item = ic.FindltemByPath(@″temp\foo.txt″);
//单个或多个域// single or multiple fields
result=ic.FindAllItemsByPath(@″temp\foo.txt″);result = ic.FindAllItemsByPath(@″temp\foo.txt″);
foreach(结果中的Item I)...;foreach(Item I in result)...;
(e)GetSearcher模式(e) GetSearcher mode
在存储平台API中有许多期望提供在另一对象的上下文中或用特定的参数来执行搜索的助手方法的许多地方。GetSearcher模式允许这些情形。在API中有许多GerSearcher方法。其每一个都返回预先被配置成执行给定搜索的ItemSearcher。例如:There are many places in the storage platform API where it is desirable to provide helper methods that perform searches within the context of another object or with specific parameters. The GetSearcher pattern allows for these situations. There are many GerSearcher methods in the API. Each of these returns an ItemSearcher pre-configured to perform a given search. For example:
searcher=itemContext.GetSearcher();searcher = itemContext. GetSearcher();
searcher=Person.GetSearcher();searcher = Person. GetSearcher();
searcher=EmployeeEmployer.GetSearcherGivenEmployer(organization);searcher = EmployeeEmployer. GetSearcherGivenEmployer(organization);
searcher=person.GetSearcherForReports();searcher = person. GetSearcherForReports();
可在执行搜索之前添加其它过滤器:Additional filters can be added before performing the search:
searcher=person.GetSearcherForReports();searcher = person. GetSearcherForReports();
searcher.Filters.Add(″PersonalNames.Surname=’Smith’″);searcher.Filters.Add("PersonalNames.Surname='Smith'");
可选择如何希望结果:Optionally choose how you want the result:
FindResult findResult=searcher.FindAll();FindResult findResult = searcher. FindAll();
Person person=searcher.FindOne();Person person = searcher. FindOne();
(3)更新存储(3) Update storage
一旦通过搜索检索了对象,它可按应用程序所需修改。也可创建新对象并与现有对象相关联。一旦应用程序做出了形成逻辑组的所有改变,应用程序调用ItemContext.Update来将这些改变持久保存到存储中。依照本发明的存储平台API的又一方面,API收集由应用程序对项目做出的改变,然后将它们组织成其上实现数据存储的数据库引擎(或任何种类的存储引擎)所需的正确更新。这使得应用程序员能够对存储器中的项目做出改变,而将数据存储更新的复杂性留给API。Once an object has been retrieved through a search, it can be modified as required by the application. New objects can also be created and associated with existing objects. Once the application has made all the changes that form a logical group, the application calls ItemContext.Update to persist these changes to storage. According to yet another aspect of the storage platform API of the present invention, the API collects changes made to items by applications and then organizes them into the correct updates required by the database engine (or any kind of storage engine) on which the data storage is implemented. . This enables application programmers to make changes to items in memory, leaving the complexity of data store updates to the API.
保存对单个项目的改变Save changes to a single project
Person p=ic.FindItemByld(pid)as Person;Person p=ic.FindItemByld(pid)as Person;
p.DisplayName=″foo″;p.DisplayName = "foo";
p.TelephoneNumbers.Add(new TelephoneNumber(″425-555-1234″));p.TelephoneNumbers.Add(new TelephoneNumber(″425-555-1234″));
ic.Update();ic.Update();
保存对多个项目的改变Save changes to multiple projects
Household h1=ic.FindItemByld(hid1)as Household;Household h1=ic.FindItemByld(hid1)as Household;
Household h2=ic.FindItemByld(hid2)as Household;Household h2=ic.FindItemByld(hid2)as Household;
Person p=ic.FindItemByld(pid)as Person;Person p=ic.FindItemByld(pid)as Person;
h1.MemberRelationships.Remove(p);h1.MemberRelationships.Remove(p);
h2.MemberRelationships.Add(p);h2.MemberRelationships.Add(p);
ic.Update();ic.Update();
创建新项目create new project
Folder f=ic.FindItemByld(fid)as Folder;Folder f=ic.FindItemByld(fid)as Folder;
Person p=new Person();Person p = new Person();
p.DisplayName=″foo″;p.DisplayName = "foo";
f.Relationships.Add(new FolderMember(p,″foo″));f.Relationships.Add(new FolderMember(p, "foo"));
ic.Update();ic.Update();
//或使用快捷方式...// or use a shortcut...
Folder f=ic.FindItemByld(fid)as Folder;Folder f=ic.FindItemByld(fid)as Folder;
Person p=new Person();Person p = new Person();
p.DisplayName=″foo″;p.DisplayName = "foo";
f.MemberRelationships.Add(p,″foo″);f.MemberRelationships.Add(p, "foo");
ic.Update();ic.Update();
删除关系(以及可能的目标项目)Delete the relationship (and possibly the target item)
searcher=ic.GetSearcher(typeof(FolderMember));searcher = ic. GetSearcher(typeof(FolderMember));
searcher.Filters.Add(″SourceItemId=@fid″);searcher.Filters.Add("SourceItemId=@fid");
searcher.Filters.Add(″TargetItemId=@pid″);searcher.Filters.Add("TargetItemId=@pid");
searcher.Parameters.Add(″fid″,fid);searcher.Parameters.Add("fid", fid);
searcher.Parameters.Add(″pid″,pid);searcher.Parameters.Add("pid", pid);
foreach(searcher.FindAll()中的FolderMember fm)fm.MarkForDelete();foreach(FolderMember fm in searcher. FindAll()) fm.MarkForDelete();
ic.Update();ic.Update();
//或使用快捷方式...// or use a shortcut...
Folder f=ic.FindItemByld(fid)as Folder;Folder f=ic.FindItemByld(fid)as Folder;
f.MemberRelationships.Remove(pid);f. MemberRelationships. Remove(pid);
ic.Update();ic.Update();
添加项目扩展Add project extension
Item item=ic.FindItemByld(iid);Item item = ic.FindItemByld(iid);
MyExtension me=new MyExtension();MyExtension me = new MyExtension();
me.Foo=″bar″;me.Foo="bar";
item.Extensions.Add(me);item.Extensions.Add(me);
ic.Update();ic.Update();
删除项目扩展remove project extension
searcher=ic.GetSearcher(typeof(MyExtension));searcher = ic. GetSearcher(typeof(MyExtension));
searcher.FiIters.Add(″ItemId=@iid″);searcher.FiIters.Add("ItemId=@iid");
searcher.Parameters.Add(″iid″,iid);searcher.Parameters.Add("iid", iid);
foreach(searcher.FindAll()中的MyExtension me)me.MarkForDelete();foreach(MyExtension me in searcher.FindAll())me.MarkForDelete();
ic.Update();ic.Update();
//或使用快捷方式...// or use a shortcut...
Item i=ic.FindItemByld(iid);Item i = ic.FindItemByld(iid);
i.Extensions.Remove(typeof(MyExtension));i.Extensions.Remove(typeof(MyExtension));
ic.Update();ic.Update();
6.安全性6. Security
参考上文的第II.E节(安全性),在存储平台API的本实施例中,在项目上下文上有五种方法可用于检索和修改与存储中的项目相关联的安全策略。这些方法是:Referring to Section II.E (Security) above, in this embodiment of the storage platform API, there are five methods available on the item context for retrieving and modifying the security policy associated with an item in storage. These methods are:
1.GetItemSecurity;1. GetItemSecurity;
2.SetItemSecurity;2. SetItemSecurity;
3.GetPathSecurity;3. GetPathSecurity;
4.SetPathSecurity 以及4. SetPathSecurity and
5.GetEffectiveItemSecurity。5. GetEffectiveItemSecurity.
GetItemSecurity和SetItemSecurity提供了检索和修改与项目相关联的显式ACL的机制。该ACL独立于所存在的到项目的路径,且在进行中独立于具有该项目作为目标的持有关系。这使得管理员能够如所期望的独立于所存在的到项目的路径推断出项目的安全性。GetItemSecurity and SetItemSecurity provide mechanisms to retrieve and modify explicit ACLs associated with items. This ACL is independent of the path that exists to the item, and is in progress independent of the holding relationship that has the item as the target. This enables an administrator to infer the security of an item as desired independently of the paths that exist to the item.
GetPathSecurity和SetPathSecurity提供了用于检索和修改由于来自另一文件夹的持有关系而存在于项目上的ACL的机制。该ACL由考虑中的路径从各个祖先的ACL到该项目以及对该路径的显式ACL(如果提供的话)组成。该ACL和前一情况下的ACL之间的差别在于该ACL仅当对应的持有关系存在时才在进行中保留,而显式项目ACL独立于对该项目的任何持有关系。GetPathSecurity and SetPathSecurity provide mechanisms for retrieving and modifying ACLs that exist on an item due to a holding relationship from another folder. This ACL consists of the ACLs from the respective ancestors for the path under consideration to the item and the explicit ACL for that path, if provided. The difference between this ACL and the ACL in the previous case is that this ACL is kept in progress only if the corresponding holding relationship exists, whereas an explicit item ACL is independent of any holding relationship to the item.
可以在项目上用SetItemSecurity和SetPathSecurity设置的ACL被限于可继承的和对象专用的ACE。它们不能包含被标记为继承的任何ACE。The ACLs that can be set on items with SetItemSecurity and SetPathSecurity are limited to inheritable and object-specific ACEs. They cannot contain any ACEs that are marked as inherited.
GetEffectiveItemSecurity基于ACL以及项目上的显式ACL来检索各种路径。这反映了给定项目上有效的授权策略。GetEffectiveItemSecurity retrieves various paths based on ACLs as well as explicit ACLs on items. This reflects the authorization policy in effect on a given project.
7.对关系的支持7. Support for relationships
如上所述,存储平台的数据模型定义了允许项目彼此相关的“关系”。当生成模式的数据类时,为每一关系类型产生以下类:As mentioned above, the storage platform's data model defines "relationships" that allow items to be related to each other. When generating the schema's data classes, the following classes are generated for each relation type:
1.表示关系本身的类。该类从Relationship类导出,且包含对关系类型专用的成员。1. The class that represents the relationship itself. This class is derived from the Relationship class and contains members specific to the relationship type.
2.强类型化的“虚拟”集合类。该类从VirtualRelationshipCollection(虚拟关系集合)导出,且允许创建和删除关系实例。2. Strongly typed "virtual" collection classes. This class is derived from VirtualRelationshipCollection and allows creation and deletion of relationship instances.
本节描述了存储平台API中对关系的支持。This section describes the support for relationships in the Storage Platform API.
a)基础关系类型a) Basic relationship type
存储平台API提供了System.Storage名字空间中形成关系API的基础的多种类型。这些类型是:The Storage Platform API provides several types in the System.Storage namespace that form the basis of the relational API. These types are:
1.Relationship(关系)-所有关系类的基础类型1. Relationship (relationship) - the base type of all relationship classes
2.VirtualRelationshipCollection(虚拟关系集合)-所有关系集合的基础类型2. VirtualRelationshipCollection (virtual relationship collection) - the basic type of all relationship collections
3.ItemReference(项目引用)、ItemIdReference(项目ID引用)、ItemPathReference(项目路径引用)-表示项目引用类型;这些类型之间的关系在图11中示出。3. ItemReference (item reference), ItemIdReference (item ID reference), ItemPathReference (item path reference) - represent item reference types; the relationship between these types is shown in FIG. 11 .
(1)Relationship类(1) Relationship class
public abstract class Relationship:StoreObjectpublic abstract class Relationship:StoreObject
{{
//用默认值创建//Create with default values
protected Relationship(ItemIDReference targetItemReference);protected Relationship(ItemIDReference targetItemReference);
//通知关系它被添加到关系集合。对象将询问集合来确定源项目、项目上下文等。//Notify the relation that it was added to the relation collection. The object will interrogate the collection to determine the source item, item context, etc.
internalAddedToCollection(virtualRelationshipCollection collection);internalAddedToCollection(virtualRelationshipCollection collection);
//关系的ID//Relationship ID
public RelationshipId RelationshipId{get;} public RelationshipId RelationshipId{get;}
//源项目的ID//The ID of the source project
public ItemId SourceItemId{get;} public ItemId SourceItemId{get;}
//获得源项目// Get the source item
public Item SourceItem{get;}public Item SourceItem{get;}
//对目标项目的引用//Reference to the target project
public ItemIdReference TargetItemReference{get;} public ItemIdReference TargetItemReference{get;}
//获得目标项目(调用TargetItemReference.GetItem())//Get the target item (call TargetItemReference.GetItem())
public Item TargetItem{get;}public Item TargetItem{get;}
//确定ItemContext是否已经具有到目标项目的域的连接//Determine if the ItemContext already has a connection to the domain of the target item
//(调用TargetItemReference,IsDomainConnected)//(call TargetItemReference, IsDomainConnected)
public bool is TargetDomainConnected{get;}public bool is TargetDomainConnected{get;}
//目标项目在名字空间中的名字。该名字必须在所有源项目的持有关系上是唯一的//The name of the target project in the namespace. The name must be unique across all source project holding relationships
public OptionalValue<string>Name{get;set;} public OptionalValue<string>Name{get;set;}
//确定这是持有还是引用关系//Determine whether this is a holding or reference relationship
public OptionalValue<bool>IsOwned{get;set;} public OptionalValue<bool>IsOwned{get;set;}
}}
(2)ItemReference类(2) ItemReference class
以下是项目引用类型的基类。The following are the base classes for item reference types.
public abstract class ItemReference:NestedElementpublic abstract class ItemReference:NestedElement
{{
//用默认值创建//Create with default values
protected Item Reference();protected Item Reference();
//返回引用的项目// Returns the referenced item
public virtual Item GetItem();public virtual Item GetItem();
//确定是否建立了到引用的项目的域的连接// Determine if a connection to the domain of the referenced project is established
public virtual bool IsDomainConnected();public virtual bool IsDomainConnected();
}}
ItemReference对象可标识存在于除项目引用本身所驻留的存储之外的存储中的项目。每一导出的类型指定了如何构造和使用对远程存储的引用。导出类中GetItem和IsDomainConnected的实现使用ItemContext的多域支持来从所需的域中加载项目,并确定是否已建立了到该域的连接。An ItemReference object may identify an item that exists in a storage other than the storage in which the item reference itself resides. Each exported type specifies how references to remote storage are constructed and used. The implementations of GetItem and IsDomainConnected in the exported class use the ItemContext's multi-domain support to load the item from the desired domain and determine whether a connection to that domain has already been established.
(3)ItemIdReference类(3) ItemIdReference class
以下是ItemIdReference类-使用项目ID来标识目标项目的项目引用。Below is the ItemIdReference class - an item reference that uses the item ID to identify the target item.
public class ItemIdReference:ItemReferencepublic class ItemIdReference:ItemReference
{{
//用默认值构造新的ItemIdReference// Construct a new ItemIdReference with default values
public ItemIdReference();public ItemIdReference();
//构造对指定项目的新ItemIdReference。与该项目相关联的域用作定位符//Construct a new ItemIdReference to the specified item. The domain associated with the item is used as the locator
public ItemIdReference(Item item);public ItemIdReference(Item item);
//用空定位符和给定的目标项目ID构造新的ItemIdReference// Construct a new ItemIdReference with an empty locator and the given target item ID
public ItemIdReference(ItemId itemId);public ItemIdReference(ItemId itemId);
//用给定定位符和项目ID值构造新的ItemIdReference//Construct a new ItemIdReference with the given locator and item ID value
public ItemIdReference(string locator,ItemId itemId);public ItemIdReference(string locator, ItemId itemId);
//目标项目的ID//The ID of the target project
public ItemId ItemId{get;set;} public ItemId ItemId{get;set;}
//标识在其域中包含目标项目的WinFS项目的路径。如果为空,则包含该项目的域是未知的。// Identifies the path to the WinFS project that contains the target project in its domain. If empty, the domain containing the item is unknown.
public OptionalValue<string>Locator{get;set;} public OptionalValue<string>Locator{get;set;}
//确定是否建立了到所引用的项目的域的连接// Determine if a connection to the referenced project's domain is established
public override bool IsDomainConnected();public override bool IsDomainConnected();
//检索所引用的项目//Retrieve the referenced item
public override Item GetItem();public override Item GetItem();
}}
GetItem和IsDomainConnected使用ItemContext的多域支持来从所需的域中加载项目,并确定是否已经建立了到该域的连接。该特征尚未实现。GetItem and IsDomainConnected use the ItemContext's multi-domain support to load the item from the desired domain and determine if a connection to that domain has already been established. This feature is not yet implemented.
(4)ItemPathReference类(4) ItemPathReference class
ItemPathReference类是使用路径来标识目标项目的项目引用。用于该类的代码如下:The ItemPathReference class is an item reference that uses a path to identify the target item. The code for this class is as follows:
oublic class ItemPathReference:ItemReferenceou public class ItemPathReference:ItemReference
{{
//用默认值构造项目路径引用//Construct project path reference with default value
public ItemPathReference();public ItemPathReference();
//不用任何定位符但用给定路径构造项目路径引用//Construct project path reference with given path without any locator
public ItemPathReference(string path);public ItemPathReference(string path);
//用给定定位符和路径构造项目路径引用//Construct project path reference with given locator and path
public ItemPathReference(string locator,string path); public ItemPathReference(string locator, string path);
//标识在其域中包含目标项目的WinFS项目的路径//Identifies the path to the WinFS project that contains the target project in its domain
public OptionalValue<string>Locator{get;set;} public OptionalValue<string>Locator{get;set;}
//相对于由定位符指定的项目域的目标项目路径//The target project path relative to the project field specified by the locator
public string Path{get;set;} public string Path{get;set;}
//确定是否已经建立了到所引用的项目的域的连接// Determine if a connection to the referenced project's domain has been established
public override bool IsDomainConnected();public override bool IsDomainConnected();
//检索所引用的项目//Retrieve the referenced item
public override Item Getltem();public override Item Getltem();
}}
GetItem和IsDomainConnected使用ItemContext的多域支持来从所需的域中加载项目,并确定是否已经建立了到该域的连接。GetItem and IsDomainConnected use the ItemContext's multi-domain support to load the item from the desired domain and determine if a connection to that domain has already been established.
(5)RelationshipId结构(5) RelationshipId structure
RelationshipId结构封装了关系ID GUID。The RelationshipId structure encapsulates the relationship ID GUID.
publicc lass RelationshipIdpublicc lass RelationshipId
{{
//生成新的关系ID GUID//Generate a new relationship ID GUID
public static RelationshipId NewRelationshipId();public static RelationshipId NewRelationshipId();
//用新的关系ID GUID初始化//Initialize with the new relationship ID GUID
public RelationshipId();public RelationshipId();
//用指定的GUID初始化//Initialize with the specified GUID
public RelationshipId(Guid Id);public RelationshipId(Guid Id);
//用GUID的串标识初始化//Initialize with GUID string identifier
public RelationshipId(string id);public RelationshipId(string id);
//返回关系ID GUID的串标识//Returns the string ID of the relationship ID GUID
public override string ToString();public override string ToString();
//将System.Guid实例转换成RelationshipId实例//Convert the System.Guid instance into a RelationshipId instance
public static implicit operator RelationshipId(Guid guid);public static implicit operator RelationshipId(Guid guid);
//将RelationshipId实例转换成System.Guid实例//Convert the RelationshipId instance into a System.Guid instance
public static implicit operator Guid(RelationshipId relationshipId);public static implicit operator Guid(RelationshipId relationshipId);
}}
该值类型包装了GUID,使得参数和属性可被强类型化为关系ID。OptionalValue<RelationshipId>应当在关系ID可为空时使用。诸如由System.Guid.Empty提供的空值不被展现。RelationshipId不能用空值来构造。当使用默认的构造函数来创建RelationshipId时,创建新的GUID。This value type wraps a GUID so that parameters and properties can be strongly typed as relation IDs. OptionalValue<RelationshipId> should be used when the relationship ID is nullable. Empty values such as those provided by System.Guid.Empty are not represented. RelationshipId cannot be constructed with a null value. When using the default constructor to create a RelationshipId, a new GUID is created.
(6)VirtualRelationshipCollection类(6) VirtualRelationshipCollection class
VirtualRelationshipCollection类实现了包括来自数据存储的对象加上被添加到集合的新对象,但不包括从存储中移除的对象的关系对象的集合。给定源项目ID的指定关系类型的对象被包括在该集合中。The VirtualRelationshipCollection class implements a collection of relationship objects that includes objects from the data store plus new objects that are added to the collection, but not objects that are removed from the store. Objects of the specified relationship type for the given source item ID are included in this collection.
这是为每一关系类型生成的关系集合类的基类。该类可用作源项目类型中的属性的类型,以提供对给定项目的关系的访问和简易操纵。This is the base class for the relation collection classes generated for each relation type. This class can be used as the type of an attribute in the source item type to provide access and easy manipulation of the relationship for a given item.
枚举VirtualRelationshipCollection的内容可能要求从存储中加载大量的关系对象。应用程序应当在枚举该集合的内容之前使用Count(计数)属性来确定可加载多少关系。向集合添加对象/从集合移除对象不需要从存储中加载关系。Enumerating the contents of a VirtualRelationshipCollection may require loading a large number of relationship objects from storage. Applications should use the Count property to determine how many relationships can be loaded before enumerating the contents of the collection. Adding/removing objects to/from a collection does not require loading relationships from storage.
为效率起见,较佳的是应用程序搜索满足特定准则的关系,而非使用VirtualRelationshipCollection对象枚举所有的项目关系。向集合添加关系对象使得在调用ItemContext.Update时在存储中创建所表示的关系。从集合中移除关系对象使得当调用ItemContext.Update时在存储中删除所表示的关系。虚拟集合包含正确的对象集,而不管是否通过Item.Relationships集合或该项目上的任何其它关系集合添加/移除了关系对象。For efficiency, it is preferable for the application to search for relationships that meet certain criteria, rather than enumerating all item relationships using a VirtualRelationshipCollection object. Adding a relationship object to the collection causes the represented relationship to be created in the store when ItemContext.Update is called. Removing a relationship object from a collection causes the represented relationship to be deleted in storage when ItemContext.Update is called. The virtual collection contains the correct set of objects regardless of whether relationship objects were added/removed via the Item.Relationships collection or any other relationship collection on the item.
以下代码定义了VirtualRelationshipCollection类:The following code defines the VirtualRelationshipCollection class:
public abstract class VirtualRelationshipCollection:ICollectionpublic abstract class VirtualRelationshipCollection:ICollection
{{
//该集合包含由项目itemId标识的项目所拥有的类型的关系//The collection contains relationships of the type owned by the item identified by the item itemId
protected VirtualRelatiohshipCollection(ItemContext itemContext,protected VirtualRelatiohshipCollection(ItemContext itemContext,
ItemId itemId,ItemId itemId,
Type relationshipType);Type relationshipType);
//枚举器将返回从存储中检索到的所有对象减去除具有状态Inserted(已插入)的对象// The enumerator will return all objects retrieved from storage minus objects with status Inserted (already inserted)
//之外的具有状态Deleted(已删除)的任何对象//any object with status Deleted (already deleted)
public IEnumerator GetEnumerator();public IEnumerator GetEnumerator();
//返回由枚举器返回的关系对象的数目的计数。该计数无需从存储中检索所有对象即可计算。// Returns a count of the number of relation objects returned by the enumerator. This count can be calculated without retrieving all objects from storage.
public int Count{get;}public int Count{get;}
//总是返回假//Always return false
public bool Icollection.IsSynchronized(){get;}public bool Icollection.IsSynchronized(){get;}
//总是返回该对象//Always return this object
public object ICollection.SyncRoot{get;} public object ICollection.SyncRoot{get;}
//搜索存储中的所需对象//Search for the desired object in storage
public void Refresh();public void Refresh();
//向集合添加指定的关系。对象必须具有状态Constructed(已构造)或Removed(已移除)。//Add the specified relationship to the collection. Objects must have status Constructed (constructed) or Removed (removed).
//如果状态为Constructed,它被改为Added(已添加)。如果状态是Removed,则它适当地// If the status is Constructed, it is changed to Added (added). If the status is Removed, it appropriately
//改为Retrieved(已检索)或Modified(已修改)。关系的源项目ID必须与当构造集合时//Change to Retrieved (retrieved) or Modified (modified). The source item ID of the relationship must be the same as when constructing the collection
//提供的源项目ID相同。// The provided source project ID is the same.
protected void Add(Relationship relationship);protected void Add(Relationship relationship);
//从集合中移除指定的关系。对象的状态必须是Added、Retrieved或Modified。//Remove the specified relationship from the collection. The status of the object must be Added, Retrieved, or Modified.
//如果对象状态是Added,它将被设为Constructed。如果对象状态是Retrieved或Modifieed,// If the object status is Added, it will be set to Constructed. If the object status is Retrieved or Modified,
//它将被设为Removed。关系的源项目ID必须与当构造集合时提供的源项目ID相同。//It will be set to Removed. The source item ID of the relation must be the same as the source item ID provided when constructing the collection.
protected void Remove(Relationship relationship);protected void Remove(Relationship relationship);
//从集合中移除的对象// Objects removed from the collection
public ICollection RemovedRelationships{get;}public ICollection RemovedRelationships{get;}
//被添加到集合的对象// Objects added to the collection
public ICollection AddedRelationshipas{get;}public ICollection AddedRelationships{get;}
//从存储中检索的对象。该集合将为空,直到枚举了VirtualRelationshipCollection// The object retrieved from storage. The collection will be empty until the VirtualRelationshipCollection is enumerated
//或调用了Refresh之后(获得该属性的值不导致填满该集合)。// or after calling Refresh (obtaining the value of this property does not cause the collection to be filled).
public ICollection StoredRelationships{get;}public ICollection StoredRelationships{get;}
//匿名方法//Anonymous method
public IAsyncResult BeginGetCount(IAsyncCallback callback,object state);public IAsyncResult BeginGetCount(IAsyncCallback callback, object state);
public int EndGetCount(IAsyncResult asyncResult);public int EndGetCount(IAsyncResult asyncResult);
public IAsyncResult BeginRefresh(IAsyncCallback callback,object state);public IAsyncResult BeginRefresh(IAsyncCallback callback, object state);
public void EndRefresh(IAsyncResult asyncResult);public void EndRefresh(IAsyncResult asyncResult);
}}
b)生成的关系类型b) Generated relationship types
当为存储平台模式生成类时,为每一关系声明生成一个类。除表示关系本身的类之外,也为每一关系生成关系集合类。这些类用作关系的源或目标项目类中的属性类型。When generating classes for storage platform schemas, a class is generated for each relationship declaration. In addition to the class representing the relationship itself, a relationship collection class is also generated for each relationship. These classes are used as attribute types in the source or target item classes of the relationship.
本节描述了使用若干“原型”类生成的类。即,给定指定的关系声明,描述了生成的类。重要的是注意,原型类中使用的类、类型和端点名是关系模式中指定的名字的占位符,且不应当在文字上解释。This section describes the classes generated using several "prototype" classes. That is, given the specified relationship declarations, describe the generated classes. It is important to note that the class, type and endpoint names used in the prototype class are placeholders for the names specified in the relational schema and should not be interpreted literally.
(1)生成的关系类型(1) Generated relationship type
本节描述了为每一关系类型生成的类。例如:This section describes the classes generated for each relation type. For example:
<Relationship Name=″RelationshipPrototype″BaseType=″Holding″><Relationship Name="RelationshipPrototype" BaseType="Holding">
<Source Name=″Head″ItemType=″Foo″/><Source Name="Head" ItemType="Foo"/>
<Target Name=″Tail″ItemType=″Bar″ReferenceType=″ItemIDReference″/><Target Name="Tail"ItemType="Bar"ReferenceType="ItemIDReference"/>
<Property Name=″SomeProperty″Type=″WinFSTypes.String″/><Property Name="SomeProperty"Type="WinFSTypes.String"/>
</Relationship></Relationship>
给定该关系定义RelationshipPrototype(关系原型),将生成RelationshipPrototypeCollection(关系原型集合)类。RelationshipPrototype类表示关系本身。RelationshipPrototypeCollection类提供了对具有指定的项目作为源端点的RelationshipPrototype实例的访问。Given the relationship definition RelationshipPrototype, a RelationshipPrototypeCollection class will be generated. The RelationshipPrototype class represents the relationship itself. The RelationshipPrototypeCollection class provides access to RelationshipPrototype instances with the specified project as the source endpoint.
(2)RelationshipPrototype类(2) RelationshipPrototype class
这是用于名为“HoldingRelationshipPrototype(持有关系原型)”的持有关系的原型关系类,其中源端点名为“Head”,且指定了“Foo”项目类型,而目标端点名为“Tail”,且指定了“Bar”项目类型。它定义如下:This is the prototype relationship class for a holding relationship named "HoldingRelationshipPrototype" where the source endpoint is named "Head" and the item type "Foo" is specified, and the target endpoint is named "Tail" , and the 'Bar' item type is specified. It is defined as follows:
public class RelationshipPrototype:Relationshippublic class RelationshipPrototype: Relationship
{{
public RelationshipPrototype(Bar tailItem);public RelationshipPrototype(Bar tailItem);
public Re/ationshipPrototype(Bar tailItem,string name);public Re/ationshipPrototype(Bar tailItem, string name);
public RelationshipPrototype(Bar tailItem,string name,bool IsOwned); public RelationshipPrototype(Bar tailItem, string name, bool IsOwned);
public RelationshipPrototype(Bar tailItem,bool IsOwned);public RelationshipPrototype(Bar tailItem, bool IsOwned);
public RelationshipPrototype(ItemIdReference tailItemReference);public RelationshipPrototype(ItemIdReference tailItemReference);
//获得Head项目(调用base.SourceItem)// Get the Head item (call base.SourceItem)
public Foo HeadItem{get;}public Foo HeadItem{get;}
//获得Tail项目(调用base.TargetItem)//Get Tail item (call base.TargetItem)
public Bar TailItem{get;}public Bar TailItem{get;}
//表示关系模式中声明的其它属性。这些是正如项目或嵌套元素类型中的属性那样生成的。//Represents other attributes declared in the relational schema. These are generated just like attributes on item or nested element types.
public string SomeProperty{get;set;}public string SomeProperty{get;set;}
public static ItemSearcher GetSearcher(ItemContext itemContext);public static ItemSearcher GetSearcher(ItemContext itemContext);
public static ItemSearcher GetSearcher(Foo headItem);public static ItemSearcher GetSearcher(Foo headItem);
public static FindResult FindAll(string filter);public static FindResult FindAll(string filter);
public static RelationshipPrototype FindOne(string filter);public static RelationshipPrototype FindOne(string filter);
public static RelationshipPrototype FindOnly(string filter);public static RelationshipPrototype FindOnly(string filter);
}}
(3)RelationshipPrototpyeCollection类(3) RelationshipPrototpyeCollection class
这是用RelationshipPrototype类生成的原型类,它维护由指定的项目拥有的RelationshipPrototype关系实例的集合。它定义如下:This is the prototype class generated with the RelationshipPrototype class, which maintains a collection of RelationshipPrototype relationship instances owned by the specified project. It is defined as follows:
public class RelationshipPrototypeCollection:VirtualRelationshipCollectionpublic class RelationshipPrototypeCollection:VirtualRelationshipCollection
{{
public RelationshipPrototypeCollection(ItemContext itemContext,public RelationshipPrototypeCollection(ItemContext itemContext,
ItemId headItemId);ItemId headItemId);
public void Add(RelationshipPrototype relationship);public void Add(RelationshipPrototype relationship);
public RelationshipPrototype Add(Bar bar);public RelationshipPrototype Add(Bar bar);
public RelationshipPrototype Add(Bar bar,string name);public RelationshipPrototype Add(Bar bar, string name);
public RelationshipPrototype Add(Bar bar,string name,bool IsOwned);public RelationshipPrototype Add(Bar bar, string name, bool IsOwned);
public RelationshipPrototype Add(Bar bar,bool IsOwned);public RelationshipPrototype Add(Bar bar, bool IsOwned);
public void Remove(RelationshipPrototype relationship);public void Remove(RelationshipPrototype relationship);
public void Remove(Bar bar);public void Remove(Bar bar);
public void Remove(ItemId barItemId);public void Remove(ItemId barItemId);
public void Remove(RelationshipId relationshipId);public void Remove(RelationshipId relationshipId);
public void Remove(string name);public void Remove(string name);
}}
c)Item类中的关系支持c) Relationship support in the Item class
Item类包含提供对其中该项目是关系的源的关系的访问的Relationships属性。Relationships属性具有类型RelationshipCollection。The Item class contains a Relationships property that provides access to the relationship of which the item is the source of the relationship. The Relationships property has type RelationshipCollection.
(1)Item类(1) Item class
以下代码示出了Item类的关系上下文属性:The following code shows the relational context property of the Item class:
public abstract class Item:StoreObjectpublic abstract class Item:StoreObject
{{
......
//其中该项目是源的关系的集合//A collection of relationships where the item is the source
public RelationshipCollection Relationships{get;}public RelationshipCollection Relationships{get;}
......
}}
(2)RelationshipCollection类(2) RelationshipCollection class
该类提供了对其中给定项目是关系的源的关系实例的访问。它定义如下:This class provides access to the relation instance where the given item is the source of the relation. It is defined as follows:
public class RelationshipCollection:VirtualRelationshipCollectionpublic class RelationshipCollection:VirtualRelationshipCollection
{{
public RelationshipCollection(ItemContext itemContext,public RelationshipCollection(ItemContext itemContext,
ItemId headItemId);ItemId headItemId);
public void Add(Relationship relationship);public void Add(Relationship relationship);
public Relationship Add(Bar bar);public Relationship Add(Bar bar);
public Relationship Add(Bar bar,string name);public Relationship Add(Bar bar, string name);
public Relationship Add(Bar bar,string name,bool IsOwned);public Relationship Add(Bar bar, string name, bool IsOwned);
public Relationship Add(Bar bar,bool IsOwned);public Relationship Add(Bar bar, bool IsOwned);
public void Remove(Relationship relationship);public void Remove(Relationship relationship);
public void Remove(Bar bar);public void Remove(Bar bar);
public void Remove(ItemId barItemId);public void Remove(ItemId barItemId);
public void Remove(RelationshipId relationshipId);public void Remove(RelationshipId relationshipId);
public void Remove(string name);public void Remove(string name);
}}
d)搜索表达式中的关系支持d) Relation support in search expressions
可能在搜索表达式中指定关系和相关项目之间的联结的遍历。A traversal of the joins between relations and related items may be specified in the search expression.
(1)从项目遍历到关系(1) From item traversal to relationship
当搜索表达式的当前上下文是一组项目时,项目和其中该项目是源的关系实例之间的联结可使用Item.Relationships属性来完成。联结到特定类型的关系可使用搜索表达式的Cast(类型强制转换)运算符来指定。When the current context of the search expression is a set of items, the join between the item and the instance of the relationship of which the item is the source can be done using the Item.Relationships property. Relationships that join to specific types can be specified using the Cast (type cast) operator of search expressions.
强类型化的关系集合(例如,Folder.MemberRelationships)也可在搜索表达式中使用。到关系类型的类型强制转换是隐式的。Strongly typed relationship collections (for example, Folder.MemberRelationships ) can also be used in search expressions. Type casts to relational types are implicit.
一旦建立了该组关系,该关系的属性可用于判定或作为投影的目标。当用于指定投影的目标时,将返回该组关系。例如,以下语句将找出涉及其中关系的StartDate属性具有大于或等于“1/1/2000”的值的组织的所有人。Once the set of relationships is established, the attributes of the relationships can be used in decisions or as targets for projections. When used to specify the target of a projection, the set of relations is returned. For example, the following statement will find all owners involved in organizations where the StartDate attribute of the relationship has a value greater than or equal to "1/1/2000".
FindResult result=Person.FindAll(context,FindResult result = Person. FindAll(context,
″Relationships.Cast(Contact.EmployeeOfOrganization).StartDate>’1/1/2000’″);″Relationships.Cast(Contact.EmployeeOfOrganization).StartDate>’1/1/2000’″);
如果Person类型具有类型为EmployeeSideEmployerEmployeeRelationships的属性EmployerContext(对EmployeeEmployer关系类型生成的),则这将被写为:If the Person type had a property EmployerContext of type EmployeeSideEmployerEmployeeRelationships (generated for the EmployeeEmployer relationship type), then this would be written as:
FindResult result=Person.FindAll(context,FindResult result = Person. FindAll(context,
″EmployerRelationships.StartDate>’1/1/2000’″);"EmployerRelationships.StartDate > '1/1/2000'");
(2)从关系遍历到项目(2) From relationship traversal to items
当搜索表达式的当前上下文是一组关系时,可通过指定端点名来遍历从关系到关系的任一端点的联结。一旦建立了该组相关项目,那些项目的属性可用于判定或作为投影的目标。当用于指定投影的目标时,将返回该组项目。例如,以下语句将找出其中雇员的姓是名字“Smith”的所有EmployeeOfOrganization(组织的雇员)关系(而不论组织是什么):When the current context of the search expression is a set of relations, the joins from the relation to any endpoint of the relation can be traversed by specifying the endpoint name. Once the set of related items is established, the attributes of those items can be used for determination or as targets for projections. When used to specify the target of a projection, the set of items is returned. For example, the following statement will find all EmployeeOfOrganization relationships (regardless of the organization) where the employee's last name is the first name "Smith":
FindResult result=EmployeeOfOrganization.FindAll(context,FindResult result = EmployeeOfOrganization. FindAll(context,
“Employee.PersonalNames[SurName=’Smith’]”);"Employee. PersonalNames[SurName='Smith']");
搜索表达式Cast运算符可用于过滤端点项目的类型。例如,为找出其中成员是具有姓“Smith”的Person项目的所有MemberOfFoler(文件夹成员)关系实例:The search expression Cast operator can be used to filter the type of endpoint items. For example, to find all MemberOfFoler (folder member) relationship instances where the member is a Person item with the last name "Smith":
FindResult result=MemberOfFolder.FindAll(context,FindResult result = MemberOfFolder. FindAll(context,
“Member.Cast(Contact.Person).PersonalNames[Surname=’Smith’]”);"Member.Cast(Contact.Person).PersonalNames[Surname='Smith']");
(3)组合关系遍历(3) Combination relationship traversal
前两种模式,即从项目遍历到关系以及从关系遍历到项目可被组合以实现任意复杂的遍历。例如,为找出具有姓为“Smith”的雇员的所有组织:The first two patterns, item traversal to relations and relational traversal to items, can be combined to achieve arbitrarily complex traversals. For example, to find all organizations that have employees with the last name "Smith":
FindResult result=Organization.FindAll(context,FindResult result = Organization. FindAll(context,
“EmployeeRelationships.”+"EmployeeRelationships."+
“Employee.”+"Employee." +
“PersonalNames[SurName=‘Smith’]”);"PersonalNames[SurName='Smith']");
以下示例将找出表示生活在“New York”区域的家庭的人的所有Person项目(计划项目:这不再支持……它是一种替换)。The following example will find all Person items that represent people living in households in the "New York" area (planned items: this is no longer supported...it's a replacement).
FindResult result=Person.FindAll(context,FindResult result = Person. FindAll(context,
“Relationships.Cast(Contact.MemberOfHousehold).”+"Relationships. Cast(Contact. MemberOfHousehold)." +
“Household.”+"Household." +
“Relationships.Cast(Contact.LocationOfHousehold).”+"Relationships. Cast(Contact. LocationOfHousehold)." +
“MetropolitonRegion=‘New York’“);"MetropolitonRegion = 'New York'");
e)关系支持的示例使用e) Example usage of relationship support
以下是如何使用存储平台API中的关系支持来操纵关系的示例。对于以下示例,假定以下声明:Below is an example of how to manipulate relationships using the relationship support in the storage platform API. For the following examples, assume the following declarations:
ItemContext ic=...;ItemContext ic = ...;
ItemId fid=...;//文件夹项目的IDItemId fid=...;//ID of the folder item
Folder folder=Folder.FindByld(ic,fid);Folder folder = Folder.FindByld(ic, fid);
ItemId sid=...;//源项目的IDItemId sid=...;//The ID of the source item
Item source=Item.FindByld(ic,sid);Item source = Item.FindByld(ic, sid);
ItemId tid=...;//目标项目的IDItemId tid=...;//ID of the target item
Item target=Item.FindByld(ic,tid);Item target = Item. FindByld(ic, tid);
ItemSearcher searcher=null;ItemSearcher searcher = null;
(1)搜索关系(1) Search relationship
可能搜索源或目标关系。可使用过滤器来选择指定类型且具有给定属性值的关系。也可使用过滤器来选择基于关系的相关项目类型或属性值。例如,可执行以下搜索:May search for source or target relationships. Filters can be used to select relationships of a specified type with a given property value. Filters can also be used to select related item types or attribute values based on relationships. For example, the following searches can be performed:
其中给定项目是源的所有关系all relationships where the given item is a source
searcher=Relationship.GetSearcher(folder);searcher = Relationship. GetSearcher(folder);
foreach(searcher.FindAll()中的Relationship relationship)...;foreach(Relationship relationship in searcher. FindAll())...;
其中给定项目是具有匹配“A%”的名字的源的所有关系where the given item is all relations with a source that has a name that matches "A%"
searcher=Relationship.GetSearcher(folder);searcher = Relationship. GetSearcher(folder);
searcher.Filters.Add(″Name like′A%′″);searcher.Filters.Add("Name like'A%'");
foreach(searcher.FindAll()中的Relationship relationship)...;foreach(Relationship relationship in searcher. FindAll())...;
其中给定项目是源的所有FolderMember关系All FolderMember relationships where the given item is a source
searcher=FolderMember.GetSearcher(folder);searcher = FolderMember. GetSearcher(folder);
foreach(searcher.FindAll()中的FolderMember folderMember)...;foreach(FolderMember folderMember in searcher. FindAll())...;
其中给定项目是源且名如“A%”的所有FolderMember关系All FolderMember relationships where the given item is a source and have a name like "A%"
searcher=FolderMember.GetSearcher(folder);searcher = FolderMember. GetSearcher(folder);
searcher.Filters.Add(″Name like′A%′″);searcher.Filters.Add("Name like'A%'");
foreach(searcher.FindAll()中的FolderMember folderMember)...;foreach(FolderMember folderMember in searcher. FindAll())...;
其中目标项目是Person的所有FolderMember关系where the target items are all FolderMember relationships of Person
searcher=FolderMember.GetSearcher(folder);searcher = FolderMember. GetSearcher(folder);
searcher.Filters.Add(″MemberItem.Cast(Person)″);searcher.Filters.Add("MemberItem.Cast(Person)");
foreach(searcher.FindAll()中的FolderMember folderMember)...;foreach(FolderMember folderMember in searcher. FindAll())...;
其中目标项目是姓为“Smith”的Person的所有FolderMember关系where the target item is all FolderMember relationships for a Person with last name "Smith"
searcher=FolderMember.GetSearcher(folder);searcher = FolderMember. GetSearcher(folder);
searcher.Filters.Add(″MemberItem.Cast(Person).PersonalNames.Surname=′Smith′″);searcher.Filters.Add("MemberItem.Cast(Person).PersonalNames.Surname='Smith'");
foreach(searcher.FindAll()中的FolderMember folderMember)...;foreach(FolderMember folderMember in searcher. FindAll())...;
除以上示出的GerSearcher API之外,每一关系类支持静态FindAll、FineOne以及FindOnly API。另外,关系类型可以在调用ItemContext.GetSearcher、ItemContext.FindAll、ItemContext.FindOne或ItemContext.FindOnly时指定。In addition to the GerSearcher API shown above, each relationship class supports static FindAll, FineOne and FindOnly APIs. Additionally, the relationship type can be specified when calling ItemContext.GetSearcher, ItemContext.FindAll, ItemContext.FindOne, or ItemContext.FindOnly.
(2)从关系导航到源和目标项目(2) Navigate from the relationship to the source and target items
一旦通过搜索检索了关系对象,可能“导航”到目标或源项目。基本关系类提供了返回Item对象的SourceItem(源项目)和TargetItem(目标项目)属性。所生成的关系类提供了等效强类型化和命名的属性(例如,FolderMember.FolderItem和FolderMember.MemberItem)。例如:Once the relational object has been retrieved by searching, it is possible to "navigate" to the target or source item. The base relationship class provides SourceItem (source item) and TargetItem (target item) properties that return an Item object. The generated relationship classes provide equivalent strongly typed and named properties (eg, FolderMember.FolderItem and FolderMember.MemberItem). For example:
导航到名为“Foo”的关系的源和目标项目Navigate to the source and target projects of the relationship named "Foo"
searcher=Relationship.GetSearcher();searcher = Relationship. GetSearcher();
searcher.Filters.Add(″Name=′Foo′″);searcher.Filters.Add("Name='Foo'");
foreach(searcher.FindAll()中的Relationship relationship)foreach(Relationship relationship in searcher. FindAll())
{{
Item source=relationship.SourceItem; Item source = relationship. SourceItem;
Item target=relationship.TargetItem; Item target = relationship.TargetItem;
}}
导航到目标项目Navigate to the target project
searcher=FolderMember.GetSearcher(folder);searcher = FolderMember. GetSearcher(folder);
searcher.Filters.Add(″Name like′A%′″);searcher.Filters.Add("Name like'A%'");
foreach(searcher.FindAll()中的FolderMember folderMember)foreach(FolderMember folderMember in searcher. FindAll())
{{
Item member=folderMember.TargetItem; Item member = folderMember.TargetItem;
......
}}
导航到目标项目即使在目标项目不在其中找到关系的域中也可运作。在这一情况下,存储平台API打开到所需的目标域的连接。应用程序可在检索目标项目之前确定是否需要连接。Navigating to the target item works even in domains where the target item does not find the relationship. In this case, the storage platform API opens a connection to the desired target domain. Applications can determine whether a connection is required before retrieving the target item.
检查未连接的域中的目标项目Check target project in unconnected domain
searcher=Relationship.GetSearcner(source);searcher = Relationship. GetSearcner(source);
foreach(searcher.FindAll()中的Relationship relationship)foreach(Relationship relationship in searcher. FindAll())
{{
if(relationship.IsTargetDomaiinConnected)If(relationship. IsTargetDomaiinConnected)
{{
Item member=relationship.TargetItem;Item member = relationship.TargetItem;
......
}}
}}
(3)从源项目导航到关系(3) Navigate from the source item to the relationship
给定项目对象,可能导航到该项目为其源的关系,而无需执行显式的搜索。这可使用Item.Relationships集合属性或诸如Folder.MemberRelationships等强类型化的集合属性来完成。从关系中,可能导航到目标项目。这一导航即使在目标项目不在与源项目的ItemContext相关联的项目域中时也能运作,包括当目标项目不在与源项目相同的存储中的时候。例如:Given an item object, it is possible to navigate to relationships for which the item is a source, without performing an explicit search. This can be done using the Item.Relationships collection property or a strongly typed collection property such as Folder.MemberRelationships. From a relationship, it is possible to navigate to the target item. This navigation works even when the target item is not in the item scope associated with the source item's ItemContext, including when the target item is not in the same store as the source item. For example:
从源项目导航到关系再到目标项目Navigate from source item to relationship to target item
Console.WriteLine(″Item{0}is the source of the following relationships:″,source.ItemId);Console.WriteLine("Item{0} is the source of the following relationships:", source.ItemId);
foreach(source.Relationships中的Relationship relationship)foreach(Relationship relationship in source.Relationships)
{{
Item target=relationship.TargetItem;Item target = relationship.TargetItem;
Console.WriteLine({0}==>{1}″,relationship.Relationshipld,target.ItemId);Console.WriteLine({0}==>{1}″, relationship.Relationshipld, target.ItemId);
}}
从文件夹项目导航到文件夹成员关系再到目标项目Navigate from folder item to folder membership to target item
console.WriteLine(″Item{0}is the source of the following relationships:″,folder.ItemId);console.WriteLine("Item{0} is the source of the following relationships:", folder.ItemId);
foreach(folder.MemberRelationships中的FolderMember folderMember)foreach(FolderMember folderMember in folder.MemberRelationships)
{{
Item target=folderMember.GetMemberItem();Item target = folderMember. GetMemberItem();
Console.WriteLine(″{0}==>{1}″,folderMember.RelationshipId,target.ItemId);Console.WriteLine("{0}==>{1}", folderMember.RelationshipId, target.ItemId);
项目可具有许多关系,因此应用程序在枚举关系集合时应谨慎使用。一般而言,应使用搜索来标识感兴趣的特定关系而非枚举整个集合。然而,对关系具有基于集合的编程模型以及足够有价值,且具有许多关系的项目少得足以证明开发者滥用的风险。应用程序可检查集合中的关系的数目,并在需要时使用不同的编程模型。例如:Items can have many relationships, so applications should use caution when enumerating collections of relationships. In general, searches should be used to identify specific relationships of interest rather than to enumerate the entire collection. However, projects that have a set-based programming model for relations and are valuable enough to have many relations are sufficiently rare to justify the risk of developer abuse. An application can check the number of relationships in the collection and use a different programming model if needed. For example:
检查关系集合的大小Check size of relationship collection
if(folder.MemberRelationships.Count>1000)if(folder.MemberRelationships.Count>1000)
{{
Console.WriteLine(″Too many relationships!″);Console.WriteLine("Too many relationships!");
}}
elseelse
{{
......
}}
上述关系集合在它们实际上不用表示每一关系的对象来填充的意义上是“虚拟的”,除非应用程序试图枚举该集合。如果该集合被枚举,则结果反映了存储中有什么,加上应用程序添加但没有保存了什么,但不反映由应用程序移除但没有保存的任何关系。The relationship collections described above are "virtual" in the sense that they are not actually populated with objects representing each relationship, unless the application attempts to enumerate the collection. If the collection is enumerated, the result reflects what is in storage, plus what the application added but did not save, but does not reflect any relationships that were removed but not saved by the application.
(4)创建关系(以及项目)(4) Create relationships (and items)
新关系通过创建关系对象、将其添加到源项目中的关系集合、并更新项目上下文来创建。为创建新项目,必须创建持有或嵌入关系。例如:New relationships are created by creating a relationship object, adding it to the relationship collection in the source project, and updating the project context. In order to create a new item, a hold or embed relationship must be created. For example:
向现有文件夹添加新项目Add a new item to an existing folder
Bar bar=new Bar();Bar bar = new Bar();
folder.Relationships.Add(new FolderMember(bar,″name″));folder.Relationships.Add(new FolderMember(bar, "name"));
ic.Update();ic.Update();
//或者//or
Bar bar=new Bar();Bar bar = new Bar();
folder.MemberRelationships.Add(new FolderMember(bar,″name″));folder.MemberRelationships.Add(new FolderMember(bar, "name"));
ic.Update();ic.Update();
//或者//or
Bar bar=new Bar();Bar bar = new Bar();
folder.MemberRelationships.Add(bar,name);folder.MemberRelationships.Add(bar, name);
ic.Update();ic.Update();
向现有文件夹添加现有项目Add an existing item to an existing folder
folder.MemberRelationships.Add(target,″name″);folder.MemberRelationships.Add(target, "name");
ic.Update();ic.Update();
向新文件夹添加现有项目Add existing items to new folder
Folder existingFolder=ic.FindItemByld(fid)as Folder;Folder existingFolder=ic.FindItemByld(fid)as Folder;
Folder newFolder=new Folder();Folder newFolder = new Folder();
existingFolder.MemberRelationships.Add(newFolder,″a name″);existingFolder.MemberRelationships.Add(newFolder, "a name");
newFolder.MemberRelationships.Add(target,″a name″);newFolder.MemberRelationships.Add(target, "a name");
ic.Update();ic.Update();
向新文件夹添加新项目Add a new item to a new folder
Folder existingFolder=ic.FindItemByld(fid)as Folder;Folder existingFolder=ic.FindItemByld(fid)as Folder;
Folder newFolder=new Folder();Folder newFolder = new Folder();
existingFolder.MemberRelationships.Add(newFolder,″a name″);existingFolder.MemberRelationships.Add(newFolder, "a name");
Bar bar=new Bar();Bar bar = new Bar();
newFolder.MemberRelationships.Add(bar,″a name″);newFolder.MemberRelationships.Add(bar, "a name");
ic.Update();ic.Update();
(5)删除关系(以及项目)(5) Delete relationships (and items)
删除持有关系delete holding relationship
//如果源项目和关系ID已知...// If the source item and relationship IDs are known...
RelationshipId rid=...;RelationshipId rid =...;
Relationship r=ic.FindRelationshipByld(fid,rid);Relationship r = ic. FindRelationshipByld(fid, rid);
r.MarkForDelete;r.MarkForDelete;
ic.Update();ic.Update();
//否则...//otherwise...
folder.MemberRelationships.Remove(target);folder.MemberRelationships.Remove(target);
ic.Update();ic.Update();
8.“扩展”存储平台API8. "Extended" storage platform API
如上所述,每一存储平台模式都导致一组类。这些类具有诸如Find*等标准方法,且还具有用于设置和获得字段值的属性。这些类和相关联的方法形成了存储平台API的基础。As mentioned above, each storage platform pattern results in a set of classes. These classes have standard methods such as Find * , and also have properties for setting and getting field values. These classes and associated methods form the basis of the Storage Platform API.
a)域行为a) Domain Behavior
除这些标准方法之外,每一模式具有一组用于该模式的域专用方法。将这些方法成为域行为。例如,联系人模式中某些域行为是:In addition to these standard methods, each pattern has a set of domain-specific methods for that pattern. Make these methods domain behaviors. For example, some field behaviors in the contact schema are:
·电子邮件地址是否有效?· Is the email address valid?
·给定文件夹,获得该文件夹的所有成员的集合。• Given a folder, get a collection of all members of that folder.
·给定项目ID,获得表示该项目的对象。• Given an item ID, get an object representing that item.
·给定人,获得其在线状态。• Given a person, get their online status.
·助手函数创建新联系人或临时联系人。·Helper function to create a new contact or a temporary contact.
·等等。·etc.
重要的是注意,尽管在“标准”行为(Find*等)和域行为之间做出了区别,但是它们对程序员仅仅表现为方法。这些方法之间的区别在于标准行为是由存储平台API设计时工具从模式文件自动生成的,而域行为是硬编码的。It's important to note that although a distinction is made between "standard" behavior (Find *, etc.) and domain behavior, they appear to the programmer as mere methods. The difference between these methods is that the standard behavior is automatically generated from the schema file by the storage platform API design-time tools, while the domain behavior is hard-coded.
就其最本性而言,域行为应当是手工制作的。这导致一个实际问题:C#的初始版本要求类的整个实现在单个文件内。由此,这迫使自动生成的类文件必须被编辑以添加域行为。这本身就是一个问题。By its very nature, domain behavior should be handcrafted. This leads to a practical problem: the initial version of C# required the entire implementation of a class to be in a single file. Thus, this forces the automatically generated class files to have to be edited to add domain behavior. This is a problem in itself.
在C#中为诸如此类的问题引入一种称为局部类的特征。最基本地,局部类允许类实现跨越多个文件。局部类与常规的类相同,不同之处在于其声明前有关键字A feature called local classes was introduced in C# for problems like this. At its most basic, local classes allow class implementations to span multiple files. A local class is the same as a regular class, except that its declaration is preceded by the keyword
partial:partial:
partial public class Person:DerivedItemBasepartial public class Person:DerivedItemBase
{{
//实现 //accomplish
}}
现在,Person的域行为可以被放置在不同的文件中,如:Now, the domain behavior of Person can be placed in different files, such as:
partial public class Personpartial public class Person
{{
public EmailAddress PrimaryEmailAddresspublic EmailAddress PrimaryEmailAddress
{{
get{/*实现*/} get{/*implementation*/}
}}
}}
b)增值行为b) Value-added behavior
具有域行为的数据类形成了应用程序开发者在其上进行构建的基础。然而,数据类展现与该数据有关的每一可想到的行为是不可能也是不合需要的。存储平台允许开发者在由存储平台API提供的基础功能上进行构建。此处的基础模式是编写其方法采用存储平台数据类的一个或多个作为参数的类。例如,用于使用Microsoft Outlook或使用Microsoft Windows Messenger来发送电子邮件的增值类可以如下:Data classes with domain behavior form the basis upon which application developers build. However, it is neither possible nor desirable that a data class exhibit every conceivable behavior related to that data. The storage platform allows developers to build on the basic functionality provided by the storage platform API. The underlying pattern here is to write a class whose methods take one or more storage platform data classes as parameters. For example, a value-added class for sending email using Microsoft Outlook or using Microsoft Windows Messenger could be as follows:
MailMessage m=MailMessage.FindOne(...);MailMessage m = MailMessage. FindOne(...);
OutlookEMailServices.SendMessage(m);OutlookEMailServices.SendMessage(m);
Person p=Person.FindOne(...);Person p = Person. FindOne(...);
WindowsMessagerServices m=new WindowsMessagerServices(p);WindowsMessagerServices m = new WindowsMessagerServices(p);
m.MessageReceived+=new MessageReceivedHandler(f);m.MessageReceived+=new MessageReceivedHandler(f);
m.SendMessage(″Hello″);m.SendMessage("Hello");
这些增值类可以向存储平台注册。注册数据与存储平台为每一安装的存储平台类型维护的模式元数据相关联。该元数据作为存储平台项目储存,且可被查询。These value-added classes can be registered with the storage platform. The registration data is associated with schema metadata that the storage platform maintains for each installed storage platform type. This metadata is stored as a storage platform item and can be queried.
增值类的注册是一种强大的特征;例如,它允许以下情形:Shell资源管理器中的Person对象上右键点击,且可从对Person注册的增值类中导出允许的该组动作。Registration of value-added classes is a powerful feature; for example, it allows the following scenario: Right-click on a Person object in the Shell Explorer, and the allowed set of actions can be derived from the value-added class registered with Person.
c)作为服务提供者的增值行为c) Value-added behavior as a service provider
在本实施例中,存储平台API提供了一种机制,其中增值类可被注册为给定类型的“服务”。这使得应用程序能够设置和获得给定类型的服务提供者(=增值类)。希望利用这一机制的增值类应当实现一种公知的接口;例如:In this embodiment, the storage platform API provides a mechanism by which value-added classes can be registered as "services" of a given type. This enables applications to set and get service providers (=value-added classes) of a given type. Value-added classes wishing to take advantage of this mechanism should implement a well-known interface; for example:
interface IChatServicesinterface IChatServices
{{
void SendMessage(string msg);void SendMessage(string msg);
event MessageReceivedHandler MessageReceived;event MessageReceivedHandler MessageReceived;
}}
class WindowsMessengerServices:IChatServicesclass WindowsMessengerServices:IChatServices
{{
......
}}
class YahooMessengerServices:IChatServicesclass YahooMessengerServices:IChatServices
{{
......
}}
所有存储平台API数据类实现ICachedServiceProvider(高速缓存的服务提供者)接口。该接口扩展了System.IServiceProvider接口,如下:All storage platform API data classes implement the ICachedServiceProvider (cached service provider) interface. This interface extends the System.IServiceProvider interface, as follows:
interface ICachedServiceProvider:System.IServiceProviderinterface ICachedServiceProvider: System.IServiceProvider
{{
void SetService(System.Type type,Object provider);void SetService(System.Type type, Object provider);
void RemoteService(System.Type type);void RemoteService(System.Type type);
}}
使用该接口,应用程序可设置服务提供者示例以及请求特定类型的服务提供者。Using this interface, applications can set service provider instances and request specific types of service providers.
为支持该接口,存储平台数据类维护以类型作为键的服务提供者的散列表。当请求服务提供者时,实现首先在散列表中查看是否设置了指定类型的服务提供者。如果否,则使用注册的服务提供者基础结构来标识指定类型的服务提供者。然后创建该提供者的实例,将其添加到散列表,并返回。注意,也可能由数据类上的共享方法请求服务提供者,并将操作转发到该提供者。例如,这可用于提供使用由用户指定的电子邮件系统的邮件消息类上的Send方法。To support this interface, the storage platform data class maintains a hash table of service providers keyed by type. When requesting a service provider, the implementation first looks in the hash table to see if a service provider of the specified type is set. If not, use the registered service provider infrastructure to identify a service provider of the specified type. An instance of that provider is then created, added to the hash table, and returned. Note that it is also possible for a shared method on a data class to request a service provider and forward operations to that provider. For example, this could be used to provide a Send method on a mail message class that uses an email system specified by the user.
9.设计时架构9. Design-time architecture
本节描述了依照本发明的本实施例,存储平台模式如何转换成客户机上的存储平台API以及服务器上的UDT类。图24的图示出了所涉及的组件。This section describes how the storage platform pattern translates to the storage platform API on the client and UDT classes on the server according to this embodiment of the invention. The diagram of Figure 24 shows the components involved.
参考图24,模式中的类型包含在XML文件(框1)中。该文件也包含与模式相关联的字段级和项目级约束。存储平台类生成器(xfs2cs.exe-框2)采用该文件,并生成存储UDT的局部类(框5)以及客户机类的局部类(框3)。对于每一模式域,存在其它方法-称为域行为。存在在存储(框7)、客户机(框6)和两者中(框4)有意义的域行为。框4、6和7中的代码是手写的(不是自动生成的)。框3、4和6中的局部类共同形成了存储平台API域类的完整类实现。框3、4和6被编译(框8)以形成存储平台API类-框11(实际上,存储平台API是编译从所有初始模式域所得的框3、4和6的结果)。除域类之外,也存在实现增值行为的其它类。这些类利用一个或多个模式域中的一个或多个类。这是由框10表示的。框4、5和7中的局部类共同形成了服务器UDT类的完整类实现。框4、5和7被编译(框9)以形成服务器方的UDT程序集-框12(实际上,服务器方的UDT程序级是编译器加编译从所有初始模式域所得的框4、5和7的结果)。DDL命令生成器模块(框13)采用该UDT程序集(框12)以及模式文件(框1),并将它们安装在数据存储上。该过程涉及表的生成以及每一模式中的类型的查看等等。Referring to Figure 24, the types in the schema are contained in the XML file (box 1). This file also contains field-level and item-level constraints associated with the schema. The storage platform class generator (xfs2cs.exe - box 2) takes this file and generates a partial class for the storage UDT (box 5) and a partial class for the client class (box 3). For each schema domain, there are other methods - called domain behaviors. There is meaningful domain behavior in storage (box 7), client (box 6), and both (box 4). The code in
10.查询形式10. Inquiry form
当被精简到基础时,在使用存储平台API时应用程序的模式为:打开ItemContext;以过滤器准则使用Find来检索期望的对象;在对象上操作;以及将改变发送回存储。本节涉及对于什么进入过滤器串的句法。When stripped down to the basics, the pattern for an application when using the storage platform API is to: open an ItemContext; use Find with filter criteria to retrieve the desired object; operate on the object; and send changes back to the storage. This section deals with the syntax for what goes into the filter string.
当查找存储平台数据对象时提供的过滤器串描述了对象的属性必须满足以被返回的约束。由存储平台API使用的句法支持类型强制转换和关系遍历。The filter string provided when looking up a storage platform data object describes the constraints that the object's properties must satisfy in order to be returned. The syntax used by the storage platform API supports type casting and relation traversal.
a)过滤器基础a) Filter base
过滤器串要么为空,指示要返回指定类型的所有对象;要么是每一返回的对象必须满足的布尔表达式。表达式引用对象的属性。存储平台API运行库知道这些属性名如何映射到存储平台类型字段名,并最终映射到由存储平台存储维护的SQL视图。The filter string is either empty, indicating that all objects of the specified type are to be returned, or a Boolean expression that must be satisfied by each returned object. An expression refers to a property of an object. The storage platform API runtime knows how these property names map to storage platform type field names and ultimately to the SQL views maintained by the storage platform storage.
考虑以下示例:Consider the following example:
//找出所有人//find everyone
FindResult res1=Person.FindAll(ctx)FindResult res1 = Person. FindAll(ctx)
//找出其Gender(性别)属性值等于“Male”(男)的所有人//Find out all the people whose Gender (gender) attribute value is equal to "Male" (male)
FindResult res2=Person.FindAll(ctx,″Gender=′Male′″)FindResult res2 = Person.FindAll(ctx, "Gender = 'Male'")
//找出其Gender属性值等于“Male”且在上-世纪出生的人// Find people whose Gender attribute value is equal to "Male" and who were born in the last century
FindResult res3=Person.FindAll(FindResult res3 = Person.FindAll(
ctx,ctx,
″Gender=′Male′And Birthdate<′1/1/2001″″)"Gender='Male'And Birthdate<'1/1/2001"")
嵌套对象的属性也可在过滤器中使用。例如:Properties of nested objects can also be used in filters. For example:
//找出在上24小时中修改的所有人//Find out everyone modified in the last 24 hours
FindResult res1=Person.FindAll(FindResult res1 = Person.FindAll(
ctx,ctx,
String.Format(″Item.Modified>′{0}′″,DateTime.NowSubstract(nes TimeSpan(24,0,0))));String.Format("Item.Modified>'{0}'", DateTime.NowSubstract(nes TimeSpan(24, 0, 0))));
对于集合,可能使用方括号中的条件来过滤成员。例如:For collections, it is possible to filter members using conditions enclosed in square brackets. For example:
//找出名为“John”且姓为“Smith”的所有人//Find all people whose name is "John" and whose last name is "Smith"
FindResult res1=Person.FindAll(FindResult res1 = Person.FindAll(
ctx,ctx,
″PersonalNames[GivenName=′John′And Surname=′Smith′]″)"PersonalNames[GivenName='John'And Surname='Smith']")
//找出实时地址来自提供者“x”且在线状态类别为“y”的所有人//Find out all persons whose live address is from provider "x" and whose presence class is "y"
FindResult res2=Person.FindAll(FindResult res2 = Person.FindAll(
ctx,ctx,
″PersonalRealtimeAddress[ProviderURI=′x′].BasicPresence″+″PersonalRealtimeAddress[ProviderURI=′x′].BasicPresence″+
″OnlineStatus.Category=′y′″) "OnlineStatus.Category='y'")
以下示例列出了自从12/31/1999以来出生的所有人:The following example lists all people born since 12/31/1999:
ItemContext ctx=ItemContext.Open(″Work Contacts″);ItemContext ctx = ItemContext. Open("Work Contacts");
FindResult results=FindResult results=
Person.FindAll(ctx,″Birthdate>′12/31/1999′″); Person.FindAll(ctx, "Birthdate>'12/31/1999'");
foreach(results中的Person person)foreach(Person person in results)
Console.WriteLine(person.DisplayName);Console.WriteLine(person.DisplayName);
ctx.Close();ctx. Close();
第1行创建了新的ItemContext对象来访问本地计算机上存储平台共享上的“Work Contacts(工作联系人)”。第3行和第4行获得其中Birthdate(生日)属性满足晚于12/31/1999的日期的Person对象的集合,如由表达式“Birthdate>′12/31/1999′”所指定的。该FindAll操作的执行在图23中示出。
b)类型强制转换b) Type coercion
情况通常是储存在属性中的值的类型是从属性声明的类型导出的。例如,Person中的PersonalEAddress(个人电子地址)属性包含从诸如EMailAddress(电子邮件地址)和TelephoneNumber(电话号码)等EAdress(电子地址)中导出的类型的集合。为基于电话区号过滤,必须从EAddress类型强制转换到TelephoneNumber类型:It is often the case that the type of the value stored in the property is derived from the type declared by the property. For example, the PersonalEAddress (personal electronic address) attribute in Person contains a collection of types derived from EAdress (electronic address) such as EMailAddress (email address) and TelephoneNumber (telephone number). To filter based on telephone area codes, you must cast from the EAddress type to the TelephoneNumber type:
//找出电话号码425区号中的所有人//Find all people in the phone number 425 area code
FindResult res1=Person.FindAll(FindResult res1 = Person.FindAll(
ctx,ctx,
″PersonalEAddresses.″+"PersonalEA Addresses."+
″Cast(System.Storage.Contact.TelephoneNumber)).″+″Cast(System.Storage.Contact.TelephoneNumber)).″+
″AreaCode=’425’″);"AreaCode='425'");
//或者,可如下传递类型名:// Alternatively, the type name can be passed as follows:
FindResult res1=Person.FindAll(FindResult res1 = Person.FindAll(
ctx,ctx,
String.Format(″PersonalEAddresses.Cast({0})).AreaCode=’425’″,String.Format("PersonalEAddresses.Cast({0})).AreaCode='425'",
typeof(TelephoneNumber).FullName))typeof(TelephoneNumber).FullName))
c)过滤器句法c) filter syntax
以下是依照一个实施例由存储平台API支持的过滤器句法的描述。The following is a description of the filter syntax supported by the storage platform API according to one embodiment.
过滤器::=空过滤器|条件filter ::= empty filter | condition
空过滤器::=empty filter ::=
条件::=简单条件|复合条件|加括号的条件condition::=simple condition | compound condition | parenthesized condition
简单条件::=存在检查|比较simple condition ::= existence check|comparison
存在检查::=属性引用Existence Check ::= Property Reference
比较::=属性引用比较运算符常量comparison ::= property reference comparison operator constant
复合条件::=简单条件布尔运算符条件Compound Condition ::= Simple Condition Boolean Operator Condition
加括号的条件::=′(′条件′)′Bracketed condition::='('condition')'
比较运算符::=′!=′|′==′|′=′|′<′|′>′|′>=′|′<=′Comparison operator ::='! ='|'=='|'='|'<'|'>'|'>='|'<='
布尔运算符::=′And′|′&&′|′Or′|′||′Boolean Operators::='And'|'&&'|'Or'|'||'
常量::=串常量|数字常量constant ::= string constant | number constant
串常量::=′″(任何Unicode字符)*′″String constant::=′″(any Unicode character) * ′″
注意:嵌入的′字符通过复制来转义Note: Embedded ' characters are escaped by copying
数字常量::=0-9* Numeric constant::=0-9 *
属性引用::=简单属性名|复合属性名Attribute Reference ::= Simple Attribute Name|Compound Attribute Name
简单属性名::=(除′.′和空格之外的所有Unicode字符)*过滤器?Simple property name ::= (all Unicode characters except '.' and space) * filter?
过滤器::=′(′条件′)′filter::='('condition')'
复合属性名::=(类型强制转换|关系遍历|简单属性名)′.′属性引用Composite property name::=(type coercion|relation traversal|simple property name)'.'property reference
类型强制转换::=′Cast(′类型名′)′Type cast ::= 'Cast('type name')'
关系遍历::=遍历到源|遍历到目标Relation Traversal ::= Traverse to Source | Traverse to Target
遍历到源::=′Source(′完整关系名′)′Traverse to source ::= 'Source('full relation name')'
遍历到目标::=′Target(′完整关系名′)′Traverse to target::='Target('full relation name')'
类型名::=完全合格的CLR类型名typename::= fully qualified CLR typename
完整关系名::=模式名′.′关系名Full relation name ::= schema name '.' relation name
模式名::=存储平台名schema name::=storage platform name
关系名::=存储平台名Relationship name::=storage platform name
存储平台名::=如[模式定义]中所定义的storage platform name ::= as defined in [schema definition]
11.遥控11. Remote control
a)API中的本地/远程透明性a) Local/remote transparency in the API
存储平台中的数据访问的目标为本地存储平台实例。如果查询(或其部分)涉及远程数据,则本地实例用作路由器。由此,API层提供了本地/远程透明性:在本地和远程数据访问之间没有结构上的API差别。它纯粹是由所请求的范围来决定的。The target of data access in the storage platform is the local storage platform instance. If the query (or parts thereof) involve remote data, the local instance acts as a router. Thus, the API layer provides local/remote transparency: there is no structural API difference between local and remote data access. It is purely determined by the scope requested.
存储平台数据存储也实现了分布式查询;由此,可能连接到本地存储平台实例,并执行包括来自不同卷的项目的查询,其中某一些项目在本地存储上,而其它项目在远程存储上。存储对结果执行并操作,并将其呈现给应用程序。从存储平台API的观点(因此是应用程序开发者的观点)来看,任何远程访问完全是无缝和透明的。The storage platform data store also enables distributed queries; thus, it is possible to connect to a local storage platform instance and execute queries involving items from different volumes, some of which are on local storage and others on remote storage. The store performs operations on the results and presents them to the application. From the point of view of the storage platform API (and thus the point of view of the application developer), any remote access is completely seamless and transparent.
存储平台API允许应用程序使用IsRemote属性确定给定的ItemContext对象(如由ItemContext.Open方法返回的)是表示本地还是远程连接,该属性是ItemContext对象上的属性。尤其是,应用程序可能希望提供视频反馈来帮助为性能、可靠性等设置用户期望。The storage platform API allows applications to determine whether a given ItemContext object (as returned by the ItemContext.Open method) represents a local or remote connection using the IsRemote property, which is a property on the ItemContext object. In particular, an app might want to provide video feedback to help set user expectations for performance, reliability, and more.
b)遥控的存储平台实现b) Realization of remote storage platform
存储平台数据存储使用特殊的OLEDB提供者来彼此交谈,该提供者在HTTP上运行(默认的OLEDG提供者使用TDS)。在一个实施例中,分布式查询通过关系型数据库引擎的默认OPENROWSET功能。提供一种特殊的用户定义函数(UDF):DoRemoteQuery(server,queryText),以完成实际的遥控。Storage Platform Datastores talk to each other using a special OLEDB provider, which runs over HTTP (the default OLEDG provider uses TDS). In one embodiment, the distributed query is through the default OPENROWSET function of the relational database engine. Provide a special user-defined function (UDF): DoRemoteQuery (server, queryText), to complete the actual remote control.
c)访问非存储平台存储c) Access to non-storage platform storage
在本发明的存储平台的一个实施例中,不存在允许任何存储参与存储平台数据访问的非一般提供者体系结构。然而,为Microsoft Exchange和Microsoft ActiveDirectory(AD)的特定情况提供了有限提供者体系结构。这意味着开发者可如同在存储平台中那样使用存储平台API并访问AD和Exchange中的数据,但是他们能够访问的数据限于存储平台模式化的类型。由此,在AD中支持地址簿(=存储平台Person类型的集合),且对Exchange支持邮件、日历和联系人。In one embodiment of the storage platform of the present invention, there is no non-generic provider architecture that allows any storage to participate in storage platform data access. However, a limited provider architecture is provided for the specific case of Microsoft Exchange and Microsoft Active Directory (AD). This means that developers can use the storage platform API and access data in AD and Exchange just as they can in the storage platform, but the data they can access is limited to the type of storage platform schema. Thus, address books (=collections of type Person of storage platform) are supported in AD, and mail, calendar and contacts are supported for Exchange.
d)与DFS的关系d) Relationship with DFS
存储平台属性升级器不升级过去的固定点。即使名字空间足够丰富以通过固定点来访问,查询仍不能通过它们。存储平台卷可以作为DFS树中的叶节点出现。The storage platform attribute upgrader does not upgrade past fixed points. Even if namespaces are rich enough to be accessed through fixed points, queries cannot pass through them. Storage platform volumes can appear as leaf nodes in the DFS tree.
e)与GXA/Indigo的关系e) Relationship with GXA/Indigo
开发者可使用存储平台API以在数据存储的上方展示“GXA头”。概念上,创建任何其它web服务没有任何区别。存储平台API不使用GXA与存储平台数据存储交谈。如上所述,API使用TDS与本地存储交谈;任何遥控是由本地存储使用同步服务来处理的。Developers can use the storage platform API to expose a "GXA header" on top of the data storage. Conceptually, there is no difference in creating any other web service. The Storage Platform API does not use GXA to talk to Storage Platform datastores. As mentioned above, the API uses TDS to talk to local storage; any remote control is handled by local storage using the sync service.
12.约束12. Constraints
存储平台数据模型允许类型上的值约束。这些约束在存储上自动评估,且该过程对于用户是透明的。注意,在服务器处检查约束。注意到这一点之后,有时候期望给予开发者验证输入数据满足约束的灵活性而不会导致对服务器的往返额外开销。这在其中最终用户输入用于填充对象的数据的交互式应用程序中尤其有用。存储平台API提供该工具。The storage platform data model allows value constraints on types. These constraints are evaluated automatically on storage, and this process is transparent to the user. Note that constraints are checked at the server. With this in mind, it is sometimes desirable to give developers the flexibility to verify that input data satisfies constraints without incurring the overhead of a round trip to the server. This is especially useful in interactive applications where end users enter data to populate objects. The Storage Platform API provides this facility.
可以回想在XML文件中指定了存储平台模式,它由存储平台用于生成表示该模式的适当的数据库对象。它也由存储平台API的设计时架构用于自动生成类。Recall that the storage platform schema is specified in an XML file, which is used by the storage platform to generate the appropriate database objects representing the schema. It is also used by the design-time schema of the Storage Platform API to automatically generate classes.
以下是用于生成Contacts模式的XML文件的部分清单:Here is a partial listing of the XML file used to generate the Contacts schema:
<Schema Name=″Contacts″MajorVersion=″1″MinorVersion=″8″><Schema Name="Contacts" MajorVersion="1"MinorVersion="8">
<ReferencedSchema Name=″Base″MajorVersion=″1″/><ReferencedSchema Name="Base" MajorVersion="1"/>
<Type Name=″Person″MajorVersion=″1″MinorVersion=″0″<Type Name="Person" MajorVersion="1" MinorVersion="0"
ExtendsType=″Principal″ExtendsVersion=″1″>ExtendsType="Principal"ExtendsVersion="1">
<Field Name=″Birthdate″Type=″the storage platformTypes.datetime″<Field Name="Birthdate"Type="the storage platformTypes.datetime"
Nullable=″true″MultiValued=″false″/>Nullable="true"MultiValued="false"/>
<Field Name=″Gender″Type=″the storage platformTypes.nvarchar(16)″<Field Name="Gender"Type="the storage platformTypes.nvarchar(16)"
Nullable=″true″MultiValued=″false″/>Nullable="true"MultiValued="false"/>
<Field Name=″PersonalNames″Type=″FullName″TypeMajorVersion=″1″<Field Name="PersonalNames"Type="FullName"TypeMajorVersion="1"
Nullable=″true″MultiValued=″true″/>Nullable="true"MultiValued="true"/>
<Field Name=″PersonalEAddresses″Type=″EAddress″<Field Name="PersonalEAddresses"Type="EAddress"
TypeMajorVersion=″1″Nullable=″true″MultiValued=″true″/>TypeMajorVersion="1"Nullable="true"MultiValued="true"/>
<Field Name=″PersonalPostalAddresses″Type=″PostalAddress″<Field Name="PersonalPostalAddresses"Type="PostalAddress"
TypeMajorVersion=″1″Nullable=″true″MultiValued=″true″/>TypeMajorVersion="1"Nullable="true"MultiValued="true"/>
<Check>expression</Check><Check>expression</Check>
</Type></Type>
......
......
</Schema></Schema>
以上XML中的Check标签指定了Person类型上的约束。可以有一个以上Check标签。以上约束一般是在存储中检查的。为指定约束也可由应用程序显式地检查,以上XML被修改为:The Check tag in the XML above specifies constraints on the Person type. There can be more than one Check tag. The above constraints are generally checked in storage. To specify constraints that can also be checked explicitly by the application, the above XML is modified to:
<Schema Name=″Contacts″MajorVersion=″1″MinorVersion=″8″><Schema Name="Contacts" MajorVersion="1"MinorVersion="8">
<ReferencedSchema Name=″Base″MajorVersion=″1″/><ReferencedSchema Name="Base" MajorVersion="1"/>
<Type Name=″Person″...><Type Name="Person"...>
<Field Name=″Birthdate″Type=″the storage platformTypes.datetime″<Field Name="Birthdate"Type="the storage platformTypes.datetime"
Nullable=″true″MultiValued=″false″/>Nullable="true"MultiValued="false"/>
......
<Check InApplication=″true″>expression</Check><Check InApplication="true">expression</Check>
</Type></Type>
......
......
</Schema></Schema>
注意,<Check>元素上的新的“InApplication”属性被设为真。这导致存储平台API通过Person类上称为Validate()的实例方法在API中将约束置于表面。应用程序可在对象上调用该方法,以确保数据是有效的,并防止对服务器的可能的无用往返。这返回指示确认的结果的布尔值。注意,值约束仍在服务器处应用,而不论客户机是否调用了<object>.Validate()方法。以下是如何使用Validate的一个示例:Note that the new "InApplication" attribute on the <Check> element is set to true. This causes the storage platform API to surface constraints in the API through an instance method called Validate() on the Person class. Applications can call this method on the object to ensure that the data is valid and to prevent possible useless round trips to the server. This returns a boolean indicating the result of the confirmation. Note that value constraints are still applied at the server, regardless of whether the client calls the <object>.Validate() method. Here is an example of how to use Validate:
ItemContext ctx=ItemContext.Open();ItemContext ctx = ItemContext. Open();
//在用户的My Contacts文件夹中创建联系人。// Create a contact in the user's My Contacts folder.
Folder f=UserDataFolder.FindMyPersonalContactsFolder(ctx);Folder f = UserDataFolder.FindMyPersonalContactsFolder(ctx);
Person p=new Person(f);Person p = new Person(f);
//设置人的生日//set the person's birthday
p.Birthdate=new DateTime(1959,6,9);p.Birthdate = new DateTime(1959, 6, 9);
//添加被归类为人名的名字//Add names classified as person names
FullName name=new FullName(FullName.Category.PrimaryName);FullName name = new FullName(FullName.Category.PrimaryName);
name.GivenName=″Joe″;name.GivenName="Joe";
name.Surname=″Smith″;name.Surname="Smith";
p.PersonalNames.Add(name);p.PersonalNames.Add(name);
//确认Person对象//Confirm the Person object
if(p.Validate()==false)if(p.Validate()==false)
{{
//数据不表示有效的人//The data does not represent a valid person
}}
//保存改变//save changes
p.Update();p.Update();
ctx.Close();ctx. Close();
存在到存储平台存储的多条访问路径-存储平台API、ADO.NET、ODBC、OLEDB和ADO。这引发了权威约束检查的问题-即,如何确保从例如ODBC写出的数据与从存储平台API写出的数据通过相同的数据完整性约束。由于所有的约束是在存储处检查的,因此约束现在是权威的。不论用于到达存储的API路径如何,对存储的所有写都通过存储处的约束检查来过滤。There are multiple access paths to Storage Platform storage - Storage Platform API, ADO.NET, ODBC, OLEDB and ADO. This raises the problem of authoritative constraint checking - ie, how to ensure that data written from eg ODBC passes the same data integrity constraints as data written from the storage platform API. Since all constraints are checked at the store, the constraints are now authoritative. Regardless of the API path used to reach the storage, all writes to the storage are filtered by constraint checks at the storage.
13.共享13. Sharing
存储平台中的共享是以下形式:Shares in the storage platform are of the form:
\\<DNS名>\<上下文服务>\\<DNS name>\<context service>
其中<DNS名>是机器的DNS名,<上下文服务>是该机器上的卷中的包含文件夹、虚拟文件夹或项目。例如,假定机器“Johns Desktop”具有名为Johns Information的卷,且在该卷中存在名为Contacts_Categories的文件夹;该文件夹包含名为Work的文件夹,后者具有John的工作联系人:where <DNS name> is the DNS name of the machine and <context service> is a containing folder, virtual folder, or item in a volume on that machine. For example, assume that the machine "Johns Desktop" has a volume named Johns Information, and within that volume there is a folder named Contacts_Categories; this folder contains a folder named Work, which has John's work contacts:
\\Johns_Desktop\Johns_Information$\Contacts_Categories\Work这可以被共享为“WorkContacts”。采用该共享的定义,\\Johns_Desktop\WorkContacts\JaneSmith是有效的存储平台名,且标识了Person项目JaneSmith。\\Johns_Desktop\Johns_Information$\Contacts_Categories\Work This can be shared as "WorkContacts". Using the shared definition, \\Johns_Desktop\WorkContacts\JaneSmith is a valid storage platform name and identifies the Person project JaneSmith.
a)表示共享a) means sharing
共享项目类型具有以下属性:共享名以及共享目标(这可以是非持有链接)。例如,上述共享的名称是WorkContacts,且目标是卷Johns_Information上的Contacts_Categories\Work。以下是用于Share类型的模式片段:A shared item type has the following attributes: share name and share target (this can be a non-holding link). For example, the name of the above share is WorkContacts and the target is Contacts_Categories\Work on the volume Johns_Information. Here is the schema snippet for the Share type:
<Schema<Schema
xmlns=″http://schemas.microsoft.com/winfs/2002/11/18/schema″xmlns="http://schemas.microsoft.com/winfs/2002/11/18/schema"
Name=″Share″MajorVersion=″1″MinorVersion=″0″>Name="Share"MajorVersion="1"MinorVersion="0">
<ReferencedSchema Name=″Base″MajorVersion=″1″/><ReferencedSchema Name="Base" MajorVersion="1"/>
<ReferencedSchema Name=″the storage platformTypes″MajorVersion=″1″/><ReferencedSchema Name="the storage platformTypes" MajorVersion="1"/>
<Type Name=″Share″MajorVersion=″1″MinorVersion=″0″<Type Name="Share" MajorVersion="1"MinorVersion="0"
ExtendsType=″Base.Item″ExtendsVersion=″1″>ExtendsType="Base.Item"ExtendsVersion="1">
<Field Name=″Name″Type=″the storage platformTypes.nvarchar(512)″<Field Name="Name"Type="the storage platformTypes.nvarchar(512)"
TypeMajorVersion=″1″/> TypeMajorVersion="1"/>
<Field Name=″Target″Type=″Base.RelationshipData″TypeMajorVersion=″1″/><Field Name="Target"Type="Base.RelationshipData"TypeMajorVersion="1"/>
</Type></Type>
</Schema></Schema>
b)管理共享b) Manage shares
由于共享是一个项目,因此共享可如同其它项目那样管理。共享可被创建、删除和修改。共享也以与其它存储平台项目一样的方式来保护。Since a share is a project, a share can be managed like any other project. Shares can be created, deleted and modified. Shares are also protected in the same way as other storage platform projects.
c)访问共享c) access share
应用程序通过在ItemContext.Open()方法调用中将共享名(例如,\\Johns_Desktop\WorkContacts)传递到存储平台API来访问远程存储平台共享。ItemContext.Open返回ItemContext对象实例。存储平台API然后与本地存储平台服务交谈(可以回想访问远程存储平台是通过本地存储平台完成的)。本地存储平台服务进而与具有给定共享名(例如,WorkContacts)的远程存储平台服务(例如,在机器Johns_Desktop)交谈。远程存储平台服务然后将WorkContacts转换成Contacts_Categories\Work并打开它。在那之后,与其它范围一样执行查询和其它操作。The application accesses the remote storage platform share by passing the share name (eg, \\Johns_Desktop\WorkContacts) to the storage platform API in the ItemContext.Open() method call. ItemContext.Open returns the ItemContext object instance. The storage platform API then talks to the local storage platform service (recall that accessing remote storage platforms is done through the local storage platform). The local storage platform service in turn talks to a remote storage platform service (eg, on machine Johns_Desktop) with a given share name (eg, WorkContacts). The remote storage platform service then translates the WorkContacts into Contacts_Categories\Work and opens it. After that, queries and other operations are performed as with other scopes.
d)可发现性d) Discoverability
在一个实施例中,应用程序可以用以下方式发现给定的<DNS名>上可用的共享。依照第一种方式,存储平台API接受DNS名(例如,Johns_Desktop),作为ItemContext.Open()方法中的范围参数。存储平台API然后用该DNS名作为连接串的一部分连接到存储平台存储。采用该连接,应用程序唯一能做的事情是调用ItemContext.FindAll(typeof(Share))。存储平台服务然后对所有附加的卷上的所有共享执行并操作,并返回共享集合。依照第二种方式,在本地机器上,管理员可通过FindAll(typeof(Share))发现特定卷上的共享,或通过FindAll(typeof(Share),″Target(ShareDestination).Id=folderId″)来发现特定的文件夹。In one embodiment, an application can discover the shares available on a given <DNS name> in the following manner. According to the first approach, the Storage Platform API accepts a DNS name (eg, Johns_Desktop) as a scope parameter in the ItemContext.Open() method. The storage platform API then uses the DNS name as part of the connection string to connect to the storage platform storage. With this connection, the only thing the application can do is call ItemContext.FindAll(typeof(Share)). The storage platform service then performs a union operation on all shares on all attached volumes and returns the set of shares. According to the second method, on the local machine, the administrator can find shares on a specific volume through FindAll(typeof(Share)), or through FindAll(typeof(Share), "Target(ShareDestination).Id=folderId") Discover specific folders.
14.Find的语义14.Semantics of Find
Find*方法(无论它们是在ItemContext对象还是在个别的项目上调用)一般应用于给定上下文中的项目(包括嵌入的项目)。嵌套元素没有Find-它们不能独立于其包含项目来搜索。这与存储平台数据模型所期望的语义相一致,其中嵌套元素从包含项目导出其“身份”。为使这一概念更清楚,以下是有效和无效查找操作的示例:The Find * methods (whether they are called on the ItemContext object or on individual items) generally apply to items (including embedded items) in a given context. Nested elements do not have Find - they cannot be searched independently of their containing item. This is consistent with the expected semantics of the storage platform data model, where nested elements derive their "identity" from the containing item. To make this concept clearer, here are examples of valid and invalid lookup operations:
a)示出系统中具有区号206的所有电话号码?a) Show all phone numbers in the system that have
无效,因为该查找是在电话号码(元素)上完成的,而没有引用项目。doesn't work because that lookup is done on the phone number (element) without referencing the item.
b)示出所有Person内具有区号206的所有电话号码?b) Show all phone numbers with
无效,即使引用了Person(=项目),搜索准则也不涉及该项目。Invalid, even though Person(=item) is referenced, the search criteria does not refer to the item.
c)示出Murali(=单个人)的具有区号206的所有电话号码?c) Show all phone numbers of Murali (=single person) with
有效,因为存在项目(名为“Murali”的Person)上的搜索准则。该规则的例外是对于直接或间接从Base.Relationship类型导出的嵌套元素。这些类型可通过关系类个别地查询。这一查询可被支持,因为存储平台实现采用了“主链表”来储存Relationship元素而非将它们嵌入在项目UDT中。Valid because there are search criteria on the item (Person named "Murali"). The exception to this rule is for nested elements derived directly or indirectly from the Base.Relationship type. These types can be queried individually through relationship classes. This query can be supported because the storage platform implementation uses a "master linked list" to store the Relationship elements instead of embedding them in the item UDT.
15.存储平台Contacts API15. Storage platform Contacts API
本节给出了存储平台Contacts API的综述。Contacts API背后的模式在图21A和21B中示出。This section gives an overview of the storage platform Contacts API. The schema behind the Contacts API is shown in Figures 21A and 21B.
a)System.Storage.Contact的综述a) Overview of System.Storage.Contact
存储平台API包括用于处理联系人模式中的项目和元素的名字空间。该名字空间被称为System.Stroage.Contact。The storage platform API includes namespaces for working with items and elements in the contact schema. The namespace is called System.Stroage.Contact.
该模式具有例如以下类:The schema has for example the following classes:
·项目:UserDataFolder、User、Person、ADService、Service、Group、Organization、Principal、LocationProjects: UserDataFolder, User, Person, ADService, Service, Group, Organization, Principal, Location
·元素:Profile、PostalAddress、EmailAddress、TelephoneNumber、RealTimeAddress、Eaddress、FullName、BasicPresence、GroupMembership、RoleOccupancyElements: Profile, PostalAddress, EmailAddress, TelephoneNumber, RealTimeAddress, Eaddress, FullName, BasicPresence, GroupMembership, RoleOccupancy
b)域行为b) Domain Behavior
以下是联系人模式的域行为的列表。当从足够高的级别来查看时,域行为落入良好组织的类别中:The following is a list of domain behaviors for contact mode. When viewed at a high enough level, domain behavior falls into well-organized categories:
·静态助手,例如创建新个人联系人的Person.CreatePersonalContact();· Static helpers, such as Person.CreatePersonalContact() to create a new personal contact;
·实例助手,例如将用户(User类的实例)登录到被标记为自动登录的所有概况的user.AutoLoginToAllProfiles();· Instance helpers, such as user.AutoLoginToAllProfiles() that log a user (an instance of the User class) into all profiles that are marked for automatic login;
·类别GUID,例如Category.Home、Category.Work等;· Category GUID, such as Category.Home, Category.Work, etc.;
·导出属性,例如emailAddress.Address()-返回组合给定emailAddress(EmailAddress类的实例)的用户名和域字段的串;以及Export properties, eg emailAddress.Address() - returns a string combining the username and domain fields of a given emailAddress (an instance of the EmailAddress class); and
·导出集合,例如person.PersonalEmailAddress-给定Person类的实例,获得其个人电子邮件地址。• Export collections eg person.PersonalEmailAddress - Given an instance of the Person class, get its personal email address.
下表对Contacts中具有域行为的每一类给出了这些方法和它们所属的类别的列表。The following table gives a list of these methods and the category they belong to for each class in Contacts that has domain behavior.
16.存储平台File API16. Storage platform File API
本节依照本发明的一个实施例给出了存储平台File API的综述。This section provides an overview of the File API of the storage platform according to an embodiment of the present invention.
a)介绍a) introduction
(1)在存储平台中反映NTFS卷(1) Reflect NTFS volumes in the storage platform
存储平台提供了在现有NTFS卷中的内容上进行索引的方法。这是通过从NTFS中的每一文件流或目录中提取(“升级”)属性,并将这些属性作为项目储存在存储平台中来实现的。The storage platform provides methods for indexing on content in existing NTFS volumes. This is accomplished by extracting ("updating") attributes from each file stream or directory in NTFS and storing these attributes as items in the storage platform.
存储平台的文件模式定义了两种项目类型-File(文件)和Directory(目录),来储存升级的文件系统实体。Directory类型是Folder类型的子类型;它是包含其它Directory项目或File项目的包含文件夹。The file mode of the storage platform defines two item types - File (file) and Directory (directory), to store the updated file system entities. The Directory type is a subtype of the Folder type; it is a containing folder that contains other Directory items or File items.
Directory项目可包含Directory和File项目;它不能包含任何其它类型的项目。至于所考虑的存储平台,Directory和File项目从任何数据访问API都是只读的。文件系统升级管理器(FSPM)服务异步地将改变的属性升级到存储平台中。File和Directory项目的属性可由Win32 API来改变。存储平台API可用于读取这些项目的任何属性,包括与File项目相关联的流。A Directory item can contain Directory and File items; it cannot contain any other type of item. As for the storage platforms considered, the Directory and File items are read-only from any data access API. The File System Upgrade Manager (FSPM) service asynchronously upgrades changed attributes into the storage platform. The properties of File and Directory items can be changed by Win32 API. The storage platform API can be used to read any attribute of these items, including streams associated with File items.
(2)在存储平台名字空间中创建文件和目录(2) Create files and directories in the storage platform namespace
当NTFS卷被升级到存储平台卷时,其中的所有文件和目录都在该卷的特定部分中。该区域从存储平台的观点来看是只读的;FSPM可创建新目录和文件,和/或改变现有项目的属性。When an NTFS volume is upgraded to a storage platform volume, all files and directories within it are in a specific section of the volume. This area is read-only from the storage platform's point of view; FSPM can create new directories and files, and/or change attributes of existing items.
该卷的名字空间的剩余部分可包含存储平台项目类型的普通全范围-Principal(主体)、Organization(组织)、Document(文档)、Folder(文件夹)等。存储平台也允许在存储平台名字空间的任何部分中创建文件和目录。这些“本机”文件和目录在NTFS文件系统中没有相应物;它们完全储存在存储平台中。此外,对属性的改变是立即可见的。The rest of the volume's namespace may contain the usual full range of storage platform item types - Principal, Organization, Document, Folder, etc. The storage platform also allows files and directories to be created in any part of the storage platform namespace. These "native" files and directories have no counterpart in the NTFS file system; they are stored entirely within the storage platform. Furthermore, changes to properties are immediately visible.
然而,编程模型保持相同;就考虑到存储平台数据访问API而言,它们仍是只读的。“本机”文件和目录必须使用Win32 API来更新。这简化了开发者的思维模型,该思维模型为:However, the programming model remains the same; as far as storage platform data access APIs are concerned, they are still read-only. "Native" files and directories must be updated using the Win32 API. This simplifies the developer's mental model, which is:
1.任何存储平台项目类型可以在名字空间中的任何地方处创建(当然,除非被许可所阻止);1. Any storage platform project type can be created anywhere in the namespace (unless, of course, prohibited by the license);
2.任何存储平台项目类型可以使用存储平台API来读取;2. Any storage platform item type can be read using the storage platform API;
3.所有存储平台项目类型可使用具有File和Directory的例外的存储平台API来写入3. All storage platform item types can be written using the storage platform API with the exception of File and Directory
4.为写到File和Directory项目而不管它们在名字空间中的何处,使用Win32API;以及4. Use the Win32 API for writing to File and Directory items regardless of where they are in the namespace; and
5.在“升级的”名字空间中对File/Directory项目的改变可能不直接出现在存储平台中;在“非升级”名字空间中,改变直接在存储平台中反映。5. Changes to File/Directory items in an "upgraded" namespace may not appear directly in the storage platform; in a "non-upgraded" namespace, changes are reflected directly in the storage platform.
b)文件模式b) file mode
图25示出了File API所基于的模式。Figure 25 shows the schema on which the File API is based.
c)System.Storage.Files的综述c) Overview of System.Storage.Files
存储平台API包括用于处理文件对象的名字空间。该名字空间称为System.Storage.Files。System.Storage.Files中的类的数据成员直接反映了储存在存储平台存储中的信息;该信息从文件系统对象“升级”,或可以使用Win32 API本机创建。System.Storage.Files名字空间具有两个类:FileItem(文件项目)和DirectoryItem(目录项目)。这些类的成员及其方法可通过查看图25中的模式图来容易地猜想。FileItem和DirectoryItem从存储平台API是只读的。为修改它们,必须使用Win32 API或System.IO中的类。The storage platform API includes namespaces for working with file objects. The namespace is called System.Storage.Files. The data members of the classes in System.Storage.Files directly reflect the information stored in the storage platform's storage; this information is "upgraded" from the file system object, or can be created natively using the Win32 API. The System.Storage.Files namespace has two classes: FileItem (file item) and DirectoryItem (directory item). The members of these classes and their methods can be easily guessed by looking at the schema diagram in Figure 25. FileItem and DirectoryItem are read-only from the storage platform API. To modify them, you must use the Win32 API or the classes in System.IO.
d)代码示例d) Code example
在本节中,提供了三个代码示例,示出了System.Storage.Files中的类的使用。In this section, three code samples are provided showing the use of the classes in System.Storage.Files.
(1)打开文件并向其写入(1) Open the file and write to it
本示例示出了如何完成“传统”文件操纵。This example shows how "traditional" file manipulation is done.
ItemContext ctx=ItemContext.Open();ItemContext ctx = ItemContext. Open();
FileItem f=FileItem.FindByPath(ctx,@″\My Documents\billg.ppt″);FileItem f = FileItem.FindByPath(ctx, @″\My Documents\billg.ppt″);
//处理文件属性的示例-确保文件不是只读的// Example of handling file attributes - making sure the file is not read-only
if(!f.IsReadOnly)if (! f. IsReadOnly)
{{
FileStream fs=f.OpenWrite(); FileStream fs = f. OpenWrite();
//读、写、关闭文件流fs //Read, write, and close the file stream fs
}}
ctx.Close();ctx. Close();
第3行使用了FindByPath(按照路径查找)方法来打开文件。第7行示出了对升级的属性IsReadOnly的使用,来检查文件是否可写。如果是,则在第9行使用FileItem对象上的OpenWrite()方法来获得文件流。
(2)使用查询(2) Use query
由于存储平台存储持有从文件系统升级的属性,因此可能容易地在文件上完成丰富的查询。在本示例中,列出了在最后三天修改的所有文件:Rich queries may be easily done on files due to the storage platform storage holding properties upgraded from the file system. In this example, all files modified in the last three days are listed:
//列出在最后三天中修改的所有文件//List all files modified in the last three days
FindResult result=FileItem.FindAll(FindResult result = FileItem.FindAll(
ctx,ctx,
″Modified>=′{0}′″,"Modified>='{0}'",
DateTime.Now.AddDays(-3));DateTime. Now. AddDays(-3));
foreach(result中的FileItem file)foreach(FileItem file in result)
{{
......
}}
以下是使用查询的另一示例-该示例找出某一类型(=extension)的所有可写文件:Here is another example of using a query - this one finds all writable files of a certain type (=extension):
//找出特定目录中所有可写.cs文件//Find all writable .cs files in a specific directory
//等效于:dir c:\win\src\api\*.cs/a-r-d//Equivalent to: dir c:\win\src\api\*.cs/a-r-d
DirectoryItem dir=DirectoryItem dir=
DirectoryItem.FindByPath(ctx,@″c:\win\src\api″);DirectoryItem.FindByPath(ctx, @″c:\win\src\api″);
Find Result=dir.GetFiles(Find Result = dir. GetFiles(
″Extension=′cs′and IsReadOnly=false″);"Extension='cs' and IsReadOnly=false");
foreach(result中的File file)foreach(File file in result)
{{
......
}}
e)域行为e) Domain Behavior
在一个实施例中,除标准属性和方法之外,文件类也具有域行为(手工编码的属性和方法)。这些行为一般基于对应的System.IO类中的方法。In one embodiment, file classes also have domain behavior (hand-coded properties and methods) in addition to standard properties and methods. These behaviors are generally based on methods in the corresponding System.IO classes.
J.总结J. Summary
如上所述,本发明针对一种用于组织、搜索和共享数据的存储平台。本发明的存储平台在现有文件系统和数据库系统之外扩展并拓宽了数据存储的概念,并被设计成储存所有类型的数据,包括结构化的、非结构化的或半结构化的数据,诸如关系型(表式)数据、XML以及称为项目的新形式的数据。通过其公共存储基础和模式化的数据,本发明的存储平台对消费者、知识工作者和企业允许更有效的应用程序开发。它提供了一种丰富且可扩展的应用程序编程接口,该接口不仅使得其数据模型中的固有能力可用,还包含并扩展了现有文件系统和数据库访问方法。可以理解,可以对上述实施例做出改变而不脱离其宽泛的发明性概念。因此,本发明不限于所揭示的具体实施例,而是旨在覆盖落入由所附权利要求书定义的本发明的精神和范围之内的所有修改。As noted above, the present invention is directed to a storage platform for organizing, searching and sharing data. The storage platform of the present invention expands and broadens the concept of data storage beyond existing file systems and database systems, and is designed to store all types of data, including structured, unstructured or semi-structured data, Such as relational (table) data, XML, and new forms of data called items. Through its common storage base and schematized data, the storage platform of the present invention allows for more efficient application development for consumers, knowledge workers and enterprises. It provides a rich and extensible application programming interface that not only makes available the capabilities inherent in its data model, but also includes and extends existing file system and database access methods. It will be appreciated that changes may be made to the above-described embodiments without departing from their broad inventive concepts. Therefore, this invention is not limited to the particular embodiments disclosed, but it is intended to cover modifications which come within the spirit and scope of the present invention as defined by the appended claims.
如从上文中可以清楚的,本发明的各种系统、方法和方面的全部或部分可以用程序代码(即,指令)的形式来实施。该程序代码可被储存在计算机可读介质上,诸如磁、电、光存储介质,包括但不限于,软盘、CD-ROM、CD-RW、DVD-ROM、DVD-RAM、磁带、闪存、硬盘驱动器、或任何其它机器可读存储介质,其中,当程序代码被加载到诸如计算机或服务器等机器并由其执行时,该机器成为用于实现本发明的装置。本发明也可用通过某一传输介质,诸如通过电线或电缆、通过光纤、通过包括因特网或内联网的网络、或通过任何其它形式的传输来传输的程序代码的形式来实施,其中,当程序代码由诸如计算机等机器接受并加载到其中由其执行时,该机器成为用于实现本发明的装置。当在通用处理器上实现时,程序代码与处理器相结合以提供类似于特定逻辑电路操作的独特装置。As is apparent from the above, all or part of the various systems, methods and aspects of the invention can be implemented in the form of program code (ie, instructions). The program code can be stored on a computer readable medium, such as magnetic, electronic, optical storage medium, including but not limited to, floppy disk, CD-ROM, CD-RW, DVD-ROM, DVD-RAM, magnetic tape, flash memory, hard disk drive, or any other machine-readable storage medium in which, when the program code is loaded into and executed by a machine such as a computer or a server, the machine becomes a means for implementing the present invention. The present invention can also be implemented in the form of program code transmitted through some transmission medium, such as by wire or cable, by optical fiber, by a network including the Internet or an intranet, or by any other form of transmission, wherein when the program code When received by a machine such as a computer and loaded into it for execution, the machine becomes a means for carrying out the invention. When implemented on a general-purpose processor, the program code combines with the processor to provide a unique means that operates analogously to specific logic circuits.
附录AAppendix A
namespace System.Storagenamespace System. Storage
{{
abstract class ItemContext:IDisposable,IServiceProviderabstract class ItemContext: IDisposable, IServiceProvider
{{
ItemContext创建和管理成员 ItemContext creates and manages members
//应用程序无法直接创建ItemContext对象,也无法从ItemContext中导出类。//Applications cannot directly create ItemContext objects, nor can they derive classes from ItemContext.
internal itemContext();internal itemContext();
//创建可用于搜索指定路径,或者如果未指定路径,//Create can be used to search for the specified path, or if no path is specified,
//则创建可用于搜索本地计算机上的默认存储的ItemContext。//Create an ItemContext that can be used to search the default storage on the local computer.
public static ItemContext Open();public static ItemContext Open();
public static ItemContext Open(string path);public static ItemContext Open(string path);
public static ItemContext Open(params string[]paths);public static ItemContext Open(params string[]paths);
//返回创建ItemContext时指定的路径。// Returns the path specified when creating the ItemContext.
public string[]GetOpenPaths();public string[]GetOpenPaths();
//创建该ItemContext的副本。该副本将具有独立的事务、高速缓存和更新状态。高速缓存//Create a copy of the ItemContext. This replica will have independent transaction, cache, and update state. cache
//初始为空。期望使用克隆的ItemContext将比使用同一项目域打开新的ItemContext更有效。//Initially empty. It is expected that using a cloned ItemContext will be more efficient than opening a new ItemContext with the same item scope.
public ItemContext Clone();public ItemContext Clone();
//关闭ItemContext。在关闭之后使用ItemContext的任何尝试将导致ObjectDisposedException。//Close the ItemContext. Any attempt to use the ItemContext after it has been closed will result in an ObjectDisposedException.
public void Close();public void Close();
void IDisposable.Dispose();void IDisposable. Dispose();
//如果当打开ItemContext指定的任何域解析到远程计算机,则为真。//True if any domain specified by the ItemContext resolves to the remote computer when opened.
public bool IsRemote{get;}public bool IsRemote{get;}
//返回可提供所请求的服务类型的对象。如果不能提供所请求的服务,则返回空。// Returns an object that provides the requested service type. Returns NULL if the requested service cannot be provided.
//对IServiceProvider模式的使用允许非正常使用且可能导致开发者混淆的API被排除在//The use of the IServiceProvider mode allows APIs that are not normally used and may cause developer confusion to be excluded
//ItemContext类之外。ItemContext可提供以下种类的服务:ItemSerialization、IStoreObjectCache// Outside the ItemContext class. ItemContext can provide the following types of services: ItemSerialization, IStoreObjectCache
public object GerService(Type serviceType);public object GerService(Type serviceType);
更新相关成员 update related members
//保存由所有修改的对象以及传递到MarkForCreate或MarkForDelete的所有对象表示的改变。// Save the changes represented by all modified objects and all objects passed to MarkForCreate or MarkForDelete.
//如果检测到更新冲突,则可抛出UpdateCollisionException。// An UpdateCollisionException may be thrown if an update conflict is detected.
public void Update();public void Update();
//保存由所指定的对象表示的改变。对象必须已被修改或已被传递到MarkForCreate或// Save the changes represented by the specified object. Object must have been modified or passed to MarkForCreate or
//MarkForDelete,否则抛出ArgumentException。如果检测到更新冲突,//MarkForDelete, otherwise ArgumentException is thrown. If an update conflict is detected,
//可抛出UpdateCollisionException。//UpdateCollisionException can be thrown.
public void Update(object objectToUpdate);public void Update(object objectToUpdate);
public void Update(IEnumerable objectsToUpdate);public void Update(IEnumerable objectsToUpdate);
//从存储中刷新所指定对象的内容。如果对象已被修改,则覆盖改变,且对象不再被认为是已// Refresh the contents of the specified object from storage. If the object has been modified, the changes are overwritten and the object is no longer considered
//改变的。如果指定了除项目、项目扩展或关系对象之外的任何内容,则抛出ArgumentException。 //changed. An ArgumentException is thrown if anything other than an item, itemextension, or relationship object is specified.
public void Refresh(object objectToRefresh);public void Refresh(object objectToRefresh);
public void Refresh(IEnumerable objectsToRefresh);public void Refresh(IEnumerable objectsToRefresh);
//当更新检测到检索修改的对象和试图保存它之间在存储中改变了数据时引发。如果没有注册任// Raised when update detects that data has changed in storage between retrieving the modified object and attempting to save it. If not registered
//何事件处理程序,则更新抛出异常。如果注册了事件处理程序,则它可抛出异常来中止更新,// Any event handler, update throws an exception. If an event handler is registered, it can throw an exception to abort the update,
//包装修改的对象以覆盖存储中的数据,或合并在存储中和对象中做出的改变。//Wrap the modified object to overwrite the data in the store, or merge changes made in the store and in the object.
public event ChangeCollisionEventHandler UpdateCollision;public event ChangeCollisionEventHandler UpdateCollision;
//在更新处理的各点处引发,以提供更新进展信息。//Raised at various points in update processing to provide update progress information.
public event UpdateProgressEventhandler UpdateProgress;public event UpdateProgressEventhandler UpdateProgress;
//Update的异步版本//Asynchronous version of Update
public IAsyncResult BeginUpdate(IAsyncCallback callback,object state);public IAsyncResult BeginUpdate(IAsyncCallback callback, object state);
public IAsyncResult BeginUpdate(object objectToUpdate,public IAsyncResult BeginUpdate(object objectToUpdate,
IAsyncCallback callback,IAsyncCallback callback,
object state);object state);
public IAsyncResult BeginUpdate(IEnumerable objectsToUpdate, public IAsyncResult BeginUpdate(IEnumerable objectsToUpdate,
IAsyncCallback callback,IAsyncCallback callback,
object state);object state);
public void EndUpdate(IAsyncResult result);public void EndUpdate(IAsyncResult result);
//Refresh的异步版本//Asynchronous version of Refresh
public IAsyncResult BeginRefresh(object objectToRefresh,public IAsyncResult BeginRefresh(object objectToRefresh,
IAsyncCallback callback,IAsyncCallback callback,
object state);object state);
public IAsyncResult BeginRefresh(IEnumerable objectsToRefresh, public IAsyncResult BeginRefresh(IEnumerable objectsToRefresh,
IAsyncCallback callback,IAsyncCallback callback,
object state);object state);
public void EndRefresh(IAsyncResult result);public void EndRefresh(IAsyncResult result);
事务相关成员 business related members
//以指定的隔离级别启动事务。默认的隔离级别是ReadCommited。在所有情况下,//Start a transaction with the specified isolation level. The default isolation level is ReadCommited. in all situations,
//启动分布式事务,因为它可能必须包含改变流类型化项目属性。//Start a distributed transaction as it may have to include changing stream typed item properties.
public Transaction BeginTransaction();public Transaction BeginTransaction();
public Transaction BeginTransaction(System.Data.IsolationLevel isolationLevel);public Transaction BeginTransaction(System.Data.IsolationLevel isolationLevel);
搜索相关成员 Search related members
//创建在该项目上下文中搜索指定类型对象的ItemSearcher。如果指定了除项目、关系或//Create an ItemSearcher that searches for objects of the specified type in the context of this item. If an except item, relationship, or
//项目扩展之外的类型,则抛出ArgumentException。//ArgumentException is thrown for types other than project extension.
public ItemSearcher GetSearcher(Type type);public ItemSearcher GetSearcher(Type type);
//给定其ID找出项目。//Find an item given its ID.
public Item FindltemByld(ItemId ItemId);public Item FindltemByld(ItemId ItemId);
//给定其路径找出项目。路径可以是绝对或相对的。如果是相对的,则如果当打开ItemContext//Find an item given its path. Paths can be absolute or relative. If it is relative, then if when opening the ItemContext
//时指定了多个项目域,则抛出NotSupportedException。如果不存在这样的项目,则返回空。//If multiple project domains are specified, NotSupportedException will be thrown. Returns NULL if no such item exists.
//创建到域的\\machine\share部分的连接以检索项目。该项目将与该域相关联。//Create a connection to the \\machine\share part of the domain to retrieve items. The project will be associated with this domain.
public Item FinditemByPath(string path);public Item FinditemByPath(string path);
//给定其路径找出项目。路径相对于指定的项目域。创建到指定域的连接以检索项目。该项目将//Find an item given its path. Paths are relative to the specified project domain. Creates a connection to the specified domain to retrieve items. The project will
//与该域相关联。如果不存在这样的项目,则返回空。// Associated with this domain. Returns NULL if no such item exists.
public Item FindltemByPath(string domain,string path);public Item FindltemByPath(string domain, string path);
//给定其路径找出一组项目。该路径相对于当打开ItemContext时指定的项目域。如果不存在//Find a set of items given their path. The path is relative to the item scope specified when opening the ItemContext. if not present
//这样的项目,则返回空结果。// Such an item returns an empty result.
public FindResult FindAllItemsByPath(string path);public FindResult FindAllItemsByPath(string path);
//给定其ID找出关系。//Find a relationship given its ID.
public Relationship FindRelationshipByld(ItemId itemID, public Relationship FindRelationshipByld(ItemId itemID,
Relationshipld relationshipld);Relationshipld relationshipld);
//给定其ID找出项目扩展。//Find out the project extension given its ID.
public ItemExtension FindItemExtensionByld(ItemId itemId, public ItemExtension FindItemExtensionByld(ItemId itemId,
ItemExtensionId itemExtensionId);ItemExtensionId itemExtensionId);
//找出可任意地满足给定过滤器的指定类型的所有项目、关系或项目扩展。如果指定了//Find all items, relationships, or item extensions of the specified type that arbitrarily satisfy the given filter. if specified
//这些类型之一以外的类型,则抛出ArgumentException。//A type other than one of these types throws an ArgumentException.
public FindResult FindAll(Tyoe type);public FindResult FindAll(Tyoe type);
public FindResult FindAll(Type type,string filter);public FindResult FindAll(Type type, string filter);
//找出满足给定过滤器的指定类型的任何项目、关系或项目扩展。如果指定了这些类型之一// Find any items, relationships, or item extensions of the specified type that satisfy the given filter. If one of these types is specified
//以外的类型,则抛出ArgumentException。如果没有找到这样的对象,则返回空。//Types other than ArgumentException will be thrown. Returns NULL if no such object is found.
public object FindOne(Type type,string filter);public object FindOne(Type type, string filter);
//找出满足给定过滤器的指定类型的项目、关系或项目扩展。如果指定了这些类型之一以外的// Find items, relationships, or item extensions of the specified type that satisfy the given filter. If one of these types other than
//类型,则抛出ArgumentException。如果没有找到这样的对象,则抛出//Type, ArgumentException is thrown. If no such object is found, throws
//ObjectNotFoundException。如果找到一个以上对象,则抛出MultipleObjectsFoundException。//ObjectNotFoundException. If more than one object is found, MultipleObjectsFoundException is thrown.
public object FindOnly(Type type,string filter);public object FindOnly(Type type, string filter);
//如果存在满足给定过滤器的指定类型的项目、关系或项目扩展,则返回真。如果指定了这些// Returns true if there is an item, relationship, or item extension of the specified type that satisfies the given filter. If these are specified
//类型之一以外的类型,则抛出ArgumentException。//An ArgumentException is thrown for a type other than one of the types.
public bool Exists(Type type,string filter);public bool Exists(Type type, string filter);
//指定由涉及对象的搜索返回的对象如何标识由ItemContext维护的映射。// Specifies how objects returned by searches involving objects identify the map maintained by the ItemContext.
public SearchCollisionMode SearchCollisionMode{get;set;}public SearchCollisionMode SearchCollisionMode{get;set;}
//当为ResultMapping指定了PreserveModifiedObject时引发。该事件允许应用程序选择性地用//Raised when PreserveModifiedObject is specified for ResultMapping. This event allows an application to optionally use the
//以该搜索检索到俄数据来更新修改的对象。//Update the modified object with the Russian data retrieved by this search.
public event ChangeCollisionEventHandler SearchCollision;public event ChangeCollisionEventHandler SearchCollision;
//将来自另一ItemContext的对象结合到该项目上下文中。如果表示同一项目、关系或项目扩展的// Combine objects from another ItemContext into this item context. If denoting the same item, relationship, or item extension
//对象并未在该ItemContext的身份映射中存在,则创建该对象的克隆并将其添加到该映射。如果// If the object does not exist in the ItemContext's identity map, create a clone of the object and add it to the map. if
//对象的确存在,则用指定对象的状态和内容以与SearchCollisionMode一致的方式更新该对象。//If the object does exist, update the object with the state and content of the specified object in a manner consistent with SearchCollisionMode.
public Item IncorporateItem(Item item);public Item IncorporateItem(Item item);
public Relationship IncorporateRelationship(Relationship relationship);public Relationship IncorporateRelationship(Relationship relationship);
public ItemExtension IncorporateItemExtension(ItemExtension itemExtension);public ItemExtension IncorporateItemExtension(ItemExtension itemExtension);
}}
//用于ItemContext.UpdateCollision和ItemSearcher.SearchCollision事件的处理程序。//Handlers for the ItemContext.UpdateCollision and ItemSearcher.SearchCollision events.
public delegate void ChangeCollisionEventHandler(object source,public delegate void ChangeCollisionEventHandler(object source,
ChangeCollisionEventArgs args);ChangeCollisionEventArgs args);
//用于ChangeCollisionEventHandler委托的自变量//Arguments for the ChangeCollisionEventHandler delegate
public class ChangeCollisionEventArgs:EventArgspublic class ChangeCollisionEventArgs:EventArgs
{{
//修改的项目、项目扩展或关系对象。//Modified item, item extension or relationship object.
public object ModifiedObject{get;}public object ModifiedObject{get;}
//来自存储的属性// Attributes from storage
public IDictionary StoredProperties{get;}public IDictionary StoredProperties{get;}
}}
//用于ItemContext.UpdateProgress的处理程序//Handler for ItemContext.UpdateProgress
public delegate void UpdateProgressEventHandler(ItemContext itemContext,public delegate void UpdateProgressEventHandler(ItemContext itemContext,
UpdateProgressEventArgs args);UpdateProgressEventArgs args);
//用于UpdateProgressEventHandler委托的自变量//Arguments for the UpdateProgressEventHandler delegate
public class ChangeCollisionEventArgs:EventArgspublic class ChangeCollisionEventArgs:EventArgs
{{
//当前更新操作//Current update operation
public UpdateOperation CurrentOperation{get;}public UpdateOperation CurrentOperation{get;}
//当前更新的对象//Currently updated object
public object CurrentObject{get;}public object CurrentObject{get;}
}}
//指定由涉及对象的搜索返回的对象如何标识由ItemContext维护的映射。// Specifies how objects returned by searches involving objects identify the map maintained by the ItemContext.
public enum SearchCollisionModepublic enum SearchCollisionMode
{{
//指示应当创建和返回新对象。忽略身份映射中表示同一项目、项目扩展或关系的对象。如果// Indicates that a new object should be created and returned. Objects in the identity map that represent the same item, item extension, or relationship are ignored. if
//指定了该选项,则不引发SearchCollision事件。//If this option is specified, the SearchCollision event will not be triggered.
DoNotMapSearchResults,DoNotMapSearchResults,
//指示应返回来自身份映射的对象。如果应用程序修改了对象的内容,则保存修改的对象的内容。// Indicates that an object from the identity map should be returned. If the application modifies the contents of the object, save the modified contents of the object.
//如果未修改对象,则用由搜索返回的数据更新其内容。应用程序可提供用于SearchCollision// If the object has not been modified, update its contents with the data returned by the search. Apps available for SearchCollision
//事件的处理程序,并在需要时选择性地更新对象。//Handler for the event and optionally updates the object if needed.
PreserveModifiedObjects,PreserveModifiedObjects,
//指示应返回来自身份映射的对象。使用由搜索返回的数据更新对象的内容,即使对象已被应用// Indicates that an object from the identity map should be returned. Update the object's content with the data returned by the search, even if the object has been applied
//程序修改。如果指定了该选项,则不引发SearchCollision事件。//Program modification. If this option is specified, the SearchCollision event is not raised.
OverwriteModifiedObjects OverwriteModifiedObjects
}}
//当前更新操作//Current update operation
public enum UpdateOperationpublic enum UpdateOperation
{{
//当首次调用Update时提供。CurrentObject将为空。// Provided when Update is called for the first time. CurrentObject will be null.
OverallUpdateStarting,OverallUpdateStarting,
//仅在成功更新后的Update返回之前提供。CurrentObject将为空。// Provided only before Update returns after a successful update. CurrentObject will be null.
OverallUpdateCompletedSuccessfully,OverallUpdateCompletedSuccessfully,
//仅在Update抛出异常之前提供。CurrentObject将是异常对象。// Provided only before Update throws an exception. CurrentObject will be the exception object.
OverallUpdateCompletedUnsuccessfully,OverallUpdateCompletedUnsuccessfully,
//当启动对象的更新时提供。CurrentObject将引用用于更新的对象。// Provided when the update of the object is started. CurrentObject will refer to the object used for updates.
ObjectUpdateStaring,ObjectUpdateStarting,
//当需要新连接时提供。CurrentObject将是包含标识传递给ItemContext.Open或从关系的// Provided when a new connection is required. CurrentObject will be the one containing the id passed to ItemContext.Open or from a relation
//Location字段检索的项目域的路径的串。//The string of the path of the project field retrieved by the Location field.
OpeningConnectionOpeningConnection
}}
}}
附录BAppendix B
namespace System.Storagenamespace System.Storage
{{
//在项目上下文中执行跨特定类型的搜索。// Perform a search across specific types in the project context.
public class ItemSearcherpublic class ItemSearcher
{{
构造函数 Constructor
public ItemSearcher();public ItemSearcher();
public ItemSearcher(Type targetType,ItemContext context);public ItemSearcher(Type targetType, ItemContext context);
public ItemSearcher(Type targetType,ItemContext context,public ItemSearcher(Type targetType, ItemContext context,
params SearchExpression[]filters);params SearchExpression[] filters);
属性 Attributes
//用于标识匹配对象的过滤器。//Filter used to identify matching objects.
public SearchExpressionCollection Filters{get;}public SearchExpressionCollection Filters { get; }
//指定将被搜索的域的ItemContext。//Specifies the ItemContext of the field that will be searched.
public ItemContext ItemContext{get;set;}public ItemContext ItemContext { get; set; }
//搜索参数集合。//A collection of search parameters.
public ParameterCollection Parameters{get;}public ParameterCollection Parameters{get;}
//搜索器将用于操作的类型。对于简单的搜索,这是将返回的对象的类型。// The type of searcher that will be used for operations. For simple searches, this is the type of object that will be returned.
public Type TargetType{get;set;}public Type TargetType { get; set; }
搜索方法 search method
//找出满足由Filters指定的条件的TargetType的对象。如果不存在这样的对象,则返回空的// Find objects of TargetType that meet the conditions specified by Filters. Returns empty if no such object exists
//FindResult。//FindResult.
public FindResult FindAll();public FindResult FindAll();
public FindResult FindAll(FindOptions findOptions);public FindResult FindAll(FindOptions findOptions);
public FindResult FindAll(params SortOption[]sortOptions);public FindResult FindAll(params SortOption[]sortOptions);
//找出满足由Filters指定的条件的TargetType的任何一个对象。如果不存在这样的对象则返回空。//Find out any object of TargetType that satisfies the condition specified by Filters. Returns null if no such object exists.
public object FindOne();public object FindOne();
public object FindOne(FindOptions findOptions);public object FindOne(FindOptions findOptions);
public object FindOne(params SortOption[]sortOptions);public object FindOne(params SortOption[]sortOptions);
//找出满足由Filters指定的条件的TargetType。如果未找到这样的对象则抛出//Find the TargetType that satisfies the conditions specified by Filters. thrown if no such object is found
//ObjectNotFoundException。如果找到一个以上对象,则抛出MultipleObjectsFoundException。//ObjectNotFoundException. If more than one object is found, MultipleObjectsFoundException is thrown.
public object FindOnly();public object FindOnly();
public object FindOnly(FindOptions findOptions);public object FindOnly(FindOptions findOptions);
//确定满足由Filters指定的条件的TargetType的对象是否存在。//Determine whether an object of TargetType that satisfies the conditions specified by Filters exists.
public bool Exists();public bool Exists();
//创建可用于更有效地重复执行同一搜索的对象。//Create objects that can be used to more efficiently perform the same search repeatedly.
public PreparedFind PrepareFind();public PreparedFind PrepareFind();
public PreparedFind PrepareFind(FindOptions findOptions);public PreparedFind PrepareFind(FindOptions findOptions);
public PreparedFind PrepareFind(params SortOption[]sortOptions);public PreparedFind PrepareFind(params SortOption[]sortOptions);
//检索将由FindAll()返回的记录的数目。// Retrieve the number of records that will be returned by FindAll().
public int GetCount();public int GetCount();
//各种方法的异步版本//Asynchronous versions of various methods
public IAsyncResult BeginFindAll(AsyncCallback callback,public IAsyncResult BeginFindAll(AsyncCallback callback,
object state);object state);
public IAsyncResult BeginFindAll(FindOptions findOptions,public IAsyncResult BeginFindAll(FindOptions findOptions,
AsyncCallback callback,AsyncCallback callback,
object state);object state);
public IAsyncResult BeginFindAll(SortOption[]sortOptions,public IAsyncResult BeginFindAll(SortOption[]sortOptions,
AsyncCallback callback,AsyncCallback callback,
object state);object state);
public FindResult EndFindAll(IAsyncResult ar);public FindResult EndFindAll(IAsyncResult ar);
public IAsyncResult BeginFindOne(AsyncCallback callback,public IAsyncResult BeginFindOne(AsyncCallback callback,
object state);object state);
public IAsyncResult BeginFindOne(FindOptions findOptions,public IAsyncResult BeginFindOne(FindOptions findOptions,
AsyncCallback callback,AsyncCallback callback,
object state);object state);
public IAsyncResult BeginFindOne(SortOption[]sortOptions,public IAsyncResult BeginFindOne(SortOption[]sortOptions,
AsyncCallback callback,AsyncCallback callback,
object state);object state);
public object EndFindOne(IAsyncResult asyncResult);public object EndFindOne(IAsyncResult asyncResult);
public IAsyncResult BeginFindOnly(AsyncCallback callback,public IAsyncResult BeginFindOnly(AsyncCallback callback,
object state);object state);
public IAsyncResult BeginFindOnly(FindOptions findOptions,public IAsyncResult BeginFindOnly(FindOptions findOptions,
AsyncCallback callback,AsyncCallback callback,
object state);object state);
public IAsyncResult BeginFindOnly(SortOption[]sortOptions,public IAsyncResult BeginFindOnly(SortOption[]sortOptions,
AsyncCallback callback,AsyncCallback callback,
object state);object state);
public object EndFindOnly(IAsyncResult asyncResult);public object EndFindOnly(IAsyncResult asyncResult);
public IAsyncResult BeginGetCount(AsyncCallback callback,public IAsyncResult BeginGetCount(AsyncCallback callback,
object state);object state);
public int EndGetCount(IAsyncResult asyncResult);public int EndGetCount(IAsyncResult asyncResult);
public IAsyncResult BeginExists(AsyncCallback callback,public IAsyncResult BeginExists(AsyncCallback callback,
object state);object state);
public bool EndExists(IAsyncResult asyncResult);public bool EndExists(IAsyncResult asyncResult);
}}
//当执行搜索时使用的选项// options to use when performing the search
public class FindOptionspublic class FindOptions
{{
public FindOptions();public FindOptions();
public FindOptions(params SortOption[]sortOptions);public FindOptions(params SortOption[]sortOptions);
//指定是否应当延迟加载可延迟加载的字段。//Specify whether lazy-loadable fields should be lazy-loaded.
public bool DelayLoad{get;set;}public bool DelayLoad{get;set;}
//返回的匹配的数目。//The number of matches returned.
public int MaxResults{get;set;}public int MaxResults { get; set; }
//排序选项的集合。//A collection of sorting options.
public SortOptionCollextion SortOptions{get;}public SortOptionCollextion SortOptions{get;}
}}
//表示参数名和值//Represent the parameter name and value
public class Parameterpublic class Parameter
{{
//使用名称和值初始化Parameter对象// Initialize the Parameter object with name and value
public Parameter(string name,object value);public Parameter(string name, object value);
//参数名 //parameter name
public string Name{get;}public string Name{get;}
//参数值//parameter value
public object Value{get;set;}public object Value{get;set;}
}}
//参数名/值对的集合//Collection of parameter name/value pairs
public class ParameterCollection:ICollectionpublic class ParameterCollection:ICollection
{{
public ParameterCollection();public ParameterCollection();
public int Count{get;}public int Count{get;}
public object this[string name]{get;set;}public object this[string name]{get;set;}
public object SyncRoot{get;}public object SyncRoot{get;}
public void Add(Parameter parameter);public void Add(Parameter parameter);
public Parameter Add(string name,object value);public Parameter Add(string name, object value);
public bool Contains(Parameter parameter);public bool Contains(Parameter parameter);
public bool Contains(string name);public bool Contains(string name);
public void CopyTo(Parameter[]array,int index);public void CopyTo(Parameter[]array, int index);
void ICollection.CopyTo(Array array,int index);void ICollection.CopyTo(Array array, int index);
IEnumerator IEnumerable.GetEnumerator();IEnumerator IEnumerable. GetEnumerator();
public void Remove(Parameter parameter);public void Remove(Parameter parameter);
public void Remove(string name);public void Remove(string name);
}}
//表示已为重复执行进行优化的搜索。// Indicates a search that has been optimized for repeated execution.
public class PreparedFindpublic class PreparedFind
{{
public ItemContext ItemContext{get;}public ItemContext ItemContext{get;}
public ParameterCollection Parameters{get:}public ParameterCollection Parameters{get:}
public FindResult FindAll();public FindResult FindAll();
public object FindOne();public object FindOne();
public object FindOnly();public object FindOnly();
public bool Exists();public bool Exists();
}}
//指定搜索中使用的排序选项。// Specifies the sorting options used in the search.
public class SortOptionpublic class SortOption
{{
//使用默认值初始化对象。// Initialize the object with default values.
public SortOption();public SortOption();
//使用SearchExpression、order初始化SortOptions对象。//Use SearchExpression and order to initialize the SortOptions object.
public sortOption(SearchExpression searchExpression,SortOrder order);public sortOption(SearchExpression searchExpression, SortOrder order);
//标识将排序的属性的搜索SearchExpression。// The search SearchExpression that identifies the attribute that will be sorted.
public SearchExpression Expression{get;set;}public SearchExpression Expression{get;set;}
//指定升序或降序的排序顺序//Specify ascending or descending sort order
public SortOrder Order{get;set;}public SortOrder Order{get;set;}
}}
//排序选项对象的集合//Collection of sort option objects
public class SortOptionCollection:IListpublic class SortOptionCollection: IList
{{
public SortOptionCollection();public SortOptionCollection();
public SortOption this[int index]{get;set;}public SortOption this[int index]{get;set;}
public int Add(SortOption value);public int Add(SortOption value);
public int Add(SearchExpression expression,SortOrder order);public int Add(SearchExpression expression, SortOrder order);
int IList.Add(object value);int IList. Add(object value);
public void Clear();public void Clear();
public bool Contains(SortOption value);public bool Contains(SortOption value);
bool IList.Contains(object value);bool IList. Contains(object value);
public void CopyTo(SortOption[]array,int index);public void CopyTo(SortOption[]array, int index);
void ICollection.CopyTo(Array array,int index);void ICollection.CopyTo(Array array, int index);
public int Count{get;}public int Count{get;}
IEnumerator IEnumerable.GetEnumerator();IEnumerator IEnumerable. GetEnumerator();
public void Insert(int index,SortOption value);public void Insert(int index, SortOption value);
void IList.Insert(int index,object value);void IList. Insert(int index, object value);
public int indexOf(SortOption value);public int indexOf(SortOption value);
int IList.IndexOf(object value);int IList. IndexOf(object value);
public void Remove(SortOption value);public void Remove(SortOption value);
void IList.Remove(object value);void IList. Remove(object value);
public void RemoveAt(int index);public void RemoveAt(int index);
public object SyncRoot{get;}public object SyncRoot{get;}
}}
//使用SortOption对象指定排序顺序//Use the SortOption object to specify the sort order
public enum SortOrderpublic enum SortOrder
{{
Ascending,Ascending,
DescendingDescending
}}
}}
附录CAppendix C
namespace System.Storagenamespace System.Storage
{{
public abstract class FindResult:IAsyncObjectReaderpublic abstract class FindResult:IAsyncObjectReader
{{
public FindResult();public FindResult();
//将FindResult移至结果中的下一位置。//Move the FindResult to the next position in the results.
public bool Read();public bool Read();
public IAsyncResult BeginRead(AsyncCallback callback,object state);public IAsyncResult BeginRead(AsyncCallback callback, object state);
public bool EndRead(IAsyncResult asyncResult);public bool EndRead(IAsyncResult asyncResult);
//当前对象。//Current object.
public object Current{get;}public object Current{get;}
//返回FindResult是否包含任何对象。//Returns whether the FindResult contains any objects.
public bool HasResults{get;}public bool HasResults{get;}
//返回FindResult是否被关闭。//Returns whether FindResult is closed.
public bool IsClosed{get;}public bool IsClosed{get;}
//返回该FindResult中的项目的类型。// Return the type of the item in this FindResult.
public Type ObjectType{get;}public Type ObjectType{get;}
//关闭FindResult//Close FindResult
public void Close();public void Close();
void IDisposable.Dispose();void IDisposable. Dispose();
//返回FindResult上的枚举器,从当前位置开始。在FindResult上前进任何枚举器将前进所有的// Returns the enumerator on FindResult, starting from the current position. Advancing any enumerator on FindResult will advance all
//枚举器以及FindResult本身。// Enumerator and FindResult itself.
IEnumerator IEnumerable.GetEnumerator();IEnumerator IEnumerable. GetEnumerator();
public FindResultEnumerator GetEnumerator();public FindResultEnumerator GetEnumerator();
}}
public abstract class FindResultEnumerator:IEnumerator,IDisposablepublic abstract class FindResultEnumerator:IEnumerator, IDisposable
{{
public abstract object Current{get;}public abstract object Current{get;}
public abstract bool MoveNext();public abstract bool MoveNext();
public abstract void Reset();public abstract void Reset();
public abstract void Close();public abstract void Close();
void IDisposable.Dispose();void IDisposable. Dispose();
}}
}}
namespace Systemnamespace System
{{
//用于在对象上迭代的公共接口//Public interface for iterating over objects
public interface iObjectReader:IEnumerable,IDisposablepublic interface iObjectReader: IEnumerable, IDisposable
{{
object Current{get;}objectCurrent{get;}
bool IsClosed{get;}bool IsClosed{get;}
bool HasResults{get;}bool HasResults{get;}
Type objectType{get;}Type objectType { get; }
bool Read();bool Read();
void Close();void Close();
}}
//向IObjectReader添加异步方法//Add an asynchronous method to IObjectReader
public interface IAsyncObjectReader:IObjectReaderpublic interface IAsyncObjectReader:IObjectReader
{{
IAsyncResult BeginRead(AsyncCallback callback,object state); IAsyncResult BeginRead(AsyncCallback callback, object state);
bool EndRead(IAsyncResult result);bool EndRead(IAsyncResult result);
}}
}}
Claims (61)
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
PCT/US2003/026144 WO2005029313A1 (en) | 2003-08-21 | 2003-08-21 | Systems and methods for data modeling in an item-based storage platform |
Publications (2)
Publication Number | Publication Date |
---|---|
CN1820245A CN1820245A (en) | 2006-08-16 |
CN100570549C true CN100570549C (en) | 2009-12-16 |
Family
ID=34374761
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CNB038269430A Expired - Fee Related CN100570549C (en) | 2003-08-21 | 2003-08-21 | System and method for data modeling in a project-based storage platform |
Country Status (9)
Country | Link |
---|---|
EP (1) | EP1658555A4 (en) |
JP (1) | JP4394643B2 (en) |
KR (1) | KR101024730B1 (en) |
CN (1) | CN100570549C (en) |
AU (1) | AU2003259959B2 (en) |
BR (1) | BR0318469A (en) |
CA (1) | CA2533088C (en) |
MX (1) | MXPA06001986A (en) |
WO (1) | WO2005029313A1 (en) |
Families Citing this family (37)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8171479B2 (en) | 2004-09-30 | 2012-05-01 | Citrix Systems, Inc. | Method and apparatus for providing an aggregate view of enumerated system resources from various isolation layers |
US7711835B2 (en) | 2004-09-30 | 2010-05-04 | Citrix Systems, Inc. | Method and apparatus for reducing disclosure of proprietary data in a networked environment |
US7748032B2 (en) | 2004-09-30 | 2010-06-29 | Citrix Systems, Inc. | Method and apparatus for associating tickets in a ticket hierarchy |
US8095940B2 (en) | 2005-09-19 | 2012-01-10 | Citrix Systems, Inc. | Method and system for locating and accessing resources |
US7680758B2 (en) | 2004-09-30 | 2010-03-16 | Citrix Systems, Inc. | Method and apparatus for isolating execution of software applications |
US8613048B2 (en) | 2004-09-30 | 2013-12-17 | Citrix Systems, Inc. | Method and apparatus for providing authorized remote access to application sessions |
US8024568B2 (en) | 2005-01-28 | 2011-09-20 | Citrix Systems, Inc. | Method and system for verification of an endpoint security scan |
US9621666B2 (en) | 2005-05-26 | 2017-04-11 | Citrix Systems, Inc. | Systems and methods for enhanced delta compression |
US9407608B2 (en) | 2005-05-26 | 2016-08-02 | Citrix Systems, Inc. | Systems and methods for enhanced client side policy |
US9692725B2 (en) | 2005-05-26 | 2017-06-27 | Citrix Systems, Inc. | Systems and methods for using an HTTP-aware client agent |
US8943304B2 (en) | 2006-08-03 | 2015-01-27 | Citrix Systems, Inc. | Systems and methods for using an HTTP-aware client agent |
US7756826B2 (en) | 2006-06-30 | 2010-07-13 | Citrix Systems, Inc. | Method and systems for efficient delivery of previously stored content |
US8131825B2 (en) | 2005-10-07 | 2012-03-06 | Citrix Systems, Inc. | Method and a system for responding locally to requests for file metadata associated with files stored remotely |
US7779034B2 (en) | 2005-10-07 | 2010-08-17 | Citrix Systems, Inc. | Method and system for accessing a remote file in a directory structure associated with an application program executing locally |
US20070174429A1 (en) | 2006-01-24 | 2007-07-26 | Citrix Systems, Inc. | Methods and servers for establishing a connection between a client system and a virtual machine hosting a requested computing environment |
JP5149570B2 (en) * | 2006-10-16 | 2013-02-20 | キヤノン株式会社 | File management apparatus, file management apparatus control method, and program |
US8533846B2 (en) | 2006-11-08 | 2013-09-10 | Citrix Systems, Inc. | Method and system for dynamically associating access rights with a resource |
US7853679B2 (en) | 2007-03-12 | 2010-12-14 | Citrix Systems, Inc. | Systems and methods for configuring handling of undefined policy events |
US7865589B2 (en) | 2007-03-12 | 2011-01-04 | Citrix Systems, Inc. | Systems and methods for providing structured policy expressions to represent unstructured data in a network appliance |
US8631147B2 (en) | 2007-03-12 | 2014-01-14 | Citrix Systems, Inc. | Systems and methods for configuring policy bank invocations |
US8490148B2 (en) | 2007-03-12 | 2013-07-16 | Citrix Systems, Inc | Systems and methods for managing application security profiles |
US7853678B2 (en) | 2007-03-12 | 2010-12-14 | Citrix Systems, Inc. | Systems and methods for configuring flow control of policy expressions |
US8171483B2 (en) | 2007-10-20 | 2012-05-01 | Citrix Systems, Inc. | Method and system for communicating between isolation environments |
US8090797B2 (en) | 2009-05-02 | 2012-01-03 | Citrix Systems, Inc. | Methods and systems for launching applications into existing isolation environments |
CN102567315A (en) * | 2010-12-08 | 2012-07-11 | 金蝶软件(中国)有限公司 | Method, device and system for data inquiry |
US8732213B2 (en) | 2011-12-23 | 2014-05-20 | Amiato, Inc. | Scalable analysis platform for semi-structured data |
CN102968685A (en) * | 2012-10-26 | 2013-03-13 | 广东电子工业研究院有限公司 | Account information asset management system and method thereof |
KR102053709B1 (en) * | 2014-11-10 | 2019-12-09 | 한국전자통신연구원 | method and apparatus for representation of editable visual object |
CN109271490A (en) * | 2018-11-01 | 2019-01-25 | 中企动力科技股份有限公司 | The classification method and system of dynamic field |
US11132368B2 (en) * | 2019-02-21 | 2021-09-28 | Oracle International Corporation | Recursive data traversal model |
RU2721999C1 (en) * | 2019-03-18 | 2020-05-25 | Сергей Александрович Гайдамаков | Associative network of contacts, notes and/or events |
US11301498B2 (en) * | 2019-08-08 | 2022-04-12 | Sap Portals Israel Ltd. | Multi-cloud object store access |
CN113448584B (en) * | 2020-03-25 | 2023-07-21 | 浙江满趣科技有限公司 | APP version management method, device, medium and computer equipment |
US11940960B2 (en) | 2022-04-21 | 2024-03-26 | Folder Front, LLC | Intelligent folder-based data organization system |
CN117150598B (en) * | 2023-09-05 | 2024-04-02 | 上海易立德信息技术股份有限公司 | Family table management and integration method and system for CAD model construction |
CN118153007B (en) * | 2024-05-10 | 2024-07-30 | 杭州世平信息科技有限公司 | Text-oriented data database watermark embedding method, system and storage medium |
CN119150434B (en) * | 2024-11-18 | 2025-03-14 | 四川凉山水洛河电力开发有限公司 | Hydraulic engineering dam safety monitoring device and monitoring method |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5900870A (en) * | 1989-06-30 | 1999-05-04 | Massachusetts Institute Of Technology | Object-oriented computer user interface |
CN1224875A (en) * | 1998-01-27 | 1999-08-04 | 国际商业机器公司 | Dynamic modification of database management system |
US6108004A (en) * | 1997-10-21 | 2000-08-22 | International Business Machines Corporation | GUI guide for data mining |
US6112024A (en) * | 1996-10-02 | 2000-08-29 | Sybase, Inc. | Development system providing methods for managing different versions of objects with a meta model |
US6370541B1 (en) * | 1999-09-21 | 2002-04-09 | International Business Machines Corporation | Design and implementation of a client/server framework for federated multi-search and update across heterogeneous datastores |
US6556983B1 (en) * | 2000-01-12 | 2003-04-29 | Microsoft Corporation | Methods and apparatus for finding semantic information, such as usage logs, similar to a query using a pattern lattice data space |
US6578046B2 (en) * | 1998-04-01 | 2003-06-10 | International Business Machines Corporation | Federated searches of heterogeneous datastores using a federated datastore object |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4953080A (en) | 1988-04-25 | 1990-08-28 | Hewlett-Packard Company | Object management facility for maintaining data in a computer system |
US5504892A (en) * | 1994-09-08 | 1996-04-02 | Taligent, Inc. | Extensible object-oriented file system |
US5915253A (en) * | 1996-12-13 | 1999-06-22 | Novell, Inc. | Method and system for implementing objects in a storage system |
US6324533B1 (en) | 1998-05-29 | 2001-11-27 | International Business Machines Corporation | Integrated database and data-mining system |
US6704743B1 (en) * | 1999-09-13 | 2004-03-09 | Copernus, Inc. | Selective inheritance of object parameters in object-oriented computer environment |
JP3983961B2 (en) * | 2000-07-18 | 2007-09-26 | 株式会社東芝 | Directory information management apparatus and computer-readable recording medium recording program |
GB2371884A (en) * | 2000-10-12 | 2002-08-07 | Abb Ab | Queries in an object-oriented computer system |
US7376895B2 (en) * | 2001-11-09 | 2008-05-20 | Wuxi Evermore Software, Inc. | Data object oriented repository system |
-
2003
- 2003-08-21 WO PCT/US2003/026144 patent/WO2005029313A1/en active Application Filing
- 2003-08-21 JP JP2005509096A patent/JP4394643B2/en not_active Expired - Fee Related
- 2003-08-21 CN CNB038269430A patent/CN100570549C/en not_active Expired - Fee Related
- 2003-08-21 CA CA2533088A patent/CA2533088C/en not_active Expired - Fee Related
- 2003-08-21 BR BRPI0318469-2A patent/BR0318469A/en not_active IP Right Cessation
- 2003-08-21 EP EP03818743A patent/EP1658555A4/en not_active Ceased
- 2003-08-21 MX MXPA06001986A patent/MXPA06001986A/en active IP Right Grant
- 2003-08-21 AU AU2003259959A patent/AU2003259959B2/en not_active Ceased
- 2003-08-21 KR KR1020067003584A patent/KR101024730B1/en not_active Expired - Fee Related
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5900870A (en) * | 1989-06-30 | 1999-05-04 | Massachusetts Institute Of Technology | Object-oriented computer user interface |
US6112024A (en) * | 1996-10-02 | 2000-08-29 | Sybase, Inc. | Development system providing methods for managing different versions of objects with a meta model |
US6108004A (en) * | 1997-10-21 | 2000-08-22 | International Business Machines Corporation | GUI guide for data mining |
CN1224875A (en) * | 1998-01-27 | 1999-08-04 | 国际商业机器公司 | Dynamic modification of database management system |
US6578046B2 (en) * | 1998-04-01 | 2003-06-10 | International Business Machines Corporation | Federated searches of heterogeneous datastores using a federated datastore object |
US6370541B1 (en) * | 1999-09-21 | 2002-04-09 | International Business Machines Corporation | Design and implementation of a client/server framework for federated multi-search and update across heterogeneous datastores |
US6556983B1 (en) * | 2000-01-12 | 2003-04-29 | Microsoft Corporation | Methods and apparatus for finding semantic information, such as usage logs, similar to a query using a pattern lattice data space |
Also Published As
Publication number | Publication date |
---|---|
JP2007521532A (en) | 2007-08-02 |
CA2533088C (en) | 2014-04-29 |
KR20060080921A (en) | 2006-07-11 |
BR0318469A (en) | 2006-09-12 |
CA2533088A1 (en) | 2005-03-31 |
EP1658555A4 (en) | 2009-05-06 |
KR101024730B1 (en) | 2011-03-25 |
AU2003259959B2 (en) | 2010-02-18 |
CN1820245A (en) | 2006-08-16 |
MXPA06001986A (en) | 2006-05-17 |
AU2003259959A2 (en) | 2005-04-11 |
EP1658555A1 (en) | 2006-05-24 |
WO2005029313A1 (en) | 2005-03-31 |
AU2003259959A1 (en) | 2005-04-11 |
JP4394643B2 (en) | 2010-01-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100550010C (en) | System and method for interfacing an application with an item-based storage platform | |
CN100570549C (en) | System and method for data modeling in a project-based storage platform | |
US7349913B2 (en) | Storage platform for organizing, searching, and sharing data | |
US7529811B2 (en) | Systems and methods for the implementation of a core schema for providing a top-level structure for organizing units of information manageable by a hardware/software interface system | |
US7428546B2 (en) | Systems and methods for data modeling in an item-based storage platform | |
US7483915B2 (en) | Systems and method for representing relationships between units of information manageable by a hardware/software interface system | |
US8131739B2 (en) | Systems and methods for interfacing application programs with an item-based storage platform | |
US7555497B2 (en) | Systems and methods for separating units of information manageable by a hardware/software interface system from their physical organization | |
US7739316B2 (en) | Systems and methods for the implementation of base schema for organizing units of information manageable by a hardware/software interface system | |
CN100458732C (en) | Method and system for synchronizing multiple instances of a data platform | |
US20050055354A1 (en) | Systems and methods for representing units of information manageable by a hardware/software interface system but independent of physical representation | |
CN100565505C (en) | System and method by intermediary's file system or device synchronization computer system | |
JP4580390B2 (en) | System and method for extending and inheriting information units manageable by a hardware / software interface system | |
JP4394644B2 (en) | Storage platform for organizing, searching, and sharing data | |
RU2412461C2 (en) | Systems and methods of interfacing application programs with article based storage platform | |
KR101109390B1 (en) | Systems and methods for providing synchronization services for units of information manageable by a hardware/software interface system | |
ZA200600644B (en) | Systems and methods for interfacing application programs with an item-based storage platform |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
ASS | Succession or assignment of patent right |
Owner name: MICROSOFT TECHNOLOGY LICENSING LLC Free format text: FORMER OWNER: MICROSOFT CORP. Effective date: 20150507 |
|
C41 | Transfer of patent application or patent right or utility model | ||
TR01 | Transfer of patent right |
Effective date of registration: 20150507 Address after: Washington State Patentee after: Micro soft technique license Co., Ltd Address before: Washington State Patentee before: Microsoft Corp. |
|
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20091216 Termination date: 20200821 |