jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject svn commit: r160863 - in incubator/jackrabbit/trunk/contrib/orm-persistence: ./ applications/test/ applications/test/hibernate/ applications/test/ojb/ applications/test/workspaces/default/ src/java/org/apache/jackrabbit/core/state/orm/ src/java/org/apache/jackrabbit/core/state/orm/hibernate/
Date Mon, 11 Apr 2005 11:45:00 GMT
Author: stefan
Date: Mon Apr 11 04:44:58 2005
New Revision: 160863

URL: http://svn.apache.org/viewcvs?view=rev&rev=160863
Log:
committing as-is Patch for ORM-Persistence posted by serge (JCR-100)

Modified:
    incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/hibernate/jackrabbit.hbm.xml
    incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/jaas.config
    incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/ojb/repository_user.xml
    incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/repositoryStubImpl.properties
    incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/default/workspace.xml
    incubator/jackrabbit/trunk/contrib/orm-persistence/create_db_hsqldb.sql
    incubator/jackrabbit/trunk/contrib/orm-persistence/create_db_mysql.sql
    incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMChildNodeEntry.java
    incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeState.java
    incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/hibernate/HibernateNodeState.java

Modified: incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/hibernate/jackrabbit.hbm.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/hibernate/jackrabbit.hbm.xml?view=diff&r1=160862&r2=160863
==============================================================================
--- incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/hibernate/jackrabbit.hbm.xml
(original)
+++ incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/hibernate/jackrabbit.hbm.xml
Mon Apr 11 04:44:58 2005
@@ -40,14 +40,15 @@
             <column name="DEFINITION_ID" not-null="false"/>
         </property>
 
-        <set name="setChildNodeEntries" table="JCR_CHILD_NODE" order-by="NODE_INDEX ASC">
+        <list name="listChildNodeEntries" table="JCR_CHILD_NODE">
             <key column="PARENT_UUID"/>
+            <index column="CHILDREN_INDEX" />
             <composite-element class="org.apache.jackrabbit.core.state.orm.ORMChildNodeEntry">
               <property name="uuid" type="string" column="UUID"/>
               <property name="name" type="string" column="NAME"/>
-              <property name="index" type="integer" column="NODE_INDEX"/>
+              <property name="sameNameIndex" type="integer" column="SAMENAME_INDEX"/>
             </composite-element>
-        </set>
+        </list>
 
         <set name="setPropertyEntries" table="JCR_NODE_PROPERTY">
             <key column="PARENT_UUID"/>

Modified: incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/jaas.config
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/jaas.config?view=diff&r1=160862&r2=160863
==============================================================================
--- incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/jaas.config (original)
+++ incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/jaas.config Mon Apr
11 04:44:58 2005
@@ -1,3 +1,6 @@
 Jackrabbit {
   org.apache.jackrabbit.core.security.SimpleLoginModule required anonymousId="anonymous";
 };
+Jackrabbit {
+  org.apache.jackrabbit.core.security.SimpleLoginModule required anonymousId="anonymous";
+};

Modified: incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/ojb/repository_user.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/ojb/repository_user.xml?view=diff&r1=160862&r2=160863
==============================================================================
--- incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/ojb/repository_user.xml
(original)
+++ incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/ojb/repository_user.xml
Mon Apr 11 04:44:58 2005
@@ -55,7 +55,7 @@
        element-class-ref="org.apache.jackrabbit.core.state.orm.ORMChildNodeEntry"
        auto-update="true"
        auto-delete="true"
-       orderby="index"
+       orderby="childrenIndex"
        sort="ASC"
     >
        <inverse-foreignkey field-ref="parentUUID"/>
@@ -160,8 +160,14 @@
          primarykey="true"
       />
        <field-descriptor
-         name="index"
-         column="NODE_INDEX"
+         name="sameNameIndex"
+         column="SAMENAME_INDEX"
+         jdbc-type="INTEGER"
+         primarykey="true"
+      />
+       <field-descriptor
+         name="childrenIndex"
+         column="CHILDREN_INDEX"
          jdbc-type="INTEGER"
          primarykey="true"
       />

Modified: incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/repositoryStubImpl.properties
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/repositoryStubImpl.properties?view=diff&r1=160862&r2=160863
==============================================================================
--- incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/repositoryStubImpl.properties
(original)
+++ incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/repositoryStubImpl.properties
Mon Apr 11 04:44:58 2005
@@ -392,4 +392,7 @@
 javax.jcr.tck.OnParentVersionCopyTest.nodename4=test:copyOnParentVersion
 javax.jcr.tck.OnParentVersionCopyTest.nodetype=nt:unstructured
 javax.jcr.tck.OnParentVersionAbortTest.nodename4=test:abortOnParentVersion
