Table of Content
1 Preface1.1 Documents Included
2 Introduction
2.1 Motivation
2.2 Goals
3 Use Cases
3.1 Swappability
3.2 Resource Crunch (Personalization)
4 The Repository Model
4.1 API Basics
4.1.1 Traversal Access
4.1.2 Direct Access
4.1.3 Writing to the Repository
4.1.3.1 Removing Items
4.1.3.2 Transient Storage in the Session
4.1.3.3 Transactions
4.1.4 Nodes, Properties and Items
4.2 Compliance Levels
4.3 Same–Name Siblings
4.3.1 Index Notation
4.3.2 Support for Same Name Siblings is Optional
4.3.3 Properties Cannot Have Same Name Siblings
4.4 Orderable Child Nodes
4.4.1 Orderable Same Name Siblings
4.4.2 Non-orderable Child Nodes
4.4.3 Orderable Child Node Support is Optional
4.4.4 Properties are Never Orderable
4.5 Namespaces
4.6 Path Syntax
4.6.1 Names vs. Paths
4.7 Properties
4.7.1 Multi-Value Properties
4.7.2 Reference, Path and Name Property Types
4.7.3 No Null Values
4.8 Node Types
4.9 Referenceable Nodes
4.9.1.1 When UUIDs are Assigned
4.9.1.2 Reference Properties
4.10 Workspaces
4.10.1 Single Workspace Repositories
4.10.2 Multiple Workspaces and Corresponding Nodes
4.10.2.1 Example
4.11 Versioning
4.11.1.1 Relation Between Nodes and Version Histories
4.11.1.2 Example
4.12 Metadata
4.13 Hierarchical versus Direct Access
5 Example Implementations
5.1 A File System-backed Content Repository
5.2 A WebDAV-backed Content Repository
5.3 Database-backed Content Repository
5.4 XML-backed Content Repository
5.5 Namespace Prefixes in the Examples
6 Level 1 Repository Features
6.1 Accessing the Repository
6.1.1 Repository
6.1.1.1 Repository Descriptors
6.1.1.2 Thread Safety of Repository Methods
6.1.2 Credentials
6.2 Reading Repository Content
6.2.1 Session Read Methods
6.2.2 Workspace Read Methods
6.2.3 Node Read Methods
6.2.4 Property Read Methods
6.2.5 Property Types
6.2.5.1 Date
6.2.5.2 Name
6.2.5.3 Path
6.2.5.4 Reference
6.2.6 Property Type Conversion
6.2.7 Value
6.2.7.1 Creating New Value Instances
6.2.7.2 Equality Conditions
6.2.7.3 Value Length
6.2.8 Item Read Methods
6.2.9 Effect of Access Denial on Read
6.2.10 Example
6.3 Namespaces
6.3.1 Namespace Registry
6.3.2 Prefix Syntax
6.3.3 Session Namespace Remapping
6.3.3.1 Using Session Namespace Remapping
6.3.3.2 Scope of Session Namespace Remapping
6.3.4 Internal Storage of Names and Paths
6.4 XML Mappings
6.4.1 System View XML Mapping
6.4.1.1 Example
6.4.2 Document View XML Mapping
6.4.2.1 General Structure
6.4.2.2 Workspace Root
6.4.2.3 XML Text
6.4.2.4 Invalid Item Names
6.4.2.5 Multi-value Properties
6.4.2.6 Example
6.4.3 Escaping of Names
6.4.4 Escaping of Values
6.5 Exporting Repository Content
6.5.1 Encoding
6.6 Searching Repository Content
6.6.1 XPath over Document View
6.6.2 XPath and SQL
6.6.3 Structure of a Query
6.6.3.1 Column Specifier
6.6.3.2 Type Constraint
6.6.3.3 Property Constraint
6.6.3.4 Path Constraint
6.6.3.5 Ordering Specifier
6.6.4 Adapting XPath to the Content Repository
6.6.4.1 Same-Name Siblings
6.6.4.2 Document Order
6.6.4.3 Context Node
6.6.4.4 Mapping Property Types to XML Types
6.6.4.5 Abbreviated Syntax
6.6.4.6 Axes
6.6.4.7 Predicates
6.6.4.8 Boolean Functions
6.6.4.9 Escaping
6.6.4.10 Searching Multi-value Properties
6.6.4.11 Comparison Operators
6.6.4.12 text() Node Test
6.6.4.13 element() Node Test
6.6.5 XPath Extensions
6.6.5.1 jcr:like Function
6.6.5.2 jcr:contains Function
6.6.5.3 jcr:score function
6.6.5.4 jcr:deref Function
6.6.5.5 order by Clause
6.6.6 XPath Grammar
6.6.6.1 Named Terminals
6.6.6.2 Non-Terminals
6.6.6.3 Notes on the Grammar
6.6.7 Search Scope
6.6.8 Query API
6.6.9 QueryManager
6.6.10 The Query Object
6.6.11 Persistent vs. Transient Queries
6.6.12 Query Results
6.6.13 Permissions
6.7 Node Types
6.7.1 Node Type Configuration
6.7.2 What Constitutes a Node Type
6.7.3 Node Type Discovery in Level 1
6.7.4 Primary and Mixin Node Types
6.7.5 Special Properties jcr:primaryType and jcr:mixinTypes
6.7.6 Property Definitions
6.7.7 Child Node Definitions
6.7.8 Inheritance Among Node Types
6.7.9 Discovering available Node Types
6.7.10 Discovering the Node Types of a Node
6.7.11 Discovering the Definition of a Node Type
6.7.12 ItemDefinition
6.7.13 PropertyDefinition
6.7.14 NodeDefinition
6.7.15 Residual Definitions
6.7.16 Value Constraints
6.7.16.1 Choice Lists
6.7.17 Automatic Item Creation
6.7.18 Discovery of Constraints on Existing Items
6.7.19 Predefined Node Types
6.7.19.1 Node Type Definition Notation
6.7.20 Node Type Definitions in Content
6.7.21 Predefined Mixin Node Types
6.7.21.1 mix:lockable
6.7.21.2 mix:referenceable
6.7.21.3 mix:versionable
6.7.22 Predefined Primary Node Types
6.7.22.1 Node Type Inheritance Hierarchy
6.7.22.2 Additions to the Hierarchy
6.7.22.3 nt:base
6.7.22.4 nt:unstructured
6.7.22.5 nt:hierarchyNode
6.7.22.6 nt:file
6.7.22.7 nt:linkedFile
6.7.22.8 nt:folder
6.7.22.9 nt:resource
6.7.22.10 nt:nodeType
6.7.22.11 nt:propertyDefinition
6.7.22.12 nt:childNodeDefinition
6.7.22.13 nt:versionHistory
6.7.22.14 nt:versionLabels
6.7.22.15 nt:version
6.7.22.16 nt:frozenNode
6.7.22.17 nt:versionedChild
6.7.22.18 nt:query
6.8 System Node
6.9 Access Control
6.9.1 JAAS
6.9.2 Checking Permissions
7 Level 2 Repository Features
7.1 Writing Repository Content
7.1.1.1 Writing to Transient Storage
7.1.1.2 Writing Directly to the Workspace
7.1.1.3 Effect of Transactions
7.1.1.4 Invalid States
7.1.1.5 Timing of Validation
7.1.1.6 Session
7.1.1.7 Item
7.1.2 Saving by UUID and Path
7.1.3 Reflecting Item State
7.1.3.1 Re-using Item Objects
7.1.3.2 Effect of Save and Refresh
7.1.3.3 Invalid Items
7.1.3.4 Seeing Changes Made by Other Sessions
7.1.3.5 Resolving Conflicts with Persistent State
7.1.3.6 Item Status
7.1.4 Adding Nodes
7.1.4.1 Example
7.1.5 Adding and Writing Properties
7.1.5.1 Example
7.1.5.2 Setting Multi-value vs. Single-value Properties
7.1.5.3 Creating Value Objects
7.1.6 Removing Nodes and Properties
7.1.7 Moving and Copying
7.1.7.1 Example
7.1.8 Updating and Cloning Nodes across Workspaces
7.1.8.1 Creating a Corresponding Node
7.1.8.2 Update
7.1.8.3 getCorrespondingNodePath
7.1.9 Referenceable Nodes
7.1.10 Treatment of UUIDs
7.1.11 Ordering Child Nodes
7.2 Adding and Deleting Namespaces
7.2.1 Visibility of Namespace Registry Changes
7.3 Importing Repository Content
7.3.1 Import from System View
7.3.2 Import from Document View
7.3.2.1 Roundtripping
7.3.2.2 Example
7.3.3 Respecting Property Semantics
7.3.4 Determining Node Types
7.3.5 Determining Property Types
7.3.6 Workspace Import Methods
7.3.7 Session Import Methods
7.3.8 Importing jcr:root
7.4 Assigning Node Types
7.4.1 The Special Properties jcr:primaryType and jcr:mixinTypes
7.4.2 Assigning a Primary Node Type
7.4.3 Assigning Mixin Node Types
7.4.4 Automatic Addition and Removal of Mixins
7.4.5 Serialization and Node Types
7.5 Thread-Safety Requirements
8 Optional Repository Features
8.1 Transactions
8.1.1 Container Managed Transactions: Sample Request Flow
8.1.2 User Managed Transactions: Sample Code
8.1.3 Save vs. Commit
8.1.4 Single Session Across Multiple Transactions
8.1.5 Mention of Transactions within this Specification
8.2 Versioning
8.2.1 Versionable Nodes
8.2.2 Version Storage
8.2.2.1 jcr:versionStorage
8.2.2.2 Searching and Traversing Version Storage
8.2.2.3 nt:versionHistory
8.2.2.4 nt:versionLabels
8.2.2.5 nt:version
8.2.2.6 nt:frozenNode
8.2.2.7 nt:versionedChild
8.2.2.8 Version Graph
8.2.2.9 Reference Properties within a Version
8.2.2.10 Removal of Versions
8.2.3 The Base Version
8.2.4 Initializing the Version History
8.2.5 Check In
8.2.6 Check Out
8.2.7 Restoring a Version
8.2.8 Restoring a Group of Versions
8.2.9 Update
8.2.10 Merge
8.2.10.1 Merge Algorithm
8.2.10.2 Merging Branches
8.2.11 OnParentVersion Attribute
8.2.11.1 COPY
8.2.11.2 VERSION
8.2.11.3 INITIALIZE
8.2.11.4 COMPUTE
8.2.11.5 IGNORE
8.2.11.6 ABORT
8.2.12 The OnParentVersionAction Class
8.2.13 Removal of Versions
8.2.14 Versioning API
8.2.14.1 Node Versioning Methods
8.2.14.2 Workspace Versioning Methods
8.2.14.3 VersionHistory Interface
8.2.14.4 The Version Interface
8.2.15 Serialization of Version Storage
8.2.16 Versioning within a Transaction
8.3 Observation
8.3.1 Event Listeners
8.3.2 Listener Registration
8.3.3 Observation Manager
8.3.4 Event Production
8.3.5 Event Filtering
8.3.6 Event Bundles
8.3.7 Interpretation of Events
8.3.7.1 Creating a new Node
8.3.7.2 Creating a Property
8.3.7.3 Changing a Property
8.3.7.4 Removing a Child Node
8.3.7.5 Removing a Property
8.3.7.6 Copying a Subtree
8.3.7.7 Moving a Subtree
8.3.7.8 Re-ordering a set of Child Nodes
8.3.7.9 Adding a Mixin
8.3.7.10 Removing a Mixin
8.3.7.11 Checking in a Node
8.3.7.12 Restoring, Updating or Merging a Node
8.3.7.13 Locking and Unlocking a Node
8.3.8 Deserializing Content
8.3.9 External Mechanisms
8.3.10 Location of Listeners
8.3.11 Persistence of Event Listeners
8.3.12 Vetoable Event Listeners
8.3.13 Exceptions
8.4 Locking
8.4.1 Discovery of Lock Capabilities
8.4.2 Lockable
8.4.3 Shallow and Deep Locks
8.4.4 Lock Owner
8.4.5 Placing and Removing a Lock
8.4.6 Lock Token
8.4.7 Session-scoped and Open-scoped Locks
8.4.8 Effect of a Lock
8.4.9 Timing Out
8.4.10 Locks and Transactions
8.4.11 Locking Methods
8.4.12 The Lock Object
8.4.13 Session Methods Related to the Lock Token
8.5 Searching Repository Content with SQL
8.5.1 The SQL Language
8.5.2 Database View
8.5.2.1 Node Types as Tables
8.5.2.2 Pseudo-property jcr:path
8.5.2.3 Path Literals
8.5.2.4 Pseudo-property jcr:score
8.5.2.5 Namespace delimiting colons
8.5.2.6 Joins
8.5.2.7 Multi-value Properties
8.5.2.8 Null Values
8.5.2.9 Undefined Property Types
8.5.2.10 Data Type Mapping
8.5.2.11 Optional Features
8.5.3 SQL EBNF
8.5.4 SQL Syntax in Detail
8.5.4.1 SELECT
8.5.4.2 FROM
8.5.4.3 WHERE
8.5.4.4 LIKE
8.5.4.5 CONTAINS
8.5.4.6 ORDER BY
8.5.5 Query Results
8.4.3 Shallow and Deep Locks
A lock can be specified as either shallow or deep. A shallow lock applies only to its holding node. A deep lock applies to its holding node and all its descendants.
Consequently, there is a distinction between a lock being held by a node and a lock applying to a node. A lock always applies to its holding node. However, if it is a deep lock, it also applies to all nodes in the holding node's subtree. When a lock applies to a node, that node is said to be locked.
Since a deep lock applies to all nodes in the lock-holding node's subtree, this may include both mix:lockable nodes and non-mix:lockable nodes. The deep lock applies to both categories of node equally and it does not add any jcr:lockOwner or jcr:isDeep properties to any of the deep-locked mix:lockable nodes. However, if any such nodes exist and they already have these properties, this means that they are already locked, and hence the attempt to deep lock above them will fail.
Additionally, assuming a deep lock exists above a mix:lockable node any attempt to lock this lower level mix:lockable node will also fail, because it is already locked from above.