Return-Path: Delivered-To: apmail-incubator-jackrabbit-commits-archive@www.apache.org Received: (qmail 84541 invoked from network); 3 Jul 2005 11:59:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 3 Jul 2005 11:59:05 -0000 Received: (qmail 44108 invoked by uid 500); 3 Jul 2005 11:59:03 -0000 Mailing-List: contact jackrabbit-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jackrabbit-dev@incubator.apache.org Delivered-To: mailing list jackrabbit-commits@incubator.apache.org Received: (qmail 43922 invoked by uid 500); 3 Jul 2005 11:59:01 -0000 Delivered-To: apmail-incubator-jackrabbit-cvs@incubator.apache.org Received: (qmail 43888 invoked by uid 99); 3 Jul 2005 11:59:01 -0000 X-ASF-Spam-Status: No, hits=0.2 required=10.0 tests=NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 03 Jul 2005 04:58:55 -0700 Received: (qmail 84338 invoked by uid 65534); 3 Jul 2005 11:58:52 -0000 Message-ID: <20050703115852.84337.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r208906 [4/5] - in /incubator/jackrabbit/trunk/contrib/phpcr: ./ PHPCR/ PHPCR/lock/ PHPCR/nodetype/ PHPCR/observation/ PHPCR/query/ PHPCR/util/ PHPCR/version/ Date: Sun, 03 Jul 2005 11:58:39 -0000 To: jackrabbit-cvs@incubator.apache.org From: jukka@apache.org X-Mailer: svnmailer-1.0.2 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Workspace.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Workspace.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Workspace.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/Workspace.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,599 @@ + + * @package phpcr + */ +interface Workspace +{ + /** + * A constant used as the value of the flag uuidBehavior in + * the methods {@link #getImportContentHandler} and {@link #importXML}. + * See those methods for details. + */ + const IMPORT_UUID_CREATE_NEW = 0; + + /** + * A constant used as the value of the flag uuidBehavior in + * the methods {@link #getImportContentHandler} and {@link #importXML}. + * See those methods for details. + */ + const IMPORT_UUID_COLLISION_REMOVE_EXISTING = 1; + + /** + * A constant used as the value of the flag uuidBehavior in + * the methods {@link #getImportContentHandler} and {@link #importXML}. + * See those methods for details. + */ + const IMPORT_UUID_COLLISION_REPLACE_EXISTING = 2; + + /** + * A constant used as the value of the flag uuidBehavior in + * the methods {@link #getImportContentHandler} and {@link #importXML}. + * See those methods for details. + */ + const IMPORT_UUID_COLLISION_THROW = 3; + + + /** + * Returns the Session object through which this Workspace + * object was acquired. + * + * @return a {@link Session} object. + */ + public function getSession(); + + /** + * Returns the name of the actual persistent workspace represented by this + * Workspace object. + * + * @return the name of this workspace. + */ + public function getName(); + + /** + * This method copies the subtree at srcAbsPath in srcWorkspace + * to destAbsPath in this workspace. Unlike clone, + * this method does assign new UUIDs to the new copies of referenceable nodes. + * This operation is performed entirely within the persistent workspace, it does not involve + * transient storage and therefore does not require a save. + *

+ * The destAbsPath provided must not + * have an index on its final element. If it does then a RepositoryException + * is thrown. Strictly speaking, the destAbsPath parameter is actually an absolute path + * to the parent node of the new location, appended with the new name desired for the + * copied node. It does not specify a position within the child node + * ordering. If ordering is supported by the node type of + * the parent node of the new location, then the new copy of the node is appended to the end of the + * child node list. + *

+ * This method cannot be used to copy just an individual property by itself. + * It copies an entire node and its subtree (including, of course, any properties contained therein). + *

+ * A NoSuchWorkspaceException is thrown if srcWorkspace does not + * exist or if the current Session does not have permission to access it. + *

+ * A ConstraintViolationException is thrown if the operation would violate a node-type + * or other implementation-specific constraint. + *

+ * A VersionException is thrown if the parent node of destAbsPath is + * versionable and checked-in, or is non-versionable but its nearest versionable ancestor is + * checked-in. + *

+ * An AccessDeniedException is thrown if the current session (i.e. the session that + * was used to acquire this Workspace object) does not have sufficient access rights + * to complete the operation. + *

+ * A PathNotFoundException is thrown if the node at srcAbsPath or the + * parent of the new node at destAbsPath does not exist. + *

+ * An ItemExistException is thrown if a property already exists at + * destAbsPath or a node already exist there, and same name + * siblings are not allowed. + *

+ * A LockException is thrown if a lock prevents the copy. + * + * @param srcWorkspace the name of the worksapce from which the copy is to be made. + * @param srcAbsPath the path of the node to be copied. + * @param destAbsPath the location to which the node at srcAbsPath + * is to be copied in this workspace. + * @throws NoSuchWorkspaceException if srcWorkspace does not + * exist or if the current Session does not have permission to access it. + * @throws ConstraintViolationException if the operation would violate a + * node-type or other implementation-specific constraint + * @throws VersionException if the parent node of destAbsPath is + * versionable and checked-in, or is non-versionable but its nearest versionable ancestor is + * checked-in. + * @throws AccessDeniedException if the current session does have permission to access + * srcWorkspace but otherwise does not have sufficient access rights to + * complete the operation. + * @throws PathNotFoundException if the node at srcAbsPath or + * the parent of the new node at destAbsPath does not exist. + * @throws ItemExistsException if a property already exists at + * destAbsPath or a node already exist there, and same name + * siblings are not allowed. + * @throws LockException if a lock prevents the copy. + * @throws RepositoryException if the last element of destAbsPath + * has an index or if another error occurs. + */ + public function copy( $srcWorkspace, $srcAbsPath, $destAbsPath ); + + /** + * Clones the subtree at the node srcAbsPath in srcWorkspace to the new location at + * destAbsPath in this workspace. This method does not assign new UUIDs to + * the new nodes but preserves the UUIDs (if any) of their respective source nodes. + *

+ * If removeExisting is true and an existing node in this workspace + * (the destination workspace) has the same UUID as a node being cloned from + * srcWorkspace, then the incoming node takes precedence, and the + * existing node (and its subtree) is removed. If removeExisting + * is false then a UUID collision causes this method to throw a + * ItemExistsException and no changes are made. + *

+ * If successful, the change is persisted immediately, there is no need to call save. + *

+ * The destAbsPath provided must not + * have an index on its final element. If it does then a RepositoryException + * is thrown. Strictly speaking, the destAbsPath parameter is actually an absolute path + * to the parent node of the new location, appended with the new name desired for the + * cloned node. It does not specify a position within the child node + * ordering. If ordering is supported by the node type of the parent node of the new + * location, then the new clone of the node is appended to the end of the child node list. + *

+ * This method cannot be used to clone just an individual property by itself. It clones an + * entire node and its subtree (including, of course, any properties contained therein). + *

+ * A NoSuchWorkspaceException is thrown if srcWorkspace does not + * exist or if the current Session does not have permission to access it. + *

+ * A ConstraintViolationException is thrown if the operation would violate a node-type + * or other implementation-specific constraint. + *

+ * A VersionException is thrown if the parent node of destAbsPath is + * versionable and checked-in, or is non-versionable but its nearest versionable ancestor is + * checked-in. This exception will also be thrown if removeExisting is true, + * and a UUID conflict occurs that would require the moving and/or altering of a node that is checked-in. + *

+ * An AccessDeniedException is thrown if the current session (i.e. the session that + * was used to acquire this Workspace object) does not have sufficient access rights + * to complete the operation. + *

+ * A PathNotFoundException is thrown if the node at srcAbsPath or the + * parent of the new node at destAbsPath does not exist. + *

+ * An ItemExistsException is thrown if a node or property already exists at + * destAbsPath + *

+ * An ItemExistException is thrown if a property already exists at + * destAbsPath or a node already exist there, and same name + * siblings are not allowed or if removeExisting is false and a + * UUID conflict occurs. + *

+ * A LockException is thrown if a lock prevents the clone. + * + * @param srcWorkspace The name of the workspace from which the node is to be copied. + * @param srcAbsPath the path of the node to be copied in srcWorkspace. + * @param destAbsPath the location to which the node at srcAbsPath + * is to be copied in this workspace. + * @param removeExisting if false then this method throws an + * ItemExistsException on UUID conflict with an incoming node. + * If true then a UUID conflict is resolved by removing the existing node + * from its location in this workspace and cloning (copying in) the one from + * srcWorkspace. + * + * @throws NoSuchWorkspaceException if destWorkspace does not exist. + * @throws ConstraintViolationException if the operation would violate a + * node-type or other implementation-specific constraint. + * @throws VersionException if the parent node of destAbsPath is + * versionable and checked-in, or is non-versionable but its nearest versionable ancestor is + * checked-in. This exception will also be thrown if removeExisting is true, + * and a UUID conflict occurs that would require the moving and/or altering of a node that is checked-in. + * @throws AccessDeniedException if the current session does not have + * sufficient access rights to complete the operation. + * @throws PathNotFoundException if the node at srcAbsPath or + * the parent of the new node at destAbsPath does not exist. + * @throws ItemExistsException if a property already exists at + * destAbsPath or a node already exist there, and same name + * siblings are not allowed or if removeExisting is false and a + * UUID conflict occurs. + * @throws LockException if a lock prevents the clone. + * @throws RepositoryException if the last element of destAbsPath + * has an index or if another error occurs. + */ + public function clone_( $srcAbsPath, $destAbsPath, $srcWorkspace = null, $removeExisting = null ); + + /** + * Moves the node at srcAbsPath (and its entire subtree) to the + * new location at destAbsPath. If successful, + * the change is persisted immediately, there is no need to call save. + * Note that this is in contrast to {@link Session#move} which operates within the + * transient space and hence requires a save. + *

+ * The destAbsPath provided must not + * have an index on its final element. If it does then a RepositoryException + * is thrown. Strictly speaking, the destAbsPath parameter is actually an absolute path + * to the parent node of the new location, appended with the new name desired for the + * moved node. It does not specify a position within the child node + * ordering. If ordering is supported by the node type of + * the parent node of the new location, then the newly moved node is appended to the end of the + * child node list. + *

+ * This method cannot be used to move just an individual property by itself. + * It moves an entire node and its subtree (including, of course, any properties contained therein). + *

+ * A ConstraintViolationException is thrown if the operation would violate a node-type + * or other implementation-specific constraint. + *

+ * A VersionException is thrown if the parent node of destAbsPath + * or the parent node of srcAbsPath is versionable and checked-in, or is + * non-versionable but its nearest versionable ancestor is checked-in. + *

+ * An AccessDeniedException is thrown if the current session (i.e. the session that + * was used to acquire this Workspace object) does not have sufficient access rights + * to complete the operation. + *

+ * A PathNotFoundException is thrown if the node at srcAbsPath or the + * parent of the new node at destAbsPath does not exist. + *

+ * An ItemExistException is thrown if a property already exists at + * destAbsPath or a node already exist there, and same name + * siblings are not allowed. + *

+ * A LockException if a lock prevents the move. + * + * @param srcAbsPath the path of the node to be moved. + * @param destAbsPath the location to which the node at srcAbsPath + * is to be moved. + * @throws ConstraintViolationException if the operation would violate a + * node-type or other implementation-specific constraint + * @throws VersionException if the parent node of destAbsPath + * or the parent node of srcAbsPath is versionable and checked-in, + * or is non-versionable but its nearest versionable ancestor is checked-in. + * @throws AccessDeniedException if the current session (i.e. the session that + * was used to aqcuire this Workspace object) does not have + * sufficient access rights to complete the operation. + * @throws PathNotFoundException if the node at srcAbsPath or + * the parent of the new node at destAbsPath does not exist. + * @throws ItemExistsException if a property already exists at + * destAbsPath or a node already exist there, and same name + * siblings are not allowed. + * @throws LockException if a lock prevents the move. + * @throws RepositoryException if the last element of destAbsPath + * has an index or if another error occurs. + */ + public function move( $srcAbsPath, $destAbsPath ); + + /** + * Restores a set of versions at once. Used in cases where a "chicken and egg" problem of + * mutually referring REFERENCE properties would prevent the restore in any + * serial order. + *

+ * If the restore succeeds the changes made to this node are + * persisted immediately, there is no need to call save. + *

+ * The following restrictions apply to the set of versions specified: + *

+ * If S is the set of versions being restored simultaneously, + *

    + *
  1. + * For every version V in S that corresponds to + * a missing node, there must also be a parent of V in S. + *
  2. + *
  3. + * S must contain at least one version that corresponds to + * an existing node in the workspace. + *
  4. + *
+ * If either of these restrictions does not hold, the restore will fail + * because the system will be unable to determine the path locations to which + * one or more versions are to be restored. In this case a + * VersionException is thrown. + *

+ * The versionable nodes in this workspace that correspond to the versions being restored + * define a set of (one or more) subtrees. A UUID collision occurs when this workspace + * contains a node outside these subtrees that has the same UUID as one of the nodes + * that would be introduced by the restore operation into one of these subtrees. + * The result in such a case is governed by the removeExisting flag. + * If removeExisting is true then the incoming node takes precedence, + * and the existing node (and its subtree) is removed. If removeExisting + * is false then a ItemExistsException is thrown and no changes are made. + * Note that this applies not only to cases where the restored + * node itself conflicts with an existing node but also to cases where a conflict occurs with any + * node that would be introduced into the workspace by the restore operation. In particular, conflicts + * involving subnodes of the restored node that have OnParentVersion settings of + * COPY or VERSION are also governed by the removeExisting flag. + *

+ * An UnsupportedRepositoryOperationException is thrown if versioning is not supported. + *

+ * An InvalidItemStateException is thrown if this Session (not necessarily this Node) + * has pending unsaved changes. + *

+ * A LockException is thrown if a lock prevents the restore. + * + * @param versions The set of versions to be restored + * @param removeExisting governs what happens on UUID collision. + * + * @throws ItemExistsException if removeExisting is false + * and a UUID collision occurs with a node being restored. + * @throws UnsupportedRepositoryOperationException if versioning is not supported. + * @throws VersionException if the set of versions to be restored is such that the + * original path location of one or more of the versions cannot be determined or + * if the restore would change the state of a existing verisonable + * node that is currently checked-in. + * @throws LockException if a lock prevents the restore. + * @throws InvalidItemStateException if this Session (not necessarily this Node) has pending unsaved changes. + * @throws RepositoryException if another error occurs. + */ + public function restore( /* Version */ $versions, $removeExisting ); + + /** + * Gets the QueryManager. + * Returns the QueryManager object, through search methods are accessed. + * + * @throws RepositoryException if an error occurs. + * @return the QueryManager object. + */ + public function getQueryManager(); + + /** + * Returns the NamespaceRegistry object, which is used to access information + * and (in level 2) set the mapping between namespace prefixes and URIs. + * + * @throws RepositoryException if an error occurs. + * @return the NamespaceRegistry. + */ + public function getNamespaceRegistry(); + + /** + * Returns the NodeTypeManager through which node type + * information can be queried. There is one node type registry per + * repository, therefore the NodeTypeManager is not + * workspace-specific; it provides introspection methods for the + * global, repository-wide set of available node types. + * + * @throws RepositoryException if an error occurs. + * @return a NodeTypeManager object. + */ + public function getNodeTypeManager(); + + /** + * If the the implemention supports observation + * this method returns the ObservationManager object; + * otherwise it throws an UnsupportedRepositoryOperationException. + * + * @throws UnsupportedRepositoryOperationException if the implementation does not support observation. + * @throws RepositoryException if an error occurs. + * + * @return an ObservationManager object. + */ + public function getObservationManager(); + + /** + * Returns an string array containing the names of all workspaces + * in this repository that are accessible to this user, given the + * Credentials that were used to get the Session + * tied to this Workspace. + *

+ * In order to access one of the listed workspaces, the user performs another + * Repository.login, specifying the name of the desired workspace, + * and receives a new Session object. + * + * @return string array of names of accessible workspaces. + * @throws RepositoryException + */ + public function getAccessibleWorkspaceNames(); + + /** + * Returns a org.xml.sax.ContentHandler which can be used to push SAX events into the repository. + * If the incoming XML stream (in the form of SAX events) does not appear to be a JCR system view XML document then it is + * interpreted as a document view XML document. + *

+ * The incoming XML is deserialized into a subtree of items immediately below the node at + * parentAbsPath. + *

+ * The special properties jcr:primaryType and jcr:mixinTypes are + * taken into account during deserialization in order to determine the node types of the newly created nodes. + *

+ * This method simply returns the ContentHandler without altering the state of the + * repsoitory; the actual deserialization is done through the methods of the ContentHandler. + * Invalid XML data will cause the ContentHandler to throw a SAXException. + *

+ * As SAX events are fed into the ContentHandler, changes are made directly at the + * workspace level, without going through the Session. As a result, there is not need + * to call save. The advantage of this + * direct-to-workspace method is that a large import will not result in a large cache of pending + * nodes in the Session. The disadvantage is that structures that violate node type constraints + * cannot be imported, fixed and then saved. Instead, a constraint violation will cause the + * ContentHandler to throw a SAXException. See Session.getImportContentHandler for a version of + * this method that does go through the Session. + *

+ * The flag uuidBehavior governs how the UUIDs of incoming (deserialized) nodes are + * handled. There are four options: + *

    + *
  • {@link #IMPORT_UUID_CREATE_NEW}: Incoming referenceable nodes are assigned newly + * created UUIDs upon additon to the workspace. As a result UUID collisions never occur. + *
  • {@link #IMPORT_UUID_COLLISION_REMOVE_EXISTING}: If an incoming referenceable node + * has the same UUID as a node already existing in the workspace, then the already exisitng node + * (and its subtree) is removed from wherever it may be in the workspace before the incoming node + * is added. Note that this can result in nodes "disappearing" from locations in the worksapce that + * are remote from the location to which the incoming subtree is being written. + *
  • {@link #IMPORT_UUID_COLLISION_REPLACE_EXISTING}: If an incoming referenceable node + * has the same UUID as a node already existing in the workspace then the already existing node + * is replaced by the incoming node in the same position as the existing node. Note that this may + * result in the incoming subtree being disaggregated and "spread around" to different locations + * in the workspace. In the most extreme case this behavior may result in no node at all + * being added as child of parentAbsPath. This will occur if the topmost element + * of the incoming XML has the same UUID as an existing node elsewhere in the workspace. + *
  • {@link #IMPORT_UUID_COLLISION_THROW}: If an incoming referenceable node + * has the same UUID as a node already existing in the workspace then a SAXException + * is thrown by the returned ContentHandler during deserialization. + *
+ * A SAXException will be thrown by the returned ContentHandler + * during deserialization if the top-most element of the incoming XML would deserialize to + * a node with the same name as an existing child of parentAbsPath and that + * child does not allow same-name siblings. + *

+ * A SAXException will also be thrown by the returned ContentHandler + * during deserialzation if uuidBehavior is set to + * IMPORT_UUID_COLLISION_REMOVE_EXISTING and an incoming node has the same UUID as + * the node at parentAbsPath or one of its ancestors. + *

+ * A PathNotFoundException is thrown if no node exists at parentAbsPath. + *

+ * A ConstraintViolationException is thrown if the new subtree cannot be added to the node at + * parentAbsPath due to node-type or other implementation-specific constraints, and this can + * be determined before the first SAX event is sent. Unlike {@link Session#getImportContentHandler}, + * this method also enforces node type constraints by throwing SAXExceptions during + * deserialization. + *

+ * A VersionException is thrown if the node at parentAbsPath is versionable + * and checked-in, or is non-versionable but its nearest versionable ancestor is checked-in. + *

+ * A LockException is thrown if a lock prevents the addition ofthe subtree. + *

+ * A RepositoryException is thrown if another error occurs. + * + * @param parentAbsPath the absolute path of a node under which (as child) the imported subtree will be built. + * @param uuidBehavior a four-value flag that governs how incoming UUIDs are handled. + * @return an org.xml.sax.ContentHandler whose methods may be called to feed SAX events into the deserializer. + * + * @throws PathNotFoundException if no node exists at parentAbsPath. + * @throws ConstraintViolationException if the new subtree cannot be added to the node at + * parentAbsPath due to node-type or other implementation-specific constraints, + * and this can be determined before the first SAX event is sent. + * @throws VersionException if the node at parentAbsPath is versionable + * and checked-in, or is non-versionable but its nearest versionable ancestor is checked-in. + * @throws LockException if a lock prevents the addition of the subtree. + * @throws RepositoryException if another error occurs. + */ + public function getImportContentHandler( $parentAbsPath, $uuidBehavior ); + + /** + * Deserializes an XML document and adds the resulting item subtree as a child of the node at + * parentAbsPath. + *

+ * If the incoming XML stream does not appear to be a JCR system view XML document then it is interpreted as a + * document view XML document. + *

+ * The special properties jcr:primaryType and jcr:mixinTypes are + * taken into account during deserialization in order to determine the node types of the newly + * created nodes. + *

+ * Changes are made directly at the workspace level, without going through the Session. + * As a result, there is not need to call save. The advantage of this + * direct-to-workspace method is that a large import will not result in a large cache of + * pending nodes in the Session. The disadvantage is that invalid data cannot + * be imported, fixed and then saved. Instead, invalid data will cause this method to throw an + * InvalidSerializedDataException. See Session.importXML for + * a version of this method that does go through the Session. + *

+ * The flag uuidBehavior governs how the UUIDs of incoming (deserialized) nodes are + * handled. There are four options: + *

    + *
  • {@link #IMPORT_UUID_CREATE_NEW}: Incoming referenceable nodes are assigned newly + * created UUIDs upon additon to the workspace. As a result UUID collisions never occur. + *
  • {@link #IMPORT_UUID_COLLISION_REMOVE_EXISTING}: If an incoming referenceable node + * has the same UUID as a node already existing in the workspace then the already exisitng node + * (and its subtree) is removed from wherever it may be in the workspace before the incoming node + * is added. Note that this can result in nodes "disappearing" from locations in the worksapce that + * are remote from the location to which the incoming subtree is being written. If an incoming node + * has the same UUID as the existing root node of this workspace then + *
  • {@link #IMPORT_UUID_COLLISION_REPLACE_EXISTING}: If an incoming referenceable node + * has the same UUID as a node already existing in the workspace then the already existing node + * is replaced by the incoming node in the same position as the existing node. Note that this may + * result in the incoming subtree being disaggregated and "spread around" to different locations + * in the workspace. In the most extreme edge case this behavior may result in no node at all + * being added as child of parentAbsPath. This will occur if the topmost element + * of the incoming XML has the same UUID as an existing node elsewhere in the workspace. + *
  • {@link #IMPORT_UUID_COLLISION_THROW}: If an incoming referenceable node + * has the same UUID as a node already existing in the workspace then an ItemExistsException + * is thrown. + *
+ * An ItemExistsException will be thrown if uuidBehavior + * is set to IMPORT_UUID_CREATE_NEW or IMPORT_UUID_COLLISION_THROW + * and the import would would overwrite an existing child of parentAbsPath. + *

+ * An IOException is thrown if an I/O error occurs. + *

+ * If no node exists at parentAbsPath, a PathNotFoundException is thrown. + *

+ * An ItemExisitsException is thrown if the top-most element of the incoming XML would deserialize + * to a node with the same name as an existing child of parentAbsPath and that + * child does not allow same-name siblings, or if a uuidBehavior is set to + * IMPORT_UUID_COLLISION_THROW and a UUID collision occurs. + *

+ * If node-type or other implementation-specific constraints + * prevent the addition of the subtree, a ConstraintViolationException is thrown. + *

+ * A ConstraintViolationException will also be thrown if uuidBehavior + * is set to IMPORT_UUID_COLLISION_REMOVE_EXISTING and an incoming node has the same + * UUID as the node at parentAbsPath or one of its ancestors. + *

+ * A VersionException is thrown if the node at parentAbsPath is versionable + * and checked-in, or is non-versionable but its nearest versionable ancestor is checked-in. + *

+ * A LockException is thrown if a lock prevents the addition of the subtree. + * + * @param parentAbsPath the absolute path of the node below which the deserialized subtree is added. + * @param in The Inputstream from which the XML to be deserilaized is read. + * @param uuidBehavior a four-value flag that governs how incoming UUIDs are handled. + * + * @throws IOException if an error during an I/O operation occurs. + * @throws PathNotFoundException if no node exists at parentAbsPath. + * @throws ConstraintViolationException if node-type or other implementation-specific constraints + * prevent the addition of the subtree or if uuidBehavior + * is set to IMPORT_UUID_COLLISION_REMOVE_EXISTING and an incoming node has the same + * UUID as the node at parentAbsPath or one of its ancestors. + * @throws VersionException if the node at parentAbsPath is versionable + * and checked-in, or is non-versionable but its nearest versionable ancestor is checked-in. + * @throws InvalidSerializedDataException if incoming stream is not a valid XML document. + * @throws ItemExistsException if the top-most element of the incoming XML would deserialize + * to a node with the same name as an existing child of parentAbsPath and that + * child does not allow same-name siblings, or if a uuidBehavior is set to + * IMPORT_UUID_COLLISION_THROW and a UUID collision occurs. + * @throws LockException if a lock prevents the addition of the subtree. + * @throws RepositoryException is another error occurs. + */ + public function importXML( $parentAbsPath, $in, $uuidBehavior ); +} + +?> Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/lock/Lock.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/lock/Lock.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/lock/Lock.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/lock/Lock.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,116 @@ + + * Level 2 only + *