+<<<<<<< .mine
+javax.jcr.tck.OnParentVersionAbortTest.nodetype=nt:unstructured=======
 javax.jcr.tck.OnParentVersionAbortTest.nodetype=nt:unstructured
+>>>>>>> .r160307

Modified: incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/default/workspace.xml
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/default/workspace.xml?view=diff&r1=160862&r2=160863
==============================================================================
--- incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/default/workspace.xml
(original)
+++ incubator/jackrabbit/trunk/contrib/orm-persistence/applications/test/workspaces/default/workspace.xml
Mon Apr 11 04:44:58 2005
@@ -14,8 +14,8 @@
       persistence of the workspace:
       class: FQN of class implementing PersistenceManager interface
   -->
-        <PersistenceManager class="org.apache.jackrabbit.core.state.orm.ojb.OJBPersistenceManager"
/>
-        <!--PersistenceManager class="org.apache.jackrabbit.core.state.orm.hibernate.HibernatePersistenceManager"
/-->
+        <!--PersistenceManager class="org.apache.jackrabbit.core.state.orm.ojb.OJBPersistenceManager"
/-->
+        <PersistenceManager class="org.apache.jackrabbit.core.state.orm.hibernate.HibernatePersistenceManager"
/>
   <!--
       Search index and the file system it uses.
   -->

Modified: incubator/jackrabbit/trunk/contrib/orm-persistence/create_db_hsqldb.sql
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/orm-persistence/create_db_hsqldb.sql?view=diff&r1=160862&r2=160863
==============================================================================
--- incubator/jackrabbit/trunk/contrib/orm-persistence/create_db_hsqldb.sql (original)
+++ incubator/jackrabbit/trunk/contrib/orm-persistence/create_db_hsqldb.sql Mon Apr 11 04:44:58
2005
@@ -2,14 +2,14 @@
 CREATE TABLE JCR_PROPERTY(ITEM_ID VARCHAR(200) NOT NULL,NAME VARCHAR(100),VALUE VARCHAR(100),PARENT_UUID
VARCHAR(36),PROP_TYPE INTEGER,DEFINITION_ID VARCHAR(100),MULTI_VALUED CHAR(1),PRIMARY KEY
(ITEM_ID))
 CREATE TABLE JCR_NODE_MIXIN_TYPE(NODE_UUID VARCHAR(36) NOT NULL,MIXIN_TYPE VARCHAR(100))
 CREATE TABLE JCR_NODE_PARENT(NODE_UUID VARCHAR(36) NOT NULL,PARENT_UUID VARCHAR(36))
-CREATE TABLE JCR_CHILD_NODE(PARENT_UUID VARCHAR(36),UUID VARCHAR(36),NAME VARCHAR(100),NODE_INDEX
INTEGER)
+CREATE TABLE JCR_CHILD_NODE(PARENT_UUID VARCHAR(36),UUID VARCHAR(36),NAME VARCHAR(100),SAMENAME_INDEX
INTEGER,CHILDREN_INDEX INTEGER)
 CREATE TABLE JCR_NODE_PROPERTY(PARENT_UUID VARCHAR(36) NOT NULL,NAME VARCHAR(100))
 CREATE TABLE JCR_NODE_REF(NREF_ID IDENTITY,TARGET_UUID VARCHAR(36) NOT NULL,PROP_UUID VARCHAR(36),PROP_NAME
VARCHAR(100))
 CREATE TABLE JCR_BLOB(BLOB_ID IDENTITY, PARENT_UUID VARCHAR(36), PROP_NAME VARCHAR(100),
VALUE_INDEX INTEGER, BLOB_SIZE INTEGER, BLOB_VALUE LONGVARBINARY)
 CREATE INDEX JCR_NODE_PROPERTY_INDEX1 ON JCR_NODE_PROPERTY(PARENT_UUID, NAME)
 CREATE INDEX JCR_NODE_PROPERTY_INDEX2 ON JCR_NODE_PROPERTY(PARENT_UUID)
-CREATE INDEX JCR_CHILD_NODE_INDEX1 ON JCR_CHILD_NODE (PARENT_UUID, UUID, NAME, NODE_INDEX)
-CREATE INDEX JCR_CHILD_NODE_INDEX2 ON JCR_CHILD_NODE (PARENT_UUID)
+CREATE INDEX JCR_CHILD_NODE_INDEX1 ON JCR_CHILD_NODE (PARENT_UUID, UUID, NAME, SAMENAME_INDEX)
+CREATE INDEX JCR_CHILD_NODE_INDEX2 ON JCR_CHILD_NODE (PARENT_UUID, CHILDREN_INDEX)
 CREATE INDEX JCR_NODE_MIXIN_TYPE_INDEX1 ON JCR_NODE_MIXIN_TYPE (NODE_UUID, MIXIN_TYPE)
 CREATE INDEX JCR_NODE_MIXIN_TYPE_INDEX2 ON JCR_NODE_MIXIN_TYPE (NODE_UUID)
 CREATE INDEX JCR_NODE_PARENT_INDEX1 ON JCR_NODE_PARENT (NODE_UUID, PARENT_UUID)

