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 [4/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/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 @@
+<?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/InvalidItemStateException.php';
+require_once 'PHPCR/NoSuchWorkspaceException.php';
+require_once 'PHPCR/nodetype/ConstraintViolationException.php';
+require_once 'PHPCR/version/VersionException.php';
+require_once 'PHPCR/AccessDeniedException.php';
+require_once 'PHPCR/PathNotFoundException.php';
+require_once 'PHPCR/ItemExistsException.php';
+require_once 'PHPCR/lock/LockException.php';
+require_once 'PHPCR/RepositoryException.php';
+require_once 'PHPCR/UnsupportedRepositoryOperationException.php';
+/* require_once 'PHPCR/version/Version.php'; */
+require_once 'PHPCR/IOException.php';
+require_once 'PHPCR/InvalidSerializedDataException.php';
+require_once 'PHPCR/query/QueryManager.php';
+require_once 'PHPCR/NamespaceRegistry.php';
+require_once 'PHPCR/nodetype/NodeTypeManager.php';
+require_once 'PHPCR/observation/ObservationManager.php';
+
+
+/**
+ * Represents a view onto the the content repository.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ */
+interface Workspace
+{
+ /**
+ * A constant used as the value of the flag <code>uuidBehavior</code> 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 <code>uuidBehavior</code> 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 <code>uuidBehavior</code> 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 <code>uuidBehavior</code> in
+ * the methods {@link #getImportContentHandler} and {@link #importXML}.
+ * See those methods for details.
+ */
+ const IMPORT_UUID_COLLISION_THROW = 3;
+
+
+ /**
+ * Returns the <code>Session</code> object through which this <code>Workspace</code>
+ * object was acquired.
+ *
+ * @return a <code>{@link Session}</code> object.
+ */
+ public function getSession();
+
+ /**
+ * Returns the name of the actual persistent workspace represented by this
+ * <code>Workspace</code> object.
+ *
+ * @return the name of this workspace.
+ */
+ public function getName();
+
+ /**
+ * This method copies the subtree at <code>srcAbsPath</code> in <code>srcWorkspace</code>
+ * to <code>destAbsPath</code> in <code>this</code> workspace. Unlike <code>clone</code>,
+ * this method <i>does</i> 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 <code>save</code>.
+ * <p/>
+ * The <code>destAbsPath</code> provided must not
+ * have an index on its final element. If it does then a <code>RepositoryException</code>
+ * is thrown. Strictly speaking, the <code>destAbsPath</code> parameter is actually an <i>absolute path</i>
+ * to the parent node of the new location, appended with the new <i>name</i> 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.
+ * <p/>
+ * 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).
+ * <p/>
+ * A <code>NoSuchWorkspaceException</code> is thrown if <code>srcWorkspace</code> does not
+ * exist or if the current Session does not have permission to access it.
+ * <p/>
+ * A <code>ConstraintViolationException</code> is thrown if the operation would violate a node-type
+ * or other implementation-specific constraint.
+ * <p/>
+ * A <code>VersionException</code> is thrown if the parent node of <code>destAbsPath</code> is
+ * versionable and checked-in, or is non-versionable but its nearest versionable ancestor is
+ * checked-in.
+ * <p/>
+ * An <code>AccessDeniedException</code> is thrown if the current session (i.e. the session that
+ * was used to acquire this <code>Workspace</code> object) does not have sufficient access rights
+ * to complete the operation.
+ * <p/>
+ * A <code>PathNotFoundException</code> is thrown if the node at <code>srcAbsPath</code> or the
+ * parent of the new node at <code>destAbsPath</code> does not exist.
+ * <p/>
+ * An <code>ItemExistException</code> is thrown if a property already exists at
+ * <code>destAbsPath</code> or a node already exist there, and same name
+ * siblings are not allowed.
+ * <p/>
+ * A <code>LockException</code> 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 <code>srcAbsPath</code>
+ * is to be copied in <code>this</code> workspace.
+ * @throws NoSuchWorkspaceException if <code>srcWorkspace</code> does not
+ * exist or if the current <code>Session</code> 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 <code>destAbsPath</code> 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
+ * <code>srcWorkspace</code> but otherwise does not have sufficient access rights to
+ * complete the operation.
+ * @throws PathNotFoundException if the node at <code>srcAbsPath</code> or
+ * the parent of the new node at <code>destAbsPath</code> does not exist.
+ * @throws ItemExistsException if a property already exists at
+ * <code>destAbsPath</code> 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 <code>destAbsPath</code>
+ * has an index or if another error occurs.
+ */
+ public function copy( $srcWorkspace, $srcAbsPath, $destAbsPath );
+
+ /**
+ * Clones the subtree at the node <code>srcAbsPath</code> in <code>srcWorkspace</code> to the new location at
+ * <code>destAbsPath</code> in <code>this</code> workspace. This method does not assign new UUIDs to
+ * the new nodes but preserves the UUIDs (if any) of their respective source nodes.
+ * <p/>
+ * If <code>removeExisting</code> is true and an existing node in this workspace
+ * (the destination workspace) has the same UUID as a node being cloned from
+ * <code>srcWorkspace</code>, then the incoming node takes precedence, and the
+ * existing node (and its subtree) is removed. If <code>removeExisting</code>
+ * is false then a UUID collision causes this method to throw a
+ * <code>ItemExistsException</code> and no changes are made.
+ * <p/>
+ * If successful, the change is persisted immediately, there is no need to call <code>save</code>.
+ * <p/>
+ * The <code>destAbsPath</code> provided must not
+ * have an index on its final element. If it does then a <code>RepositoryException</code>
+ * is thrown. Strictly speaking, the <code>destAbsPath</code> parameter is actually an <i>absolute path</i>
+ * to the parent node of the new location, appended with the new <i>name</i> 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.
+ * <p/>
+ * 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).
+ * <p/>
+ * A <code>NoSuchWorkspaceException</code> is thrown if <code>srcWorkspace</code> does not
+ * exist or if the current <code>Session</code> does not have permission to access it.
+ * <p/>
+ * A <code>ConstraintViolationException</code> is thrown if the operation would violate a node-type
+ * or other implementation-specific constraint.
+ * <p/>
+ * A <code>VersionException</code> is thrown if the parent node of <code>destAbsPath</code> is
+ * versionable and checked-in, or is non-versionable but its nearest versionable ancestor is
+ * checked-in. This exception will also be thrown if <code>removeExisting</code> is <code>true</code>,
+ * and a UUID conflict occurs that would require the moving and/or altering of a node that is checked-in.
+ * <p/>
+ * An <code>AccessDeniedException</code> is thrown if the current session (i.e. the session that
+ * was used to acquire this <code>Workspace</code> object) does not have sufficient access rights
+ * to complete the operation.
+ * <p/>
+ * A <code>PathNotFoundException</code> is thrown if the node at <code>srcAbsPath</code> or the
+ * parent of the new node at <code>destAbsPath</code> does not exist.
+ * <p/>
+ * An <code>ItemExistsException</code> is thrown if a node or property already exists at
+ * <code>destAbsPath</code>
+ * <p/>
+ * An <code>ItemExistException</code> is thrown if a property already exists at
+ * <code>destAbsPath</code> or a node already exist there, and same name
+ * siblings are not allowed or if <code>removeExisting</code> is false and a
+ * UUID conflict occurs.
+ * <p/>
+ * A <code>LockException</code> 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 <code>srcWorkspace</code>.
+ * @param destAbsPath the location to which the node at <code>srcAbsPath</code>
+ * is to be copied in <code>this</code> workspace.
+ * @param removeExisting if <code>false</code> then this method throws an
+ * <code>ItemExistsException</code> on UUID conflict with an incoming node.
+ * If <code>true</code> then a UUID conflict is resolved by removing the existing node
+ * from its location in this workspace and cloning (copying in) the one from
+ * <code>srcWorkspace</code>.
+ *
+ * @throws NoSuchWorkspaceException if <code>destWorkspace</code> 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 <code>destAbsPath</code> is
+ * versionable and checked-in, or is non-versionable but its nearest versionable ancestor is
+ * checked-in. This exception will also be thrown if <code>removeExisting</code> is <code>true</code>,
+ * 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 <code>srcAbsPath</code> or
+ * the parent of the new node at <code>destAbsPath</code> does not exist.
+ * @throws ItemExistsException if a property already exists at
+ * <code>destAbsPath</code> or a node already exist there, and same name
+ * siblings are not allowed or if <code>removeExisting</code> is false and a
+ * UUID conflict occurs.
+ * @throws LockException if a lock prevents the clone.
+ * @throws RepositoryException if the last element of <code>destAbsPath</code>
+ * has an index or if another error occurs.
+ */
+ public function clone_( $srcAbsPath, $destAbsPath, $srcWorkspace = null, $removeExisting = null );
+
+ /**
+ * Moves the node at <code>srcAbsPath</code> (and its entire subtree) to the
+ * new location at <code>destAbsPath</code>. If successful,
+ * the change is persisted immediately, there is no need to call <code>save</code>.
+ * Note that this is in contrast to {@link Session#move} which operates within the
+ * transient space and hence requires a <code>save</code>.
+ * <p/>
+ * The <code>destAbsPath</code> provided must not
+ * have an index on its final element. If it does then a <code>RepositoryException</code>
+ * is thrown. Strictly speaking, the <code>destAbsPath</code> parameter is actually an <i>absolute path</i>
+ * to the parent node of the new location, appended with the new <i>name</i> 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.
+ * <p/>
+ * 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).
+ * <p/>
+ * A <code>ConstraintViolationException</code> is thrown if the operation would violate a node-type
+ * or other implementation-specific constraint.
+ * <p/>
+ * A <code>VersionException</code> is thrown if the parent node of <code>destAbsPath</code>
+ * or the parent node of <code>srcAbsPath</code> is versionable and checked-in, or is
+ * non-versionable but its nearest versionable ancestor is checked-in.
+ * <p/>
+ * An <code>AccessDeniedException</code> is thrown if the current session (i.e. the session that
+ * was used to acquire this <code>Workspace</code> object) does not have sufficient access rights
+ * to complete the operation.
+ * <p/>
+ * A <code>PathNotFoundException</code> is thrown if the node at <code>srcAbsPath</code> or the
+ * parent of the new node at <code>destAbsPath</code> does not exist.
+ * <p/>
+ * An <code>ItemExistException</code> is thrown if a property already exists at
+ * <code>destAbsPath</code> or a node already exist there, and same name
+ * siblings are not allowed.
+ * <p/>
+ * A <code>LockException</code> 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 <code>srcAbsPath</code>
+ * 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 <code>destAbsPath</code>
+ * or the parent node of <code>srcAbsPath</code> 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 <code>Workspace</code> object) does not have
+ * sufficient access rights to complete the operation.
+ * @throws PathNotFoundException if the node at <code>srcAbsPath</code> or
+ * the parent of the new node at <code>destAbsPath</code> does not exist.
+ * @throws ItemExistsException if a property already exists at
+ * <code>destAbsPath</code> 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 <code>destAbsPath</code>
+ * 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 <code>REFERENCE</code> properties would prevent the restore in any
+ * serial order.
+ * <p>
+ * If the restore succeeds the changes made to <code>this</code> node are
+ * persisted immediately, there is no need to call <code>save</code>.
+ * <p>
+ * The following restrictions apply to the set of versions specified:
+ * <p>
+ * If <code>S</code> is the set of versions being restored simultaneously,
+ * <ol>
+ * <li>
+ * For every version <code>V</code> in <code>S</code> that corresponds to
+ * a <i>missing</i> node, there must also be a parent of V in S.
+ * </li>
+ * <li>
+ * <code>S</code> must contain at least one version that corresponds to
+ * an existing node in the workspace.
+ * </li>
+ * </ol>
+ * 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
+ * <code>VersionException</code> is thrown.
+ * <p/>
+ * 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 <i>outside these subtrees</i> that has the same UUID as one of the nodes
+ * that would be introduced by the <code>restore</code> operation <i>into one of these subtrees</i>.
+ * The result in such a case is governed by the <code>removeExisting</code> flag.
+ * If <code>removeExisting</code> is <code>true</code> then the incoming node takes precedence,
+ * and the existing node (and its subtree) is removed. If <code>removeExisting</code>
+ * is <code>false</code> then a <code>ItemExistsException</code> 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 <code>OnParentVersion</code> settings of
+ * <code>COPY</code> or <code>VERSION</code> are also governed by the <code>removeExisting</code> flag.
+ * <p/>
+ * An <code>UnsupportedRepositoryOperationException</code> is thrown if versioning is not supported.
+ * <p/>
+ * An <code>InvalidItemStateException</code> is thrown if this <code>Session</code> (not necessarily this <code>Node</code>)
+ * has pending unsaved changes.
+ * <p/>
+ * A <code>LockException</code> 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 <code>removeExisting</code> is <code>false</code>
+ * 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 <code>restore</code> 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 <code>Session</code> (not necessarily this <code>Node</code>) has pending unsaved changes.
+ * @throws RepositoryException if another error occurs.
+ */
+ public function restore( /* Version */ $versions, $removeExisting );
+
+ /**
+ * Gets the <code>QueryManager</code>.
+ * Returns the <code>QueryManager</code> object, through search methods are accessed.
+ *
+ * @throws RepositoryException if an error occurs.
+ * @return the <code>QueryManager</code> object.
+ */
+ public function getQueryManager();
+
+ /**
+ * Returns the <code>NamespaceRegistry</code> 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 <code>NamespaceRegistry</code>.
+ */
+ public function getNamespaceRegistry();
+
+ /**
+ * Returns the <code>NodeTypeManager</code> through which node type
+ * information can be queried. There is one node type registry per
+ * repository, therefore the <code>NodeTypeManager</code> 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 <code>NodeTypeManager</code> object.
+ */
+ public function getNodeTypeManager();
+
+ /**
+ * If the the implemention supports observation
+ * this method returns the <code>ObservationManager</code> object;
+ * otherwise it throws an <code>UnsupportedRepositoryOperationException</code>.
+ *
+ * @throws UnsupportedRepositoryOperationException if the implementation does not support observation.
+ * @throws RepositoryException if an error occurs.
+ *
+ * @return an <code>ObservationManager</code> 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
+ * <code>Credentials</code> that were used to get the <code>Session</code>
+ * tied to this <code>Workspace</code>.
+ * <p/>
+ * In order to access one of the listed workspaces, the user performs another
+ * <code>Repository.login</code>, specifying the name of the desired workspace,
+ * and receives a new <code>Session</code> object.
+ *
+ * @return string array of names of accessible workspaces.
+ * @throws RepositoryException
+ */
+ public function getAccessibleWorkspaceNames();
+
+ /**
+ * Returns a <code>org.xml.sax.ContentHandler</code> 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.
+ * <p>
+ * The incoming XML is deserialized into a subtree of items immediately below the node at
+ * <code>parentAbsPath</code>.
+ * <p>
+ * The special properties <code>jcr:primaryType</code> and <code>jcr:mixinTypes</code> are
+ * taken into account during deserialization in order to determine the node types of the newly created nodes.
+ * <p>
+ * This method simply returns the <code>ContentHandler</code> without altering the state of the
+ * repsoitory; the actual deserialization is done through the methods of the <code>ContentHandler</code>.
+ * Invalid XML data will cause the <code>ContentHandler</code> to throw a <code>SAXException</code>.
+ * <p>
+ * As SAX events are fed into the <code>ContentHandler</code>, changes are made directly at the
+ * workspace level, without going through the <code>Session</code>. As a result, there is not need
+ * to call <code>save</code>. 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 <code>Session</code>. The disadvantage is that structures that violate node type constraints
+ * cannot be imported, fixed and then saved. Instead, a constraint violation will cause the
+ * <code>ContentHandler</code> to throw a <code>SAXException</code>. See <code>Session.getImportContentHandler</code> for a version of
+ * this method that <i>does</i> go through the <code>Session</code>.
+ * <p>
+ * The flag <code>uuidBehavior</code> governs how the UUIDs of incoming (deserialized) nodes are
+ * handled. There are four options:
+ * <ul>
+ * <li>{@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.
+ * <li>{@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.
+ * <li>{@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 <code>parentAbsPath</code>. This will occur if the topmost element
+ * of the incoming XML has the same UUID as an existing node elsewhere in the workspace.
+ * <li>{@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 <code>ContentHandler</code> during deserialization.
+ * </ul>
+ * A <code>SAXException</code> will be thrown by the returned <code>ContentHandler</code>
+ * 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 <code>parentAbsPath</code> and that
+ * child does not allow same-name siblings.
+ * <p>
+ * A <code>SAXException</code> will also be thrown by the returned <code>ContentHandler</code>
+ * during deserialzation if <code>uuidBehavior</code> is set to
+ * <code>IMPORT_UUID_COLLISION_REMOVE_EXISTING</code> and an incoming node has the same UUID as
+ * the node at <code>parentAbsPath</code> or one of its ancestors.
+ * <p>
+ * A <code>PathNotFoundException</code> is thrown if no node exists at <code>parentAbsPath</code>.
+ * <p>
+ * A <code>ConstraintViolationException</code> is thrown if the new subtree cannot be added to the node at
+ * <code>parentAbsPath</code> 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 <code>SAXException</code>s during
+ * deserialization.
+ * <p/>
+ * A <code>VersionException</code> is thrown if the node at <code>parentAbsPath</code> 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 addition ofthe subtree.
+ * <p>
+ * A <code>RepositoryException</code> 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 <code>parentAbsPath</code>.
+ * @throws ConstraintViolationException if the new subtree cannot be added to the node at
+ * <code>parentAbsPath</code> 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 <code>parentAbsPath</code> 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
+ * <code>parentAbsPath</code>.
+ * <p>
+ * If the incoming XML stream does not appear to be a JCR system view XML document then it is interpreted as a
+ * <b>document view</b> XML document.
+ * <p>
+ * The special properties <code>jcr:primaryType</code> and <code>jcr:mixinTypes</code> are
+ * taken into account during deserialization in order to determine the node types of the newly
+ * created nodes.
+ * <p>
+ * Changes are made directly at the workspace level, without going through the <code>Session</code>.
+ * As a result, there is not need to call <code>save</code>. 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 <code>Session</code>. The disadvantage is that invalid data cannot
+ * be imported, fixed and then saved. Instead, invalid data will cause this method to throw an
+ * <code>InvalidSerializedDataException</code>. See <code>Session.importXML</code> for
+ * a version of this method that <i>does</i> go through the <code>Session</code>.
+ * <p/>
+ * The flag <code>uuidBehavior</code> governs how the UUIDs of incoming (deserialized) nodes are
+ * handled. There are four options:
+ * <ul>
+ * <li>{@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.
+ * <li>{@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
+ * <li>{@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 <code>parentAbsPath</code>. This will occur if the topmost element
+ * of the incoming XML has the same UUID as an existing node elsewhere in the workspace.
+ * <li>{@link #IMPORT_UUID_COLLISION_THROW}: If an incoming referenceable node
+ * has the same UUID as a node already existing in the workspace then an <code>ItemExistsException</code>
+ * is thrown.
+ * </ul>
+ * An <code>ItemExistsException</code> will be thrown if <code>uuidBehavior</code>
+ * is set to <code>IMPORT_UUID_CREATE_NEW</code> or <code>IMPORT_UUID_COLLISION_THROW</code>
+ * and the import would would overwrite an existing child of <code>parentAbsPath</code>.
+ * <p>
+ * An IOException is thrown if an I/O error occurs.
+ * <p>
+ * If no node exists at <code>parentAbsPath</code>, a <code>PathNotFoundException</code> is thrown.
+ * <p>
+ * 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 <code>parentAbsPath</code> and that
+ * child does not allow same-name siblings, or if a <code>uuidBehavior</code> is set to
+ * <code>IMPORT_UUID_COLLISION_THROW</code> and a UUID collision occurs.
+ * <p>
+ * If node-type or other implementation-specific constraints
+ * prevent the addition of the subtree, a <code>ConstraintViolationException</code> is thrown.
+ * <p>
+ * A <code>ConstraintViolationException</code> will also be thrown if <code>uuidBehavior</code>
+ * is set to <code>IMPORT_UUID_COLLISION_REMOVE_EXISTING</code> and an incoming node has the same
+ * UUID as the node at <code>parentAbsPath</code> or one of its ancestors.
+ * <p>
+ * A <code>VersionException</code> is thrown if the node at <code>parentAbsPath</code> 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 addition of the subtree.
+ *
+ * @param parentAbsPath the absolute path of the node below which the deserialized subtree is added.
+ * @param in The <code>Inputstream</code> 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 <code>parentAbsPath</code>.
+ * @throws ConstraintViolationException if node-type or other implementation-specific constraints
+ * prevent the addition of the subtree or if <code>uuidBehavior</code>
+ * is set to <code>IMPORT_UUID_COLLISION_REMOVE_EXISTING</code> and an incoming node has the same
+ * UUID as the node at <code>parentAbsPath</code> or one of its ancestors.
+ * @throws VersionException if the node at <code>parentAbsPath</code> 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 <code>parentAbsPath</code> and that
+ * child does not allow same-name siblings, or if a <code>uuidBehavior</code> is set to
+ * <code>IMPORT_UUID_COLLISION_THROW</code> 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 @@
+<?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/lock/LockException.php';
+require_once 'PHPCR/RepositoryException.php';
+
+
+/**
+ * Represents a lock placed on an item.
+ * <p/>
+ * <b>Level 2 only</b>
+ * <p/>
+ * A lock is associated with an item and a user (not a ticket)
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ * @subpackage lock
+ */
+interface Lock
+{
+ /**
+ * Returns the user ID of the user who owns this lock. This is the value of the
+ * <code>jcr:lockOwner</code> property of the lock-holding node. It is also the
+ * value returned by <code>Session.getUserId</code> 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 <code>true</code> if this is a deep lock; <code>false</code> otherwise.
+ *
+ * @return a boolean
+ */
+ public function isDeep();
+
+ /**
+ * Returns the lock holding node. Note that <code>N.getLock().getNode()</code>
+ * (where <code>N</code> is a locked node) will only return <code>N</code>
+ * if <code>N</code> is the lock holder. If <code>N</code> is in the subtree
+ * of the lock holder, <code>H</code>, then this call will return <code>H</code>.
+ *
+ * @return an <code>Node</code>.
+ */
+ public function getNode();
+
+ /**
+ * May return the lock token for this lock.
+ * <p/>
+ * If this <code>Session</code> holds the lock token for this lock, then this method will
+ * return that lock token. If this <code>Session</code> does not hold the applicable lock
+ * token then this method will return null.
+ *
+ * @return a <code>String</code>.
+ */
+ public function getLockToken();
+
+ /**
+ * Returns true if this <code>Lock</code> 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 <code>false</code>. Note that this method is intended for
+ * those cases where one is holding a <code>Lock</code> 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
+ * <code>unlock</code> will remove a lock from a node but the <code>Lock</code>
+ * Java object corresponding to that lock may still exist, and in that case its
+ * <code>isLive</code> method will return <code>false</code>.
+ * @return a <code>boolean</code>.
+ */
+ public function isLive();
+
+ /**
+ * Returns <code>true</code> if this is a session-scoped lock. Returns
+ * <code>false</code> if this is an open-scoped lock.
+ *
+ * @return a <code>boolean</code>
+ */
+ public function isSessionScoped();
+
+ /**
+ * Refreshes (brings back to life) a previously unlocked <code>Lock</code> object
+ * (one for which <code>isLive</code> returns <code>false</code>). If this lock
+ * is still live (<code>isLive</code> returns <code>true</code>) or if this <code>Session</code>
+ * does not hold the correct lock token for this lock, then a <code>LockException</code>
+ * is thrown. A <code>RepositoryException</code> 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 (<code>isLive</code> returns <code>true</code>)
+ * or if this <code>Session</code> 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 @@
+<?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 access-related methods.
+ * <p>
+ * <b>Level 2 only</b>
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @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 @@
+<?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 an action would violate
+ * a constraint on repository structure. For example, when an attempt is made
+ * to persistently add an item to a node that would violate that node's node type.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @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 @@
+<?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.
+ */
+
+/**
+ * An item definition.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ */
+interface ItemDefinition
+{
+ /**
+ * Gets the node type that contains the declaration of <i>this</i>
+ * <code>ItemDefinition</code>.
+ *
+ * @return a <code>NodeType</code> object.
+ */
+ public function getDeclaringNodeType();
+
+ /**
+ * Gets the name of the child item. If <code>"*"</code>, this
+ * <code>ItemDefinition</code> 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 <code>String</code> denoting the name or <code>"*"</code>.
+ */
+ public function getName();
+
+ /**
+ * Reports whether the item is to be automatically created when its parent node is created.
+ * If <code>true</code>, then this <code>ItemDefinition</code> will necessarily not be a residual
+ * set definition but will specify an actual item name (in other words getName() will not
+ * return �*�).
+ *
+ * @return a <code>boolean</code>.
+ */
+ 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).
+ * <p/>
+ * 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).
+ * <p/>
+ * 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 <code>ConstraintViolationException</code> on <code>save</code>.
+ *
+ * @return a <code>boolean</code>
+ */
+ 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 <code>int</code>.
+ */
+ 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).
+ * <p/>
+ * 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
+ * <code>Node.checkin</code> method has the side-effect of changing a node's <code>jcr:isCheckedOut</code>
+ * property, even though that property is protected.
+ * <p/>
+ * 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 <code>boolean</code>.
+ */
+ 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 @@
+<?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 type-related methods.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @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 @@
+<?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/nodetype/ItemDefinition.php';
+
+
+/**
+ * A node definition. Used in node typed definition
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ */
+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 <code>nt:base</code>,
+ * which is the base of all primary node types and therefore, in this
+ * context, represents the least restrictive requirement.
+ * <p>
+ * 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 <code>NodeType</code> 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 <code>getRequiredPrimaryTypes</code>.
+ * <p/>
+ * If <code>null</code> 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 <code>ConstraintViolationException</code>.
+ *
+ * @return a <code>NodeType</code>.
+ */
+ 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 @@
+<?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/Value.php';
+require_once 'PHPCR/nodetype/PropertyDefinition.php';
+require_once 'PHPCR/nodetype/NodeDefinition.php';
+require_once 'PHPCR/nodetype/NodeType.php';
+
+
+/**
+ * Represents a node type.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ * @subpackage nodetype
+ */
+interface NodeType
+{
+ /**
+ * Returns the name of the node type.
+ *
+ * @return the name of the node type
+ */
+ public function getName();
+
+ /**
+ * Returns <code>true</code> if this node type is a mixin node type.
+ * Returns <code>false</code> if this node type is a primary node type.
+ *
+ * @return a boolean
+ */
+ public function isMixin();
+
+ /**
+ * Returns <code>true</code> if nodes of this type must support orderable child nodes; returns <code>false</code>
+ * otherwise. If a node type returns <code>true</code> on a call to this method, then all nodes of that node type
+ * <i>must</i> support the method {@link Node#orderBefore}. If a node type returns <code>false</code>
+ * on a call to this method, then nodes of that node type <i>may</i> 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 <code>true</code> if nodes of this type must support orderable child nodes; returns
+ * <code>false</code> 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 <code>null</code>.
+ * 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 <code>nt:base</code>. For mixin types, there is no
+ * required base type.
+ *
+ * @see #getDeclaredSupertypes
+ *
+ * @return an array of <code>NodeType</code> objects.
+ */
+ public function getSupertypes();
+
+ /**
+ * Returns all <i>direct</i> supertypes as specified in the declaration of
+ * <i>this</i> 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 <code>NodeType</code> objects.
+ */
+ public function getDeclaredSupertypes();
+
+ /**
+ * Returns true if this node type is <code>nodeTypeName</code>
+ * or a subtype of <code>nodeTypeName</code>, otherwise returns
+ * <code>false</code>.
+ * @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 <i>this</i> node type. This does <i>not</i> 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 <i>this</i> node type. This does
+ * <i>not</i> 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 <code>true</code> if setting <code>propertyName</code> to
+ * <code>value</code> is allowed by this node type. Otherwise returns
+ * <code>false</code>.
+ *
+ * @param propertyName The name of the property
+ * @param value A <code>Value</code> object.
+ */
+ public function canSetProperty( $propertyName, $value );
+
+ /**
+ * Returns <code>true</code> if adding a child node called
+ * <code>childNodeName</code> is allowed by this node type.
+ * <p>
+ *
+ * @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 <code>itemName</code> is allowed by this node type.
+ * Otherwise returns <code>false</code>.
+ *
+ * @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 @@
+<?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';
+
+
+/**
+ * An iterator for <code>NodeType</code> objects.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ * @subpackage nodetype
+ */
+interface NodeTypeIterator extends RangeIterator
+{
+ /**
+ * Returns the next <code>NodeType</code> in the iteration.
+ *
+ * @return the next <code>NodeType</code> in the iteration.
+ * @throws NoSuchElementException
+ * if iteration has no more <code>NodeType</code>s.
+ */
+ 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 @@
+<?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';
+require_once 'PHPCR/nodetype/NodeType.php';
+require_once 'PHPCR/nodetype/NoSuchNodeTypeException.php';
+require_once 'PHPCR/nodetype/NodeTypeIterator.php';
+
+
+/**
+ * Allows for the retrieval of node types.
+ * Accessed via Workspace#getNodeTypeManager.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ * @subpackage nodetype
+ */
+interface NodeTypeManager
+{
+ /**
+ * Returns the named node type.
+ * <p>
+ * Throws a <code>NoSuchNodeTypeException</code> if a node type by that name does not exist.
+ * <p>
+ * Throws a <code>RepositoryException</code> if another error occurs.
+ *
+ * @param nodeTypeName the name of an existing node type.
+ * @return A <code>NodeType</code> 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 <code>NodeTypeIterator</code>.
+ * @throws RepositoryException if an error occurs.
+ */
+ public function getAllNodeTypes();
+
+ /**
+ * Returns an iterator over all available primary node types.
+ *
+ * @return An <code>NodeTypeIterator</code>.
+ * @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 <code>NodeTypeIterator</code>.
+ * @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 @@
+<?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/Value.php';
+require_once 'PHPCR/nodetype/ItemDefinition.php';
+
+
+/**
+ * A property definition. Used in node type definitions.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ */
+interface PropertyDefinition extends ItemDefinition
+{
+ /**
+ * Gets the required type of the property. One of:
+ * <ul>
+ * <li><code>PropertyType::STRING</code></li>
+ * <li><code>PropertyType::DATE</code></li>
+ * <li><code>PropertyType::BINARY</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>
+ * <li><code>PropertyType::UNDEFINED</code></li>
+ * </ul>
+ * <code>PropertyType.UNDEFINED</code> 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 <code>["constraint1", "constraint2",
+ * "constraint3"]</code> has the interpretation: "the value of this property must
+ * meet either constraint1, constraint2 or constraint3".
+ * <p>
+ * Reporting of value constraints is optional. An implementation may return
+ * <code>null</code>, indicating that value constraint information is unavailable
+ * (though a constraint may still exist).
+ * <p/>
+ * Returning an empty array, on the other hand, indicates that value constraint information
+ * is available and that no constraints are placed on this value.
+ * <p>
+ * In the case of multi-value properties, the constraint string array
+ * returned applies to all the values of the property.
+ * <p>
+ * 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:
+ * <ul>
+ * <li>
+ * <code>STRING</code>: The constraint string is a regular expression pattern. For example the
+ * regular expression "<code>.*</code>" means "any string, including the empty string". Whereas
+ * a simple literal string (without any RE-specific meta-characters) like "<code>banana</code>"
+ * matches only the string "<code>banana</code>".
+ * </li>
+ * <li>
+ * <code>PATH</code>: The constraint string is a <i>JCR path</i> with an optional "<code>*</code>" character after
+ * the last "<code>/</code>" character. For example, possible constraint strings for a property
+ * of type <code>PATH</code> include:
+ * <ol>
+ * <li>
+ * "<code>/myapp:products/myapp:televisions</code>"
+ * </li>
+ * <li>
+ * "<code>/myapp:products/myapp:televisions/</code>"
+ * </li>
+ * <li>
+ * "<code>/myapp:products/*</code>"
+ * </li>
+ * <li>
+ * "<code>myapp:products/myapp:televisions</code>"
+ * </li>
+ * <li>
+ * "<code>../myapp:televisions</code>"
+ * </li>
+ * <li>
+ * "<code>../myapp:televisions/*</code>"
+ * </li>
+ * </ol>
+ * The following principles apply:
+ * <ul>
+ * <li>
+ * The "*" means "matches descendants" not "matches any subsequent path". For example,
+ * <code>/a/*</code> does not match <code>/a/../c</code>.
+ * The constraint must match the normalized path.
+ * </li>
+ * <li>
+ * Relative path constraint only match relative path values and absolute path
+ * constraints only match absolute path values.
+ * </li>
+ * <li>
+ * A trailing "<code>/</code>" has no effect (hence, <code>1</code> and <code>2</code>, above, are equivalent).
+ * </li>
+ * <li>
+ * The trailing "<code>*</code>" character means that the value of the <code>PATH</code> property is
+ * restricted to the indicated subtree (in other words any additional relative path
+ * can replace the "<code>*</code>"). For example, 3, above would allow
+ * <code>/myapp:products/myapp:radios</code>, <code>/myapp:products/myapp:microwaves/X900</code>, and so
+ * forth.
+ * </li>
+ * <li>
+ * A constraint without a "<code>*</code>" means that the <code>PATH</code> property is restricted to that
+ * precise path. For example, <code>1</code>, above, would allow only the value
+ * <code>/myapp:products/myapp:televisions</code>.
+ * </li>
+ * <li>
+ * The constraint can indicate either a relative path or an absolute path
+ * depending on whether it includes a leading "<code>/</code>" character. <code>1</code> and <code>4</code>, above for
+ * example, are distinct.
+ * </li>
+ * <li>
+ * The string returned must reflect the namespace mapping in the current <code>Session</code>
+ * (i.e., the current state of the namespace registry overlaid with any
+ * session-specific mappings). Constraint strings for <code>PATH</code> 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
+ * <code>PropertyDefinition.getValueConstraints</code> call.
+ * </li>
+ * </ul>
+ * </li>
+ * <li>
+ * <code>NAME</code>: The constraint string is a <i>JCR name</i> in prefix form. For example
+ * "<code>myapp:products</code>". No wildcards or other pattern matching are supported. As with
+ * <code>PATH</code> properties, the string returned must reflect the namespace mapping in the
+ * current <code>Session</code>. Constraint strings for <code>NAME</code> 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.
+ * </li>
+ * <li>
+ * <code>REFERENCE</code>: The constraint string is a <i>JCR name</i> in prefix form. This name is
+ * interpreted as a node type name and the <code>REFERENCE</code> property is restricted to
+ * referring only to nodes that have at least the indicated node type. For
+ * example, a constraint of "<code>mytype:document</code>" would indicate that the REFERENCE
+ * property in question can only refer to nodes that have at least the node type
+ * <code>mytype:document</code> (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 <code>PATH</code> properties, the string returned
+ * must reflect the namespace mapping in the current <code>Session</code>. Constraint strings
+ * for <code>REFERENCE</code> 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.
+ * </li>
+ * <li>
+ * <code>BOOLEAN</code>: Either "<code>true</code>" or "<code>false</code>".
+ * </li>
+ * </ul>
+ * The remaining types all have value constraints in the form of inclusive or
+ * exclusive ranges: i.e., "<code>[min, max]</code>", "<code>(min, max)</code>",
+ * "<code>(min, max]</code>" or "<code>[min, max)</code>". Where "<code>[</code>"
+ * and "<code>]</code>" indicate "inclusive", while "<code>(</code>" and "<code>)</code>"
+ * indicate "exclusive". A missing <code>min</code> or <code>max</code> 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 <code>min</code> and <code>max</code> values themselves
+ * differ between types as follows:
+ * <ul>
+ * <li>
+ * <code>BINARY</code>: <code>min</code> and <code>max</code> specify the allowed
+ * size range of the binary value in bytes.
+ * </li>
+ * <li>
+ * <code>DATE</code>: <code>min</code> and <code>max</code> are dates specifying the
+ * allowed date range. The date strings must be in the ISO8601-compliant format:
+ * <code>YYYY-MM-DDThh:mm:ss.sssTZD</code>.
+ * </li>
+ * <li>
+ * <code>LONG</code>, <code>DOUBLE</code>: min and max are numbers.
+ * </li>
+ * </ul>
+ * 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 <code>String</code> 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 <code>true</code>).
+ * <p>
+ * 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.
+ * <p/>
+ * If <code>null</code> 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 <i>must</i> be the case if <code>isAutoCreate</code>
+ * returns <code>true</code> and this method returns <code>null</code>.
+ *
+ * @return an array of <code>Value</code> objects.
+ */
+ public function getDefaultValues();
+
+ /**
+ * Reports whether this property can have multiple values. Note that the
+ * <code>isMultiple</code> flag is special in that a given node type may
+ * have two property definitions that are identical in every respect except
+ * for the their <code>isMultiple</code> status. For example, a node type
+ * can specify two string properties both called <code>X</code>, one of
+ * which is multi-valued and the other not.
+ *
+ * @return a <code>boolean</code>
+ */
+ 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 @@
+<?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';
+
+
+/**
+ * All events used by the ObservationManager system are subclassed from this interface
+ * <p>
+ * <b>Level 2 only</b>
+ * <p>
+ * For details see the <i>ObservationManager</i> section of the JCR standard document.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @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:
+ * <ul>
+ * <li><code>NODE_ADDED</code></li>
+ * <li><code>NODE_REMOVED</code></li>
+ * <li><code>PROPERTY_ADDED</code></li>
+ * <li><code>PROPERTY_REMOVED</code></li>
+ * <li><code>PROPERTY_CHANGED</code></li>
+ * </ul>
+ *
+ * @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:
+ * <ul>
+ * <li>
+ * If the event type is <code>NODE_ADDED</code> then this method returns the absolute path of
+ * the node that was added.
+ * </li>
+ * <li>
+ * If the event type is <code>NODE_REMOVED</code> then this method returns the absolute path of
+ * the node that was removed.
+ * </li>
+ * <li>
+ * If the event type is <code>PROPERTY_ADDED</code> then this method returns the absolute path of
+ * the property that was added.
+ * </li>
+ * <li>
+ * If the event type is <code>PROPERTY_REMOVED</code> then this method returns the absolute path of
+ * the property that was removed.
+ * </li>
+ * <li>
+ * If the event type is <code>PROPERTY_CHANGED</code> then this method returns the absolute path of
+ * of the changed property.
+ * </li>
+ * </ul>
+ *
+ * @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 <code>String</code>.
+ */
+ 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 @@
+<?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/observation/Event.php';
+require_once 'PHPCR/NoSuchElementException.php';
+
+
+/**
+ * Allows easy iteration through a list of <code>Event</code>s
+ * with <code>nextEvent</code> as well as a <code>skip</code> method inherited from
+ * <code>RangeIterator</code>.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ * @subpackage observation
+ */
+interface EventIterator extends RangeIterator
+{
+ /**
+ * Returns the next <code>Event</code> in the iteration.
+ *
+ * @return the next <code>Event</code> in the iteration.
+ * @throws NoSuchElementException if iteration has no more <code>Event</code>s.
+ */
+ 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 @@
+<?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/observation/EventIterator.php';
+
+
+/**
+ * An event listener.
+ * <p>
+ * <b>Level 2 only</b>
+ * <p>
+ * An <code>EventListener</code> can be registered via the
+ * <code>observation.ObservationManager</code> 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 <mn...@mayflower.de>
+ * @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 @@
+<?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/observation/EventListener.php';
+require_once 'PHPCR/NoSuchElementException.php';
+
+
+/**
+ * Allows easy iteration through a list of <code>EventListener</code>s
+ * with <code>nextEventListener</code> as well as a <code>skip</code> method inherited from
+ * <code>RangeIterator</code>.
+ *
+ * @author Markus Nix <mn...@mayflower.de>
+ * @package phpcr
+ * @subpackage observation
+ */
+interface EventListenerIterator extends RangeIterator
+{
+ /**
+ * Returns the next <code>EventListener</code> in the iteration.
+ *
+ * @return the next <code>EventListener</code> in the iteration.
+ * @throws NoSuchElementException if iteration has no more <code>EventListener</code>s.
+ */
+ public function nextEventListener();
+}
+
+?>
\ No newline at end of file