+ * A lock is associated with an item and a user (not a ticket) + * + * @author Markus Nix + * @package phpcr + * @subpackage lock + */ +interface Lock +{ + /** + * Returns the user ID of the user who owns this lock. This is the value of the + * jcr:lockOwner property of the lock-holding node. It is also the + * value returned by Session.getUserId at the time that the lock was + * placed. The lock owner's identity is only provided for informational purposes. + * It does not govern who can perform an unlock or make changes to the locked nodes; + * that depends entirely upon who the token holder is. + * @return a user ID. + */ + public function getLockOwner(); + + /** + * Returns true if this is a deep lock; false otherwise. + * + * @return a boolean + */ + public function isDeep(); + + /** + * Returns the lock holding node. Note that N.getLock().getNode() + * (where N is a locked node) will only return N + * if N is the lock holder. If N is in the subtree + * of the lock holder, H, then this call will return H. + * + * @return an Node. + */ + public function getNode(); + + /** + * May return the lock token for this lock. + *

+ * If this Session holds the lock token for this lock, then this method will + * return that lock token. If this Session does not hold the applicable lock + * token then this method will return null. + * + * @return a String. + */ + public function getLockToken(); + + /** + * Returns true if this Lock object represents a lock that is currently in effect. + * If this lock has been unlocked either explicitly or due to an implementation-specific limitation + * (like a timeout) then it returns false. Note that this method is intended for + * those cases where one is holding a Lock Java object and wants to find out + * whether the lock (the JCR-level entity that is attached to the lockable node) that this + * object originally represented still exists. For example, a timeout or explicit + * unlock will remove a lock from a node but the Lock + * Java object corresponding to that lock may still exist, and in that case its + * isLive method will return false. + * @return a boolean. + */ + public function isLive(); + + /** + * Returns true if this is a session-scoped lock. Returns + * false if this is an open-scoped lock. + * + * @return a boolean + */ + public function isSessionScoped(); + + /** + * Refreshes (brings back to life) a previously unlocked Lock object + * (one for which isLive returns false). If this lock + * is still live (isLive returns true) or if this Session + * does not hold the correct lock token for this lock, then a LockException + * is thrown. A RepositoryException is thrown if another error occurs. + * + * The implementation may either revive an existing lock or issue a new lock + * (removing this one from the session and substituting the new one). + * This is an implementation-specific issue. + * @throws LockException if this lock is still live (isLive returns true) + * or if this Session does not hold the correct lock token for this lock. + * @throws RepositoryException if another error occurs. + */ + public function refresh(); +} + +?> \ No newline at end of file Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/lock/LockException.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/lock/LockException.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/lock/LockException.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/lock/LockException.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,37 @@ + + * Level 2 only + * + * @author Markus Nix + * @package phpcr + * @subpackage lock + */ +class LockException extends RepositoryException +{ +} + +?> \ No newline at end of file Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/ConstraintViolationException.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/ConstraintViolationException.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/ConstraintViolationException.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/ConstraintViolationException.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,37 @@ + + * @package phpcr + * @subpackage nodetype + */ +class ConstraintViolationException extends RepositoryException +{ +} + +?> \ No newline at end of file Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/ItemDefinition.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/ItemDefinition.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/ItemDefinition.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/ItemDefinition.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,102 @@ + + */ +interface ItemDefinition +{ + /** + * Gets the node type that contains the declaration of this + * ItemDefinition. + * + * @return a NodeType object. + */ + public function getDeclaringNodeType(); + + /** + * Gets the name of the child item. If "*", this + * ItemDefinition defines a residual set of child items. That is, + * it defines the characteristics of all those child items with names apart + * from the names explicitly used in other child item definitions. + * + * @return a String denoting the name or "*". + */ + public function getName(); + + /** + * Reports whether the item is to be automatically created when its parent node is created. + * If true, then this ItemDefinition will necessarily not be a residual + * set definition but will specify an actual item name (in other words getName() will not + * return �*�). + * + * @return a boolean. + */ + public function isAutoCreate(); + + /** + * Reports whether the item is mandatory. A mandatory child node is one that, + * if its parent node exists, must also exist. A mandatory property is one that + * must have a value. In the case of single-value properties this means that it + * must exist (since there is no such thing a null value). In the case of + * multi-value properties this means that the property must exist and must have + * at least one value (it cannot hold an empty array). + *

+ * A mandatory item cannot be removed, short of removing its parent. + * Nor can it be set to the empty array (if it is a multi-value property). + *

+ * An attempt to save a node that has a mandatory child item without first + * creating that child item and, if it is a property, giving it a value, + * will throw a ConstraintViolationException on save. + * + * @return a boolean + */ + public function isMandatory(); + + /** + * Gets the on-parent-version status of the child item. This governs what to do if + * the parent node of this child item is versioned. + * + * @return an int. + */ + public function getOnParentVersion(); + + /** + * Reports whether the child item is protected. In level 2 implementations, a protected item is one that cannot be removed + * (except by removing its parent) or modified through the the standard write methods of this API (that is, Item.remove, + * Node.addNode, Node.setProperty and Property.setValue). + *

+ * A protected node may be removed or modified (in a level 2 implementation), however, through some + * mechanism not defined by this specification or as a side-effect of operations other than + * the standard write methods of the API. For example, in those repositories that support versioning, the + * Node.checkin method has the side-effect of changing a node's jcr:isCheckedOut + * property, even though that property is protected. + *

+ * Note that when a node is protected this means that all its + * properties are also protected (regardless of their protected setting). The protected status of a property + * only becomes relevant if its parent node is not protected. + * + * @return a boolean. + */ + public function isProtected(); +} + +?> Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NoSuchNodeTypeException.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NoSuchNodeTypeException.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NoSuchNodeTypeException.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NoSuchNodeTypeException.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,35 @@ + + * @package phpcr + * @subpackage nodetype + */ +class NoSuchNodeTypeException extends RepositoryException +{ +} + +?> \ No newline at end of file Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeDefinition.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeDefinition.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeDefinition.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeDefinition.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,69 @@ + + */ +interface NodeDefinition extends ItemDefinition +{ + /** + * Gets the minimum set of primary node types that the child node must have. + * Returns an array to support those implementations with multiple + * inheritance. The simplest case would be to return nt:base, + * which is the base of all primary node types and therefore, in this + * context, represents the least restrictive requirement. + *

+ * A node must still have only one assigned primary node type, though + * this attribute can restrict that node type by taking advantage of any + * inheritance hierarchy that the implementation may support. + * + * @return an array of NodeType objects. + */ + public function getRequiredPrimaryTypes(); + + /** + * Gets the default primary node type that will be assigned to the child + * node if it is created without an explicitly specified primary node type. + * This node type must be a subtype of (or the same type as) the node types + * returned by getRequiredPrimaryTypes. + *

+ * If null is returned this indicates that no default primary + * type is specified and that therefore an attempt to create this node without + * specifying a node type will throw a ConstraintViolationException. + * + * @return a NodeType. + */ + public function getDefaultPrimaryType(); + + /** + * Reports whether this child node can have same-name siblings. In other + * words, whether the parent node can have more than one child node of this + * name. + * + * @return a boolean. + */ + public function allowSameNameSibs(); +} + +?> Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeType.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeType.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeType.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeType.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,179 @@ + + * @package phpcr + * @subpackage nodetype + */ +interface NodeType +{ + /** + * Returns the name of the node type. + * + * @return the name of the node type + */ + public function getName(); + + /** + * Returns true if this node type is a mixin node type. + * Returns false if this node type is a primary node type. + * + * @return a boolean + */ + public function isMixin(); + + /** + * Returns true if nodes of this type must support orderable child nodes; returns false + * otherwise. If a node type returns true on a call to this method, then all nodes of that node type + * must support the method {@link Node#orderBefore}. If a node type returns false + * on a call to this method, then nodes of that node type may support these ordering methods. Only the primary + * node type of a node controls that node's status in this regard. This setting on a mixin node type will not have any effect + * on the node. + * + * @return Returns true if nodes of this type must support orderable child nodes; returns + * false otherwise. + */ + public function hasOrderableChildNodes(); + + /** + * Returns the name of the primary item (one of the child items of the node's of this node type). + * If this node has no primary item, then this method returns null. + * This indicator is used by the method {@link Node#getPrimaryItem()}. + * + * @return the name of the primary item. + */ + public function getPrimaryItemName(); + + /** + * Returns all supertypes of this node type including both those directly + * declared and those inherited. For primary types, this list will always + * include at least nt:base. For mixin types, there is no + * required base type. + * + * @see #getDeclaredSupertypes + * + * @return an array of NodeType objects. + */ + public function getSupertypes(); + + /** + * Returns all direct supertypes as specified in the declaration of + * this node type. In single inheritance systems this will always be + * an array of size 0 or 1. In systems that support multiple inheritance of + * node types this array may be of size greater than 1. + * + * @see #getSupertypes + * + * @return an array of NodeType objects. + */ + public function getDeclaredSupertypes(); + + /** + * Returns true if this node type is nodeTypeName + * or a subtype of nodeTypeName, otherwise returns + * false. + * @param nodeTypeName the name of a node type. + * @return a boolean + */ + public function isNodeType( $nodeTypeName ); + + /** + * Returns an array containing the property definitions of this node type, + * including the property definitions inherited from supertypes of this node + * type. + * + * @see #getDeclaredPropertyDefinitions + * + * @return an array containing the property definitions. + */ + public function getPropertyDefinitions(); + + /** + * Returns an array containing the property definitions explicitly specified + * in the declaration of this node type. This does not include + * property definitions inherited from supertypes of this node type. + * + * @see #getPropertyDefinitions + * + * @return an array containing the property definitions. + */ + public function getDeclaredPropertyDefinitions(); + + /** + * Returns an array containing the child node definitions of this node type, + * including the child node definitions inherited from supertypes of this + * node type. + * + * @see #getDeclaredChildNodeDefinitions + * + * @return an array containing the child node definitions. + */ + public function getChildNodeDefinitions(); + + /** + * Returns an array containing the child node definitions explicitly + * specified in the declaration of this node type. This does + * not include child node definitions inherited from supertypes of + * this node type. + * + * @see #getChildNodeDefinitions + * @return an array containing the child node definitions. + */ + public function getDeclaredChildNodeDefinitions(); + + /** + * Returns true if setting propertyName to + * value is allowed by this node type. Otherwise returns + * false. + * + * @param propertyName The name of the property + * @param value A Value object. + */ + public function canSetProperty( $propertyName, $value ); + + /** + * Returns true if adding a child node called + * childNodeName is allowed by this node type. + *

+ * + * @param childNodeName The name of the child node. + * @param nodeTypeName The name of the node type of the child node. + */ + public function canAddChildNode( $childNodeName, $nodeTypeName = null ); + + /** + * Returns true if removing the child item called itemName is allowed by this node type. + * Otherwise returns false. + * + * @param itemName The name of the child item + */ + public function canRemoveItem( $itemName ); +} + +?> \ No newline at end of file Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeTypeIterator.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeTypeIterator.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeTypeIterator.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeTypeIterator.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,44 @@ +NodeType objects. + * + * @author Markus Nix + * @package phpcr + * @subpackage nodetype + */ +interface NodeTypeIterator extends RangeIterator +{ + /** + * Returns the next NodeType in the iteration. + * + * @return the next NodeType in the iteration. + * @throws NoSuchElementException + * if iteration has no more NodeTypes. + */ + public function nextNodeType(); +} + +?> \ No newline at end of file Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeTypeManager.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeTypeManager.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeTypeManager.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/NodeTypeManager.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,77 @@ + + * @package phpcr + * @subpackage nodetype + */ +interface NodeTypeManager +{ + /** + * Returns the named node type. + *

+ * Throws a NoSuchNodeTypeException if a node type by that name does not exist. + *

+ * Throws a RepositoryException if another error occurs. + * + * @param nodeTypeName the name of an existing node type. + * @return A NodeType object. + * @throws NoSuchNodeTypeException if no node type by the given name exists. + * @throws RepositoryException if another error occurs. + */ + public function getNodeType( $nodeTypeName ); + + /** + * Returns an iterator over all available node types (primary and mixin). + * + * @return An NodeTypeIterator. + * @throws RepositoryException if an error occurs. + */ + public function getAllNodeTypes(); + + /** + * Returns an iterator over all available primary node types. + * + * @return An NodeTypeIterator. + * @throws RepositoryException if an error occurs. + */ + public function getPrimaryNodeTypes(); + + /** + * Returns an iterator over all available mixin node types. + * If none are available, an empty iterator is returned. + * + * @return An NodeTypeIterator. + * @throws RepositoryException if an error occurs. + */ + public function getMixinNodeTypes(); +} + +?> \ No newline at end of file Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/PropertyDefinition.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/PropertyDefinition.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/PropertyDefinition.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/nodetype/PropertyDefinition.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,239 @@ + + */ +interface PropertyDefinition extends ItemDefinition +{ + /** + * Gets the required type of the property. One of: + *

    + *
  • PropertyType::STRING
  • + *
  • PropertyType::DATE
  • + *
  • PropertyType::BINARY
  • + *
  • PropertyType::DOUBLE
  • + *
  • PropertyType::LONG
  • + *
  • PropertyType::BOOLEAN
  • + *
  • PropertyType::NAME
  • + *
  • PropertyType::PATH
  • + *
  • PropertyType::REFERENCE
  • + *
  • PropertyType::UNDEFINED
  • + *
+ * PropertyType.UNDEFINED is returned if this property may be + * of any type. + * + * @return an int + */ + public function getRequiredType(); + + /** + * Gets the array of constraint strings. Each string in the array specifies + * a constraint on the value of the property. The constraints are OR-ed together, + * meaning that in order to be valid, the value must meet at least one of the + * constraints. For example, a constraint array of ["constraint1", "constraint2", + * "constraint3"] has the interpretation: "the value of this property must + * meet either constraint1, constraint2 or constraint3". + *

+ * Reporting of value constraints is optional. An implementation may return + * null, indicating that value constraint information is unavailable + * (though a constraint may still exist). + *

+ * Returning an empty array, on the other hand, indicates that value constraint information + * is available and that no constraints are placed on this value. + *

+ * In the case of multi-value properties, the constraint string array + * returned applies to all the values of the property. + *

+ * The constraint strings themselves having differing formats and interpretations + * depending on the type of the property in question. The following describes the + * value constraint syntax for each property type: + *

    + *
  • + * STRING: The constraint string is a regular expression pattern. For example the + * regular expression ".*" means "any string, including the empty string". Whereas + * a simple literal string (without any RE-specific meta-characters) like "banana" + * matches only the string "banana". + *
  • + *
  • + * PATH: The constraint string is a JCR path with an optional "*" character after + * the last "/" character. For example, possible constraint strings for a property + * of type PATH include: + *
      + *
    1. + * "/myapp:products/myapp:televisions" + *
    2. + *
    3. + * "/myapp:products/myapp:televisions/" + *
    4. + *
    5. + * "/myapp:products/*" + *
    6. + *
    7. + * "myapp:products/myapp:televisions" + *
    8. + *
    9. + * "../myapp:televisions" + *
    10. + *
    11. + * "../myapp:televisions/*" + *
    12. + *
    + * The following principles apply: + *
      + *
    • + * The "*" means "matches descendants" not "matches any subsequent path". For example, + * /a/* does not match /a/../c. + * The constraint must match the normalized path. + *
    • + *
    • + * Relative path constraint only match relative path values and absolute path + * constraints only match absolute path values. + *
    • + *
    • + * A trailing "/" has no effect (hence, 1 and 2, above, are equivalent). + *
    • + *
    • + * The trailing "*" character means that the value of the PATH property is + * restricted to the indicated subtree (in other words any additional relative path + * can replace the "*"). For example, 3, above would allow + * /myapp:products/myapp:radios, /myapp:products/myapp:microwaves/X900, and so + * forth. + *
    • + *
    • + * A constraint without a "*" means that the PATH property is restricted to that + * precise path. For example, 1, above, would allow only the value + * /myapp:products/myapp:televisions. + *
    • + *
    • + * The constraint can indicate either a relative path or an absolute path + * depending on whether it includes a leading "/" character. 1 and 4, above for + * example, are distinct. + *
    • + *
    • + * The string returned must reflect the namespace mapping in the current Session + * (i.e., the current state of the namespace registry overlaid with any + * session-specific mappings). Constraint strings for PATH properties should be + * stored in fully-qualified form (using the actual URI instead of the prefix) and + * then be converted to prefix form according to the current mapping upon the + * PropertyDefinition.getValueConstraints call. + *
    • + *
    + *
  • + *
  • + * NAME: The constraint string is a JCR name in prefix form. For example + * "myapp:products". No wildcards or other pattern matching are supported. As with + * PATH properties, the string returned must reflect the namespace mapping in the + * current Session. Constraint strings for NAME properties should be stored in + * fully-qualified form (using the actual URI instead of the prefix) and then be + * converted to prefix form according to the current mapping. + *
  • + *
  • + * REFERENCE: The constraint string is a JCR name in prefix form. This name is + * interpreted as a node type name and the REFERENCE property is restricted to + * referring only to nodes that have at least the indicated node type. For + * example, a constraint of "mytype:document" would indicate that the REFERENCE + * property in question can only refer to nodes that have at least the node type + * mytype:document (assuming this was the only constraint returned in the array, + * recall that the array of constraints are to be "OR-ed" together). No wildcards or other + * pattern matching are supported. As with PATH properties, the string returned + * must reflect the namespace mapping in the current Session. Constraint strings + * for REFERENCE properties should be stored in fully-qualified form (using the + * actual URI instead of the prefix) and then be converted to prefix form according to the + * current mapping. + *
  • + *
  • + * BOOLEAN: Either "true" or "false". + *
  • + *
+ * The remaining types all have value constraints in the form of inclusive or + * exclusive ranges: i.e., "[min, max]", "(min, max)", + * "(min, max]" or "[min, max)". Where "[" + * and "]" indicate "inclusive", while "(" and ")" + * indicate "exclusive". A missing min or max value + * indicates no bound in that direction. For example [,5] means no minimum but a + * maximum of 5 (inclusive) while [,] means simply that any value will suffice, + * The meaning of the min and max values themselves + * differ between types as follows: + *
    + *
  • + * BINARY: min and max specify the allowed + * size range of the binary value in bytes. + *
  • + *
  • + * DATE: min and max are dates specifying the + * allowed date range. The date strings must be in the ISO8601-compliant format: + * YYYY-MM-DDThh:mm:ss.sssTZD. + *
  • + *
  • + * LONG, DOUBLE: min and max are numbers. + *
  • + *
+ * Because constraints are returned as an array of disjunctive constraints, + * in many cases the elements of the array can serve directly as a "choice list". + * This may, for example, be used by an application to display options to the + * end user indicating the set of permitted values. + * + * @return a String array. + */ + public function getValueConstraints(); + + /** + * Gets the default value(s) of the property. These are the values + * that the property defined by this PropertyDefinition will be assigned if it + * is automatically created (that is, if {@link #isAutoCreate()} + * returns true). + *

+ * This method returns an array of Value objects. If the property is + * multi-valued, then this array represents the full set of values + * that the property will be assigned upon being auto-created. + * Note that this could be the empty array. If the property is single-valued, + * then the array returned will be of size 1. + *

+ * If null is returned, then the property has no fixed default value. + * This does not exclude the possibility that the property still assumes some + * value automatically, but that value may be parameterized (for example, + * "the current date") and hence not expressable as a single fixed value. + * In particular, this must be the case if isAutoCreate + * returns true and this method returns null. + * + * @return an array of Value objects. + */ + public function getDefaultValues(); + + /** + * Reports whether this property can have multiple values. Note that the + * isMultiple flag is special in that a given node type may + * have two property definitions that are identical in every respect except + * for the their isMultiple status. For example, a node type + * can specify two string properties both called X, one of + * which is multi-valued and the other not. + * + * @return a boolean + */ + public function isMultiple(); +} + +?> Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/Event.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/Event.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/Event.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/Event.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,118 @@ + + * Level 2 only + *