Modified: incubator/jackrabbit/trunk/contrib/orm-persistence/create_db_mysql.sql
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/orm-persistence/create_db_mysql.sql?view=diff&r1=160862&r2=160863
==============================================================================
--- incubator/jackrabbit/trunk/contrib/orm-persistence/create_db_mysql.sql (original)
+++ incubator/jackrabbit/trunk/contrib/orm-persistence/create_db_mysql.sql Mon Apr 11 04:44:58
2005
@@ -37,7 +37,8 @@
   PARENT_UUID VARCHAR(36) NOT NULL,
   UUID VARCHAR(36),
   NAME VARCHAR(100),
-  NODE_INDEX INTEGER
+  SAMENAME_INDEX INTEGER,
+  CHILDREN_INDEX INTEGER
 ) TYPE=InnoDB;
 
 CREATE TABLE JCR_NODE_PROPERTY(
@@ -67,8 +68,8 @@
 CREATE INDEX JCR_NODE_PROPERTY_INDEX1 ON JCR_NODE_PROPERTY(PARENT_UUID, NAME);
 CREATE INDEX JCR_NODE_PROPERTY_INDEX2 ON JCR_NODE_PROPERTY(PARENT_UUID);
 
-CREATE INDEX JCR_CHILD_NODE_INDEX1 ON JCR_CHILD_NODE (PARENT_UUID, UUID, NAME, NODE_INDEX);
-CREATE INDEX JCR_CHILD_NODE_INDEX2 ON JCR_CHILD_NODE (PARENT_UUID);
+CREATE INDEX JCR_CHILD_NODE_INDEX1 ON JCR_CHILD_NODE (PARENT_UUID, UUID, NAME, SAMENAME_INDEX);
+CREATE INDEX JCR_CHILD_NODE_INDEX2 ON JCR_CHILD_NODE (PARENT_UUID, CHILDREN_INDEX);
 
 CREATE INDEX JCR_NODE_MIXIN_TYPE_INDEX1 ON JCR_NODE_MIXIN_TYPE (NODE_UUID, MIXIN_TYPE);
 CREATE INDEX JCR_NODE_MIXIN_TYPE_INDEX2 ON JCR_NODE_MIXIN_TYPE (NODE_UUID);

Modified: incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMChildNodeEntry.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMChildNodeEntry.java?view=diff&r1=160862&r2=160863
==============================================================================
--- incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMChildNodeEntry.java
(original)
+++ incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMChildNodeEntry.java
Mon Apr 11 04:44:58 2005
@@ -28,18 +28,22 @@
     private String uuid;
     private String parentUUID;
     private String name;
-    private Integer index;
+    // this is the index used for same name siblings
+    private Integer sameNameIndex;
     private Integer dbId;
     private ORMNodeState parent;
+    // this is the index used for conserving the order of child nodes.
+    private Integer childrenIndex;
     public ORMChildNodeEntry() {
     }
 
-    public ORMChildNodeEntry(ORMNodeState parent, ChildNodeEntry childNodeEntry, String parentUUID)
{
+    public ORMChildNodeEntry(ORMNodeState parent, ChildNodeEntry childNodeEntry, String parentUUID,
int childrenIndex) {
         this.parent = parent;
         uuid = childNodeEntry.getUUID();
         this.parentUUID = parentUUID;
         name = childNodeEntry.getName().toString();
-        index = new Integer(childNodeEntry.getIndex());
+        sameNameIndex = new Integer(childNodeEntry.getIndex());
+        this.childrenIndex = new Integer(childrenIndex);
     }
 
     public void setUuid(String uuid) {
@@ -54,8 +58,9 @@
         this.name = name;
     }
 
-    public void setIndex(Integer index) {
-        this.index = index;
+    public void setSameNameIndex(Integer sameNameIndex) {
+
+        this.sameNameIndex = sameNameIndex;
     }
 
     public void setDbId(Integer dbId) {
@@ -66,6 +71,10 @@
         this.parent = parent;
     }
 
+    public void setChildrenIndex(Integer childrenIndex) {
+        this.childrenIndex = childrenIndex;
+    }
+
     public String getUuid() {
         return uuid;
     }
@@ -78,8 +87,9 @@
         return name;
     }
 
-    public Integer getIndex() {
-        return index;
+    public Integer getSameNameIndex() {
+
+        return sameNameIndex;
     }
 
     public Integer getDbId() {
@@ -90,6 +100,10 @@
         return parent;
     }
 
+    public Integer getChildrenIndex() {
+        return childrenIndex;
+    }
+
     public boolean equals(Object obj) {
         if (!(obj instanceof ORMChildNodeEntry)) {
             return false;
@@ -97,7 +111,8 @@
         ORMChildNodeEntry right = (ORMChildNodeEntry) obj;
             if (getUuid().equals(right.getUuid()) &&
                 getName().equals(right.getName()) &&
-                (getIndex().equals(right.getIndex()))) {
+                (getSameNameIndex().equals(right.getSameNameIndex())) &&
+                (getChildrenIndex().equals(right.getChildrenIndex()))) {
                 return true;
             } else {
                 return false;
@@ -109,10 +124,10 @@
             return 0;
         }
         ORMChildNodeEntry right = (ORMChildNodeEntry) obj;
-        return (getUuid() + getName() + getIndex()).compareTo(right.getUuid() + right.getName()
+ right.getIndex());
+        return (getChildrenIndex() + getUuid() + getName() + getSameNameIndex()).compareTo(right.getChildrenIndex()
+ right.getUuid() + right.getName() + right.getSameNameIndex());
     }
 
     public int hashCode() {
-        return (getUuid() + getName() + getIndex()).hashCode();
+        return (getChildrenIndex() + getUuid() + getName() + getSameNameIndex()).hashCode();
     }
 }

Modified: incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeState.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeState.java?view=diff&r1=160862&r2=160863
==============================================================================
--- incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeState.java
(original)
+++ incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/ORMNodeState.java
Mon Apr 11 04:44:58 2005
@@ -71,11 +71,13 @@
             definitionId = state.getDefinitionId().toString();
         }
         Iterator childNodeEntriesIter = state.getChildNodeEntries().iterator();
+        int i=0;
         while (childNodeEntriesIter.hasNext()) {
             ChildNodeEntry curChildNodeEntry = (ChildNodeEntry) childNodeEntriesIter.next();
             log.debug("childNodeEntry " + curChildNodeEntry.getIndex() + " name=" + curChildNodeEntry.getName()
+ " uuid=" + curChildNodeEntry.getUUID());
-            ORMChildNodeEntry childNode = new ORMChildNodeEntry(this, curChildNodeEntry,
uuid);
+            ORMChildNodeEntry childNode = new ORMChildNodeEntry(this, curChildNodeEntry,
uuid, i);
             getChildNodeEntries().add(childNode);
+            i++;
         }
         Iterator propertyEntryIter = state.getPropertyEntries().iterator();
         while (propertyEntryIter.hasNext()) {

Modified: incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/hibernate/HibernateNodeState.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/hibernate/HibernateNodeState.java?view=diff&r1=160862&r2=160863
==============================================================================
--- incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/hibernate/HibernateNodeState.java
(original)
+++ incubator/jackrabbit/trunk/contrib/orm-persistence/src/java/org/apache/jackrabbit/core/state/orm/hibernate/HibernateNodeState.java
Mon Apr 11 04:44:58 2005
@@ -23,6 +23,9 @@
 import org.apache.jackrabbit.core.ItemId;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.orm.ORMNodeState;
+import java.util.TreeSet;
+import java.util.List;
+import java.util.ArrayList;
 
 /**
  * <p> Hibernate-specific node state class. This is necessary because
@@ -30,7 +33,9 @@
  */
 public class HibernateNodeState extends ORMNodeState {
 
-    private Set setChildNodeEntries = new HashSet();
+    // might be a bug here because it seems that these entries should be
+    // ordered
+    private List listChildNodeEntries = new ArrayList();
     private Set setParentUUIDs = new HashSet();
     private Set setMixinTypeNames = new HashSet();
     private Set setPropertyEntries = new HashSet();
@@ -45,11 +50,11 @@
         fromPersistentNodeState(state);
     }
     public Collection getChildNodeEntries() {
-        return setChildNodeEntries;
+        return listChildNodeEntries;
     }
     public void setChildNodeEntries(Collection childNodeEntries) {
-        this.setChildNodeEntries.clear();
-        this.setChildNodeEntries.addAll(childNodeEntries);
+        this.listChildNodeEntries.clear();
+        this.listChildNodeEntries.addAll(childNodeEntries);
     }
 
     public Collection getPropertyEntries() {
@@ -79,12 +84,12 @@
         this.setParentUUIDs.addAll(parentUUIDs);
     }
 
-    public Set getSetChildNodeEntries() {
-        return setChildNodeEntries;
+    public List getListChildNodeEntries() {
+        return listChildNodeEntries;
     }
 
-    public void setSetChildNodeEntries(Set setChildNodeEntries) {
-        this.setChildNodeEntries = setChildNodeEntries;
+    public void setListChildNodeEntries(List listChildNodeEntries) {
+        this.listChildNodeEntries = listChildNodeEntries;
     }
 
     public Set getSetPropertyEntries() {



Mime
View raw message