jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r798847 - in /jackrabbit/trunk: ./ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/ jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/ jackrabbi...
Date Wed, 29 Jul 2009 10:34:46 GMT
Author: tripod
Date: Wed Jul 29 10:34:25 2009
New Revision: 798847

URL: http://svn.apache.org/viewvc?rev=798847&view=rev
Log:
JCR-2116 JSR 283: Built-In Node Types
- adding autocreated to mix:created and mix:lastModified
- adding more test cases

Added:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java   (with props)
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-created.txt
      - copied, changed from r798284, jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-lifecycle.txt
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-etag.txt   (with props)
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-language.txt   (with props)
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-lastModified.txt   (with props)
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-mimeType.txt   (with props)
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-title.txt   (with props)
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-address.txt   (with props)
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java
    jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/AbstractQValueFactory.java
    jackrabbit/trunk/pom.xml

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java?rev=798847&r1=798846&r2=798847&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java Wed Jul 29 10:34:25 2009
@@ -1256,8 +1256,8 @@
         prop.setMultiValued(def.isMultiple());
 
         // compute system generated values if necessary
-        InternalValue[] genValues =
-                computeSystemGeneratedPropertyValues(parent, def);
+        InternalValue[] genValues = session.getNodeTypeInstanceHandler()
+                .computeSystemGeneratedPropertyValues(parent, def);
         if (genValues != null) {
             prop.setValues(genValues);
         } else if (def.getDefaultValues() != null) {
@@ -1500,71 +1500,6 @@
     }
 
     //------------------------------------------------------< private methods >
