jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r792142 [29/35] - in /jackrabbit/sandbox/JCR-1456: ./ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/ jackrabbit-core/ jackrabbit-core/src/main/java/org/apache/jackrab...
Date Wed, 08 Jul 2009 13:57:46 GMT
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java Wed Jul  8 13:57:13 2009
@@ -31,9 +31,10 @@
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.spi.QueryInfo;
 import org.apache.jackrabbit.spi.QNodeTypeDefinition;
+import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.ItemInfo;
 import org.apache.jackrabbit.spi.commons.namespace.NamespaceMapping;
 import org.apache.jackrabbit.spi.commons.nodetype.compact.CompactNodeTypeDefReader;
-import org.apache.jackrabbit.spi.commons.nodetype.compact.QNodeTypeDefinitionsBuilderImpl;
 import org.apache.jackrabbit.spi.commons.nodetype.compact.ParseException;
 
 import javax.jcr.RepositoryException;
@@ -79,13 +80,13 @@
  */
 public abstract class AbstractReadableRepositoryService extends AbstractRepositoryService {
 
-    protected static final Set WRITE_ACTIONS = new HashSet(Arrays.asList(
-            new String[]{"add_node", "set_property", "remove"}));
+    protected static final Set<String> WRITE_ACTIONS = new HashSet<String>(
+            Arrays.asList("add_node", "set_property", "remove"));
 
     /**
      * The repository descriptors.
      */
-    protected final Map descriptors;
+    protected final Map<String, String> descriptors;
 
     /**
      * The fixed set of namespaces known to the repository service.
@@ -95,7 +96,7 @@
     /**
      * The fixed set of node type definitions known to the repository service.
      */
-    protected final Map nodeTypeDefs = new HashMap();
+    protected final Map<Name, QNodeTypeDefinition> nodeTypeDefs = new HashMap<Name, QNodeTypeDefinition>();
 
     /**
      * The node definition of the root node.
@@ -105,7 +106,7 @@
     /**
      * The list of workspaces that this repository service exposes.
      */
-    protected final List wspNames;
+    protected final List<String> wspNames;
 
     /**
      * Creates a new <code>AbstractReadableRepositoryService</code>.
@@ -119,24 +120,20 @@
      * @throws RepositoryException if the namespace mappings are invalid.
      * @throws ParseException      if an error occurs while parsing the CND.
      */
-    public AbstractReadableRepositoryService(Map descriptors,
-                                             Map namespaces,
+    public AbstractReadableRepositoryService(Map<String, String> descriptors,
+                                             Map<String, String> namespaces,
                                              Reader cnd,
-                                             List wspNames)
+                                             List<String> wspNames)
             throws RepositoryException, ParseException {
-        this.descriptors = Collections.unmodifiableMap(new HashMap(descriptors));
-        for (Iterator it = namespaces.entrySet().iterator(); it.hasNext(); ) {
-            Map.Entry entry = (Map.Entry) it.next();
-            this.namespaces.setMapping((String) entry.getKey(),
-                    (String) entry.getValue());
+        this.descriptors = Collections.unmodifiableMap(new HashMap<String, String>(descriptors));
+        for (Map.Entry<String, String> entry : namespaces.entrySet()) {
+            this.namespaces.setMapping(entry.getKey(), entry.getValue());
         }
-        CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(
-                cnd, "", this.namespaces, new QNodeTypeDefinitionsBuilderImpl());
-        for (Iterator it = reader.getNodeTypeDefs().iterator(); it.hasNext(); ) {
-            QNodeTypeDefinition def = (QNodeTypeDefinition) it.next();
+        CompactNodeTypeDefReader reader = new CompactNodeTypeDefReader(cnd, "", this.namespaces);
+        for (QNodeTypeDefinition def : reader.getNodeTypeDefinitions()) {
             nodeTypeDefs.put(def.getName(), def);
         }
-        this.wspNames = Collections.unmodifiableList(new ArrayList(wspNames));
+        this.wspNames = Collections.unmodifiableList(new ArrayList<String>(wspNames));
     }
 
     //---------------------------< subclass responsibility >--------------------
@@ -265,7 +262,7 @@
      * This default implementation returns an iterator over the item infos
      * returned by the call to {@link #getNodeInfo(SessionInfo, NodeId)}.
      */
-    public Iterator getItemInfos(SessionInfo sessionInfo, NodeId nodeId) throws
+    public Iterator<? extends ItemInfo> getItemInfos(SessionInfo sessionInfo, NodeId nodeId) throws
             ItemNotFoundException, RepositoryException {
         return Collections.singleton(getNodeInfo(sessionInfo, nodeId)).iterator();
     }
@@ -276,7 +273,7 @@
      * This default implementation returns the descriptors that were passed
      * to the constructor of this repository service.
      */
-    public Map getRepositoryDescriptors() throws RepositoryException {
+    public Map<String, String> getRepositoryDescriptors() throws RepositoryException {
         return descriptors;
     }
 
@@ -290,7 +287,7 @@
     public String[] getWorkspaceNames(SessionInfo sessionInfo) throws
             RepositoryException {
         checkSessionInfo(sessionInfo);
-        return (String[]) wspNames.toArray(new String[wspNames.size()]);
+        return wspNames.toArray(new String[wspNames.size()]);
     }
 
     //-------------------------< access control >-------------------------------
@@ -306,8 +303,8 @@
                              String[] actions) throws RepositoryException {
         checkSessionInfo(sessionInfo);
         // deny all but read
-        for (int i = 0; i < actions.length; i++) {
-            if (WRITE_ACTIONS.contains(actions[i])) {
+        for (String action : actions) {
+            if (WRITE_ACTIONS.contains(action)) {
                 return false;
             }
         }
@@ -320,7 +317,7 @@
      * This default implementation first calls {@link #checkSessionInfo(SessionInfo)}
      * with the <code>sessionInfo</code>,
      */
-    public Iterator getQNodeTypeDefinitions(SessionInfo sessionInfo) throws
+    public Iterator<QNodeTypeDefinition> getQNodeTypeDefinitions(SessionInfo sessionInfo) throws
             RepositoryException {
         checkSessionInfo(sessionInfo);
         return nodeTypeDefs.values().iterator();
@@ -333,15 +330,14 @@
      * is not a valid node type definition then a {@link RepositoryException}
      * is thrown.
      */
-    public Iterator getQNodeTypeDefinitions(SessionInfo sessionInfo, Name[] nodetypeNames)
+    public Iterator<QNodeTypeDefinition> getQNodeTypeDefinitions(SessionInfo sessionInfo, Name[] nodetypeNames)
             throws RepositoryException {
         checkSessionInfo(sessionInfo);
-        List ntDefs = new ArrayList();
-        for (int i = 0; i < nodetypeNames.length; i++) {
-            Object def = nodeTypeDefs.get(nodetypeNames[i]);
+        List<QNodeTypeDefinition> ntDefs = new ArrayList<QNodeTypeDefinition>();
+        for (Name nodetypeName : nodetypeNames) {
+            QNodeTypeDefinition def = nodeTypeDefs.get(nodetypeName);
             if (def == null) {
-                throw new RepositoryException("unknown node type: "
-                        + nodetypeNames[i]);
+                throw new RepositoryException("unknown node type: " + nodetypeName);
             }
             ntDefs.add(def);
         }
@@ -400,7 +396,7 @@
      * URL mapping that was provided in the constructor of this repository
      * service.
      */
-    public Map getRegisteredNamespaces(SessionInfo sessionInfo) throws
+    public Map<String, String> getRegisteredNamespaces(SessionInfo sessionInfo) throws
             RepositoryException {
         checkSessionInfo(sessionInfo);
         return namespaces.getPrefixToURIMapping();
@@ -597,23 +593,29 @@
     }
 
     /**
-     * @throws UnsupportedRepositoryOperationException always.
+     * @throws UnsupportedRepositoryOperationException
+     *          always.
      */
-    public Iterator merge(SessionInfo sessionInfo,
-                          NodeId nodeId,
-                          String srcWorkspaceName,
-                          boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+    public Iterator<NodeId> merge(SessionInfo sessionInfo,
+                                  NodeId nodeId,
+                                  String srcWorkspaceName,
+                                  boolean bestEffort) throws
+            NoSuchWorkspaceException, AccessDeniedException, MergeException,
+            LockException, InvalidItemStateException, RepositoryException {
         throw new UnsupportedRepositoryOperationException();
     }
 
     /**
-     * @throws UnsupportedRepositoryOperationException always.
+     * @throws UnsupportedRepositoryOperationException
+     *          always.
      */
-    public Iterator merge(SessionInfo sessionInfo,
-                          NodeId nodeId,
-                          String srcWorkspaceName,
-                          boolean bestEffort,
-                          boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+    public Iterator<NodeId> merge(SessionInfo sessionInfo,
+                                  NodeId nodeId,
+                                  String srcWorkspaceName,
+                                  boolean bestEffort,
+                                  boolean isShallow) throws
+            NoSuchWorkspaceException, AccessDeniedException, MergeException,
+            LockException, InvalidItemStateException, RepositoryException {
         throw new UnsupportedRepositoryOperationException();
     }
 
@@ -649,6 +651,36 @@
         throw new UnsupportedRepositoryOperationException();
     }
 
+    /**
+     * @throws UnsupportedRepositoryOperationException always.
+     */
+    public NodeId createActivity(SessionInfo sessionInfo, String title) throws UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    /**
+     * @throws UnsupportedRepositoryOperationException always.
+     */
+    public void removeActivity(SessionInfo sessionInfo, NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+
+    }
+
+    /**
+     * @throws UnsupportedRepositoryOperationException always.
+     */
+    public Iterator mergeActivity(SessionInfo sessionInfo, NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+
+    }
+
+    /**
+     * @throws UnsupportedRepositoryOperationException always.
+     */
+    public NodeId createConfiguration(SessionInfo sessionInfo, NodeId nodeId, NodeId baselineId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
     //-----------------------------< observation >------------------------------
 
     /**
@@ -694,6 +726,15 @@
     /**
      * @throws UnsupportedRepositoryOperationException always.
      */
+    public EventBundle getEvents(SessionInfo sessionInfo, EventFilter filter,
+                                   long after) throws
+            RepositoryException, UnsupportedRepositoryOperationException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    /**
+     * @throws UnsupportedRepositoryOperationException always.
+     */
     public void dispose(Subscription subscription) throws RepositoryException {
         throw new UnsupportedRepositoryOperationException();
     }
@@ -742,15 +783,15 @@
         return new String[0];
     }
 
-    public void checkQueryStatement(SessionInfo sessionInfo, String statement,
+    public String[] checkQueryStatement(SessionInfo sessionInfo, String statement,
                                     String language, Map namespaces) throws
             InvalidQueryException, RepositoryException {
         throw new UnsupportedRepositoryOperationException();
     }
 
     public QueryInfo executeQuery(SessionInfo sessionInfo, String statement,
-                                  String language, Map namespaces) throws
-            RepositoryException {
+                                  String language, Map<String, String> namespaces, long limit,
+                                  long offset, Map<String, QValue> values) throws RepositoryException {
         throw new UnsupportedRepositoryOperationException();
     }
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventBundleImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventBundleImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventBundleImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventBundleImpl.java Wed Jul  8 13:57:13 2009
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.spi.commons;
 
 import org.apache.jackrabbit.spi.EventBundle;
+import org.apache.jackrabbit.spi.Event;
 
 import java.io.Serializable;
 import java.util.Collection;
@@ -35,7 +36,7 @@
     /**
      * The events in this bundle.
      */
-    private final Collection events;
+    private final Collection<Event> events;
 
     /**
      * Creates a new event bundle with <code>events</code>.
@@ -43,7 +44,7 @@
      * @param events   the events for this bundle.
      * @param isLocal  if this events were created due to a local change.
      */
-    public EventBundleImpl(Collection events, boolean isLocal) {
+    public EventBundleImpl(Collection<Event> events, boolean isLocal) {
         this.events = events;
         this.isLocal = isLocal;
     }
@@ -51,7 +52,7 @@
     /**
      * {@inheritDoc}
      */
-    public Iterator getEvents() {
+    public Iterator<Event> getEvents() {
         return events.iterator();
     }
 
@@ -61,4 +62,13 @@
     public boolean isLocal() {
         return isLocal;
     }
+
+    //-----------------------------< Iterable >---------------------------------
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator<Event> iterator() {
+        return getEvents();
+    }
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/EventImpl.java Wed Jul  8 13:57:13 2009
@@ -21,8 +21,14 @@
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.QValue;
 
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
 import java.io.Serializable;
+import java.util.Map;
+import java.util.Collections;
+import java.util.HashMap;
 
 /**
  * <code>EventImpl</code> implements a serializable SPI
@@ -66,12 +72,27 @@
      */
     private final String userId;
 
+    private final String userData;
+    private final long timestamp;
+    private final Map<Name, QValue> info;
+
     /**
      * Creates a new serializable event.
+     * @deprecated
      */
     public EventImpl(int type, Path path, ItemId itemId, NodeId parentId,
                      Name primaryNodeTypeName, Name[] mixinTypeNames,
                      String userId) {
+        this(type, path, itemId, parentId, primaryNodeTypeName, mixinTypeNames, userId, null, Long.MIN_VALUE, Collections.EMPTY_MAP);
+    }
+
+    /**
+     * Creates a new serializable event.
+     */
+    public EventImpl(int type, Path path, ItemId itemId, NodeId parentId,
+                     Name primaryNodeTypeName, Name[] mixinTypeNames,
+                     String userId, String userData, long timestamp,
+                     Map<Name, QValue> info) {
         this.type = type;
         this.path = path;
         this.itemId = itemId;
@@ -79,6 +100,10 @@
         this.primaryNodeTypeName = primaryNodeTypeName;
         this.mixinTypeNames = mixinTypeNames;
         this.userId = userId;
+
+        this.userData = userData;
+        this.info = new HashMap<Name, QValue>(info);
+        this.timestamp = timestamp;
     }
 
     /**
@@ -131,4 +156,44 @@
     public String getUserID() {
         return userId;
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Map<Name, QValue> getInfo() throws RepositoryException {
+        return info;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getUserData() {
+        return userData;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public long getDate() throws RepositoryException {
+        if (timestamp == Long.MIN_VALUE) {
+            throw new UnsupportedRepositoryOperationException("Event.getDate() not supported");
+        } else {
+            return timestamp;
+        }
+    }
+    
+    public String toString() {
+        return new StringBuffer(getClass().getName())
+            .append("[")
+            .append("eventTypes: ").append(type).append(", ")
+            .append("absPath: ").append(path).append(", ")
+            .append("itemId: ").append(itemId).append(", ")
+            .append("parentId: ").append(parentId).append(", ")
+            .append("primaryNodeTypeName: ").append(primaryNodeTypeName).append(", ")
+            .append("mixinTypeNames: ").append(mixinTypeNames).append(", ")
+            .append("userId").append(userId)
+            .append("]")
+            .toString();
+    }
+    
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QItemDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QItemDefinitionImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QItemDefinitionImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QItemDefinitionImpl.java Wed Jul  8 13:57:13 2009
@@ -175,7 +175,7 @@
     /**
      * See {@link QNodeDefinition#hashCode()} and {@link QPropertyDefinition#hashCode()}.
      *
-     * @return
+     * @return the hashcode
      */
     public abstract int hashCode();
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeDefinitionImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeDefinitionImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeDefinitionImpl.java Wed Jul  8 13:57:13 2009
@@ -57,7 +57,7 @@
     }
 
     /**
-     * Creates a new qualified node definition based on a JCR NodeDefinition.
+     * Creates a new SPI node definition based on a JCR NodeDefinition.
      *
      * @param name              the name of the child item.
      * @param declaringNodeType the delaring node type
@@ -65,6 +65,9 @@
      * @param isMandatory       if this is a mandatory item.
      * @param onParentVersion   the on parent version behaviour.
      * @param isProtected       if this item is protected.
+     * @param defaultPrimaryType the default primary type name
+     * @param requiredPrimaryTypes the required primary type name
+     * @param allowsSameNameSiblings if this node allows SNS
      */
     public QNodeDefinitionImpl(Name name, Name declaringNodeType,
                                boolean isAutoCreated, boolean isMandatory,
@@ -139,7 +142,7 @@
     /**
      * Overwrites {@link QItemDefinitionImpl#hashCode()}.
      *
-     * @return
+     * @return the hash code
      */
     public int hashCode() {
         if (hashCode == 0) {
@@ -157,11 +160,9 @@
             }
             sb.append('/');
             // set of required node type names, sorted in ascending order
-            TreeSet set = new TreeSet();
+            TreeSet<Name> set = new TreeSet<Name>();
             Name[] names = getRequiredPrimaryTypes();
-            for (int i = 0; i < names.length; i++) {
-                set.add(names[i]);
-            }
+            set.addAll(Arrays.asList(names));
             sb.append(set.toString());
 
             hashCode = sb.toString().hashCode();

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QNodeTypeDefinitionImpl.java Wed Jul  8 13:57:13 2009
@@ -23,10 +23,12 @@
 import org.apache.jackrabbit.spi.NameFactory;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.QValueFactory;
+import org.apache.jackrabbit.spi.QValueConstraint;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.apache.jackrabbit.spi.commons.conversion.IllegalNameException;
 import org.apache.jackrabbit.spi.commons.value.ValueFormat;
+import org.apache.jackrabbit.spi.commons.nodetype.constraint.ValueConstraint;
 
 import javax.jcr.PropertyType;
 import javax.jcr.NamespaceException;
@@ -37,10 +39,11 @@
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.Collections;
+import java.util.Arrays;
 import java.io.Serializable;
 
 /**
- * <code>QNodeTypeDefinitionImpl</code> implements a serializable qualified node
+ * <code>QNodeTypeDefinitionImpl</code> implements a serializable SPI node
  * type definition.
  */
 public class QNodeTypeDefinitionImpl implements QNodeTypeDefinition, Serializable {
@@ -99,12 +102,12 @@
      * Unmodifiable collection of dependent node type <code>Name</code>s.
      * @see #getDependencies()
      */
-    private transient Collection dependencies;
+    private transient Collection<Name> dependencies;
 
     /**
      * Copy constructor.
      *
-     * @param nt the qualified node type definition.
+     * @param nt the node type definition.
      */
     public QNodeTypeDefinitionImpl(QNodeTypeDefinition nt) {
         this(nt.getName(), nt.getSupertypes(), nt.getSupportedMixinTypes(),
@@ -114,65 +117,7 @@
     }
 
     /**
-     * Creates a new serializable qualified node type definition.
-     *
-     * @param name                   the name of the node type
-     * @param supertypes             the names of the supertypes
-     * @param isMixin                if this is a mixin node type
-     * @param hasOrderableChildNodes if this node type has orderable child
-     *                               nodes.
-     * @param primaryItemName        the name of the primary item, or
-     *                               <code>null</code>.
-     * @param declaredPropDefs       the declared property definitions.
-     * @param declaredNodeDefs       the declared child node definitions.
-     * @deprecated use {@link #QNodeTypeDefinitionImpl(Name, Name[], Name[], boolean, boolean, Name, QPropertyDefinition[], QNodeDefinition[])}
-     */
-    public QNodeTypeDefinitionImpl(Name name,
-                                   Name[] supertypes,
-                                   boolean isMixin,
-                                   boolean hasOrderableChildNodes,
-                                   Name primaryItemName,
-                                   QPropertyDefinition[] declaredPropDefs,
-                                   QNodeDefinition[] declaredNodeDefs) {
-        this(name, supertypes, null, isMixin, false, false,
-                hasOrderableChildNodes, primaryItemName,
-                getSerializablePropertyDefs(declaredPropDefs),
-                getSerializableNodeDefs(declaredNodeDefs));
-    }
-
-    /**
-     * Creates a new serializable qualified node type definition. Same as
-     * {@link #QNodeTypeDefinitionImpl(Name, Name[], Name[], boolean, boolean, boolean, boolean, Name, QPropertyDefinition[], QNodeDefinition[])}
-     * but using <code>false</code> for both {@link #isAbstract()} and {@link #isQueryable)}.
-     *
-     * @param name                   the name of the node type
-     * @param supertypes             the names of the supertypes
-     * @param supportedMixins        the names of supported mixins (or <code>null</code>)
-     * @param isMixin                if this is a mixin node type
-     * @param hasOrderableChildNodes if this node type has orderable child
-     *                               nodes.
-     * @param primaryItemName        the name of the primary item, or
-     *                               <code>null</code>.
-     * @param declaredPropDefs       the declared property definitions.
-     * @param declaredNodeDefs       the declared child node definitions.
-     *
-     */
-    public QNodeTypeDefinitionImpl(Name name,
-                                   Name[] supertypes,
-                                   Name[] supportedMixins,
-                                   boolean isMixin,
-                                   boolean hasOrderableChildNodes,
-                                   Name primaryItemName,
-                                   QPropertyDefinition[] declaredPropDefs,
-                                   QNodeDefinition[] declaredNodeDefs) {
-        this(name, supertypes, supportedMixins, isMixin, false, false,
-                hasOrderableChildNodes, primaryItemName,
-                getSerializablePropertyDefs(declaredPropDefs),
-                getSerializableNodeDefs(declaredNodeDefs));
-    }
-
-    /**
-     * Creates a new serializable qualified node type definition.
+     * Creates a new serializable SPI node type definition.
      *
      * @param name                   the name of the node type
      * @param supertypes             the names of the supertypes
@@ -213,18 +158,19 @@
      * Createa a new <code>QNodeTypeDefinitionImpl</code> from a JCR
      * NodeType definition.
      *
-     * @param def
-     * @param resolver
-     * @param qValueFactory
-     * @throws RepositoryException
+     * @param def node type definition
+     * @param resolver resolver
+     * @param qValueFactory value factory
+     * @throws RepositoryException if an error occurs
      */
     public QNodeTypeDefinitionImpl(NodeTypeDefinition def,
                                    NamePathResolver resolver,
-                                   QValueFactory qValueFactory) throws RepositoryException {
+                                   QValueFactory qValueFactory)
+            throws RepositoryException {
         this(resolver.getQName(def.getName()),
                 getNames(def.getDeclaredSupertypeNames(), resolver), null, def.isMixin(),
                 def.isAbstract(), def.isQueryable(), def.hasOrderableChildNodes(),
-                resolver.getQName(def.getPrimaryItemName()),
+                def.getPrimaryItemName() == null ? null : resolver.getQName(def.getPrimaryItemName()),
                 createQPropertyDefinitions(def.getDeclaredPropertyDefinitions(), resolver, qValueFactory),
                 createQNodeDefinitions(def.getDeclaredChildNodeDefinitions(), resolver));
     }
@@ -304,35 +250,34 @@
      */
     public Collection getDependencies() {
         if (dependencies == null) {
-            Collection deps = new HashSet();
+            Collection<Name> deps = new HashSet<Name>();
             // supertypes
-            for (int i = 0; i < supertypes.length; i++) {
-                deps.add(supertypes[i]);
-            }
+            deps.addAll(Arrays.asList(supertypes));
             // child node definitions
-            for (int i = 0; i < childNodeDefs.length; i++) {
+            for (QNodeDefinition childNodeDef : childNodeDefs) {
                 // default primary type
-                Name ntName = childNodeDefs[i].getDefaultPrimaryType();
+                Name ntName = childNodeDef.getDefaultPrimaryType();
                 if (ntName != null && !name.equals(ntName)) {
                     deps.add(ntName);
                 }
                 // required primary type
-                Name[] ntNames = childNodeDefs[i].getRequiredPrimaryTypes();
-                for (int j = 0; j < ntNames.length; j++) {
-                    if (ntNames[j] != null && !name.equals(ntNames[j])) {
-                        deps.add(ntNames[j]);
+                Name[] ntNames = childNodeDef.getRequiredPrimaryTypes();
+                for (Name ntName1 : ntNames) {
+                    if (ntName1 != null && !name.equals(ntName1)) {
+                        deps.add(ntName1);
                     }
                 }
             }
             // property definitions
-            for (int i = 0; i < propertyDefs.length; i++) {
-                // REFERENCE value constraints
-                if (propertyDefs[i].getRequiredType() == PropertyType.REFERENCE) {
-                    String[] ca = propertyDefs[i].getValueConstraints();
+            for (QPropertyDefinition propertyDef : propertyDefs) {
+                // [WEAK]REFERENCE value constraints
+                if (propertyDef.getRequiredType() == PropertyType.REFERENCE
+                        || propertyDef.getRequiredType() == PropertyType.WEAKREFERENCE) {
+                    QValueConstraint[] ca = propertyDef.getValueConstraints();
                     if (ca != null) {
-                        for (int j = 0; j < ca.length; j++) {
+                        for (QValueConstraint aCa : ca) {
                             NameFactory factory = NameFactoryImpl.getInstance();
-                            Name ntName = factory.create(ca[j]);
+                            Name ntName = factory.create(aCa.getString());
                             if (!name.equals(ntName)) {
                                 deps.add(ntName);
                             }
@@ -362,7 +307,7 @@
      * Returns an array of serializable property definitions for
      * <code>propDefs</code>.
      *
-     * @param propDefs the qualified property definitions.
+     * @param propDefs the SPI property definitions.
      * @return an array of serializable property definitions.
      */
     private static QPropertyDefinition[] getSerializablePropertyDefs(
@@ -382,7 +327,7 @@
      * Returns an array of serializable node definitions for
      * <code>nodeDefs</code>.
      *
-     * @param nodeDefs the qualified node definitions.
+     * @param nodeDefs the node definitions.
      * @return an array of serializable node definitions.
      */
     private static QNodeDefinition[] getSerializableNodeDefs(
@@ -408,20 +353,32 @@
 
     private static QPropertyDefinition[] createQPropertyDefinitions(PropertyDefinition[] pds,
                                                                     NamePathResolver resolver,
-                                                                    QValueFactory qValueFactory) throws RepositoryException {
+                                                                    QValueFactory qValueFactory)
+            throws RepositoryException {
         QPropertyDefinition[] declaredPropDefs = new QPropertyDefinition[pds.length];
         for (int i = 0; i < pds.length; i++) {
             PropertyDefinition propDef = pds[i];
-            Name name = resolver.getQName(propDef.getName());
+            Name name = propDef.getName().equals(QItemDefinitionImpl.ANY_NAME.getLocalName())
+                    ? QItemDefinitionImpl.ANY_NAME
+                    : resolver.getQName(propDef.getName());
             Name declName = resolver.getQName(propDef.getDeclaringNodeType().getName());
             QValue[] defVls = ValueFormat.getQValues(propDef.getDefaultValues(), resolver, qValueFactory);
-
+            String[] jcrConstraints = propDef.getValueConstraints();
+            QValueConstraint[] constraints = new QValueConstraint[jcrConstraints.length];
+            for (int j=0; j<constraints.length; j++) {
+                constraints[j] = ValueConstraint.create(propDef.getRequiredType(), jcrConstraints[j], resolver);
+            }
             declaredPropDefs[i] = new QPropertyDefinitionImpl(
-                    name, declName, propDef.isAutoCreated(), propDef.isMandatory(),
-                    propDef.getOnParentVersion(), propDef.isProtected(),
-                    defVls, propDef.isMultiple(),
-                    propDef.getRequiredType(), propDef.getValueConstraints(),
-                    getNames(propDef.getAvailableQueryOperators(), resolver),
+                    name, declName,
+                    propDef.isAutoCreated(),
+                    propDef.isMandatory(),
+                    propDef.getOnParentVersion(),
+                    propDef.isProtected(),
+                    defVls,
+                    propDef.isMultiple(),
+                    propDef.getRequiredType(),
+                    constraints,
+                    propDef.getAvailableQueryOperators(),
                     propDef.isFullTextSearchable(),
                     propDef.isQueryOrderable());
         }
@@ -432,15 +389,24 @@
         QNodeDefinition[] declaredNodeDefs = new QNodeDefinition[nds.length];
         for (int i = 0; i < nds.length; i++) {
             NodeDefinition nodeDef = nds[i];
-            Name name = resolver.getQName(nodeDef.getName());
+            Name name = nodeDef.getName().equals(QItemDefinitionImpl.ANY_NAME.getLocalName())
+                    ? QItemDefinitionImpl.ANY_NAME
+                    : resolver.getQName(nodeDef.getName());
             Name declName = resolver.getQName(nodeDef.getDeclaringNodeType().getName());
-            Name defaultPrimaryType = resolver.getQName(nodeDef.getDefaultPrimaryTypeName());
+            Name defaultPrimaryType = nodeDef.getDefaultPrimaryTypeName() == null
+                    ? null
+                    : resolver.getQName(nodeDef.getDefaultPrimaryTypeName());
             Name[] requiredPrimaryTypes = getNames(nodeDef.getRequiredPrimaryTypeNames(), resolver);
 
             declaredNodeDefs[i] = new QNodeDefinitionImpl(
-                    name, declName, nodeDef.isAutoCreated(), nodeDef.isMandatory(),
-                    nodeDef.getOnParentVersion(), nodeDef.isProtected(),
-                    defaultPrimaryType, requiredPrimaryTypes,
+                    name,
+                    declName,
+                    nodeDef.isAutoCreated(),
+                    nodeDef.isMandatory(),
+                    nodeDef.getOnParentVersion(),
+                    nodeDef.isProtected(),
+                    defaultPrimaryType,
+                    requiredPrimaryTypes,
                     nodeDef.allowsSameNameSiblings());
         }
         return declaredNodeDefs;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QPropertyDefinitionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QPropertyDefinitionImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QPropertyDefinitionImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/QPropertyDefinitionImpl.java Wed Jul  8 13:57:13 2009
@@ -19,17 +19,17 @@
 import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QValueConstraint;
 
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 
 /**
- * <code>QPropertyDefinitionImpl</code> implements a qualified property
- * definition.
+ * <code>QPropertyDefinitionImpl</code> implements SPI property
+ * definition interface.
  */
-public class QPropertyDefinitionImpl
-        extends QItemDefinitionImpl
+public class QPropertyDefinitionImpl extends QItemDefinitionImpl
         implements QPropertyDefinition {
 
     /**
@@ -40,7 +40,7 @@
     /**
      * The value constraints.
      */
-    private final String[] valueConstraints;
+    private final QValueConstraint[] valueConstraints;
 
     /**
      * The default values.
@@ -53,9 +53,9 @@
     private final boolean multiple;
 
     /**
-     * The 'multiple' flag
+     * The available query operators
      */
-    private final Name[] availableQueryOperators;
+    private final String[] availableQueryOperators;
 
     /**
      * The 'fullTextSearcheable' flag
@@ -84,7 +84,7 @@
     }
 
     /**
-     * Creates a new serializable qualified property definition.
+     * Creates a new serializable property definition.
      *
      * @param name              the name of the child item.
      * @param declaringNodeType the delaring node type
@@ -98,40 +98,9 @@
      * @param requiredType      the required type for this property.
      * @param valueConstraints  the value constraints for this property. If none
      *                          exist an empty array must be passed.
-     * @throws NullPointerException if <code>valueConstraints</code> is
-     *                              <code>null</code>.
-     * @deprecated Use {@link #QPropertyDefinitionImpl(Name, Name,
-                                   boolean, boolean, int, boolean, QValue[], boolean,
-                                   int, String[], Name[], boolean, boolean)} instead.
-     */
-    public QPropertyDefinitionImpl(Name name, Name declaringNodeType,
-                                   boolean isAutoCreated, boolean isMandatory,
-                                   int onParentVersion, boolean isProtected,
-                                   QValue[] defaultValues, boolean isMultiple,
-                                   int requiredType, String[] valueConstraints) {
-        this(name, declaringNodeType, isAutoCreated, isMandatory,
-                onParentVersion, isProtected, defaultValues, isMultiple,
-                requiredType, valueConstraints, null, false, false);
-    }
-
-    /**
-     * Creates a new serializable qualified property definition.
-     *
-     * @param name              the name of the child item.
-     * @param declaringNodeType the delaring node type
-     * @param isAutoCreated     if this item is auto created.
-     * @param isMandatory       if this is a mandatory item.
-     * @param onParentVersion   the on parent version behaviour.
-     * @param isProtected       if this item is protected.
-     * @param defaultValues     the default values or <code>null</code> if there
-     *                          are none.
-     * @param isMultiple        if this property is multi-valued.
-     * @param requiredType      the required type for this property.
-     * @param valueConstraints  the value constraints for this property. If none
-     *                          exist an empty array must be passed.
-     * @param availableQueryOperators
-     * @param isFullTextSearchable
-     * @param isQueryOrderable
+     * @param availableQueryOperators the available query operators
+     * @param isFullTextSearchable if this is fulltext searchable
+     * @param isQueryOrderable   if this is queryable
      * @throws NullPointerException if <code>valueConstraints</code> is
      *                              <code>null</code>.
      * @since JCR 2.0
@@ -140,8 +109,9 @@
                                    boolean isAutoCreated, boolean isMandatory,
                                    int onParentVersion, boolean isProtected,
                                    QValue[] defaultValues, boolean isMultiple,
-                                   int requiredType, String[] valueConstraints,
-                                   Name[] availableQueryOperators,
+                                   int requiredType,
+                                   QValueConstraint[] valueConstraints,
+                                   String[] availableQueryOperators,
                                    boolean isFullTextSearchable,
                                    boolean isQueryOrderable) {
         super(name, declaringNodeType, isAutoCreated, isMandatory,
@@ -169,7 +139,7 @@
     /**
      * {@inheritDoc}
      */
-    public String[] getValueConstraints() {
+    public QValueConstraint[] getValueConstraints() {
         return valueConstraints;
     }
 
@@ -190,7 +160,7 @@
     /**
      * {@inheritDoc}
      */
-    public Name[] getAvailableQueryOperators() {
+    public String[] getAvailableQueryOperators() {
         return availableQueryOperators;
     }
 
@@ -249,7 +219,7 @@
     /**
      * Overwrites {@link QItemDefinitionImpl#hashCode()}.
      *
-     * @return
+     * @return the hashcode
      */
     public int hashCode() {
         if (hashCode == 0) {
@@ -272,11 +242,9 @@
             sb.append('/');
             sb.append(queryOrderable ? 1 : 0);
             sb.append('/');
-            Set<Name> s = new HashSet<Name>();
-            Name[] names = getAvailableQueryOperators();
-            for (int i = 0; i < names.length; i++) {
-                s.add(names[i]);
-            }
+            Set<String> s = new HashSet<String>();
+            String[] names = getAvailableQueryOperators();
+            s.addAll(Arrays.asList(names));
             sb.append(s.toString());
 
             hashCode = sb.toString().hashCode();

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/SerializableBatch.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/SerializableBatch.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/SerializableBatch.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/SerializableBatch.java Wed Jul  8 13:57:13 2009
@@ -122,6 +122,10 @@
         recording.add(new SetMixins(nodeId, mixinNodeTypeIds));
     }
 
+    public void setPrimaryType(NodeId nodeId, Name primaryNodeTypeName) throws RepositoryException {
+        recording.add(new SetPrimaryType(nodeId, primaryNodeTypeName));
+    }
+
     public void move(NodeId srcNodeId,
                      NodeId destParentNodeId,
                      Name destName) {
@@ -265,18 +269,37 @@
 
         private final NodeId nodeId;
 
-        private final Name[] mixinNodeTypeIds;
+        private final Name[] mixinNodeTypeNames;
+
+        SetMixins(NodeId nodeId, Name[] mixinNodeTypeNames) {
+            this.nodeId = nodeId;
+            this.mixinNodeTypeNames = mixinNodeTypeNames;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void replay(Batch batch) throws RepositoryException {
+            batch.setMixins(nodeId, mixinNodeTypeNames);
+        }
+    }
+
+    private static class SetPrimaryType implements Operation {
+
+        private final NodeId nodeId;
+
+        private final Name primaryNodeTypeName;
 
-        SetMixins(NodeId nodeId, Name[] mixinNodeTypeIds) {
+        SetPrimaryType(NodeId nodeId, Name primaryNodeTypeName) {
             this.nodeId = nodeId;
-            this.mixinNodeTypeIds = mixinNodeTypeIds;
+            this.primaryNodeTypeName = primaryNodeTypeName;
         }
 
         /**
          * {@inheritDoc}
          */
         public void replay(Batch batch) throws RepositoryException {
-            batch.setMixins(nodeId, mixinNodeTypeIds);
+            batch.setPrimaryType(nodeId, primaryNodeTypeName);
         }
     }
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/SessionInfoImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/SessionInfoImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/SessionInfoImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/SessionInfoImpl.java Wed Jul  8 13:57:13 2009
@@ -18,6 +18,7 @@
 
 import org.apache.jackrabbit.spi.SessionInfo;
 
+import javax.jcr.RepositoryException;
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
@@ -34,6 +35,11 @@
     private String userId;
 
     /**
+     * The user data or <code>null</code>.
+     */
+    private String userData;
+
+    /**
      * The name of the workspace to connect to or <code>null</code> if this
      * session info refers to the default workspace.
      */
@@ -105,4 +111,11 @@
     public void removeLockToken(String s) {
         lockTokens.remove(s);
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void setUserData(String userData) throws RepositoryException {
+        this.userData = userData;
+    }
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ChangeLogImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ChangeLogImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ChangeLogImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ChangeLogImpl.java Wed Jul  8 13:57:13 2009
@@ -76,6 +76,10 @@
         addOperation(Operations.setMixins(nodeId, mixinNodeTypeNames));
     }
 
+    public void setPrimaryType(NodeId nodeId, Name primaryNodeTypeName) throws RepositoryException {
+        addOperation(Operations.setPrimaryType(nodeId, primaryNodeTypeName));
+    }
+
     public void setValue(PropertyId propertyId, QValue value) throws RepositoryException {
         addOperation(Operations.setValue(propertyId, value));
     }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/ConsolidatingChangeLog.java Wed Jul  8 13:57:13 2009
@@ -103,9 +103,7 @@
         addOperation(CancelableOperations.remove(itemId));
     }
 
-    public void reorderNodes(NodeId parentId, NodeId srcNodeId, NodeId beforeNodeId)
-            throws RepositoryException {
-
+    public void reorderNodes(NodeId parentId, NodeId srcNodeId, NodeId beforeNodeId) throws RepositoryException {
         addOperation(CancelableOperations.reorderNodes(parentId, srcNodeId, beforeNodeId));
     }
 
@@ -113,6 +111,10 @@
         addOperation(CancelableOperations.setMixins(nodeId, mixinNodeTypeNames));
     }
 
+    public void setPrimaryType(NodeId nodeId, Name primaryNodeTypeName) throws RepositoryException {
+        addOperation(CancelableOperations.setPrimaryType(nodeId, primaryNodeTypeName));
+    }
+
     public void setValue(PropertyId propertyId, QValue value) throws RepositoryException {
         addOperation(CancelableOperations.setValue(propertyId, value));
     }
@@ -325,8 +327,7 @@
             return new AddNode(parentId, nodeName, nodetypeName, uuid);
         }
 
-        // -----------------------------------------------------< AddProperty >---
-
+        // ---------------------------------------------------< AddProperty >---
         /**
          * <code>AddProperty</code> operations might cancel with
          * {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and
@@ -421,8 +422,7 @@
             return new AddProperty(parentId, propertyName, values);
         }
 
-        // -----------------------------------------------------< Move >---
-
+        // ----------------------------------------------------------< Move >---
         /**
          * An <code>Move</code> operation never cancels another operation and is never
          * cancelled by any other operation.
@@ -454,8 +454,7 @@
             return new Move(srcNodeId, destParentNodeId, destName);
         }
 
-        // -----------------------------------------------------< Remove >---
-
+        // --------------------------------------------------------< Remove >---
         /**
          * An <code>Remove</code> operation never cancels another operation and is never
          * cancelled by any other operation.
@@ -485,8 +484,7 @@
             return new Remove(itemId);
         }
 
-        // -----------------------------------------------------< Reorder Nodes >---
-
+        // -------------------------------------------------< Reorder Nodes >---
         /**
          * A <code>ReorderNodes</code> operation might cancel with
          * {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and
@@ -549,7 +547,6 @@
         }
 
         // -----------------------------------------------------< SetMixins >---
-
         /**
          * A <code>SetMixins</code> operation might cancel with
          * {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and
@@ -601,7 +598,7 @@
         }
 
         /**
-         * Factory method for creating a {@link SetMixins SetMixins} operation.
+         * Factory method for creating a {@link SetMixins} operation.
          *
          * @see Batch#setMixins(NodeId, Name[])
          * @param nodeId
@@ -612,8 +609,65 @@
             return new SetMixins(nodeId, mixinNodeTypeNames);
         }
 
-        // -----------------------------------------------------< SetValue >---
+        // -----------------------------------------------------< SetMixins >---
+        /**
+         * A <code>SetPrimaryType</code> operation might cancel with
+         * {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and
+         * {@link ConsolidatingChangeLog.CancelableOperations.SetPrimaryType SetPrimaryType} operations.
+         */
+        public static class SetPrimaryType extends Operations.SetPrimaryType implements CancelableOperation {
+
+            public SetPrimaryType(NodeId nodeId, Name primaryTypeName) {
+                super(nodeId, primaryTypeName);
+            }
+
+            /**
+             * @return
+             * <ul>
+             * <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_THIS CANCEL_THIS} if
+             *   <code>other</code> is an instance of
+             *   {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and has an node higher up
+             *   the hierarchy or this node as target. Or if <code>other</code> is an instance of
+             *   {@link ConsolidatingChangeLog.CancelableOperations.SetMixins SetMixins} which has this node
+             *   as target and has the same <code>mixinNodeTypeNames</code>.</li>
+             * <li>{@link ConsolidatingChangeLog.CancelableOperation#CANCEL_NONE CANCEL_NONE} otherwise.</li>
+             * </ul>
+             */
+            public int cancel(CancelableOperation other) throws RepositoryException {
+                if (other instanceof Remove) {
+                    Path thisPath = ConsolidatingChangeLog.getPath(nodeId);
+                    Path otherPath = ConsolidatingChangeLog.getPath(((Remove) other).itemId);
+                    return thisPath.isDescendantOf(otherPath) || thisPath.equals(otherPath)
+                        ? CANCEL_THIS
+                        : CANCEL_NONE;
+                }
+                if (other instanceof SetPrimaryType) {
+                    SetPrimaryType setPrimaryType = (SetPrimaryType) other;
+                    if (primaryTypeName.equals(setPrimaryType.primaryTypeName)) {
+                        Path thisPath = ConsolidatingChangeLog.getPath(nodeId);
+                        Path otherPath = ConsolidatingChangeLog.getPath(setPrimaryType.nodeId);
+                        if (thisPath.equals(otherPath)) {
+                            return CANCEL_THIS;
+                        }
+                    }
+                }
+                return CANCEL_NONE;
+            }
+        }
+
+        /**
+         * Factory method for creating a {@link SetPrimaryType} operation.
+         *
+         * @see Batch#setPrimaryType(NodeId, Name)
+         * @param nodeId
+         * @param primaryTypeName
+         * @return
+         */
+        public static CancelableOperation setPrimaryType(NodeId nodeId, Name primaryTypeName) {
+            return new SetPrimaryType(nodeId, primaryTypeName);
+        }
 
+        // ------------------------------------------------------< SetValue >---
         /**
          * A <code>SetValue</code> operation might cancel with
          * {@link ConsolidatingChangeLog.CancelableOperations.Remove Remove} and

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operations.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operations.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operations.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/batch/Operations.java Wed Jul  8 13:57:13 2009
@@ -38,8 +38,7 @@
         super();
     }
 
-    // -----------------------------------------------------< Empty >---
-
+    // -------------------------------------------------------------< Empty >---
     /**
      * Representative of the empty {@link Operation} which does nothing when
      * applied to a {@link Batch}.
@@ -81,8 +80,7 @@
         return Empty.INSTANCE;
     }
 
-    // -----------------------------------------------------< AddNode >---
-
+    // -----------------------------------------------------------< AddNode >---
     /**
      * Representative of an add-node {@link Operation} which calls
      * {@link Batch#addNode(NodeId, Name, Name, String)} when applied to a {@link Batch}.
@@ -167,8 +165,7 @@
         return new AddNode(parentId, nodeName, nodetypeName, uuid);
     }
 
-    // -----------------------------------------------------< AddProperty >---
-
+    // -------------------------------------------------------< AddProperty >---
     /**
      * Representative of an add-property {@link Operation} which calls
      * {@link Batch#addProperty(NodeId, Name, QValue)} or {@link Batch#addProperty(NodeId, Name, QValue[])}
@@ -283,8 +280,7 @@
         return new AddProperty(parentId, propertyName, values);
     }
 
-    // -----------------------------------------------------< Move >---
-
+    // --------------------------------------------------------------< Move >---
     /**
      * Representative of a move {@link Operation} which calls
      * {@link Batch#move(NodeId, NodeId, Name)} when applied to a {@link Batch}.
@@ -361,8 +357,7 @@
         return new Move(srcNodeId, destParentNodeId, destName);
     }
 
-    // -----------------------------------------------------< Remove >---
-
+    // ------------------------------------------------------------< Remove >---
     /**
      * Representative of a remove {@link Operation} which calls {@link Batch#remove(ItemId)} when
      * applied to a {@link Batch}.
@@ -425,8 +420,7 @@
         return new Remove(itemId);
     }
 
-    // -----------------------------------------------------< ReorderNodes >---
-
+    // ------------------------------------------------------< ReorderNodes >---
     /**
      * Representative of a reorder-nodes {@link Operation} which calls
      * {@link Batch#reorderNodes(NodeId, NodeId, NodeId)} when applied to a {@link Batch}.
@@ -503,8 +497,7 @@
         return new ReorderNodes(parentId, srcNodeId, beforeNodeId);
     }
 
-    // -----------------------------------------------------< SetMixins >---
-
+    // ---------------------------------------------------------< SetMixins >---
     /**
      * Representative of a set-mixin {@link Operation} which calls
      * {@link Batch#setMixins(NodeId, Name[])} when applied to a {@link Batch}.
@@ -574,8 +567,77 @@
         return new SetMixins(nodeId, mixinNodeTypeNames);
     }
 
-    // -----------------------------------------------------< SetValue >---
+    // ----------------------------------------------------< SetPrimaryType >---
+    /**
+     * Representative of a set-mixin {@link Operation} which calls
+     * {@link Batch#setMixins(NodeId, Name[])} when applied to a {@link Batch}.
+     */
+    public static class SetPrimaryType implements Operation {
+        protected final NodeId nodeId;
+        protected final Name primaryTypeName;
+
+        /**
+         * Create a new set-mixin {@link Operation} for the given arguments.
+         *
+         * @see Batch#setMixins(NodeId, Name[])
+         * @param nodeId
+         * @param primaryTypeName
+         */
+        public SetPrimaryType(NodeId nodeId, Name primaryTypeName) {
+            super();
+            this.nodeId = nodeId;
+            this.primaryTypeName = primaryTypeName;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        public void apply(Batch batch) throws RepositoryException {
+            batch.setPrimaryType(nodeId, primaryTypeName);
+        }
+
+        public String toString() {
+            return "SetPrimaryType[" + nodeId + ", " + primaryTypeName + "]";
+        }
+
+        public boolean equals(Object other) {
+            if (null == other) {
+                return false;
+            }
+            if (this == other) {
+                return true;
+            }
+            if (other instanceof SetPrimaryType) {
+                return equals((SetPrimaryType) other);
+            }
+            return false;
+        }
+
+        public boolean equals(SetPrimaryType other) {
+            return Operations.equals(nodeId, other.nodeId)
+                && primaryTypeName.equals(other.primaryTypeName);
+        }
+
+        public int hashCode() {
+            return 41 * (
+                    41 + Operations.hashCode(nodeId))
+                    + Operations.hashCode(primaryTypeName);
+        }
+    }
+
+    /**
+     * Factory method for creating a set-primaryType {@link Operation} for the given arguments.
+     *
+     * @see Batch#setPrimaryType(NodeId, Name)
+     * @param nodeId
+     * @param primaryTypeName
+     * @return
+     */
+    public static Operation setPrimaryType(NodeId nodeId, Name primaryTypeName) {
+        return new SetPrimaryType(nodeId, primaryTypeName);
+    }
 
+    // ----------------------------------------------------------< SetValue >---
     /**
      * Representative of a set-value {@link Operation} which calls
      * {@link Batch#setValue(PropertyId, QValue)} or {@link Batch#setValue(PropertyId, QValue[])}
@@ -681,7 +743,7 @@
         return new SetValue(propertyId, values);
     }
 
-    // -----------------------------------------------------< private >---
+    // -----------------------------------------------------------< private >---
 
     protected static boolean equals(Object o1, Object o2) {
         return o1 == null

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingNameResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingNameResolver.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingNameResolver.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingNameResolver.java Wed Jul  8 13:57:13 2009
@@ -60,41 +60,41 @@
 
     //-------------------------------------------------------< NameResolver >---
     /**
-     * Returns the qualified name for the given prefixed JCR name. The name
+     * Returns a <code>Name</code> for the given prefixed JCR name. The name
      * is first looked up form the generational cache and the call gets
      * delegated to the decorated name resolver only if the cache misses.
      *
-     * @param name prefixed JCR name
-     * @return qualified name
+     * @param jcrName A JCR name String.
+     * @return A <code>Name</code> object.
      * @throws IllegalNameException if the JCR name format is invalid
      * @throws NamespaceException if the namespace prefix can not be resolved
      */
-    public Name getQName(String name)
+    public Name getQName(String jcrName)
             throws IllegalNameException, NamespaceException {
-        Name qname = (Name) cache.get(name);
-        if (qname == null) {
-            qname = resolver.getQName(name);
-            cache.put(name, qname);
+        Name name = (Name) cache.get(jcrName);
+        if (name == null) {
+            name = resolver.getQName(jcrName);
+            cache.put(jcrName, name);
         }
-        return qname;
+        return name;
     }
 
 
     /**
-     * Returns the prefixed JCR name for the given qualified name. The name
+     * Returns the prefixed JCR name for the given <code>Name</code>. The name
      * is first looked up form the generational cache and the call gets
      * delegated to the decorated name resolver only if the cache misses.
      *
-     * @param qname qualified name
-     * @return prefixed JCR name
+     * @param name The name object.
+     * @return qualified JCR name in the form <code>prefix:localName</code>.
      * @throws NamespaceException if the namespace URI can not be resolved
      */
-    public String getJCRName(Name qname) throws NamespaceException {
-        String name = (String) cache.get(qname);
-        if (name == null) {
-            name = resolver.getJCRName(qname);
-            cache.put(qname, name);
+    public String getJCRName(Name name) throws NamespaceException {
+        String jcrName = (String) cache.get(name);
+        if (jcrName == null) {
+            jcrName = resolver.getJCRName(name);
+            cache.put(name, jcrName);
         }
-        return name;
+        return jcrName;
     }
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingPathResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingPathResolver.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingPathResolver.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/CachingPathResolver.java Wed Jul  8 13:57:13 2009
@@ -61,15 +61,17 @@
     //--------------------------------------------------------< PathResolver >
 
     /**
-     * Returns the qualified path for the given prefixed JCR path. The path
-     * is first looked up form the generational cache and the call gets
+     * Returns the <code>Path</code> object for the given JCR path String.
+     * The path is first looked up form the generational cache and the call gets
      * delegated to the decorated path resolver only if the cache misses.
      *
-     * @param path prefixed JCR path
-     * @return qualified path
+     * @param path A JCR path String.
+     * @return A <code>Path</code> object.
      * @throws MalformedPathException if the JCR path format is invalid
-     * @throws IllegalNameException if any of the JCR names contained in the path are invalid.
-     * @throws NamespaceException if a namespace prefix can not be resolved
+     * @throws IllegalNameException if any of the JCR names contained in the
+     * path are invalid.
+     * @throws NamespaceException if a namespace prefix can not be resolved.
+     * @see PathResolver#getQPath(String) 
      */
     public Path getQPath(String path) throws MalformedPathException, IllegalNameException, NamespaceException {
         return getQPath(path, true);
@@ -103,21 +105,21 @@
 
 
     /**
-     * Returns the prefixed JCR path for the given qualified path. The path
+     * Returns the JCR path String for the given <code>Path</code>. The path
      * is first looked up form the generational cache and the call gets
      * delegated to the decorated path resolver only if the cache misses.
      *
-     * @param qpath qualified path
-     * @return prefixed JCR path
-     * @throws NamespaceException if a namespace URI can not be resolved
+     * @param path A <code>Path</code> object.
+     * @return A JCR path String in the standard form.
+     * @throws NamespaceException if a namespace URI can not be resolved.
+     * @see PathResolver#getJCRPath(org.apache.jackrabbit.spi.Path)
      */
-    public String getJCRPath(Path qpath) throws NamespaceException {
-        String path = (String) cache.get(qpath);
-        if (path == null) {
-            path = resolver.getJCRPath(qpath);
-            cache.put(qpath, path);
+    public String getJCRPath(Path path) throws NamespaceException {
+        String jcrPath = (String) cache.get(path);
+        if (jcrPath == null) {
+            jcrPath = resolver.getJCRPath(path);
+            cache.put(path, jcrPath);
         }
-        return path;
+        return jcrPath;
     }
-
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameParser.java Wed Jul  8 13:57:13 2009
@@ -41,7 +41,7 @@
      * Parses the <code>jcrName</code> (either qualified or expanded) and
      * returns a new <code>Name</code>.
      *
-     * @param jcrName the name to be parsed. The jcrName may either in the
+     * @param jcrName the name to be parsed. The jcrName may either be in the
      * qualified or in the expanded form.
      * @param resolver <code>NamespaceResolver</code> use to retrieve the
      * namespace URI from the prefix contained in the given JCR name.
@@ -94,7 +94,7 @@
                     throw new IllegalNameException("'" + c + "' not valid name start");
                 }
                 trailingSpaces = true;
-            } else if (Character.isWhitespace(c) || c == '[' || c == ']' || c == '*' || c == '\'' || c == '\"') {
+            } else if (Character.isWhitespace(c) || c == '[' || c == ']' || c == '*' || c == '|') {
                 throw new IllegalNameException("'" + c + "' not allowed in name");
             } else if (c == '/') {
                 if (state == STATE_URI_START) {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameResolver.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameResolver.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/NameResolver.java Wed Jul  8 13:57:13 2009
@@ -21,26 +21,27 @@
 import javax.jcr.NamespaceException;
 
 /**
- * Resolver for prefixed JCR names and namespace-qualified
- * {@link Name Names}.
+ * Resolver for JCR name Strings and {@link Name} objects.
  */
 public interface NameResolver {
 
     /**
-     * Returns the qualified name for the given prefixed JCR name.
+     * Returns the <code>Name</code> for the given JCR name String.
      *
-     * @param name prefixed JCR name
-     * @return qualified name
+     * @param name A JCR name String.
+     * @return A <code>Name</code> object.
      * @throws IllegalNameException if the JCR name format is invalid
      * @throws NamespaceException if the namespace prefix can not be resolved
      */
     Name getQName(String name) throws IllegalNameException, NamespaceException;
 
     /**
-     * Returns the prefixed JCR name for the given qualified name.
+     * Returns the qualified JCR name String for the given <code>Name</code> object.
      *
-     * @param name qualified name
-     * @return prefixed JCR name
+     * @param name A <code>Name</code> object.
+     * @return The qualified JCR name String consisting of
+     * <code>prefix:localName</code> or
+     * <code>localName</code> in case of the empty namespace.
      * @throws NamespaceException if the namespace URI can not be resolved
      */
     String getJCRName(Name name) throws NamespaceException;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingNameResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingNameResolver.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingNameResolver.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingNameResolver.java Wed Jul  8 13:57:13 2009
@@ -52,26 +52,28 @@
     //--------------------------------------------------------< NameResolver >
 
     /**
-     * Parses the prefixed JCR name and returns the resolved qualified name.
+     * Parses the given JCR name and returns the resolved <code>Name</code> object.
      *
-     * @param name prefixed JCR name
-     * @return qualified name
+     * @param jcrName A JCR name String
+     * @return A <code>Name</code> object.
      * @throws IllegalNameException if the JCR name format is invalid
-     * @throws NamespaceException if the namespace prefix can not be resolved
+     * @throws NamespaceException if the namespace prefix can not be resolved.
+     * @see NameResolver#getQName(String)
      */
-    public Name getQName(String name) throws IllegalNameException, NamespaceException {
-        return NameParser.parse(name, resolver, nameFactory);
+    public Name getQName(String jcrName) throws IllegalNameException, NamespaceException {
+        return NameParser.parse(jcrName, resolver, nameFactory);
     }
 
     /**
-     * Returns the prefixed JCR name for the given qualified name.
+     * Returns the qualified JCR name for the given <code>Name</code> object.
      * If the name is in the default namespace, then the local name
      * is returned without a prefix. Otherwise the prefix for the
-     * namespace is resolved and used to construct returned the JCR name.
+     * namespace is resolved and used to construct the JCR name.
      *
-     * @param name qualified name
-     * @return prefixed JCR name
-     * @throws NamespaceException if the namespace URI can not be resolved
+     * @param name A <code>Name</code> object.
+     * @return A qualified JCR name string.
+     * @throws NamespaceException if the namespace URI can not be resolved.
+     * @see NameResolver#getJCRName(org.apache.jackrabbit.spi.Name)
      */
     public String getJCRName(Name name) throws NamespaceException {
         String uri = name.getNamespaceURI();

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingPathResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingPathResolver.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingPathResolver.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/ParsingPathResolver.java Wed Jul  8 13:57:13 2009
@@ -68,35 +68,36 @@
     }
 
     /**
-     * Parses the given JCR path and returns the resolved qualified path.
+     * Parses the given JCR path into a <code>Path</code> object.
      *
-     * @param path prefixed JCR path
-     * @return qualified path
+     * @param jcrPath A JCR path String.
+     * @return A <code>Path</code> object.
      * @throws MalformedPathException if the JCR path format is invalid.
      * @throws IllegalNameException if any of the JCR names contained in the path are invalid.
      * @throws NamespaceException if a namespace prefix can not be resolved
      */
-    public Path getQPath(String path) throws MalformedPathException, IllegalNameException, NamespaceException {
-        return PathParser.parse(path, nameResolver, idResolver, pathFactory);
+    public Path getQPath(String jcrPath) throws MalformedPathException, IllegalNameException, NamespaceException {
+        return PathParser.parse(jcrPath, nameResolver, idResolver, pathFactory);
     }
 
     /**
      * Calls {@link PathParser#parse(String, NameResolver, IdentifierResolver, org.apache.jackrabbit.spi.PathFactory)}
-     * from the given <code>path</code>.
+     * from the given <code>jcrPath</code>.
      * 
      * @see PathResolver#getQPath(String, boolean)
      */
-    public Path getQPath(String path, boolean normalizeIdentifier) throws MalformedPathException, IllegalNameException, NamespaceException {
-        return PathParser.parse(path, nameResolver, idResolver, pathFactory, normalizeIdentifier);
+    public Path getQPath(String jcrPath, boolean normalizeIdentifier) throws MalformedPathException, IllegalNameException, NamespaceException {
+        return PathParser.parse(jcrPath, nameResolver, idResolver, pathFactory, normalizeIdentifier);
     }
 
 
     /**
-     * Returns the given JCR path for the given qualified path.
+     * Returns the JCR path representation for the given <code>Path</code> object.
      *
-     * @param path qualified path
-     * @return prefixed JCR path
-     * @throws NamespaceException if a namespace URI can not be resolved
+     * @param path A <code>Path</code> object.
+     * @return A JCR path String in the standard form.
+     * @throws NamespaceException if a namespace URI can not be resolved.
+     * @see PathResolver#getJCRPath(org.apache.jackrabbit.spi.Path) 
      */
     public String getJCRPath(Path path) throws NamespaceException {
         StringBuffer buffer = new StringBuffer();

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/conversion/PathParser.java Wed Jul  8 13:57:13 2009
@@ -44,14 +44,14 @@
     private static final int STATE_URI_END = 10;
 
     /**
-     * Parses <code>jcrPath</code> into a qualified path using
+     * Parses <code>jcrPath</code> into a <code>Path</code> object using
      * <code>resolver</code> to convert prefixes into namespace URI's. If
      * resolver is <code>null</code> this method only checks the format of the
      * passed String and returns <code>null</code>.
      *
      * @param jcrPath the jcr path.
      * @param resolver the namespace resolver.
-     * @param factory
+     * @param factory <code>PathFactory</code> to be used.
      * @return A path object.
      * @throws MalformedPathException If the <code>jcrPath</code> is malformed.
      * @throws IllegalNameException if any of the jcrNames is malformed.
@@ -63,7 +63,7 @@
     }
 
     /**
-     * Parses <code>jcrPath</code> into a qualified path using
+     * Parses <code>jcrPath</code> into a <code>Path</code> object using
      * <code>resolver</code> to convert prefixes into namespace URI's. If the
      * specified <code>jcrPath</code> is an identifier based absolute path
      * beginning with an identifier segment the specified
@@ -91,7 +91,7 @@
     }
 
     /**
-     * Parses <code>jcrPath</code> into a qualified path using
+     * Parses <code>jcrPath</code> into a <code>Path</code> object using
      * <code>resolver</code> to convert prefixes into namespace URI's. If the
      * specified <code>jcrPath</code> is an identifier based absolute path
      * beginning with an identifier segment the specified
@@ -401,10 +401,8 @@
                         throw new MalformedPathException("'" + jcrPath + "' is not a valid path. Whitespace not a allowed in name.");
                     }
                 case '*':
-                case '\'':
-                case '\"':
+                case '|':
                     if (state != STATE_IDENTIFIER) {
-                        // TODO for JCR 2.0 remove limitation of ' and "
                         throw new MalformedPathException("'" + jcrPath + "' is not a valid path. '" + c + "' not a valid name character.");
                     }
                 case '{':

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/AbstractLogger.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/AbstractLogger.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/AbstractLogger.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/AbstractLogger.java Wed Jul  8 13:57:13 2009
@@ -77,7 +77,7 @@
      */
     protected Object execute(SafeCallable thunk, String methodName, Object[] args)  {
         writer.enter(methodName, args);
-        Object result = null;
+        Object result;
         try {
             result = thunk.call();
             writer.leave(methodName, args, result);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/BatchLogger.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/BatchLogger.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/BatchLogger.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/BatchLogger.java Wed Jul  8 13:57:13 2009
@@ -123,6 +123,14 @@
             }}, "setMixins(NodeId, Name[])", new Object[]{nodeId, mixinNodeTypeNames});
     }
 
+    public void setPrimaryType(final NodeId nodeId, final Name primaryNodeTypeName) throws RepositoryException {
+        execute(new Callable() {
+            public Object call() throws RepositoryException {
+                batch.setPrimaryType(nodeId, primaryNodeTypeName);
+                return null;
+            }}, "setPrimaryType(NodeId, Name)", new Object[]{nodeId, primaryNodeTypeName});
+    }
+
     public void move(final NodeId srcNodeId, final NodeId destParentNodeId, final Name destName)
             throws RepositoryException {
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/QValueFactoryLogger.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/QValueFactoryLogger.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/QValueFactoryLogger.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/QValueFactoryLogger.java Wed Jul  8 13:57:13 2009
@@ -20,6 +20,8 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Calendar;
+import java.net.URI;
+import java.math.BigDecimal;
 
 import javax.jcr.RepositoryException;
 
@@ -102,6 +104,20 @@
             }}, "create(Path)", new Object[]{value});
     }
 
+    public QValue create(final URI value) throws RepositoryException {
+        return (QValue) execute(new Callable() {
+            public Object call() throws RepositoryException {
+                return qValueFactory.create(value);
+            }}, "create(URI)", new Object[]{value});
+    }
+
+    public QValue create(final BigDecimal value) throws RepositoryException {
+        return (QValue) execute(new Callable() {
+            public Object call() throws RepositoryException {
+                return qValueFactory.create(value);
+            }}, "create(BigDecimal)", new Object[]{value});
+    }
+
     public QValue create(final byte[] value) throws RepositoryException {
         return (QValue) execute(new Callable() {
             public Object call() throws RepositoryException {



Mime
View raw message