1、Content Repository forJava Technology API 2.0SpecificationJCR 2.0 SpecificationJava Specification Request (JSR) 28310 August 20091 PREFACE61.1 Previous Versions61.2 Coverage61.3 Typographical Conventions71.4 System Requirements71.5 License71.6 Acknowledgements102 INTRODUCTION123 REPOSITORY MODEL133.
2、1 Overview133.2 Names163.3 Identifiers203.4 Paths203.5 Namespace Mapping273.6 Properties293.7 Node Types383.8 Referenceable Nodes593.9 Shareable Nodes Model613.10 Corresponding Nodes643.11 System Node663.12 Unfiled Content673.13 Versioning Model674 CONNECTING834.1 Repository Object834.2 Login844.3 I
3、mpersonate854.4 Session854.5 Workspace865 READING885.1 Direct Access885.2 Traversal Access905.3 Query Access925.4 Relationship among Access Modes925.5 Effect of Access Denial on Read925.6 Item Information935.7 Node Identifier945.8 Node Index945.9 Iterators945.10 Reading Properties955.11 Namespace Ma
4、pping996 QUERY1006.1 Optional Joins1006.2 Introduction to the Abstract Query Model1016.3 Equality and Comparison1026.4 Query Validity1026.5 Search Scope1036.6 Notations1036.7 Abstract Query Model and Language Bindings1056.8 QueryManager1356.9 Query Object1356.10 Literal Values1386.11 QueryResult1386
5、.12 Query Scope1407 EXPORT1427.1 Exporting a Subgraph1427.2 System View1427.3 Document View1447.4 Escaping of Names1467.5 Escaping of Values1477.6 Export API1487.7 Export Scope1497.8 Encoding1498 NODE TYPE DISCOVERY1508.1 NodeTypeManager Object1508.2 NodeType Object1508.3 ItemDefinition Object1528.4
6、 PropertyDefinition Object1538.5 NodeDefinition Object1548.6 Node Type Information for Existing Nodes1559 PERMISSIONS AND CAPABILITIES1579.1 Permissions1579.2 Capabilities15810 WRITING15910.1 Types of Write Methods15910.2 Core Write Methods16110.3 Session and Workspace Objects16110.4 Adding Nodes an
7、d Setting Properties16310.5 Selecting the Applicable Item Definition16610.6 Moving Nodes16610.7 Copying Nodes16710.8 Cloning and Updating Nodes16810.9 Removing Nodes and Properties16910.10 Node Type Assignment17010.11 Saving17210.12 Namespace Registration17511 IMPORT17711.1 Importing Document View17
8、711.2 Import System View17811.3 Respecting Property Semantics17911.4 Determining Node Types17911.5 Determining Property Types17911.6 Event-Based Import Methods18011.7 Stream-Based Import Methods18111.8 Identifier Handling18111.9 Importing jcr:root18212 OBSERVATION18412.1 Event Model18412.2 Scope of
9、Event Reporting18412.3 The Event Object18512.4 Event Bundling18712.5 Asynchronous Observation18712.6 Journaled Observation19012.7 Importing Content19112.8 Exceptions19113 WORKSPACE MANAGEMENT19213.1 Creation and Deletion of Workspaces19214 SHAREABLE NODES19314.1 Creation of Shared Nodes19314.2 Share
10、d Set19314.3 Removing Shared Nodes19414.4 Transient Layer19414.5 Copy19414.6 Share Cycles19514.7 Export19514.8 Import19514.9 Observation19514.10 Locking19514.11 Node Type Constraints19514.12 Versioning19614.13 Restore19614.14 IsSame19614.15 RemoveMixin19614.16 Query19715 VERSIONING19815.1 Creating a
11、 Versionable Node19815.2 Check-In: Creating a Version20215.3 Check-Out20515.4 Version Labels20615.5 Searching Version Histories20815.6 Retrieving Version Storage Nodes20815.7 Restoring a Version20815.8 Removing a Version21215.9 Merge21215.10 Serialization of Version Storage21715.11 Versioning within
12、 a Transaction21715.12 Activities21715.13 Configurations and Baselines22116 ACCESS CONTROL MANAGEMENT22516.1 Access Control Manager22516.2 Privilege Discovery22516.3 Access Control Policies22916.4 Named Access Control Policies23216.5 Access Control Lists23316.6 Privileges Permissions and Capabilitie
13、s23417 LOCKING23617.1 Lockable23617.2 Shallow and Deep Locks23617.3 Lock Owner23617.4 Placing and Removing a Lock23717.5 Lock Token23817.6 Session-Scoped and Open-Scoped Locks23817.7 Effect of a Lock23817.8 Timing Out23917.9 Locks and Persistence23917.10 Locks and Transactions23917.11 LockManager Ob
14、ject24017.12 Lock Object24317.13 LockException24418 LIFECYCLE MANAGEMENT24518.1 mix:lifecycle24518.2 Node Methods24519 NODE TYPE MANAGEMENT24619.1 NodeTypeDefinition24619.2 NodeTypeManager24619.3 Node Type Registration Restrictions24819.4 Templates24820 RETENTION AND HOLD25020.1 Retention Manager250
15、20.2 Placing a Hold25020.3 Effect of a Hold25120.4 Getting the Holds present on a Node25120.5 Removing a Hold25120.6 Hold Object25120.7 Setting a Retention Policy25120.8 Getting a Retention Policy25120.9 Effect of a Retention Policy25120.10 RetentionPolicy object25220.11 Removing a Retention Policy2
16、5221 TRANSACTIONS25321.1 Container Managed Transactions: Sample Request Flow25421.2 User Managed Transactions: Sample Code25421.3 Save vs. Commit25521.4 Single Session Across Multiple Transactions25522 SAME-NAME SIBLINGS25722.1 Scope of Same-Name Siblings25722.2 Addressing Same-Name Siblings by Path
17、25722.3 Reading and Writing Same-Name Siblings25822.4 Properties Cannot Have Same-Name Siblings25922.5 Effect of Access Denial on Read of Same-Name Siblings25923 ORDERABLE CHILD NODES26023.1 Scope of Orderable Child Nodes26023.2 Ordering Child Nodes26023.3 Adding a New Child Node26123.4 Orderable Sa
18、me-Name Siblings26123.5 Non-orderable Child Nodes26123.6 Properties are Never Orderable26124 REPOSITORY COMPLIANCE26224.1 Definition of Support26224.2 Repository Descriptors26224.3 Node Type-Related Features26824.4 Implementation Issues26925 APPENDIX27025.1 Treatment of Identifiers27025.2 Compact No
19、de Type Definition Notation2711 PrefaceThe Content Repository API for Java Technology Specification, Version 2.0 (JCR 2.0 Specification) consists of a normative part and a non-normative part.The normative part consists of: This document, excluding the appendix. The source code of javax.jcr and its s
20、ubpackages. The Javadoc reference.In case of a conflict this document takes precedence over the source code and the source code takes precedence over the Javadoc.The non-normative part consists of: The appendix of this document. The jar file of javax.jcr and its subpackages.The JCR 2.0 Specification
21、 was created and released through the Java Community Process (JCP) under Java Specification Request 283 (JSR 283).1.1 Previous VersionsThe Content Repository for Java Technology API Specification, Version 1.0 (JCR 1.0 Specification) was created and released through the Java Community Process (JCP) u
22、nder Java Specification Request 170 (JSR 170).1.2 CoverageThis document describes the abstract repository model and Java API of JCR. The API is described from a high-level, functional perspective. Consult the accompanying Javadoc for full information on signature variants and exceptions.1.2.1 Classe
23、s and InterfacesUnless otherwise indicated, all Java classes and interfaces mentioned are in the package javax.jcr and its subpackages. Non-JCR classes mentioned are always fully qualified. The only exception is java.lang.String, which is used throughout and written simply as String.1.2.2 Null Param
24、etersWhen describing JCR API methods, this specification and the Javadoc assume that all parameters passed are non-null, unless otherwise stated. If null is passed as parameter and its behavior is not explicitly described in this specification or in the Javadoc, then the behavior of the method in th
25、at case is implementation-specific.1.3 Typographical ConventionsA monospaced font is used for JCR names and paths, and all instances of machine-readable text (Java code, XML, grammars, JCR-SQL2 examples, URIs, etc.).1.3.1 String Literals in Syntactic GrammarsFormal grammars are used at various place
26、s in the specification to define the syntax of string-based entities such as names, paths, search languages and other notations.When a string literal appears as a terminal symbol within a grammar, each character literal in that string corresponds to exactly one Unicode code point.The intended code p
27、oint of such a character literal must be determined only by reference to the Unicode Basic Latin code chart See http:/unicode.org/charts/PDF/U0000.pdf. and no other part of the Unicode character set. Any code point outside the Basic Latin set cannot be the intended code point of such a character lit
28、eral, even if the grapheme of the code point superficially resembles that of the character literal.For example, in the following production (excerpted from 3.2.2 Local Names).InvalidChar := / | : | | | | | *The code points indicated by the character literals are, respectively, U+002F (“/”), U+003A (
29、“:”), U+005B (“), U+005D (“”), U+007C (“|”) and U+002A (“*”).1.4 System RequirementsThe JCR 2.0 requires Java Runtime Environment (JRE) 1.4 or greater.1.5 LicenseDay Management AG (“Licensor”) is willing to license this specification to you ONLY UPON THE CONDITION THAT YOU ACCEPT ALL OF THE TERMS CO
30、NTAINED IN THIS LICENSE AGREEMENT (“Agreement”). Please read the terms and conditions of this Agreement carefully.Content Repository for Java Technology API 2.0 Specification (“Specification”) Status: FCSRelease: 10 August 2009Copyright 2009 Day Management AGBarfuesserplatz 6, 4001 Basel, Switzerlan
31、d.All rights reserved.NOTICE; LIMITED LICENSE GRANTS1. License for Purposes of Evaluation and Developing Applications. Licensor hereby grants you a fully-paid, non-exclusive, non-transferable, worldwide, limited license (without the right to sublicense), under Licensors applicable intellectual prope
32、rty rights to view, download, use and reproduce the Specification only for the purpose of internal evaluation. This includes developing applications intended to run on an implementation of the Specification provided that such applications do not themselves implement any portion(s) of the Specificati
33、on.2. License for the Distribution of Compliant Implementations. Licensor also grants you a perpetual, non-exclusive, non-transferable, worldwide, fully paid-up, royalty free, limited license (without the right to sublicense) under any applicable copyrights or, subject to the provisions of subsectio
34、n 4 below, patent rights it may have covering the Specification to create and/or distribute an Independent Implementation of the Specification that: (a) fully implements the Specification including all its required interfaces and functionality; (b) does not modify, subset, superset or otherwise exte
35、nd the Licensor Name Space, or include any public or protected packages, classes, Java interfaces, fields or methods within the Licensor Name Space other than those required/authorized by the Specification or Specifications being implemented; and (c) passes the Technology Compatibility Kit (includin
36、g satisfying the requirements of the applicable TCK Users Guide) for such Specification (“Compliant Implementation”). In addition, the foregoing license is expressly conditioned on your not acting outside its scope. No license is granted hereunder for any other purpose (including, for example, modif
37、ying the Specification, other than to the extent of your fair use rights, or distributing the Specification to third parties).3. Pass-through Conditions. You need not include limitations (a)-(c) from the previous paragraph or any other particular “pass through” requirements in any license You grant
38、concerning the use of your Independent Implementation or products derived from it. However, except with respect to Independent Implementations (and products derived from them) that satisfy limitations (a)-(c) from the previous paragraph, You may neither: (a) grant or otherwise pass through to your l
39、icensees any licenses under Licensors applicable intellectual property rights; nor (b) authorize your licensees to make any claims concerning their implementations compliance with the Specification.4. Reciprocity Concerning Patent Licenses. With respect to any patent claims covered by the license gr
40、anted under subparagraph 2 above that would be infringed by all technically feasible implementations of the Specification, such license is conditioned upon your offering on fair, reasonable and non-discriminatory terms, to any party seeking it from You, a perpetual, non-exclusive, non-transferable,
41、worldwide license under Your patent rights that are or would be infringed by all technically feasible implementations of the Specification to develop, distribute and use a Compliant Implementation.5. Definitions. For the purposes of this Agreement: “Independent Implementation” shall mean an implemen
42、tation of the Specification that neither derives from any of Licensors source code or binary code materials nor, except with an appropriate and separate license from Licensor, includes any of Licensors source code or binary code materials; “Licensor Name Space” shall mean the public class or interfa
43、ce declarations whose names begin with “java”, “javax”, “javax.jcr” or their equivalents in any subsequent naming convention adopted by Licensor through the Java Community Process, or any recognized successors or replacements thereof; and “Technology Compatibility Kit” or “TCK” shall mean the test s
44、uite and accompanying TCK Users Guide provided by Licensor which corresponds to the particular version of the Specification being tested.6. Termination. This Agreement will terminate immediately without notice from Licensor if you fail to comply with any material provision of or act outside the scop
45、e of the licenses granted above.7. Trademarks. No right, title, or interest in or to any trademarks, service marks, or trade names of Licensor is granted hereunder. Java is a registered trademark of Sun Microsystems, Inc. in the United States and other countries.8. Disclaimer of Warranties. The Spec
46、ification is provided “AS IS”. LICENSOR MAKES NO REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT (INCLUDING AS A CONSEQUENCE OF ANY PRACTICE OR IMPLEMENTATION OF THE SPECIFICATIO
47、N), OR THAT THE CONTENTS OF THE SPECIFICATION ARE SUITABLE FOR ANY PURPOSE. This document does not represent any commitment to release or implement any portion of the Specification in any product.The Specification could include technical inaccuracies or typographical errors. Changes are periodically added to the information therein; these changes will be incorporated into new versions of the Specification, if any. L