+ * For details see the ObservationManager section of the JCR standard document. + * + * @author Markus Nix + * @package phpcr + * @subpackage observation + */ +interface Event +{ + /** + * An event of this type is generated when a node is added. + */ + const NODE_ADDED = 1; + + /** + * An event of this type is generated when a node is removed. + */ + const NODE_REMOVED = 2; + + /** + * An event of this type is generated when a property is added. + */ + const PROPERTY_ADDED = 4; + + /** + * An event of this type is generated when a property is removed. + */ + const PROPERTY_REMOVED = 8; + + /** + * An event of this type is generated when a property is changed. + */ + const PROPERTY_CHANGED = 16; + + + /** + * Returns the type of this event: a constant defined by this interface. + * One of: + *

    + *
  • NODE_ADDED
  • + *
  • NODE_REMOVED
  • + *
  • PROPERTY_ADDED
  • + *
  • PROPERTY_REMOVED
  • + *
  • PROPERTY_CHANGED
  • + *
+ * + * @return the type of this event. + */ + public function getType(); + + /** + * Returns the absolute path of the parent node connected with this event. + * The interpretation given to the returned path depends upon the type of the event: + *
    + *
  • + * If the event type is NODE_ADDED then this method returns the absolute path of + * the node that was added. + *
  • + *
  • + * If the event type is NODE_REMOVED then this method returns the absolute path of + * the node that was removed. + *
  • + *
  • + * If the event type is PROPERTY_ADDED then this method returns the absolute path of + * the property that was added. + *
  • + *
  • + * If the event type is PROPERTY_REMOVED then this method returns the absolute path of + * the property that was removed. + *
  • + *
  • + * If the event type is PROPERTY_CHANGED then this method returns the absolute path of + * of the changed property. + *
  • + *
+ * + * @throws RepositoryException if an error occurs. + * @return the absolute path of the parent node connected with this event. + */ + public function getPath(); + + /** + * Returns the user ID connected with this event. This is the string returned by getUserId of the session that + * caused the event. + * + * @return a String. + */ + public function getUserId(); +} + +?> \ No newline at end of file Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/EventIterator.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/EventIterator.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/EventIterator.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/EventIterator.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,46 @@ +Events + * with nextEvent as well as a skip method inherited from + * RangeIterator. + * + * @author Markus Nix + * @package phpcr + * @subpackage observation + */ +interface EventIterator extends RangeIterator +{ + /** + * Returns the next Event in the iteration. + * + * @return the next Event in the iteration. + * @throws NoSuchElementException if iteration has no more Events. + */ + public function nextEvent(); +} + +?> \ No newline at end of file Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/EventListener.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/EventListener.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/EventListener.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/EventListener.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,49 @@ + + * Level 2 only + *