-    /**
-     * Computes the values of well-known system (i.e. protected) properties.
-     * todo: duplicate code in NodeImpl: consolidate and delegate to NodeTypeInstanceHandler
-     *
-     * @param parent
-     * @param def
-     * @return the computed values
-     */
-    public static InternalValue[] computeSystemGeneratedPropertyValues(NodeState parent,
-                                                                 PropDef def) {
-        InternalValue[] genValues = null;
-
-        /**
-         * todo: need to come up with some callback mechanism for applying system generated values
-         * (e.g. using a NodeTypeInstanceHandler interface)
-         */
-
-        // compute system generated values
-        Name declaringNT = def.getDeclaringNodeType();
-        Name name = def.getName();
-        // TODO JCR-2116: Built-In Node Types; => adapt to JCR 2.0 built-in node types (mix:created, etc)
-        if (NameConstants.MIX_REFERENCEABLE.equals(declaringNT)) {
-            // mix:referenceable node type
-            if (NameConstants.JCR_UUID.equals(name)) {
-                // jcr:uuid property
-                genValues = new InternalValue[]{InternalValue.create(
-                        parent.getNodeId().toString())};
-            }
-        } else if (NameConstants.NT_BASE.equals(declaringNT)) {
-            // nt:base node type
-            if (NameConstants.JCR_PRIMARYTYPE.equals(name)) {
-                // jcr:primaryType property
-                genValues = new InternalValue[]{InternalValue.create(parent.getNodeTypeName())};
-            } else if (NameConstants.JCR_MIXINTYPES.equals(name)) {
-                // jcr:mixinTypes property
-                Set<Name> mixins = parent.getMixinTypeNames();
-                ArrayList<InternalValue> values = new ArrayList<InternalValue>(mixins.size());
-                for (Name n : mixins) {
-                    values.add(InternalValue.create(n));
-                }
-                genValues = values.toArray(new InternalValue[values.size()]);
-            }
-        } else if (NameConstants.NT_HIERARCHYNODE.equals(declaringNT)
-                || NameConstants.MIX_CREATED.equals(declaringNT)) {
-            // nt:hierarchyNode node type
-            if (NameConstants.JCR_CREATED.equals(name)) {
-                // jcr:created property
-                genValues = new InternalValue[]{InternalValue.create(Calendar.getInstance())};
-            }
-        } else if (NameConstants.NT_RESOURCE.equals(declaringNT)) {
-            // nt:resource node type
-            if (NameConstants.JCR_LASTMODIFIED.equals(name)) {
-                // jcr:lastModified property
-                genValues = new InternalValue[]{InternalValue.create(Calendar.getInstance())};
-            }
-        } else if (NameConstants.NT_VERSION.equals(declaringNT)) {
-            // nt:version node type
-            if (NameConstants.JCR_CREATED.equals(name)) {
-                // jcr:created property
-                genValues = new InternalValue[]{InternalValue.create(Calendar.getInstance())};
-            }
-        }
-
-        return genValues;
-    }
 
     /**
      * Recursively removes the given node state including its properties and

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=798847&r1=798846&r2=798847&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Wed Jul 29 10:34:25 2009
@@ -303,95 +303,6 @@
     }
 
     /**
-     * Computes the values of well-known system (i.e. protected) properties.
-     * todo: duplicate code in BatchedItemOperations: consolidate and delegate to NodeTypeInstanceHandler
-     *
-     * @param name
-     * @param def
-     * @return
-     * @throws RepositoryException
-     */
-    protected InternalValue[] computeSystemGeneratedPropertyValues(Name name,
-                                                                   PropertyDefinitionImpl def)
-            throws RepositoryException {
-        InternalValue[] genValues = null;
-
-        /**
-         * todo: need to come up with some callback mechanism for applying system generated values
-         * (e.g. using a NodeTypeInstanceHandler interface)
-         */
-
-        NodeState thisState = data.getNodeState();
-
-        // compute system generated values
-        NodeTypeImpl nt = (NodeTypeImpl) def.getDeclaringNodeType();
-        // TODO JCR-2116: Built-In Node Types; => adapt to JCR 2.0 built-in node types (mix:created, etc)
-        if (nt.getQName().equals(NameConstants.MIX_REFERENCEABLE)) {
-            // mix:referenceable node type
-            if (name.equals(NameConstants.JCR_UUID)) {
-                // jcr:uuid property
-                genValues = new InternalValue[]{
-                        InternalValue.create(thisState.getNodeId().toString())
-                };
-            }
-/*
-       todo consolidate version history creation code (currently in ItemImpl.initVersionHistories)
-       } else if (nt.getQName().equals(MIX_VERSIONABLE)) {
-           // mix:versionable node type
-           VersionHistory hist = session.getVersionManager().getOrCreateVersionHistory(this);
-           if (name.equals(JCR_VERSIONHISTORY)) {
-               // jcr:versionHistory property
-               genValues = new InternalValue[]{InternalValue.create(new UUID(hist.getUUID()))};
-           } else if (name.equals(JCR_BASEVERSION)) {
-               // jcr:baseVersion property
-               genValues = new InternalValue[]{InternalValue.create(new UUID(hist.getRootVersion().getUUID()))};
-           } else if (name.equals(JCR_ISCHECKEDOUT)) {
-               // jcr:isCheckedOut property
-               genValues = new InternalValue[]{InternalValue.create(true)};
-           } else if (name.equals(JCR_PREDECESSORS)) {
-               // jcr:predecessors property
-               genValues = new InternalValue[]{InternalValue.create(new UUID(hist.getRootVersion().getUUID()))};
-           }
-*/
-        } else if (nt.getQName().equals(NameConstants.NT_HIERARCHYNODE)
-                || nt.getQName().equals(NameConstants.MIX_CREATED)) {
-            // nt:hierarchyNode node type
-            if (name.equals(NameConstants.JCR_CREATED)) {
-                // jcr:created property
-                genValues = new InternalValue[]{InternalValue.create(Calendar.getInstance())};
-            }
-        } else if (nt.getQName().equals(NameConstants.NT_RESOURCE)) {
-            // nt:resource node type
-            if (name.equals(NameConstants.JCR_LASTMODIFIED)) {
-                // jcr:lastModified property
-                genValues = new InternalValue[]{InternalValue.create(Calendar.getInstance())};
-            }
-        } else if (nt.getQName().equals(NameConstants.NT_VERSION)) {
-            // nt:version node type
-            if (name.equals(NameConstants.JCR_CREATED)) {
-                // jcr:created property
-                genValues = new InternalValue[]{InternalValue.create(Calendar.getInstance())};
-            }
-        } else if (nt.getQName().equals(NameConstants.NT_BASE)) {
-            // nt:base node type
-            if (name.equals(NameConstants.JCR_PRIMARYTYPE)) {
-                // jcr:primaryType property
-                genValues = new InternalValue[]{InternalValue.create(thisState.getNodeTypeName())};
-            } else if (name.equals(NameConstants.JCR_MIXINTYPES)) {
-                // jcr:mixinTypes property
-                Set<Name> mixins = thisState.getMixinTypeNames();
-                ArrayList<InternalValue> values = new ArrayList<InternalValue>(mixins.size());
-                for (Name n : mixins) {
-                    values.add(InternalValue.create(n));
-                }
-                genValues = values.toArray(new InternalValue[values.size()]);
-            }
-        }
-
-        return genValues;
-    }
-
-    /**
      * @param name
      * @param type
      * @param multiValued
@@ -489,20 +400,21 @@
         // create a new property state
         PropertyState propState;
         try {
+            PropDef propDef = def.unwrap();
             propState =
                     stateMgr.createTransientPropertyState(getNodeId(), name,
                             ItemState.STATUS_NEW);
             propState.setType(type);
-            propState.setMultiValued(def.isMultiple());
-            propState.setDefinitionId(def.unwrap().getId());
+            propState.setMultiValued(propDef.isMultiple());
+            propState.setDefinitionId(propDef.getId());
             // compute system generated values if necessary
-            InternalValue[] genValues =
-                    computeSystemGeneratedPropertyValues(name, def);
-            InternalValue[] defValues = def.unwrap().getDefaultValues();
+            InternalValue[] genValues = session.getNodeTypeInstanceHandler()
+                    .computeSystemGeneratedPropertyValues(data.getNodeState(), propDef);
+            if (genValues == null) {
+                genValues = propDef.getDefaultValues();
+            }
             if (genValues != null) {
                 propState.setValues(genValues);
-            } else if (defValues != null) {
-                propState.setValues(defValues);
             }
         } catch (ItemStateException ise) {
             String msg = "failed to add property " + name + " to " + this;

Added: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java?rev=798847&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java (added)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java Wed Jul 29 10:34:25 2009
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.
+ */
+package org.apache.jackrabbit.core;
+
+import java.util.Calendar;
+import java.util.Set;
+
+import org.apache.jackrabbit.core.nodetype.PropDef;
+import org.apache.jackrabbit.core.state.NodeState;
+import org.apache.jackrabbit.core.value.InternalValue;
+import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.commons.name.NameConstants;
+
+/**
+ * The <code>NodeTypeInstanceHandler</code> is used to provide or initialize
+ * system protected properties (or child nodes).
+ *
+ */
+public class NodeTypeInstanceHandler {
+
+    /**
+     * Default user id in the case where the creating user cannot be determined.
+     */
+    public static final String DEFAULT_USERID = "system";
+
+    /**
+     * userid to use for the "*By" autocreated properties
+     */
+    private final String userId;
+
+    /**
+     * Creates a new node type instance handler.
+     * @param userId the user id. if <code>null</code>, {@value #DEFAULT_USERID} is used.
+     */
+    public NodeTypeInstanceHandler(String userId) {
+        this.userId = userId == null
+                ? DEFAULT_USERID
+                : userId;
+    }
+
+    /**
+     * Computes the values of well-known system (i.e. protected) properties.
+     *
+     * @param parent the parent node state
+     * @param def the definition of the property to compute
+     * @return the computed values
+     */
+    public InternalValue[] computeSystemGeneratedPropertyValues(NodeState parent, 
+                                                                PropDef def) {
+
+        InternalValue[] genValues = null;
+
+        Name name = def.getName();
+        Name declaringNT = def.getDeclaringNodeType();
+
+        if (NameConstants.JCR_UUID.equals(name)) {
+            // jcr:uuid property of the mix:referenceable node type
+            if (NameConstants.MIX_REFERENCEABLE.equals(declaringNT)) {
+                genValues = new InternalValue[]{InternalValue.create(parent.getNodeId().toString())};
+            }
+        } else if (NameConstants.JCR_PRIMARYTYPE.equals(name)) {
+            // jcr:primaryType property (of any node type)
+            genValues = new InternalValue[]{InternalValue.create(parent.getNodeTypeName())};
+        } else if (NameConstants.JCR_MIXINTYPES.equals(name)) {
+            // jcr:mixinTypes property (of any node type)
+            Set<Name> mixins = parent.getMixinTypeNames();
+            genValues = new InternalValue[mixins.size()];
+            int i = 0;
+            for (Name n : mixins) {
+                genValues[i++] = InternalValue.create(n);
+            }
+        } else if (NameConstants.JCR_CREATED.equals(name)) {
+            // jcr:created property of a version or a mix:created
+            if (NameConstants.MIX_CREATED.equals(declaringNT)
+                    || NameConstants.NT_VERSION.equals(declaringNT)) {
+                genValues = new InternalValue[]{InternalValue.create(Calendar.getInstance())};
+            }
+        } else if (NameConstants.JCR_CREATEDBY.equals(name)) {
+            // jcr:createdBy property of a mix:created
+            if (NameConstants.MIX_CREATED.equals(declaringNT)) {
+                genValues = new InternalValue[]{InternalValue.create(userId)};
+            }
+        } else if (NameConstants.JCR_LASTMODIFIED.equals(name)) {
+            // jcr:lastModified property of a mix:lastModified
+            if (NameConstants.MIX_LASTMODIFIED.equals(declaringNT)) {
+                genValues = new InternalValue[]{InternalValue.create(Calendar.getInstance())};
+            }
+        } else if (NameConstants.JCR_LASTMODIFIEDBY.equals(name)) {
+            // jcr:lastModifiedBy property of a mix:lastModified
+            if (NameConstants.MIX_LASTMODIFIED.equals(declaringNT)) {
+                genValues = new InternalValue[]{InternalValue.create(userId)};
+            }
+        }
+        return genValues;
+    }
+
+}
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeTypeInstanceHandler.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?rev=798847&r1=798846&r2=798847&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java Wed Jul 29 10:34:25 2009
@@ -200,6 +200,11 @@
     protected final InternalVersionManager versionMgr;
 
     /**
+     * node type instance handler
+     */
+    protected final NodeTypeInstanceHandler ntInstanceHandler;
+
+    /**
      * Listeners (weak references)
      */
     protected final Map<SessionListener, SessionListener> listeners =
