You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2005/07/03 13:58:39 UTC
svn commit: r208906 [2/5] - in /incubator/jackrabbit/trunk/contrib/phpcr: ./
PHPCR/ PHPCR/lock/ PHPCR/nodetype/ PHPCR/observation/ PHPCR/query/
PHPCR/util/ PHPCR/version/
Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Node.php
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Node.php?rev=208906&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Node.php (added)
+++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Node.php Sun Jul 3 04:58:33 2005
@@ -0,0 +1,941 @@
+<?php
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+require_once 'PHPCR/AccessDeniedException.php';
+require_once 'PHPCR/nodetype/ConstraintViolationException.php';
+require_once 'PHPCR/nodetype/NoSuchNodeTypeException.php';
+require_once 'PHPCR/nodetype/NodeDefinition.php';
+require_once 'PHPCR/nodetype/NodeType.php';
+require_once 'PHPCR/version/OnParentVersionAction.php';
+/* require_once 'PHPCR/version/Version.php'; */
+require_once 'PHPCR/version/VersionException.php';
+/* require_once 'PHPCR/version/VersionHistory.php'; */
+/* require_once 'PHPCR/version/VersionIterator.php'; */
+require_once 'PHPCR/ItemExistsException.php';
+require_once 'PHPCR/PathNotFoundException.php';
+require_once 'PHPCR/nodetype/NoSuchNodeTypeException.php';
+require_once 'PHPCR/nodetype/ConstraintViolationException.php';
+require_once 'PHPCR/RepositoryException.php';
+require_once 'PHPCR/ValueFormatException.php';
+require_once 'PHPCR/NodeIterator.php';
+require_once 'PHPCR/Property.php';
+require_once 'PHPCR/PropertyIterator.php';
+require_once 'PHPCR/Item.php';
+require_once 'PHPCR/ItemNotFoundException.php';
+require_once 'PHPCR/NoSuchWorkspaceException.php';
+require_once 'PHPCR/UnsupportedRepositoryOperationException.php';
+require_once 'PHPCR/MergeException.php';
+require_once 'PHPCR/lock/Lock.php';
+require_once 'PHPCR/lock/LockException.php';
+require_once 'PHPCR/InvalidItemStateException.php';
+
+
+/**
+ * The <code>Node</code> interface represents a node in the hierarchy that
+ * makes up the repository.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ */
+interface Node extends Item
+{
+ /**
+ * Creates a new node at <code>relPath</code>. The new node will only be
+ * persisted in the workspace when <code>save()</code> and if the structure
+ * of the new node (its child nodes and properties) meets the constraint
+ * criteria of the parent node's node type.
+ * <p/>
+ * If <code>relPath</code> implies intermediary nodes that do not
+ * exist then a <code>PathNotFoundException</code> is thrown.
+ * <p/>
+ * If an item already exists at <code>relPath</code> then an
+ * <code>ItemExistsException</code> is thrown.
+ * <p/>
+ * If an attempt is made to add a node as a child of a
+ * property then a <code>ConstraintViolationException</code> is
+ * thrown immediately (not on <code>save</code>).
+ * <p/>
+ * Since this signature does not allow explicit node type assignment, the
+ * new node's node types (primary and mixin, if applicable) will be
+ * determined immediately (not on save) by the <code>NodeDefinition</code>s
+ * in the node types of its parent. If there is no <code>NodeDefinition</code>
+ * corresponding to the name specified for this new node, then a
+ * <code>ConstraintViolationException</code> is thrown immediately (not on
+ * <code>save</code>).
+ *
+ * @param relPath The path of the new node to be created.
+ * @return The node that was added.
+ * @param primaryNodeTypeName The name of the primary node type of the new node.
+ * @throws ItemExistsException If an item at the specified path already exists.
+ * @throws PathNotFoundException If the specified path implies intermediary
+ * nodes that do not exist.
+ * @throws ConstraintViolationException if If there is no NodeDefinition
+ * corresponding to the name specified for this new node in the parent
+ * node's node type, or if an attempt is made to add a node as a child of a
+ * property.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function addNode( $relPath, $primaryNodeTypeName = null );
+
+ /**
+ * If this node supports child node ordering, this method inserts the child node at
+ * <code>srcChildRelPath</code> before its sibling, the child node at <code>destChildRelPath</code>,
+ * in the child node list.
+ * <p/>
+ * To place the node <code>srcChildRelPath</code> at the end of the list, a <code>destChildRelPath</code>
+ * of <code>null</code> is used.
+ * <p/>
+ * Note that (apart from the case where <code>destChildRelPath</code> is <code>null</code>) both of these
+ * arguments must be relative paths of depth one, in other words they are the names of the child nodes,
+ * possibly suffixed with an index.
+ * <p/>
+ * Changes to ordering of child nodes are persisted on <code>save</code> of the parent node. But, if this node
+ * does not support child node ordering, then a <code>UnsupportedRepositoryOperationException</code>
+ * thrown immediately (i.e., not on <code>save</code>).
+ * <p/>
+ * If <code>srcChildRelPath</code> and <code>destChildRelPath</code> are the same,
+ * then a <code>ConstraintViolationException</code> is thrown.
+ * <p/>
+ * A <code>ConstraintViolationException</code> is also thrown if a node-type or implementation-specific
+ * constraint violation is detected immediately. Otherwise, if the violation can only be detected later,
+ * on <code>save</code>, then that method throws a <code>ConstraintViolationException</code>. Implementations
+ * may differ as to which constraints are enforced immediately, and which on <code>save</code>.
+ * <p/>
+ * If either parameter is not the relative path to a child node of this node, then an
+ * <code>ItemNotFoundException</code> is thrown.
+ * <p/>
+ * A <code>VersionException</code> is thrown if this node is versionable and checked-in or is non-versionable
+ * but its nearest versionable ancestor is checked-in.
+ * <p/>
+ * A <code>LockException</code> is thrown if a lock prevents the re-ordering.
+ *
+ * @param srcChildRelPath the relative path to the child node (i.e., name plus possible index)
+ * to be moved in the ordering
+ * @param destChildRelPath the the relative path to the child node (i.e., name plus possible index)
+ * before which the node <code>srcChildRelPath</code> will be placed.
+ * @throws UnsupportedRepositoryOperationException
+ * if ordering is not supported.
+ * @throws ConstraintViolationException if <code>srcChildRelPath</code> and
+ * <code>destChildRelPath</code> are the same or some implementation-specific ordering restriction is violated.
+ * @throws ItemNotFoundException if either parameter is not the relative path of a child node of this node.
+ * @throws VersionException if this node is versionable and checked-in or is non-versionable but its
+ * nearest versionable ancestor is checked-in.
+ * @throws LockException if a lock prevents the re-ordering.
+ * @throws RepositoryException if another error occurs.
+ */
+ public function orderBefore( $srcChildRelPath, $destChildRelPath );
+
+ /**
+ * This method returns the index of this node within the ordered set of its same-name
+ * sibling nodes. This index is the one used to address same-name siblings using the
+ * square-bracket notation, e.g., <code>/a[3]/b[4]</code>. Note that the index always starts
+ * at 1 (not 0), for compatibility with XPath. As a result, for nodes that do not have
+ * same-name-siblings, this method will always return 1.
+ *
+ * @return The index of this node within the ordered set of its same-name sibling nodes.
+ * @throws RepositoryException if an error occurs.
+ */
+ public function getIndex();
+
+ /**
+ * Adds the existing node at <code>absPath</code> as child of this node, thus adding
+ * <code>this</code> node as an addional parent of the node at <code>absPath</code>.
+ * <p/>
+ * This change will be persisted (if valid) on <code>save</code>.
+ * <p/>
+ * If the node at <code>absPath</code> is not of mixin type
+ * <code>mix:referenceable</code>, a <code>ConstraintViolationException</code>
+ * will be thrown on <code>save</code>.
+ * <p/>
+ * The name of the new child node as accessed from <code>this</code> node
+ * will be the same as its current name in <code>absPath</code> (that is, the last path
+ * segment in that <code>absPath</code>).
+ *
+ * @param absPath The absolute path of the new child node.
+ * @return The new child node.
+ * @param newName The new name for this node when referenced as a child of this node.
+ * @throws PathNotFoundException If no node exists at <code>absPath</code>.
+ * @throws RepositoryException In level 2: If another error occurs.
+ */
+ public function addExistingNode( $absPath, $newName = null );
+
+ /**
+ * Sets the specified property to the specified value. If the property does
+ * not yet exist, it is created. The property type of the property will be
+ * that specified by the node type of <code>this</code> node (the one on
+ * which this method is being called). If the </code>PropertyType</code>
+ * of the supplied <code>Value</code> object (recall that a
+ * <code>Value</code> object records the property type of its
+ * contained value) is different from that required, a best-effort
+ * conversion is attempted.
+ * <p/>
+ * If the node type of the parent node does not specify a
+ * specific property type for the property being set, then
+ * the property type of the supplied <code>Value</code> object
+ * is used.
+ * <p/>
+ * If the property already exists (has previously been set) it assumes
+ * the new value. If the node type of the parent node does not specify a
+ * specific property type for the property being set, then the property
+ * will also assume the new type (if different).
+ * <p/>
+ * To erase a property, use <code>#remove(String relPath)</code>.
+ * <p/>
+ * To persist the addition or change of a property to the workspace
+ * <code>#save</code> must be called on
+ * this node (the parent of the property being set) or a higher-order
+ * ancestor of the property.
+ *
+ * @param name The name of a property of this node
+ * @param value The Value to be assigned, an array of <code>Value</code> objects,
+ * an string representing path to a resource
+ * @param type The type of the property
+ * @return The updated <code>Property</code> object
+ * @throws ValueFormatException if <code>value</code> is incompatible with
+ * (i.e. can not be converted to) the type of the specified property.
+ * @throws ConstraintViolationException if the change would violate
+ * a node-type or other constraint and this implementation performs
+ * this validation immediately instead of waiting until save.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function setProperty( $name, $val, $type = null );
+
+ /**
+ * Returns the node at <code>relPath</code> relative to <code>this</code> node.
+ * The properties and child nodes of the returned node can then be read
+ * (and if permissions allow) changed and written. However, any changes
+ * made to this node, its properties or its child nodes
+ * (and their properties and child nodes, etc.) will only be persisted to
+ * the repository upon calling save.
+ *
+ * @param relPath The relative path of the node to retrieve.
+ * @return The node at <code>relPath</code>.
+ * @throws PathNotFoundException If no node exists at the
+ * specified path.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function getNode( $relPath );
+
+ /**
+ * Returns a <code>NodeIterator</code> over all child <code>Node</code>s of
+ * this <code>Node</code>. Does <i>not</i> include properties of this
+ * <code>Node</code>. The same <code>save</code> and re-acquisition
+ * semantics apply as with <code>#getNode(String)</code>.
+ *
+ * @param namePattern a name pattern
+ * @return A <code>NodeIterator</code> over all child <code>Node</code>s of
+ * this <code>Node</code>.
+ * @throws RepositoryException If an unexpected error occurs.
+ */
+ public function getNodes( $namePattern = null );
+
+ /**
+ * Returns the property at <code>relPath</code> relative to <code>this</code>
+ * node. The same <code>save</code> and re-acquisition
+ * semantics apply as with <code>#getNode(String)</code>.
+ *
+ * @param relPath The relative path of the property to retrieve.
+ * @return The property at <code>relPath</code>.
+ * @throws PathNotFoundException If no property exists at the
+ * specified path.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function getProperty( $relPath );
+
+ /**
+ * Returns all properties of this node.
+ * Returns a <code>PropertyIterator</code> over all properties
+ * of this node. Does <i>not</i> include child <i>nodes</i> of this
+ * node. The same <code>save</code> and re-acquisition
+ * semantics apply as with <code>#getNode(String)</code>.
+ *
+ * @param namePattern a name pattern
+ * @return A <code>PropertyIterator</code>.
+ * @throws RepositoryException If an error occurs.
+ */
+ public function getProperties( $namePattern = null );
+
+ /**
+ * Returns all <code>REFERENCE</code> properties that refer to this node.
+ * <p/>
+ * Note that in level 2 implementations, this method returns only saved properties (in a transactional setting
+ * this includes both those properties that have been saved but not yet committed,
+ * as well as properties that have been committed). This method does not return <code>REFERENCE</code>
+ * properties that have been added but not yet saved.
+ * <p/>
+ * In implementaions that support versioing, this method does not return <code>REFERENCE</code> properties
+ * that are part of the frozen state of a version in version storage.
+ * <p/>
+ * If this node has no references, an empty iterator is returned.
+ *
+ * @return A <code>PropertyIterator</code>.
+ * @throws RepositoryException if an error occurs
+ */
+ public function getReferences();
+
+ /**
+ * Returns the first property of <i>this</i> node found with the specified value.
+ * What makes a particular property "first" (that is, the search order) is
+ * implementaion dependent. If the specified value and the value of a
+ * property are of different types then a conversion is attempted before the
+ * equality test is made. Returns <code>null</code> if no such property is
+ * found. In the case of multivalue properties, a property qualifies as
+ * having the specified value if and only if at least one of its values matches.
+ * The same <code>save</code> and re-acquisition
+ * semantics apply as with <code>#getNode(String)</code>.
+ *
+ * @param value A <code>Value</code> object.
+ * @return The first property of <i>this</i> node found with the specified value.
+ * @throws RepositoryException If an unexpected error occurs.
+ */
+ public function findProperty( Value $value );
+
+ /**
+ * Returns all properties of <i>this</i> node with the specified value.
+ * If the spedified value and the value of a property are of different types
+ * then a conversion is attempted before the equality test is made. Returns
+ * an empty iterator if no such property could be found. In the case of
+ * multivalue properties, a property qualifies as having the specified value
+ * if and only if at least one of its values matches.
+ * The same <code>save</code> and re-acquisition
+ * semantics apply as with <code>#getNode(String)</code>.
+ *
+ * @param value A <code>Value</code> object.
+ * @return A PropertyIterator holding all properties of this node with the
+ * specified value. Returns an empty iterator if no such property could be found.
+ * @throws RepositoryException If an unexpected error occurs.
+ */
+ public function findProperties( Value $value );
+
+ /**
+ * Returns the deepest primary child item accessible via a chain of
+ * primary child items from this node.
+ * A node's type can specifiy a maximum of one of
+ * its child items (child node or property) as its <i>primary child item</i>.
+ * This method traverses the chain of primary child items of this node
+ * until it either encounters a property or encounters a node that does not
+ * have a primary child item. It then returns that property or node. If
+ * this node itself (the one that this method is being called on) has no
+ * primary child item then this method throws a
+ * <code>ItemNotFoundException</code>. The same <code>save</code> and re-acquisition
+ * semantics apply as with <code>#getNode(String)</code>.
+ *
+ * @return the deepest primary child item accessible from this node via
+ * a chain of primary child items.
+ * @throws ItemNotFoundException if this node does not have a primary
+ * child item.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function getPrimaryItem();
+
+ /**
+ * Returns the UUID of this node as recorded in the node's jcr:UUID
+ * property. This method only works on nodes of mixin node type
+ * <code>mix:referenceable</code>. On nonreferenceable nodes, this method
+ * throws an <code>UnsupportedRepositoryOperationException</code>.
+ *
+ * @return the UUID of this node
+ * @throws UnsupportedRepositoryOperationException If this node nonreferenceable.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function getUUID();
+
+ /**
+ * Indicates whether a node exists at <code>relPath</code>
+ * Returns <code>true</code> if a node exists at <code>relPath</code> and
+ * <code>false</code> otherwise.
+ *
+ * @param relPath The path of a (possible) node.
+ * @return <code>true</code> if a node exists at <code>relPath</code>;
+ * <code>false</code> otherwise.
+ * @throws RepositoryException If an unspecified error occurs.
+ */
+ public function hasNode( $relPath );
+
+ /**
+ * Indicates whether a property exists at <code>relPath</code>
+ * Returns <code>true</code> if a property exists at <code>relPath</code> and
+ * <code>false</code> otherwise.
+ *
+ * @param relPath The path of a (possible) property.
+ * @return <code>true</code> if a property exists at <code>relPath</code>;
+ * <code>false</code> otherwise.
+ * @throws RepositoryException If an unspecified error occurs.
+ */
+ public function hasProperty( $relPath );
+
+ /**
+ * Indicates whether this node has child nodes.
+ * Returns <code>true</code> if this node has one or more child nodes;
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if this node has one or more child nodes;
+ * <code>false</code> otherwise.
+ * @throws RepositoryException If an unspecified error occurs.
+ */
+ public function hasNodes();
+
+ /**
+ * Indicates whether this node has properties.
+ * Returns <code>true</code> if this node has one or more properties;
+ * <code>false</code> otherwise.
+ *
+ * @return <code>true</code> if this node has one or more properties;
+ * <code>false</code> otherwise.
+ * @throws RepositoryException If an unspecified error occurs.
+ */
+ public function hasProperties();
+
+ /**
+ * Returns the primary node type of this node.
+ *
+ * @return a <code>NodeType</code> object.
+ */
+ public function getPrimaryNodeType();
+
+ /**
+ * Returns an array of NodeType objects representing the mixin node types
+ * assigned to this node.
+ *
+ * @return a <code>NodeType</code> object.
+ */
+ public function getMixinNodeTypes();
+
+ /**
+ * Indicates whether this node is of the specified node type.
+ * Returns <code>true</code> if this node is of the specified node type
+ * or a subtype of the specified node type. Returns <code>false</code> otherwise.
+ * This method provides a quick method for determining whether
+ * a particular node is of a particular type without having to
+ * manually search the inheritance hierarchy (which, in some implementations
+ * may be a multiple-inhertiance hierarchy, making a manual search even
+ * more complex). This method works for both perimary node types and mixin
+ * node types.
+ *
+ * @param nodeTypeName the name of a node type.
+ * @return true if this node is of the specified node type
+ * or a subtype of the specified node type; returns false otherwise.
+ * @throws RepositoryException If an unspecified error occurs.
+ */
+ public function isNodeType( $nodeTypeName );
+
+ /**
+ * Adds the specified mixin node type to this node. If a conflict with
+ * another assigned mixin or the main node type results, then an exception
+ * is thrown on save. Adding a mixin node type to a node immediately adds
+ * the name of that type to the list held in that node�s
+ * <code>jcr:mixinTypes</code> property.
+ *
+ * @param mixinName
+ */
+ public function addMixin( $mixinName );
+
+ /**
+ * Removes the specified mixin node type from this node. Also removes <code>mixinName</code>
+ * from this node's <code>jcr:mixinTypes</code> property. The mixin node type removal
+ * takes effect on <code>save</code>.
+ * <p/>
+ * If this node does not have the specified mixin, a <code>NoSuchNodeTypeException</code> is thrown.
+ * <p/>
+ * A <code>ConstraintViolationException</code> will be thrown if the removal of a mixin is not allowed
+ * (implementations are free to enforce any policy they like with regard to mixin removal).
+ * <p/>
+ * A <code>VersionException</code> is thrown if this node is versionable and checked-in or is
+ * non-versionable but its nearest versionable ancestor is checked-in.
+ * <p/>
+ * A <code>LockException</code> is thrown if a lock prevents the removal of the mixin.
+ *
+ * @param mixinName the name of the mixin node type to be removed.
+ * @throws NoSuchNodeTypeException If the specified <code>mixinName</code>
+ * is not currently assigned to this node.
+ * @throws ConstraintViolationException If the specified mixin node type
+ * is prevented from being removed.
+ * @throws VersionException if this node is versionable and checked-in or is non-versionable but its
+ * nearest versionable ancestor is checked-in.
+ * @throws LockException if a lock prevents the removal of the mixin.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function removeMixin( $mixinName );
+
+ /**
+ * Returns <code>true</code> if the specified mixin node type,
+ * <code>mixinName</code>, can be added to this node. Returns
+ * <code>false</code> otherwise. Addition of a mixin can be
+ * prevented for any of the following reasons:
+ * <ul>
+ * <li>
+ * The mixin's definition conflicts with the existing primary node type or one of the
+ * existing mixin node types.
+ * </li>
+ * <li>
+ * The node is versionable and checked-in or is non-versionable and its nearest
+ * versionable ancestor is checked-in.
+ * </li>
+ * <li>
+ * The addition is prevented because this node is protected
+ * (as defined in this node's NodeDefinition, found in this node's parent's node type).
+ * </li>
+ * <li>
+ * The addition is prevented due to access control restrictions.
+ * </li>
+ * <li>
+ * The addition is prevented due to a lock.
+ * </li>
+ * <li>
+ * The addition is prevented for implementation-specific reasons.
+ * </li>
+ * </ul>
+ *
+ * @param mixinName
+ * @return <code>true</code> if the specified mixin node type,
+ * <code>mixinName</code>, can be added to this node; <code>false</code> otherwise.
+ * @throws RepositoryException if an error occurs.
+ */
+ public function canAddMixin( $mixinName );
+
+ /**
+ * Returns the definition of <i>this</i> <code>Node</code>. This method is
+ * actually a shortcut to searching through this node's parent's node type
+ * (and its supertypes) for the child node definition applicable to this
+ * node.
+ *
+ * @return a <code>NodeDefinition</code> object.
+ * @see NodeType#getChildNodeDefinitions
+ */
+ public function getDefinition();
+
+ /**
+ * Creates a new version with a system generated version name and returns that version.
+ *
+ * @return a <code>Version</code> object
+ * @throws UnsupportedRepositoryOperationException if versioning is not supported.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function checkin();
+
+ /**
+ * Sets this versionable node to checked-out status by setting its
+ * <code>jcr:isCheckedOut</code> property to true.
+ *
+ * @throws UnsupportedRepositoryOperationException if versioning is not supported.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function checkout();
+
+ /**
+ * Updates this node to reflect the state (i.e., have the same properties
+ * and child nodes) of this node's corresponding node in srcWorkspace (that
+ * is, the node in srcWorkspace with the same UUID as this node). If
+ * shallow is set to false, then only this node is updated. If shallow is
+ * set to true then every node with a UUID in the subtree rooted at this
+ * node is updated. If the current ticket does not have sufficient rights
+ * to perform the update or the specified workspace does not exist, a
+ * <code>NoSuchWorkspaceException</code> is thrown. If another error occurs
+ * then a RepositoryException is thrown. If the update succeeds the changes
+ * made to this node are persisted immediately, there is no need to call
+ * save.
+ *
+ * @param srcWorkspaceName the name of the source workspace.
+ * @param shallow a boolean
+ * @throws RepositoryException If another error occurs.
+ */
+ public function update( $srcWorkspaceName, $shallow );
+
+ /**
+ * This method can be thought of as a version-sensitive update
+ * (see 7.1.7 Updating and Cloning Nodes across Workspaces in the
+ * specification).
+ *
+ * It recursively tests each versionable node in the subtree of this
+ * node against its corresponding node in srcWorkspace with respect to
+ * the relation between their respective base versions and either updates
+ * the node in question or not, depending on the outcome of the test.
+ * For details see 8.2.10 Merge in the specification. A MergeException
+ * is thrown if bestEffort is false and a versionable node is encountered
+ * whose corresponding node's base version is on a divergent branch from
+ * this node's base version.
+ *
+ * If successful, the changes are persisted immediately, there is no need
+ * to call save.
+ *
+ * This method returns a NodeIterator over all versionable nodes in the
+ * subtree that received a merge result of fail.
+ *
+ * If bestEffort is false, this iterator will be empty (since if it merge
+ * returns successfully, instead of throwing an exception, it will be
+ * because no failures were encountered).
+ *
+ * If bestEffort is true, this iterator will contain all nodes that
+ * received a fail during the course of this merge operation.
+ *
+ * If the specified srcWorkspace does not exist, a NoSuchWorkspaceException
+ * is thrown.
+ *
+ * If the current session does not have sufficient permissions to perform
+ * the operation, then an AccessDeniedException is thrown.
+ *
+ * An InvalidItemStateException is thrown if this session (not necessarily
+ * this node) has pending unsaved changes.
+ *
+ * A LockException is thrown if a lock prevents the merge.
+ *
+ * @param srcWorkspace the name of the source workspace.
+ * @param shallow a boolean
+ * @return iterator over all nodes that received a merge result of "fail"
+ * in the course of this operation.
+ * @throws UnsupportedRepositoryOperationException if versioning is not supported.
+ * @throws MergeException succeeds if the base version of the corresponding
+ * node in srcWorkspace is not a successor of the base version of this node.
+ * @throws NoSuchWorkspaceException If the current
+ * ticket does not have sufficient rights to perform the <code>merge</code> or the
+ * specified workspace does not exist.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function merge( $srcWorkspace, $shallow );
+
+ /**
+ * Returns <code>true</code> if this node is currently checked-out and <code>false</code> otherwise.
+ *
+ * @return a boolean
+ * @throws UnsupportedRepositoryOperationException if versioning is not supported.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function isCheckedOut();
+
+ /**
+ * Restores this node to the state recorded in the specified version.
+ *
+ * @param versionName, or Version Object
+ * @throws UnsupportedRepositoryOperationException if versioning is not supported.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function restore( $in );
+
+ /**
+ * Restores this node to the state recorded in the version specified by
+ * <code>versionLabel</code>.
+ *
+ * @param versionLabel a String
+ * @throws UnsupportedRepositoryOperationException if versioning is not supported.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function restoreByLabel( $versionLabel );
+
+ /**
+ * Returns the <code>VersionHistory</code> object of this node. This object
+ * is simply a wrapper for the <code>nt:versionHistory</code> node holding
+ * this node's versions.
+ *
+ * @return a <code>VersionHistory</code> object
+ * @throws UnsupportedRepositoryOperationException if versioning is not supported.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function getVersionHistory();
+
+ /**
+ * Returns the current base version of this versionable node.
+ *
+ * @return a <code>Version</code> object.
+ * @throws UnsupportedRepositoryOperationException if versioning is not supported.
+ * @throws RepositoryException If another error occurs.
+ */
+ public function getBaseVersion();
+
+ /**
+ * Completes the merge process with respect to this node and the specified <code>version</code>.
+ * <p/>
+ * When the {@link #merge} method is called on a node, every versionable node in that
+ * subtree is compared with its corresponding node in the indicated other workspace and
+ * a "merge test result" is determined indicating one of the following:
+ * <ol>
+ * <li>
+ * This node will be updated to the state of its correspondee (if the base version
+ * of the correspondee is more recent in terms of version history)
+ * </li>
+ * <li>
+ * This node will be left alone (if this node's base version is more recent in terms of
+ * version history).
+ * </li>
+ * <li>
+ * This node will be marked as having failed the merge test (if this node's base version
+ * is on a different branch of the version history from the base version of its
+ * corresponding node in the other workspace, thus preventing an automatic determination
+ * of which is more recent).
+ * </li>
+ * </ol>
+ * (See {@link #merge} for more details)
+ * <p/>
+ * In the last case the merge of the non-versionable subtree
+ * (the "content") of this node must be done by the application (for example, by
+ * providing a merge tool for the user).
+ * <p/>
+ * Additionally, once the content of the nodes has been merged, their version graph
+ * branches must also be merged. The JCR versioning system provides for this by
+ * keeping a record, for each versionable node that fails the merge test, of the
+ * base verison of the corresponding node that caused the merge failure. This record
+ * is kept in the <code>jcr:mergeFailed</code> property of this node. After a
+ * <code>merge</code>, this property will contain one or more (if
+ * multiple merges have been performed) <code>REFERENCE</code>s that point
+ * to the "offending versions".
+ * <p/>
+ * To complete the merge process, the client calls <code>doneMerge(Version v)</code>
+ * passing the version object referred to be the <code>jcr:mergeFailed</code> property
+ * that the client wishes to connect to <code>this</code> node in the version graph.
+ * This has the effect of moving the reference to the indicated version from the
+ * <code>jcr:mergeFailed</code> property of <code>this</code> node to the
+ * <code>jcr:predecessors</code>.
+ * <p/>
+ * If the client chooses not to connect this node to a particular version referenced in
+ * the <code>jcr:mergeFailed</code> property, he calls {@link #cancelMerge(Version version)}.
+ * This has the effect of removing the reference to the specified <code>version</code> from
+ * <code>jcr:mergeFailed</code> <i>without</i> adding it to <code>jcr:predecessors</code>.
+ * <p/>
+ * Once the last reference in <code>jcr:mergeFailed</code> has been either moved to
+ * <code>jcr:predecessors</code> (with <code>doneMerge</code>) or just removed
+ * from <code>jcr:mergeFailed</code> (with <code>cancelMerge</code>) the <code>jcr:mergeFailed</code>
+ * property is automatically removed, thus enabling <code>this</code>
+ * node to be checked-in, creating a new version (note that before the <code>jcr:mergeFailed</code>
+ * is removed, its <code>OnParentVersion</code> setting of <code>ABORT</code> prevents checkin).
+ * This new version will have a predecessor connection to each version for which <code>doneMerge</code>
+ * was called, thus joining those branches of the version graph.
+ * <p/>
+ * If successful, these changes are persisted immediately,
+ * there is no need to call <code>save</code>.
+ * <p/>
+ * A <code>VersionException</code> is thrown if the <code>version</code> specified is
+ * not among those referecned in this node's <code>jcr:mergeFailed</code> property.
+ * <p/>
+ * If there are unsaved changes pending on this node, an <code>InvalidItemStateException</code> is thrown.
+ * <p/>
+ * An <code>UnsupportedRepositoryOperationException</code> is thrown if this repsoitory does not
+ * support versioning.
+ * <p/>
+ * A <code>RepositoryException</code> is thrown if another error occurs.
+ *
+ * @param version a version referred to by this node's <code>jcr:mergeFailed</code>
+ * property.
+ * @throws VersionException if the version specifed is
+ * not among those referenced in this node's <code>jcr:mergeFailed</code>
+ * or if this node is currently checked-in.
+ * @throws InvalidItemStateException if there are unsaved changes pending on this node.
+ * @throws UnsupportedRepositoryOperationException
+ * if versioning is not supported in
+ * this repository.
+ * @throws RepositoryException if another error occurs.
+ */
+ public function doneMerge( /* Version */ $version );
+
+ /**
+ * Cancels the merge process with respect to this node and specified <code>version</code>.
+ * <p/>
+ * See {@link #doneMerge} for a full explanation. Also see {@link #merge} for
+ * more details.
+ * <p/>
+ * If successful, these changes are persisted immediately,
+ * there is no need to call <code>save</code>.
+ * <p/>
+ * A <code>VersionException</code> is thrown if the <code>version</code> specified is
+ * not among those referecned in this node's <code>jcr:mergeFailed</code>.
+ * <p/>
+ * An <code>UnsupportedRepositoryOperationException</code> is thrown if this repsoitory does not
+ * support versioning.
+ * <p/>
+ * If there are unsaved changes pending on this node, an <code>InvalidItemStateException</code> is thrown.
+ * <p/>
+ * A <code>RepositoryException</code> is thrown if another error occurs.
+ *
+ * @param version a version referred to by this node's <code>jcr:mergeFailed</code>
+ * property.
+ * @throws VersionException if the version specifed is
+ * not among those referenced in this node's <code>jcr:mergeFailed</code> or if this node is currently checked-in.
+ * @throws InvalidItemStateException if there are unsaved changes pending on this node.
+ * @throws UnsupportedRepositoryOperationException
+ * if versioning is not supported in
+ * this repository.
+ * @throws RepositoryException if another error occurs.
+ */
+ public function cancelMerge( /* Version */ $version );
+
+ /**
+ * Returns the absolute path of the node in the specified workspace that
+ * corresponds to <code>this</code> node.
+ * <p/>
+ * The <i>corresponding node</i> is defined as the node in <code>srcWorkspace</code>
+ * with the same UUID as this node or, if this node has no UUID, the same
+ * path relative to the nearest ancestor that <i>does</i> have a UUID,
+ * or the root node, whichever comes first. This is qualified by the requirment that
+ * referencable nodes only correspond with other referencables and non-referenceables
+ * with other non-referenceables.
+ * <p/>
+ * If no corresponding node exists then an <code>ItemNotFoundException</code> is thrown.
+ * <p/>
+ * If the specified workspace does not exist then a <code>NoSuchWorkspaceException</code> is thrown.
+ * <p/>
+ * If the current <code>Session</code> does not have sufficent rights to perform this operation,
+ * an <code>AccessDeniedException</code> is thrown.
+ *
+ * @param workspaceName
+ * @return the absolute path to the corresponding node.
+ * @throws ItemNotFoundException if no corresponding node is found.
+ * @throws NoSuchWorkspaceException if the worksapce is unknown.
+ * @throws AccessDeniedException if the current <code>session</code> has insufficent rights to perform this operation.
+ * @throws RepositoryException if another error occurs.
+ */
+ public function getCorrespondingNodePath( $workspaceName );
+
+ /**
+ * Places a lock on this node. If successful, this node is said to <i>hold</i> the lock.
+ * <p/>
+ * If <code>isDeep</code> is <code>true</code> then the lock applies to this node and all its descendant nodes;
+ * if <code>false</code>, the lock applies only to this, the holding node.
+ * <p/>
+ * If <code>isSessionScoped</code> is <code>true</code> then this lock will expire upon the expiration of the current
+ * session (either through an automatic or explicit <code>Session.logout</code>); if <code>false</code>, this lock
+ * does not expire until explicitly unlocked or automatically unlocked due to a implementation-specific limitation,
+ * such as a timeout.
+ * <p/>
+ * Returns a <code>Lock</code> object reflecting the state of the new lock and including a lock token. See, in
+ * contrast, {@link Node#getLock}, which returns the <code>Lock</code> <i>without</i> the lock token.
+ * <p/>
+ * The lock token is also automatically added to the set of lock tokens held by the current <code>Session</code>.
+ * <p/>
+ * If successful, then the property <code>jcr:lockOwner</code> is created and set to the value of
+ * <code>Session.getUserId</code> for the current session and the property <code>jcr:lockIsDeep</code> is set to the
+ * value passed in as <code>isDeep</code>. These changes are persisted automatically; there is no need to call
+ * <code>save</code>.
+ * <p/>
+ * Note that it is possible to lock a node even if it is checked-in (the lock-related properties will be changed
+ * despite the checked-in status).
+ * <p/>
+ * If this node is not of mixin node type <code>mix:lockable</code> then an
+ * <code>UnsupportedRepositoryOperationException</code> is thrown.
+ * <p/>
+ * If this node is already locked (either because it holds a lock or a lock above it applies to it),
+ * a <code>LockException</code> is thrown.
+ * <p/>
+ * If <code>isDeep</code> is <code>true</code> and a descendant node of this node already holds a lock, then a
+ * <code>LockException</code> is thrown.
+ * <p/>
+ * If the current session does not have sufficient privileges to place the lock, an
+ * <code>AccessDeniedException</code> is thrown.
+ * <p/>
+ * An InvalidItemStateException is thrown if this node has pending unsaved changes.
+ * <p/>
+ * A <code>RepositoryException</code> is thrown if another error occurs.
+ *
+ * @param isDeep if <code>true</code> this lock will apply to this node and all its descendants; if
+ * <code>false</code>, it applies only to this node.
+ * @param isSessionScoped if <code>true</code>, this lock expires with the current session; if <code>false</code> it
+ * expires when explicitly or automatically unlocked for some other reason.
+ * @return A <code>Lock</code> object containing a lock token.
+ * @throws UnsupportedRepositoryOperationException
+ * if this node is not <code>mix:lockable</code>.
+ * @throws LockException if this node is already locked.
+ * @throws AccessDeniedException if this session does not have permission to lock this node.
+ * @throws InvalidItemStateException if this node has pending unsaved changes.
+ * @throws RepositoryException is another error occurs.
+ */
+ public function lock( $isDeep, $isSessionScoped );
+
+ /**
+ * Returns the <code>Lock</code> object that applies to this node. This may be either a lock on this node itself
+ * or a deep lock on a node above this node.
+ * <p/>
+ * If this <code>Session</code> (the one through which this <code>Node</code> was acquired)
+ * holds the lock token for this lock, then the returned <code>Lock</code> object contains
+ * that lock token (accessible through <code>Lock.getLockToken</code>). If this <code>Session</code>
+ * does not hold the applicable lock token, then the returned <code>Lock</code> object will not
+ * contain the lock token (its <code>Lock.getLockToken</code> method will return <code>null</code>).
+ * <p/>
+ * If this node is not of mixin node type <code>mix:lockable</code> then
+ * an <code>UnsupportedRepositoryOperationException</code> is thrown.
+ * <p/>
+ * If no lock applies to this node, a <code>LockException</code> is thrown.
+ * <p/>
+ * If the current session does not have sufficient privileges to get the lock, an <code>AccessDeniedException</code>
+ * is thrown.
+ * <p/>
+ * A <code>RepositoryException</code> is thrown if another error occurs.
+ *
+ * @return The applicable <code>Lock</code> object, without a contained lock token.
+ * @throws UnsupportedRepositoryOperationException
+ * If this node is not of mixin node type <code>mix:lockable</code>.
+ * @throws LockException if no lock applies to this node.
+ * @throws AccessDeniedException if the curent session does not have pernmission to get the lock.
+ * @throws RepositoryException is another error occurs.
+ */
+ public function getLock();
+
+ /**
+ * Removes the lock on this node. Also removes the properties <code>jcr:lockOwner</code> and
+ * <code>jcr:lockIsDeep</code> from this node. These changes are persisted automatically; there is no need to call
+ * <code>save</code>.
+ * <p/>
+ * Note that it is possible to unlock a node even if it is checked-in (the lock-related properties will be changed
+ * despite the checked-in status).
+ * <p/>
+ * If this node is <code>mix:lockable</code> but either does not currently hold a lock or
+ * holds a lock for which this Session does not have the correct lock token,
+ * then a <code>LockException</code> is thrown.
+ * <p/>
+ * If this node is not <code>mix:lockable</code> then an <code>UnsupportedRepositoryOperationException</code> is
+ * thrown.
+ * <p/>
+ * Note that either of these exceptions may be thrown when an attempt is made to unlock a node that is locked due
+ * to a deep lock above it.
+ * <p/>
+ * In such cases the unlock method fails because the lock is not held by this node. If the current session does not
+ * have sufficient privileges to remove the lock, an <code>AccessDeniedException</code> is thrown.
+ * <p/>
+ * An <code>InvalidItemStateException</code> is thrown if this node has pending unsaved changes.
+ * <p/>
+ * A <code>RepositoryException</code> is thrown if another error occurs.
+ *
+ * @throws UnsupportedRepositoryOperationException
+ * if this node is not <code>mix:lockable</code>.
+ * @throws LockException i If this node is <code>mix:lockable</code> but either does not currently hold a lock or
+ * holds a lock for which this Session does not have the correct lock token
+ * @throws AccessDeniedException if the current session does not have permission to unlock this node.
+ * @throws InvalidItemStateException if this node has pending unsaved changes.
+ * @throws RepositoryException if another error occurs.
+ */
+ public function unlock();
+
+ /**
+ * Returns <code>true</code> if this node holds a lock; otherwise returns <code>false</code>. To <i>hold</i> a
+ * lock means that this node has actually had a lock placed on it specifically, as opposed to just having a lock
+ * <i>apply</i> to it due to a deep lock held by a node above.
+ *
+ * @return a <code>boolean</code>.
+ * @throws RepositoryException if an error occurs.
+ */
+ public function holdsLock();
+
+ /**
+ * Returns <code>true</code> if this node is locked either as a result of a lock held by this node or by a deep
+ * lock on a node above this node; otherwise returns <code>false</code>.
+ *
+ * @return a <code>boolean</code>.
+ * @throws RepositoryException if an error occurs.
+ */
+ public function isLocked();
+}
+
+?>
Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/NodeIterator.php
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/NodeIterator.php?rev=208906&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/NodeIterator.php (added)
+++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/NodeIterator.php Sun Jul 3 04:58:33 2005
@@ -0,0 +1,44 @@
+<?php
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+require_once 'PHPCR/RangeIterator.php';
+require_once 'PHPCR/NoSuchElementException.php';
+
+
+/**
+ * Allows easy iteration through a list of <code>Node</code>s
+ * with <code>nextNode</code> as well as a <code>skip</code> method inherited from
+ * <code>RangeIterator</code>.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ */
+interface NodeIterator extends RangeIterator
+{
+ /**
+ * Returns the next <code>Node</code> in the iteration.
+ *
+ * @return the next <code>Node</code> in the iteration.
+ * @throws NoSuchElementException if iteration has no more <code>Node</code>s.
+ */
+ public function nextNode();
+}
+
+?>
\ No newline at end of file
Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/NumberFormatException.php
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/NumberFormatException.php?rev=208906&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/NumberFormatException.php (added)
+++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/NumberFormatException.php Sun Jul 3 04:58:33 2005
@@ -0,0 +1,29 @@
+<?php
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ */
+class NumberFormatException extends Exception
+{
+}
+
+?>
\ No newline at end of file
Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/PathNotFoundException.php
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/PathNotFoundException.php?rev=208906&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/PathNotFoundException.php (added)
+++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/PathNotFoundException.php Sun Jul 3 04:58:33 2005
@@ -0,0 +1,36 @@
+<?php
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+require_once 'PHPCR/RepositoryException.php';
+
+
+/**
+ * Exception thrown when no <code>Item</code> exists at the specified path
+ * or when the specified path implies intermediary <code>Node</code>s that do
+ * not exist.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ */
+class PathNotFoundException extends RepositoryException
+{
+}
+
+?>
\ No newline at end of file
Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Property.php
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Property.php?rev=208906&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Property.php (added)
+++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Property.php Sun Jul 3 04:58:33 2005
@@ -0,0 +1,310 @@
+<?php
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+require_once 'PHPCR/Item.php';
+require_once 'PHPCR/Node.php';
+require_once 'PHPCR/RepositoryException.php';
+require_once 'PHPCR/ValueFormatException.php';
+require_once 'PHPCR/nodetype/PropertyDefinition.php';
+require_once 'PHPCR/version/VersionException.php';
+require_once 'PHPCR/lock/LockException.php';
+require_once 'PHPCR/nodetype/ConstraintViolationException.php';
+
+
+/**
+ * A <code>Property</code> object represents the smallest granularity of content
+ * storage.
+ * <p>
+ * <b>Level 1 and 2</b>
+ * <p>
+ * A property must have one and only one parent node. A property does
+ * not have children. When we say that node A "has" property B it means that B
+ * is a child of A.
+ * <p>
+ * A property consists of a name and a value. See <code>Value</code>.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ */
+interface Property extends Item
+{
+ /**
+ * Sets the value of this property to <code>value</code>.
+ * If this property's property type is not constrained by the node type of
+ * its parent node, then the property type is changed to that of the supplied
+ * <code>value</code>. If the property type is constrained, then a
+ * best-effort conversion is attempted. If conversion fails, a
+ * <code>ValueFormatException</code> is thrown immediately (not on <code>save</code>).
+ * The change will be persisted (if valid) on <code>save</code>
+ * <p/>
+ * A <code>ConstraintViolationException</code> is thrown if a node-type
+ * or other constraint violation is detected immediately. Otherwise,
+ * if the violation is only detected later, at <code>save</code>, then a
+ * <code>ConstraintViolationException</code> is thrown by that method.
+ * Implementations may differ as to which constraints are enforced immediately,
+ * and which on <code>save</code>.
+ * <p/>
+ * A <code>VersionException</code> is thrown if the parent node of this property is
+ * versionable and checked-in or is non-versionable but its nearest versionable
+ * ancestor is checked-in.
+ * <p/>
+ * A <code>LockException</code> is thrown if a lock prevents the setting of the value.
+ *
+ * @throws ValueFormatException if the type or format of the specified value
+ * is incompatible with the type of this property.
+ * @throws VersionException if the parent node of this property is
+ * versionable and checked-in or is non-versionable but its nearest versionable
+ * ancestor is checked-in.
+ * @throws LockException if a lock prevents the setting of the value.
+ * @throws ConstraintViolationException if a node-type or other constraint violation is detected immediately.
+ * @throws RepositoryException if another error occurs.
+ */
+ public function setValue( $value );
+
+ /**
+ * Returns the value of this property as a generic
+ * <code>Value</code> object.
+ * <p>
+ * If the property is multi-valued, this method throws a <code>ValueFormatException</code>.
+ *
+ * @throws ValueFormatException if the property is multi-valued.
+ * @throws RepositoryException if another error occurs.
+ *
+ * @return the value
+ */
+ public function getValue();
+
+ /**
+ * Returns an array of all the values of this property. Used to access
+ * multi-value properties. If the property is single-valued, this method throws a
+ * <code>ValueFormatException</code>. The array returned is a copy of the stored
+ * values, so changes to it are not reflected in internal storage.
+ *
+ * @throws ValueFormatException if the property is single-valued.
+ * @throws RepositoryException if another error occurs.
+ *
+ * @return a <code>Value</code> array
+ */
+ public function getValues();
+
+ /**
+ * Returns a <code>String</code> representation of the value of this
+ * property. A shortcut for
+ * <code>Property.getValue().getString()</code>. See {@link Value}.
+ * If this property is multi-valued, this method throws a <code>ValueFormatException</code>.
+ * <p>
+ * If the value of this property cannot be converted to a
+ * string, a <code>ValueFormatException</code> is thrown.
+ * <p>
+ * A <code>RepositoryException</code> is thrown if another error occurs.
+ *
+ * @return A string representation of the value of this property.
+ * @throws ValueFormatException if conversion to a string is not possible or if the
+ * property is multi-valued.
+ * @throws RepositoryException if another error occurs.
+ */
+ public function getString();
+
+ /**
+ * Returns an <code>InputStream</code> representation of the value of this
+ * property. A shortcut for
+ * <code>Property.getValue().getStream()</code>. See {@link Value}.
+ * If this property is multi-valued, this method throws a <code>ValueFormatException</code>.
+ * <p>
+ * If the value of this property cannot be converted to a
+ * stream, a <code>ValueFormatException</code> is thrown.
+ * <p>
+ * A <code>RepositoryException</code> is thrown if another error occurs.
+ *
+ * @return A stream representation of the value of this property.
+ * @throws ValueFormatException if conversion to a string is not possible or if the
+ * property is multi-valued.
+ * @throws RepositoryException if another error occurs
+ */
+ public function getStream();
+
+ /**
+ * Returns a <code>long</code> representation of the value of this
+ * property. A shortcut for
+ * <code>Property.getValue().getLong()</code>. See {@link Value}.
+ * If this property is multi-valued, this method throws a <code>ValueFormatException</code>.
+ * <p>
+ * If the value of this property cannot be converted to a
+ * <code>long</code>, a <code>ValueFormatException</code> is thrown.
+ * <p>
+ * A <code>RepositoryException</code> is thrown if another error occurs.
+ *
+ * @return A <code>long</code> representation of the value of this property.
+ * @throws ValueFormatException if conversion to a string is not possible or if the
+ * property is multi-valued.
+ * @throws RepositoryException if another error occurs
+ */
+ public function getLong();
+
+ /**
+ * Returns a <code>double</code> representation of the value of this
+ * property. A shortcut for
+ * <code>Property.getValue().getDouble()</code>. See {@link Value}.
+ * If this property is multi-valued, this method throws a <code>ValueFormatException</code>.
+ * <p>
+ * If the value of this property cannot be converted to a
+ * double, a <code>ValueFormatException</code> is thrown.
+ * <p>
+ * A <code>RepositoryException</code> is thrown if another error occurs.
+ *
+ * @return A double representation of the value of this property.
+ * @throws ValueFormatException if conversion to a string is not possible or if the
+ * property is multi-valued.
+ * @throws RepositoryException if another error occurs
+ */
+ public function getDouble();
+
+ /**
+ * Returns date. A shortcut for
+ * <code>Property.getValue().getDate()</code>. See {@link Value}.
+ * If this property is multi-valued, this method throws a <code>ValueFormatException</code>.
+ * <p>
+ * If the value of this property cannot be converted to a
+ * date, a <code>ValueFormatException</code> is thrown.
+ * <p>
+ * A <code>RepositoryException</code> is thrown if another error occurs.
+ *
+ * @return A date (<code>Calendar</code> object) representation of the value of this property.
+ * @throws ValueFormatException if conversion to a string is not possible or if the
+ * property is multi-valued.
+ * @throws RepositoryException if another error occurs
+ */
+ public function getDate();
+
+ /**
+ * Returns a <code>boolean</code> representation of the value of this
+ * property. A shortcut for
+ * <code>Property.getValue().getBoolean()</code>. See {@link Value}.
+ * If this property is multi-valued, this method throws a <code>ValueFormatException</code>.
+ * <p>
+ * If the value of this property cannot be converted to a
+ * boolean, a <code>ValueFormatException</code> is thrown.
+ * <p>
+ * A <code>RepositoryException</code> is thrown if another error occurs.
+ *
+ * @return A boolean representation of the value of this property.
+ * @throws ValueFormatException if conversion to a string is not possible or if the
+ * property is multi-valued.
+ * @throws RepositoryException if another error occurs
+ */
+ public function getBoolean();
+
+ /**
+ * If this property is of type <code>REFERENCE</code>
+ * this method returns the node to which this property refers.
+ * <p>
+ * If this property is multi-valued, this method throws a <code>ValueFormatException</code>.
+ * <p>
+ * If this property cannot be coverted to a reference, then a <code>ValueFormatException</code> is thrown.
+ * <p>
+ * If this property is a REFERENCE property but is currently part of the frozen state of a version in version
+ * storage, this method will throw a <code>ValueFormatException</code>.
+ * <p>
+ * A <code>RepositoryException</code> is thrown if another error occurs.
+ *
+ * @return the referenced Node
+ * @throws ValueFormatException if this property cannot be converted to a reference, if the
+ * property is multi-valued or if this property is a REFERENCE property but is currently part of the frozen
+ * state of a version in version storage.
+ * @throws RepositoryException if another error occurs
+ */
+ public function getNode();
+
+ /**
+ * Returns the length of the value of this property.
+ * <p>
+ * Returns the length in bytes if the value
+ * is a <code>PropertyType.BINARY</code>, otherwise it returns the number
+ * of characters needed to display the value (for strings this is the string
+ * length, for numeric types it is the number of characters needed to
+ * display the number). Returns �1 if the implementation cannot determine
+ * the length.
+ *
+ * If this property is multi-valued, this method throws a <code>ValueFormatException</code>.
+ *
+ * @return an <code>long</code>.
+ * @throws ValueFormatException if this property is multi-valued.
+ * @throws RepositoryException if another error occurs.
+ */
+ public function getLength();
+
+ /**
+ * Returns an array holding the lengths of the values of this (multi-value) property in bytes
+ * if the values are <code>PropertyType.BINARY</code>, otherwise it returns the number of
+ * characters needed to display each value (for strings this is the string length, for
+ * numeric types it is the number of characters needed to display the number). The order of the
+ * length values corresponds to the order of the values in the property.
+ * <p/>
+ * Returns a <code>�1</code> in the appropriate position if the implementation cannot determine
+ * the length of a value.
+ * <p/>
+ * If this property is single-valued, this method throws a <code>ValueFormatException</code>.
+ * <p/>
+ * A RepositoryException is thrown if another error occurs.
+ * @return an array of lengths
+ * @throws ValueFormatException if this property is single-valued.
+ * @throws RepositoryException if another error occurs.
+ */
+ public function getLengths();
+
+ /**
+ * Returns the property definition that applies to this property. In some cases there may appear to
+ * be more than one definition that could apply to this node. However, it is assumed that upon
+ * creation of this property, a single particular definition was used and it is <i>that</i>
+ * definition that this method returns. How this governing definition is selected upon property
+ * creation from among others which may have been applicable is an implemention issue and is not
+ * covered by this specification.
+ *
+ * @see NodeType#getPropertyDefinitions
+ * @throws RepositoryException if an error occurs.
+ * @return a <code>PropertyDefinition</code> object.
+ */
+ public function getDefinition();
+
+ /**
+ * Returns the type of this <code>Property</code>. One of:
+ * <ul>
+ * <li><code>PropertyType::STRING</code></li>
+ * <li><code>PropertyType::BINARY</code></li>
+ * <li><code>PropertyType::DATE</code></li>
+ * <li><code>PropertyType::DOUBLE</code></li>
+ * <li><code>PropertyType::LONG</code></li>
+ * <li><code>PropertyType::BOOLEAN</code></li>
+ * <li><code>PropertyType::NAME</code></li>
+ * <li><code>PropertyType::PATH</code></li>
+ * <li><code>PropertyType::REFERENCE</code></li>
+ * </ul>
+ * The type returned is that which was set at property creation. Note that for some property <code>p</code>,
+ * the type returned by <code>p.getType()</code> may differ from the type returned by
+ * <code>p.getDefinition.getRequiredType()</code> only in the case where the latter returns <code>UNDEFINED</code>.
+ * The type of a property instance is never <code>UNDEFINED</code> (it must always have some actual type).
+ *
+ * @return an int
+ * @throws RepositoryException if an error occurs
+ */
+ public function getType();
+}
+
+?>
\ No newline at end of file
Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/PropertyIterator.php
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/PropertyIterator.php?rev=208906&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/PropertyIterator.php (added)
+++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/PropertyIterator.php Sun Jul 3 04:58:33 2005
@@ -0,0 +1,44 @@
+<?php
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+require_once 'PHPCR/RangeIterator.php';
+require_once 'PHPCR/NoSuchElementException.php';
+require_once 'PHPCR/Property.php';
+
+
+/**
+ * Allows easy iteration through a list of <code>Property</code>s
+ * with <code>nextProperty</code> as well as a <code>skip</code> method.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ */
+interface PropertyIterator extends RangeIterator
+{
+ /**
+ * Returns the next <code>Property</code> in the iteration.
+ *
+ * @return the next <code>Property</code> in the iteration.
+ * @throws NoSuchElementException if iteration has no more <code>Property</code>s.
+ */
+ public function nextProperty();
+}
+
+?>
\ No newline at end of file
Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/PropertyType.php
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/PropertyType.php?rev=208906&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/PropertyType.php (added)
+++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/PropertyType.php Sun Jul 3 04:58:33 2005
@@ -0,0 +1,154 @@
+<?php
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+require_once 'PHPCR/IllegalArgumentException.php';
+
+
+/**
+ * The property types supported by the JCR standard.
+ * <p/>
+ * <p>This interface defines following property types:
+ * <ul>
+ * <li><code>STRING</code>
+ * <li><code>BINARY</code>
+ * <li><code>LONG</code>
+ * <li><code>DOUBLE</code>
+ * <li><code>DATE</code>
+ * <li><code>BOOLEAN</code>
+ * <li><code>NAME</code>
+ * <li><code>PATH</code>
+ * <li><code>REFERENCE</code>
+ * </ul>
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ */
+final class PropertyType
+{
+ /*
+ * The supported property types.
+ */
+ const STRING = 1;
+ const BINARY = 2;
+ const LONG = 3;
+ const DOUBLE = 4;
+ const DATE = 5;
+ const BOOLEAN = 6;
+ const NAME = 7;
+ const PATH = 8;
+ const REFERENCE = 9;
+
+ /*
+ * Undefined type.
+ */
+ const UNDEFINED = 0;
+
+ /*
+ * The names of the supported property types,
+ * as used in serialization.
+ */
+ const TYPENAME_STRING = "String";
+ const TYPENAME_BINARY = "Binary";
+ const TYPENAME_LONG = "Long";
+ const TYPENAME_DOUBLE = "Double";
+ const TYPENAME_DATE = "Date";
+ const TYPENAME_BOOLEAN = "Boolean";
+ const TYPENAME_NAME = "Name";
+ const TYPENAME_PATH = "Path";
+ const TYPENAME_REFERENCE = "Reference";
+
+ const TYPENAME_UNDEFINED = "undefined";
+
+
+ /**
+ * Returns the name of the specified <code>type</code>,
+ * as used in serialization.
+ * @param int $type the property type
+ * @return string the name of the specified <code>type</code>
+ * @throws IllegalArgumentException if <code>type</code>
+ * is not a valid property type.
+ */
+ public static function nameFromValue( $type ) {
+ switch ( $type ) {
+ case self::STRING:
+ return self::TYPENAME_STRING;
+
+ case self::BINARY:
+ return self::TYPENAME_BINARY;
+
+ case self::BOOLEAN:
+ return self::TYPENAME_BOOLEAN;
+
+ case self::LONG:
+ return self::TYPENAME_LONG;
+
+ case self::DOUBLE:
+ return self::TYPENAME_DOUBLE;
+
+ case self::DATE:
+ return self::TYPENAME_DATE;
+
+ case self::PATH:
+ return self::TYPENAME_PATH;
+
+ case self::NAME:
+ return self::TYPENAME_NAME;
+
+ case self::REFERENCE:
+ return self::TYPENAME_REFERENCE;
+
+ default:
+ throw new IllegalArgumentException( "unknown type: " + $type );
+ }
+ }
+
+ /**
+ * Returns the numeric constant value of the type with the specified name.
+ * @param string $name the name of the property type
+ * @return int the numeric constant value
+ * @throws IllegalArgumentException if <code>name</code>
+ * is not a valid property type name.
+ */
+ public static function valueFromName( $name ) {
+ if ( $name == self::TYPENAME_STRING ) {
+ return self::STRING;
+ } else if ( $name == self::TYPENAME_BINARY ) {
+ return self::BINARY;
+ } else if ( $name == self::TYPENAME_BOOLEAN ) {
+ return self::BOOLEAN;
+ } else if ( $name == self::TYPENAME_LONG ) {
+ return self::LONG;
+ } else if ( $name == self::TYPENAME_DOUBLE ) {
+ return self::DOUBLE;
+ } else if ( $name == self::TYPENAME_DATE ) {
+ return self::DATE;
+ } else if ( $name == self::TYPENAME_PATH ) {
+ return self::PATH;
+ } else if ( $name == self::TYPENAME_NAME ) {
+ return self::NAME;
+ } else if ( $name == self::TYPENAME_REFERENCE ) {
+ return self::REFERENCE;
+ } else {
+ throw new IllegalArgumentException( "unknown type: " + $name );
+ }
+ }
+}
+
+?>
\ No newline at end of file
Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/RangeIterator.php
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/RangeIterator.php?rev=208906&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/RangeIterator.php (added)
+++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/RangeIterator.php Sun Jul 3 04:58:33 2005
@@ -0,0 +1,58 @@
+<?php
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * Extends <code>Iterator</code> with the <code>skip</code>, <code>getSize</code>
+ * and <code>getPos</code> methods.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ */
+interface RangeIterator extends Iterator
+{
+ /**
+ * Skip a number of elements in the iterator.
+ *
+ * @param skipNum the non-negative number of elements to skip
+ */
+ public function skip( $skipNum );
+
+ /**
+ * Returns the number of elements in the iterator.
+ * If this information is unavailable, returns -1.
+ *
+ * @return a long
+ */
+ public function getSize();
+
+ /**
+ * Returns the current position within the iterator. The number
+ * returned is the 0-based index of the next element in the iterator,
+ * i.e. the one that will be returned on the subsequent <code>next</code> call.
+ * <p/>
+ * Note that this method does not check if there is a next element,
+ * i.e. an empty iterator will always return 0.
+ *
+ * @return a long
+ */
+ public function getPos();
+}
+
+?>
\ No newline at end of file
Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/ReferentialIntegrityException.php
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/ReferentialIntegrityException.php?rev=208906&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/ReferentialIntegrityException.php (added)
+++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/ReferentialIntegrityException.php Sun Jul 3 04:58:33 2005
@@ -0,0 +1,34 @@
+<?php
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+require_once 'PHPCR/RepositoryException.php';
+
+
+/**
+ * Exception thrown by Node#merge(String srcWorksapce, boolean shallow).
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ */
+class ReferentialIntegrityException extends RepositoryException
+{
+}
+
+?>
\ No newline at end of file
Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Repository.php
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Repository.php?rev=208906&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Repository.php (added)
+++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Repository.php Sun Jul 3 04:58:33 2005
@@ -0,0 +1,184 @@
+<?php
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+require_once 'PHPCR/LoginException.php';
+require_once 'PHPCR/NoSuchWorkspaceException.php';
+require_once 'PHPCR/RepositoryException.php';
+require_once 'PHPCR/Session.php';
+
+
+/**
+ * The entry point into the content repository.
+ * Represents the entry point into the content repository. Typically the object
+ * implementing this interface will be acquired from a JNDI-compatible
+ * naming and directory service.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ */
+interface Repository
+{
+ /**
+ * The descriptor key for the version of the specification
+ * that this repository implements.
+ */
+ const SPEC_VERSION_DESC = "jcr.specification.version";
+
+ /**
+ * The descriptor key for the name of the specification
+ * that this repository implements.
+ */
+ const SPEC_NAME_DESC = "jcr.specification.name";
+
+ /**
+ * The descriptor key for the name of the repository vendor.
+ */
+ const REP_VENDOR_DESC = "jcr.repository.vendor";
+
+ /**
+ * The descriptor key for the URL of the repository vendor.
+ */
+ const REP_VENDOR_URL_DESC = "jcr.repository.vendor.url";
+
+ /**
+ * The descriptor key for the name of this repository implementation.
+ */
+ const REP_NAME_DESC = "jcr.repository.name";
+
+ /**
+ * The descriptor key for the version of this repository implementation.
+ */
+ const REP_VERSION_DESC = "jcr.repository.version";
+
+ /**
+ * The presence of this key indicates that this implementation supports
+ * all level 1 features. This key will always be present.
+ */
+ const LEVEL_1_SUPPORTED = "level.1.supported";
+
+ /**
+ * The presence of this key indicates that this implementation supports
+ * all level 2 features.
+ */
+ const LEVEL_2_SUPPORTED = "level.2.supported";
+
+ /**
+ * The presence of this key indicates that this implementation supports transactions.
+ */
+ const OPTION_TRANSACTIONS_SUPPORTED = "option.transactions.supported";
+
+ /**
+ * The presence of this key indicates that this implementation supports versioning.
+ */
+ const OPTION_VERSIONING_SUPPORTED = "option.versioning.supported";
+
+ /**
+ * The presence of this key indicates that this implementation supports observation.
+ */
+ const OPTION_OBSERVATION_SUPPORTED = "option.observation.supported";
+
+ /**
+ * The presence of this key indicates that this implementation supports locking.
+ */
+ const OPTION_LOCKING_SUPPORTED = "option.locking.supported";
+
+ /**
+ * The presence of this key indicates that this implementation supports the SQL query language.
+ */
+ const OPTION_QUERY_SQL_SUPPORTED = "option.query.sql.supported";
+
+ /**
+ * The presence of this key indicates that the index position notation for
+ * same-name siblings is supported within XPath queries.
+ */
+ const QUERY_XPATH_POS_INDEX = "query.xpath.pos.index";
+
+ /**
+ * The presence of this key indicates that XPath queries return results in document order.
+ */
+ const QUERY_XPATH_DOC_ORDER = "query.xpath.doc.order";
+
+ /**
+ * The presence of this key indicates that SQL queries can SELECT the pseudo-property
+ * <code>jcr:path</code>.
+ */
+ const QUERY_JCRPATH = "query.jcrpath";
+
+ /**
+ * The presence of this key indicates that the <code>jcr:score</code> pseudo-property is
+ * available in XPath and SQL queries that include a <code>jcrfn:contains</code>
+ * (in XPath) or <code>CONTAINS</code> (in SQL) function to do a full-text search.
+ */
+ const QUERY_JCRSCORE = "query.jcrscore";
+
+
+ /**
+ * Returns a string array holding all descriptor keys available for this implementation.
+ * This set must contain at least the built-in keys defined by the string constants in
+ * this interface.Used in conjunction with {@link #getDescriptor(String name)}
+ * to query information about this repository implementation.
+ */
+ public function getDescriptorKeys();
+
+ /**
+ * Returns the descriptor for the specified key. Used to query information about this
+ * repository implementation. The set of available keys can be found by calling
+ * {@link #getDescriptorKeys}. If the specifed key is not found, <code>null</code> is returned.
+ *
+ * @param key a string corresponding to a descriptor for this repsoitory implementation.
+ * @return a descriptor string
+ */
+ public function getDescriptor( $key );
+
+ /**
+ * Authenticates the user using the supplied <code>credentials</code>.
+ * <p>
+ * If <code>workspaceName</code> is recognized as the name of an existing workspace in the repository and
+ * authorization to access that workspace is granted, then a new <code>Session</code> object is returned.
+ * The format of the string <code>workspaceName</code> depends upon the implementation.
+ * <p>
+ * If <code>credentials</code> is <code>null</code>, it is assumed that authentication is handled by a
+ * mechanism external to the repository itself (for example, through the JAAS framework) and that the
+ * repository implementation exists within a context (for example, an application server) that allows
+ * it to handle authorization of the request for access to the specified workspace.
+ * <p>
+ * If <code>workspaceName</code> is <code>null</code>, a default workspace is automatically selected by
+ * the repository implementation. This may, for example, be the "home workspace" of the user whose
+ * credentials were passed, though this is entirely up to the configuration and implementation of the
+ * repository. Alternatively, it may be a "null workspace" that serves only to provide the method
+ * {@link Workspace#getAccessibleWorkspaceNames}, allowing the client to select from among available "real"
+ * workspaces.
+ * <p>
+ * If authentication or authorization for the specified workspace fails, a <code>LoginException</code> is
+ * thrown.
+ * <p>
+ * If <code>workspaceName</code> is not recognized, a <code>NoSuchWorkspaceException</code> is thrown.
+ *
+ * @param credentials The credentials of the user
+ * @param workspaceName the name of a workspace.
+ * @return a valid session for the user to access the repository.
+ * @throws LoginException If the login fails.
+ * @throws NoSuchWorkspaceException If the specified <code>workspaceName</code> is not recognized.
+ * @throws RepositoryException if another error occurs.
+ */
+ public function login( $credentials = null, $workspaceName = null );
+}
+
+?>
\ No newline at end of file
Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/RepositoryException.php
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/RepositoryException.php?rev=208906&view=auto
==============================================================================
--- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/RepositoryException.php (added)
+++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/RepositoryException.php Sun Jul 3 04:58:33 2005
@@ -0,0 +1,60 @@
+<?php
+
+/*
+ * Copyright 2004-2005 The Apache Software Foundation or its licensors,
+ * as applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * Main exception thrown by classes in this package. May either contain
+ * an error message or another exception wrapped inside this exception.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ */
+class RepositoryException extends Exception
+{
+ /**
+ * Constructs a new instance of this class.
+ */
+ public function __construct() {
+ $args = func_get_args();
+ $msg = null;
+ $ex = null;
+
+ if ( count( $args ) ) {
+ if ( is_string( $args[0] ) && isset( $args[1] ) ) {
+ if ( $args[1] instanceof Exception ) {
+ $ex = $args[1];
+ }
+ } else if ( $args[0] instanceof Exception ) {
+ $ex = $args[0];
+ }
+
+ if ( isset( $ex ) ) {
+ $msg .= $ex->getMessage();
+ }
+
+ if ( is_string( $args[0] ) ) {
+ $msg .= ' (' . $args[0] . ')';
+ }
+
+ parent::__construct( $msg );
+ }
+ }
+}
+
+?>
\ No newline at end of file