+ * An EventListener can be registered via the + * observation.ObservationManager object. Event listeners are + * notified asynchronously, and see events after they occur and the transaction + * is committed. An event listener only sees events for which the ticket that + * registered it has sufficient access rights. + * + * @author Markus Nix + * @package phpcr + * @subpackage observation + */ +interface EventListener +{ + /** + * Gets called when an event occurs. + * + * @param events The event set recieved. + */ + public function onEvent( EventIterator $events ); +} + +?> \ No newline at end of file Added: incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/EventListenerIterator.php URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/EventListenerIterator.php?rev=208906&view=auto ============================================================================== --- incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/EventListenerIterator.php (added) +++ incubator/jackrabbit/trunk/contrib/phpcr/PHPCR/observation/EventListenerIterator.php Sun Jul 3 04:58:33 2005 @@ -0,0 +1,46 @@ +EventListeners + * with nextEventListener as well as a skip method inherited from + * RangeIterator. + * + * @author Markus Nix + * @package phpcr + * @subpackage observation + */ +interface EventListenerIterator extends RangeIterator +{ + /** + * Returns the next EventListener in the iteration. + * + * @return the next EventListener in the iteration. + * @throws NoSuchElementException if iteration has no more EventListeners. + */ + public function nextEventListener(); +} + +?> \ No newline at end of file