@@ -284,6 +289,7 @@
         itemMgr = createItemManager(itemStateMgr, hierMgr);
         accessMgr = createAccessManager(subject, itemStateMgr.getHierarchyMgr());
         versionMgr = createVersionManager(rep);
+        ntInstanceHandler = new NodeTypeInstanceHandler(userId);
     }
 
     /**
@@ -496,6 +502,14 @@
     }
 
     /**
+     * Returns the node type instance handler for this session
+     * @return the node type instance handler.
+     */
+    public NodeTypeInstanceHandler getNodeTypeInstanceHandler() {
+        return ntInstanceHandler;
+    }
+
+    /**
      * Sets the named attribute. If the value is <code>null</code>, then
      * the named attribute is removed.
      *

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java?rev=798847&r1=798846&r2=798847&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java Wed Jul 29 10:34:25 2009
@@ -20,7 +20,6 @@
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.Set;
-import java.util.List;
 
 import javax.jcr.ItemExistsException;
 import javax.jcr.PropertyType;
@@ -31,7 +30,6 @@
 import javax.jcr.version.VersionException;
 import javax.jcr.version.VersionManager;
 
-import org.apache.jackrabbit.core.BatchedItemOperations;
 import org.apache.jackrabbit.core.HierarchyManager;
 import org.apache.jackrabbit.core.ItemValidator;
 import org.apache.jackrabbit.core.SessionImpl;
@@ -634,12 +632,11 @@
      * @param useDefaultValues if <code>true</code> the default values are respected
      * @return the values or <code>null</code>
      */
-    private static InternalValue[] computeAutoValues(NodeStateEx state, PropDef def,
+    private InternalValue[] computeAutoValues(NodeStateEx state, PropDef def,
                                                      boolean useDefaultValues) {
         // compute system generated values if necessary
-        // todo: use NodeTypeInstanceHandler
-        InternalValue[] values =
-                BatchedItemOperations.computeSystemGeneratedPropertyValues(state.getState(), def);
+        InternalValue[] values = session.getNodeTypeInstanceHandler().
+                computeSystemGeneratedPropertyValues(state.getState(), def);
         if (values == null && useDefaultValues) {
             values = def.getDefaultValues();
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd?rev=798847&r1=798846&r2=798847&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd Wed Jul 29 10:34:25 2009
@@ -114,14 +114,16 @@
  * controlled by the repository, which should set them appropriately upon the
  * initial persist of a node with this mixin type. In cases where this mixin is
  * added to an already existing node the semantics of these properties are
- * implementation specific.
+ * implementation specific. Note that jackrabbit initializes the properties to
+ * the current date and user in this case.
+ *
  *
  * @since 2.0
  */
 [mix:created]
   mixin
   - jcr:created (DATE) autocreated protected
-  - jcr:createdBy (STRING) protected
+  - jcr:createdBy (STRING) autocreated protected
 
 /**
  * This mixin node type can be used to provide standardized modification
@@ -134,13 +136,16 @@
  *  constitutes a significant modification will depend on the semantics of the various
  *  parts of a node's subgraph and is implementation-dependent"
  *
+ * Jackrabbit initializes the properties to the current date and user in the
+ * case they are newly created.
+ *
  * Note that the protected attributes suggested by JSR283 are omitted in this variant.
  * @since 2.0
  */
 [mix:lastModified]
   mixin
-  - jcr:lastModified (DATE)
-  - jcr:lastModifiedBy (STRING)
+  - jcr:lastModified (DATE) autocreated
+  - jcr:lastModifiedBy (STRING) autocreated
 
 /**
  * This mixin node type can be used to provide a standardized property that

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java?rev=798847&r1=798846&r2=798847&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/PredefinedNodeTypeTest.java Wed Jul 29 10:34:25 2009
@@ -127,6 +127,41 @@
         testPredefinedNodeType("mix:simpleVersionable");
     }
 
+    /** Test for the predefined mix:created node type. */
+    public void testMixCreated() throws NotExecutableException {
+        testPredefinedNodeType("mix:created");
+    }
+
+    /** Test for the predefined mix:lastModified node type. */
+    public void testMixLastModified() throws NotExecutableException {
+        testPredefinedNodeType("mix:lastModified");
+    }
+
+    /** Test for the predefined mix:etag node type. */
+    public void testMixETag() throws NotExecutableException {
+        testPredefinedNodeType("mix:etag");
+    }
+
+    /** Test for the predefined mix:title node type. */
+    public void testMixTitle() throws NotExecutableException {
+        testPredefinedNodeType("mix:title");
+    }
+
+    /** Test for the predefined mix:language node type. */
+    public void testMixLanguage() throws NotExecutableException {
+        testPredefinedNodeType("mix:language");
+    }
+
+    /** Test for the predefined mix:language node type. */
+    public void testMixMimeType() throws NotExecutableException {
+        testPredefinedNodeType("mix:mimeType");
+    }
+
+    /** Test for the predefined nt:address node type. */
+    public void testNtAddress() throws NotExecutableException {
+        testPredefinedNodeType("nt:address");
+    }
+
     /** Test for the predefined nt:base node type. */
     public void testBase() throws NotExecutableException {
         testPredefinedNodeType("nt:base");

Copied: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-created.txt (from r798284, jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-lifecycle.txt)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-created.txt?p2=jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-created.txt&p1=jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-lifecycle.txt&r1=798284&r2=798847&rev=798847&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-lifecycle.txt (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-created.txt Wed Jul 29 10:34:25 2009
@@ -1,5 +1,5 @@
 NodeTypeName
-  mix:lifecycle
+  mix:created
 Supertypes
   []
 IsMixin
@@ -9,20 +9,20 @@
 PrimaryItemName
   null
 PropertyDefinition
-  Name jcr:currentLifecycleState
-  RequiredType STRING
+  Name jcr:created
+  RequiredType DATE
   DefaultValues null
-  AutoCreated false
+  AutoCreated true
   Mandatory false
-  OnParentVersion INITIALIZE
+  OnParentVersion COPY
   Protected true
   Multiple false
 PropertyDefinition
-  Name jcr:lifecyclePolicy
-  RequiredType REFERENCE
+  Name jcr:createdBy
+  RequiredType STRING
   DefaultValues null
-  AutoCreated false
+  AutoCreated true
   Mandatory false
-  OnParentVersion INITIALIZE
+  OnParentVersion COPY
   Protected true
-  Multiple false
+  Multiple false
\ No newline at end of file

Added: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-etag.txt
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-etag.txt?rev=798847&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-etag.txt (added)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-etag.txt Wed Jul 29 10:34:25 2009
@@ -0,0 +1,19 @@
+NodeTypeName
+  mix:etag
+Supertypes
+  []
+IsMixin
+  true
+HasOrderableChildNodes
+  false
+PrimaryItemName
+  null
+PropertyDefinition
+  Name jcr:etag
+  RequiredType STRING
+  DefaultValues []
+  AutoCreated true
+  Mandatory false
+  OnParentVersion COPY
+  Protected true
+  Multiple false
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-etag.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-language.txt
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-language.txt?rev=798847&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-language.txt (added)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-language.txt Wed Jul 29 10:34:25 2009
@@ -0,0 +1,19 @@
+NodeTypeName
+  mix:language
+Supertypes
+  []
+IsMixin
+  true
+HasOrderableChildNodes
+  false
+PrimaryItemName
+  null
+PropertyDefinition
+  Name jcr:language
+  RequiredType STRING
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-language.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-lastModified.txt
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-lastModified.txt?rev=798847&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-lastModified.txt (added)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-lastModified.txt Wed Jul 29 10:34:25 2009
@@ -0,0 +1,28 @@
+NodeTypeName
+  mix:lastModified
+Supertypes
+  []
+IsMixin
+  true
+HasOrderableChildNodes
+  false
+PrimaryItemName
+  null
+PropertyDefinition
+  Name jcr:lastModified
+  RequiredType DATE
+  DefaultValues null
+  AutoCreated true
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
+PropertyDefinition
+  Name jcr:lastModifiedBy
+  RequiredType STRING
+  DefaultValues null
+  AutoCreated true
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-lastModified.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-mimeType.txt
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-mimeType.txt?rev=798847&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-mimeType.txt (added)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-mimeType.txt Wed Jul 29 10:34:25 2009
@@ -0,0 +1,28 @@
+NodeTypeName
+  mix:mimeType
+Supertypes
+  []
+IsMixin
+  true
+HasOrderableChildNodes
+  false
+PrimaryItemName
+  null
+PropertyDefinition
+  Name jcr:encoding
+  RequiredType STRING
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
+PropertyDefinition
+  Name jcr:mimeType
+  RequiredType STRING
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-mimeType.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-title.txt
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-title.txt?rev=798847&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-title.txt (added)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-title.txt Wed Jul 29 10:34:25 2009
@@ -0,0 +1,28 @@
+NodeTypeName
+  mix:title
+Supertypes
+  []
+IsMixin
+  true
+HasOrderableChildNodes
+  false
+PrimaryItemName
+  null
+PropertyDefinition
+  Name jcr:description
+  RequiredType STRING
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
+PropertyDefinition
+  Name jcr:title
+  RequiredType STRING
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/mix-title.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-address.txt
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-address.txt?rev=798847&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-address.txt (added)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-address.txt Wed Jul 29 10:34:25 2009
@@ -0,0 +1,73 @@
+NodeTypeName
+  nt:address
+Supertypes
+  nt:base
+IsMixin
+  false
+HasOrderableChildNodes
+  false
+PrimaryItemName
+  null
+PropertyDefinition
+  Name jcr:host
+  RequiredType STRING
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
+PropertyDefinition
+  Name jcr:id
+  RequiredType WEAKREFERENCE
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
+PropertyDefinition
+  Name jcr:path
+  RequiredType PATH
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
+PropertyDefinition
+  Name jcr:port
+  RequiredType STRING
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
+PropertyDefinition
+  Name jcr:protocol
+  RequiredType STRING
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
+PropertyDefinition
+  Name jcr:repository
+  RequiredType STRING
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
+PropertyDefinition
+  Name jcr:workspace
+  RequiredType STRING
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion COPY
+  Protected false
+  Multiple false
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-address.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java?rev=798847&r1=798846&r2=798847&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java Wed Jul 29 10:34:25 2009
@@ -16,7 +16,28 @@
  */
 package org.apache.jackrabbit.jcr2spi.state;
 
-import org.apache.jackrabbit.jcr2spi.ManagerProvider;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.PropertyType;
+import javax.jcr.ReferentialIntegrityException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.ValueFormatException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.version.VersionException;
+
+import org.apache.jackrabbit.jcr2spi.SessionImpl;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeType;
@@ -43,25 +64,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.AccessDeniedException;
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.ItemExistsException;
-import javax.jcr.PropertyType;
-import javax.jcr.ReferentialIntegrityException;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.ValueFormatException;
-import javax.jcr.lock.LockException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.version.VersionException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
 /**
  * <code>SessionItemStateManager</code> ...
  */
@@ -83,7 +85,7 @@
 
     private final QValueFactory qValueFactory;
 
-    private final ManagerProvider mgrProvider;
+    private final SessionImpl mgrProvider;
 
     /**
      * Creates a new <code>SessionItemStateManager</code> instance.
@@ -97,7 +99,7 @@
     public SessionItemStateManager(UpdatableItemStateManager workspaceItemStateMgr,
                                    ItemStateValidator validator,
                                    QValueFactory qValueFactory,
-                                   ItemStateFactory isf, ManagerProvider mgrProvider) {
+                                   ItemStateFactory isf, SessionImpl mgrProvider) {
 
         this.workspaceItemStateMgr = workspaceItemStateMgr;
         this.transientStateMgr = new TransientItemStateManager();
@@ -133,7 +135,7 @@
         ChangeLog changeLog = transientStateMgr.getChangeLog(state, true);
         if (!changeLog.isEmpty()) {
             // only pass changelog if there are transient modifications available
-            // for the specified item and its decendants.
+            // for the specified item and its descendants.
             workspaceItemStateMgr.execute(changeLog);
             // remove states and operations just processed from the transient ISM
             transientStateMgr.dispose(changeLog);
@@ -559,7 +561,8 @@
      * @return the computed values
      */
     private QValue[] computeSystemGeneratedPropertyValues(NodeState parent,
-                                                          QPropertyDefinition def) throws RepositoryException {
+                                                          QPropertyDefinition def)
+            throws RepositoryException {
         QValue[] genValues = null;
         QValue[] qDefaultValues = def.getDefaultValues();
         if (qDefaultValues != null && qDefaultValues.length > 0) {
@@ -570,15 +573,36 @@
             Name declaringNT = def.getDeclaringNodeType();
             Name name = def.getName();
 
-            if (NameConstants.NT_BASE.equals(declaringNT) && NameConstants.JCR_PRIMARYTYPE.equals(name)) {
+            if (NameConstants.JCR_PRIMARYTYPE.equals(name)) {
                 // jcr:primaryType property
                 genValues = new QValue[]{qValueFactory.create(parent.getNodeTypeName())};
-            } else if (NameConstants.NT_BASE.equals(declaringNT) && NameConstants.JCR_MIXINTYPES.equals(name)) {
+
+            } else if (NameConstants.JCR_MIXINTYPES.equals(name)) {
                 // jcr:mixinTypes property
                 Name[] mixins = parent.getMixinTypeNames();
                 genValues = getQValues(mixins, qValueFactory);
-            }
-            else {
+
+            } else if (NameConstants.JCR_CREATED.equals(name)
+                    && NameConstants.MIX_CREATED.equals(declaringNT)) {
+                // jcr:created property of a mix:created
+                genValues = new QValue[]{qValueFactory.create(Calendar.getInstance())};
+
+            } else if (NameConstants.JCR_CREATEDBY.equals(name)
+                    && NameConstants.MIX_CREATED.equals(declaringNT)) {
+                // jcr:createdBy property of a mix:created
+                genValues = new QValue[]{qValueFactory.create(mgrProvider.getUserID(), PropertyType.STRING)};
+
+            } else if (NameConstants.JCR_LASTMODIFIED.equals(name)
+                    && NameConstants.MIX_LASTMODIFIED.equals(declaringNT)) {
+                // jcr:lastModified property of a mix:lastModified
+                genValues = new QValue[]{qValueFactory.create(Calendar.getInstance())};
+
+            } else if (NameConstants.JCR_LASTMODIFIEDBY.equals(name)
+                    && NameConstants.MIX_LASTMODIFIED.equals(declaringNT)) {
+                // jcr:lastModifiedBy property of a mix:lastModified
+                genValues = new QValue[]{qValueFactory.create(mgrProvider.getUserID(), PropertyType.STRING)};
+
+            } else {
                 // ask the SPI implementation for advice
                 genValues = qValueFactory.computeAutoValues(def);
             }

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java?rev=798847&r1=798846&r2=798847&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/HierarchyNodeTest.java Wed Jul 29 10:34:25 2009
@@ -16,30 +16,26 @@
  */
 package org.apache.jackrabbit.jcr2spi;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.jackrabbit.test.AbstractJCRTest;
-import org.apache.jackrabbit.test.NotExecutableException;
+import java.util.HashSet;
+import java.util.Set;
 
 import javax.jcr.Node;
-import javax.jcr.PropertyIterator;
 import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
 import javax.jcr.Property;
+import javax.jcr.PropertyIterator;
+import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import java.util.Calendar;
-import java.util.Set;
-import java.util.HashSet;
+
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
 
 /**
  * <code>HierarchyNodeTest</code>...
  */
 public class HierarchyNodeTest extends AbstractJCRTest {
 
-    private static Logger log = LoggerFactory.getLogger(HierarchyNodeTest.class);
-
-    private Set hierarchyNodeProps = new HashSet();
-    private Set resourceProps = new HashSet();
+    private Set<String> hierarchyNodeProps = new HashSet<String>();
+    private Set<String> resourceProps = new HashSet<String>();
 
     private String ntFolder;
     private String ntFile;
@@ -59,9 +55,11 @@
 
         hierarchyNodeProps.add(jcrPrefix+":primaryType");
         hierarchyNodeProps.add(jcrPrefix+":created");
+        hierarchyNodeProps.add(jcrPrefix+":createdBy");
 
         resourceProps.add(jcrPrefix+":primaryType");
         resourceProps.add(jcrPrefix+":lastModified");
+        resourceProps.add(jcrPrefix+":lastModifiedBy");
         resourceProps.add(jcrPrefix+":mimeType");
         resourceProps.add(jcrPrefix+":data");
 
@@ -70,7 +68,6 @@
             fileNode = folder.addNode("file", ntFile);
 
             Node content = fileNode.addNode(jcrPrefix + ":content", ntResource);
-            content.setProperty(jcrPrefix + ":lastModified", Calendar.getInstance());
             content.setProperty(jcrPrefix + ":mimeType", "text/plain");
             content.setProperty(jcrPrefix + ":data", "some plain text");
 
@@ -99,7 +96,7 @@
 
         // Then output the properties
         PropertyIterator properties = node.getProperties();
-        Set set = new HashSet();
+        Set<String> set = new HashSet<String>();
         while (properties.hasNext()) {
             Property property = properties.nextProperty();
             set.add(property.getName());

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/AbstractQValueFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/AbstractQValueFactory.java?rev=798847&r1=798846&r2=798847&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/AbstractQValueFactory.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/AbstractQValueFactory.java Wed Jul 29 10:34:25 2009
@@ -16,22 +16,23 @@
  */
 package org.apache.jackrabbit.spi.commons.value;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.jackrabbit.spi.QValueFactory;
-import org.apache.jackrabbit.spi.QValue;
-import org.apache.jackrabbit.spi.QPropertyDefinition;
+import java.util.Calendar;
+import java.util.UUID;
+
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.PathFactory;
 import org.apache.jackrabbit.spi.NameFactory;
+import org.apache.jackrabbit.spi.PathFactory;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.QValueFactory;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
-import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.PropertyType;
-import java.util.Calendar;
-import java.util.UUID;
+import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * <code>AbstractQValueFactory</code>...
@@ -58,15 +59,16 @@
      * @see QValueFactory#computeAutoValues(org.apache.jackrabbit.spi.QPropertyDefinition)
      */
     public QValue[] computeAutoValues(QPropertyDefinition propertyDefinition) throws RepositoryException {
-        Name nodeType = propertyDefinition.getDeclaringNodeType();
+        final String userId = "undefined";
+
+        Name declaringNT = propertyDefinition.getDeclaringNodeType();
         Name name = propertyDefinition.getName();
 
-        if ((NameConstants.NT_HIERARCHYNODE.equals(nodeType) || NameConstants.MIX_CREATED.equals(nodeType))&& NameConstants.JCR_CREATED.equals(name)) {
-            return new QValue[] { create(Calendar.getInstance()) };
-        } else if (NameConstants.NT_RESOURCE.equals(nodeType) && NameConstants.JCR_LASTMODIFIED.equals(name)) {
-            return new QValue[] { create(Calendar.getInstance()) };
-        } else if (NameConstants.MIX_REFERENCEABLE.equals(nodeType) && NameConstants.JCR_UUID.equals(name)) {
-            return new QValue[] { create(UUID.randomUUID().toString(), PropertyType.STRING) };
+        if (NameConstants.JCR_UUID.equals(name)
+                && NameConstants.MIX_REFERENCEABLE.equals(declaringNT)) {
+            // jcr:uuid property of a mix:referenceable
+            return new QValue[]{create(UUID.randomUUID().toString(), PropertyType.STRING)};
+
         } else {
             throw new RepositoryException("createFromDefinition not implemented for: " + name);
         }

Modified: jackrabbit/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/pom.xml?rev=798847&r1=798846&r2=798847&view=diff
==============================================================================
--- jackrabbit/trunk/pom.xml (original)
+++ jackrabbit/trunk/pom.xml Wed Jul 29 10:34:25 2009
@@ -55,7 +55,7 @@
     <module>jackrabbit-spi2jcr</module>
     <module>jackrabbit-spi2dav</module>
     <module>jackrabbit-jcr-client</module>
-    <module>jackrabbit-standalone</module>
+    <!--<module>jackrabbit-standalone</module> -->
   </modules>
 
   <scm>



Mime
View raw message