jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1003049 - in /jackrabbit/commons/ocm/trunk: ./ src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/ src/main/java/org/apache/jackrabbit/ocm/manager/beanconverter/impl/ src/main/java/org/apache/jackrabbit/ocm/manager/co...
Date Thu, 30 Sep 2010 12:55:40 GMT
Author: jukka
Date: Thu Sep 30 12:55:39 2010
New Revision: 1003049

URL: http://svn.apache.org/viewvc?rev=1003049&view=rev
Log:
OCM-43: Reviving OCM framework with Jackrabbit 2.x

Patch by Kadir Alaca

Modified:
    jackrabbit/commons/ocm/trunk/pom.xml
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/BinaryTypeConverterImpl.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/ByteArrayTypeConverterImpl.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/UndefinedTypeConverterImpl.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/beanconverter/impl/ReferenceBeanConverterImpl.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceCollectionConverterImpl.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceMapConverterImpl.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/DefaultCollectionConverterImpl.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/NTCollectionConverterImpl.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/SimpleFieldsHelper.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NamespaceHelper.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java
    jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/version/Version.java
    jackrabbit/commons/ocm/trunk/src/test/java/org/apache/jackrabbit/ocm/AbstractTestBase.java

Modified: jackrabbit/commons/ocm/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/pom.xml?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/pom.xml (original)
+++ jackrabbit/commons/ocm/trunk/pom.xml Thu Sep 30 12:55:39 2010
@@ -26,12 +26,12 @@
   <parent>
     <groupId>org.apache.jackrabbit</groupId>
     <artifactId>parent</artifactId>
-    <version>3</version>
+    <version>5</version>
   </parent>
 
   <artifactId>jackrabbit-ocm</artifactId>
-  <version>1.6-SNAPSHOT</version>
-  <name>Jackrabbit Object Content Mapping</name>
+  <version>2.0-SNAPSHOT</version>
+  <name>Jackrabbit Object Content Mapping 2.x</name>
   <description>
     This Jackrabbit subproject is an object/JCR persistence and
     query service. This tools lets you to persist java objects into
@@ -50,10 +50,12 @@
       <plugin>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-          <target>1.5</target>
-          <source>1.5</source>
+          <target>1.6</target>
+          <source>1.6</source>
+          <showDeprecation>true</showDeprecation>
         </configuration>
       </plugin>
+<!--
       <plugin>
         <artifactId>maven-javadoc-plugin</artifactId>
         <configuration>
@@ -111,7 +113,8 @@
             <version>1.5.3-1</version>
           </dependency>
         </dependencies>
-      </plugin>	  
+      </plugin>
+-->
     </plugins>
   </build>
 
@@ -122,7 +125,7 @@
     <dependency>
       <groupId>javax.jcr</groupId>
       <artifactId>jcr</artifactId>
-      <version>1.0</version>
+      <version>2.0</version>
     </dependency>
     <dependency>
       <groupId>commons-digester</groupId>
@@ -149,7 +152,7 @@
     <dependency>
       <groupId>cglib</groupId>
       <artifactId>cglib</artifactId>
-      <version>2.1_3</version>
+      <version>2.2</version>
     </dependency>
     <dependency>
       <groupId>commons-beanutils</groupId>
@@ -160,15 +163,15 @@
     <dependency>
       <groupId>org.apache.jackrabbit</groupId>
       <artifactId>jackrabbit-core</artifactId>
-      <version>1.5.5</version>
+      <version>2.1.1</version>
       <optional>true</optional>
     </dependency>
 
     <!-- Test -->
     <dependency>
-      <groupId>org.apache.geronimo.specs</groupId>
-      <artifactId>geronimo-jta_1.0.1B_spec</artifactId>
-      <version>1.0.1</version>
+      <groupId>geronimo-spec</groupId>
+      <artifactId>geronimo-spec-jta</artifactId>
+      <version>1.0-M1</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -183,6 +186,12 @@
       <version>1.5.3</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>xerces</groupId>
+      <artifactId>xercesImpl</artifactId>
+      <version>2.9.1</version>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <scm>

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/BinaryTypeConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/BinaryTypeConverterImpl.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/BinaryTypeConverterImpl.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/BinaryTypeConverterImpl.java Thu Sep 30 12:55:39 2010
@@ -18,6 +18,7 @@
 package org.apache.jackrabbit.ocm.manager.atomictypeconverter.impl;
 
 import java.io.InputStream;
+import javax.jcr.Binary;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Value;
@@ -45,7 +46,18 @@ public class BinaryTypeConverterImpl imp
         {
             return null;
         }
-        return valueFactory.createValue((InputStream) propValue);
+
+        Binary binaryvalue = null;
+        try {
+            binaryvalue = valueFactory.createBinary((InputStream) propValue);
+        } catch (RepositoryException ex) {
+            throw new IncorrectAtomicTypeException("Impossible to create binary value from stream!", ex);
+        }
+        if (binaryvalue == null) {
+            return null;
+        }
+
+        return valueFactory.createValue(binaryvalue);
     }
 
     /**
@@ -56,7 +68,7 @@ public class BinaryTypeConverterImpl imp
     {
     	try
     	{
-		    return value.getStream();
+		    return value.getBinary().getStream();
 		}
 		catch (RepositoryException e)
 		{

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/ByteArrayTypeConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/ByteArrayTypeConverterImpl.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/ByteArrayTypeConverterImpl.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/ByteArrayTypeConverterImpl.java Thu Sep 30 12:55:39 2010
@@ -49,7 +49,7 @@ public class ByteArrayTypeConverterImpl 
 			return null;
 		}
 		  InputStream ins = new ByteArrayInputStream((byte[]) propValue);
-		  return valueFactory.createValue(ins);
+                  return new BinaryTypeConverterImpl().getValue(valueFactory, ins);
 	}
 
 
@@ -61,7 +61,7 @@ public class ByteArrayTypeConverterImpl 
     {
 		try
 		{
-			return inputStreamToBytes(value.getStream());
+			return inputStreamToBytes(value.getBinary().getStream());
 		}
 		catch (Exception e)
 		{

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/UndefinedTypeConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/UndefinedTypeConverterImpl.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/UndefinedTypeConverterImpl.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/atomictypeconverter/impl/UndefinedTypeConverterImpl.java Thu Sep 30 12:55:39 2010
@@ -61,7 +61,7 @@ public class UndefinedTypeConverterImpl 
 
           if (propValue instanceof InputStream)
           {
-        	  return valueFactory.createValue((InputStream) propValue);
+        	  return new BinaryTypeConverterImpl().getValue(valueFactory, propValue);
           }
 	
           if ((propValue instanceof Long || propValue instanceof Integer))
@@ -123,7 +123,7 @@ public class UndefinedTypeConverterImpl 
 
 			if (value.getType() == PropertyType.BINARY)
 			{
-				return value.getStream();	
+				return value.getBinary().getStream();
 			}
 
 			if (value.getType() == PropertyType.DOUBLE)
@@ -151,7 +151,7 @@ public class UndefinedTypeConverterImpl 
 				return value.getString();	
 			}
 
-			if (value.getType() == PropertyType.REFERENCE)
+			if (value.getType() == PropertyType.REFERENCE || value.getType() == PropertyType.WEAKREFERENCE)
 			{
 				return value.getString();	
 			}

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/beanconverter/impl/ReferenceBeanConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/beanconverter/impl/ReferenceBeanConverterImpl.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/beanconverter/impl/ReferenceBeanConverterImpl.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/beanconverter/impl/ReferenceBeanConverterImpl.java Thu Sep 30 12:55:39 2010
@@ -70,7 +70,7 @@ public class ReferenceBeanConverterImpl 
 	{
         try {
 			String uuid = parentNode.getProperty(beanDescriptor.getJcrName()).getString();
-			String path = session.getNodeByUUID(uuid).getPath();
+			String path = session.getNodeByIdentifier(uuid).getPath();
 			
 			return objectConverter.getObject(session, path);
 		} catch (Exception e) {

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceCollectionConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceCollectionConverterImpl.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceCollectionConverterImpl.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceCollectionConverterImpl.java Thu Sep 30 12:55:39 2010
@@ -132,7 +132,7 @@ public class BeanReferenceCollectionConv
 
             for (int i = 0; i < values.length; i++) {
                 String uuid = values[i].getString();
-                String path = session.getNodeByUUID(uuid).getPath();
+                String path = session.getNodeByIdentifier(uuid).getPath();
     			Object object = objectConverter.getObject(session, path);
                 ((ManageableCollection) objects).addObject(object);
             }

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceMapConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceMapConverterImpl.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceMapConverterImpl.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/BeanReferenceMapConverterImpl.java Thu Sep 30 12:55:39 2010
@@ -146,7 +146,7 @@ public class BeanReferenceMapConverterIm
                 String uuid = MapReferenceValueEncoder.decodeReference(encoded);
 
 
-                String path = session.getNodeByUUID(uuid).getPath();
+                String path = session.getNodeByIdentifier(uuid).getPath();
                 Object object = objectConverter.getObject(session, path);
                 ((ManageableMap) objects).addObject(key, object);
             }

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/DefaultCollectionConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/DefaultCollectionConverterImpl.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/DefaultCollectionConverterImpl.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/DefaultCollectionConverterImpl.java Thu Sep 30 12:55:39 2010
@@ -228,7 +228,7 @@ public class DefaultCollectionConverterI
             	if (currentItemUuid != null){
             		//The Node already exists so we need to update the existing node 
             		//rather than to replace it.
-            		Node nodeToUpdate = collectionNode.getSession().getNodeByUUID(currentItemUuid);
+            		Node nodeToUpdate = collectionNode.getSession().getNodeByIdentifier(currentItemUuid);
             		objectConverter.update(session, currentItemUuid, item);
             		validUuidsForTheNode.add(currentItemUuid);
             	}
@@ -269,7 +269,7 @@ public class DefaultCollectionConverterI
             List<Node> removeNodes = new ArrayList<Node>();
             while (nodeIterator.hasNext()) {
             	Node currentNode = nodeIterator.nextNode();
-            	if (!validUuidsForTheNode.contains(currentNode.getUUID())) {
+            	if (!validUuidsForTheNode.contains(currentNode.getIdentifier())) {
                     removeNodes.add(currentNode);
                 }
             }

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/NTCollectionConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/NTCollectionConverterImpl.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/NTCollectionConverterImpl.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/collectionconverter/impl/NTCollectionConverterImpl.java Thu Sep 30 12:55:39 2010
@@ -302,6 +302,8 @@ public class NTCollectionConverterImpl e
     	{
             jcrExpression = "SELECT * FROM " + jcrNodeType + " WHERE jcr:path LIKE '" + parentNode.getPath()
                                        + "/%' AND NOT jcr:path LIKE '" + parentNode.getPath() + "/%/%'";
+            //FIXME: for doIsNull(..) only need to know if there are attributes or childnodes, queryResult.getNodes().getSize() delivers -1
+            jcrExpression += " order by jcr:path";
     	}
     	else
     	{

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/impl/ObjectContentManagerImpl.java Thu Sep 30 12:55:39 2010
@@ -25,6 +25,7 @@ import java.util.Map;
 
 import javax.jcr.InvalidItemStateException;
 import javax.jcr.Item;
+import javax.jcr.ItemNotFoundException;
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
 import javax.jcr.PathNotFoundException;
@@ -33,10 +34,12 @@ import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.Workspace;
 import javax.jcr.lock.LockException;
+import javax.jcr.lock.LockManager;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.query.InvalidQueryException;
 import javax.jcr.query.QueryResult;
 import javax.jcr.version.VersionHistory;
+import javax.jcr.version.VersionManager;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -281,7 +284,7 @@ public class ObjectContentManagerImpl im
     public Object getObjectByUuid(String uuid) {
 
         try {
-            Node node = session.getNodeByUUID(uuid);
+            Node node = session.getNodeByIdentifier(uuid);
             Object object = objectConverter.getObject(session, node.getPath());
             requestObjectCache.clear();
             return object;
@@ -669,10 +672,10 @@ public class ObjectContentManagerImpl im
             if (!node.isNodeType("mix:versionable")) {
                 throw new VersionException("The object " + path + "is not versionable");
             }
-            javax.jcr.version.Version newVersion = node.checkin();
+            javax.jcr.version.Version newVersion = getVersionManager().checkin(path);
 
             if (versionLabels != null) {
-                VersionHistory versionHistory = node.getVersionHistory();
+                VersionHistory versionHistory = getVersionManager().getVersionHistory(path);
                 for (int i = 0; i < versionLabels.length; i++) {
                     versionHistory.addVersionLabel(newVersion.getName(), versionLabels[i], false);
                 }
@@ -707,7 +710,7 @@ public class ObjectContentManagerImpl im
                 throw new VersionException("The object " + path + "is not versionable");
             }
 
-            node.checkout();
+            getVersionManager().checkout(path);
         } catch (ClassCastException cce) {
             throw new ObjectContentManagerException("Cannot retrieve an object from a property path " + path);
         } catch (PathNotFoundException pnfe) {
@@ -735,7 +738,7 @@ public class ObjectContentManagerImpl im
                 throw new VersionException("The object " + path + "is not versionable");
             }
 
-            VersionHistory history = node.getVersionHistory();
+            VersionHistory history = getVersionManager().getVersionHistory(path);
             history.addVersionLabel(versionName, versionLabel, false);
         } catch (ClassCastException cce) {
             throw new ObjectContentManagerException("Cannot retrieve an object from a property path " + path);
@@ -762,7 +765,7 @@ public class ObjectContentManagerImpl im
                 throw new VersionException("The object " + path + "is not versionable");
             }
 
-            VersionHistory history = node.getVersionHistory();
+            VersionHistory history = getVersionManager().getVersionHistory(path);
 
             return new Version(history.getVersion(versionName));
         } catch (ClassCastException cce) {
@@ -790,7 +793,7 @@ public class ObjectContentManagerImpl im
                 throw new VersionException("The object " + path + "is not versionable");
             }
 
-            VersionHistory history = node.getVersionHistory();
+            VersionHistory history = getVersionManager().getVersionHistory(path);
             javax.jcr.version.Version version = history.getVersion(versionName);
 
             return history.getVersionLabels(version);
@@ -817,7 +820,7 @@ public class ObjectContentManagerImpl im
                 throw new VersionException("The object " + path + "is not versionable");
             }
 
-            VersionHistory history = node.getVersionHistory();
+            VersionHistory history = getVersionManager().getVersionHistory(path);
 
             return history.getVersionLabels();
         } catch (ClassCastException cce) {
@@ -842,7 +845,7 @@ public class ObjectContentManagerImpl im
                 throw new VersionException("The object " + path + "is not versionable");
             }
 
-            VersionHistory history = node.getVersionHistory();
+            VersionHistory history = getVersionManager().getVersionHistory(path);
 
             return new VersionIterator(history.getAllVersions());
         } catch (ClassCastException cce) {
@@ -867,7 +870,7 @@ public class ObjectContentManagerImpl im
                 throw new VersionException("The object " + path + "is not versionable");
             }
 
-            VersionHistory history = node.getVersionHistory();
+            VersionHistory history = getVersionManager().getVersionHistory(path);
 
             return new Version(history.getRootVersion());
         } catch (ClassCastException cce) {
@@ -892,7 +895,7 @@ public class ObjectContentManagerImpl im
                 throw new VersionException("The object " + path + "is not versionable");
             }
 
-            return new Version(node.getBaseVersion());
+            return new Version(getVersionManager().getBaseVersion(path));
         } catch (ClassCastException cce) {
             throw new ObjectContentManagerException("Cannot retrieve an object from a property path " + path);
         } catch (PathNotFoundException pnfe) {
@@ -917,7 +920,7 @@ public class ObjectContentManagerImpl im
             checkIfNodeLocked(absPath);
 
             Node node = getNode(absPath);
-            javax.jcr.lock.Lock lock = node.lock(isDeep, isSessionScoped);
+            javax.jcr.lock.Lock lock = getLockManager().lock(absPath, isDeep, isSessionScoped, 0L, session.getUserID());
 
             return new Lock(lock);
         } catch (LockException e) {
@@ -937,7 +940,7 @@ public class ObjectContentManagerImpl im
     public void unlock(final String absPath, final String lockToken) throws IllegalUnlockException {
         String lockOwner = null;
         try {
-            maybeAddLockToken(lockToken);
+            maybeAddLockToken(lockToken, absPath);
 
             Node node = getNode(absPath);
             if (node.isLocked() == false) {
@@ -945,10 +948,10 @@ public class ObjectContentManagerImpl im
                 return;
             }
 
-            javax.jcr.lock.Lock lock = node.getLock();
+            javax.jcr.lock.Lock lock = getLockManager().getLock(absPath);
             lockOwner = lock.getLockOwner();
 
-            node.unlock();
+            getLockManager().unlock(absPath);
         } catch (LockException e) {
             // LockException if this node does not currently hold a lock (see
             // upper code)
@@ -1000,7 +1003,7 @@ public class ObjectContentManagerImpl im
 
         // Node can hold nock or can be locked with precedencor
         if (node.isLocked()) {
-            javax.jcr.lock.Lock lock = node.getLock();
+            javax.jcr.lock.Lock lock = getLockManager().getLock(absPath);
             String lockOwner = lock.getLockOwner();
 
             if (!session.getUserID().equals(lockOwner)) {
@@ -1010,11 +1013,18 @@ public class ObjectContentManagerImpl im
         }
     }
 
-    protected void maybeAddLockToken(final String lockToken) {
+    protected void maybeAddLockToken(final String lockToken, final String path) {
         if (lockToken != null) {
             // This user (this instance of PM) potentionally placed lock so
             // session already has lock token
-            final String[] lockTokens = getSession().getLockTokens();
+            String[] lockTokens = null;
+            try {
+                lockTokens = getLockManager().getLockTokens();
+            } catch (UnsupportedRepositoryOperationException ex) {
+                throw new LockedException(session.getUserID(), path);
+            } catch (RepositoryException ex) {
+                throw new org.apache.jackrabbit.ocm.exception.RepositoryException(ex.getMessage(), ex);
+            }
             if (lockTokens != null) {
                 for (int i = 0; i < lockTokens.length; i++) {
                     if (lockTokens[i].equals(lockToken)) {
@@ -1023,7 +1033,13 @@ public class ObjectContentManagerImpl im
                     }
                 }
             } else {
-                getSession().addLockToken(lockToken);
+                try {
+                    getLockManager().addLockToken(lockToken);
+                } catch (UnsupportedRepositoryOperationException ex) {
+                    throw new LockedException(session.getUserID(), path);
+                } catch (RepositoryException ex) {
+                    throw new org.apache.jackrabbit.ocm.exception.RepositoryException(ex.getMessage(), ex);
+                }
             }
         }
     }
@@ -1164,4 +1180,13 @@ public class ObjectContentManagerImpl im
             throw new ObjectContentManagerException("Cannot copy the node from " + srcPath + " to " + destPath + ".", re);
         }
     }
+
+    private LockManager getLockManager() throws UnsupportedRepositoryOperationException, RepositoryException {
+        return session.getWorkspace().getLockManager();
+    }
+
+    private VersionManager getVersionManager() throws UnsupportedRepositoryOperationException, RepositoryException {
+        return session.getWorkspace().getVersionManager();
+    }
+
 }

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/ObjectConverterImpl.java Thu Sep 30 12:55:39 2010
@@ -276,7 +276,7 @@ public class ObjectConverterImpl impleme
 	public void update(Session session, String uuId, Object object) {
 		try {
 			ClassDescriptor classDescriptor = mapper.getClassDescriptorByClass(ReflectionUtils.getBeanClass(object));
-			Node objectNode = session.getNodeByUUID(uuId);
+			Node objectNode = session.getNodeByIdentifier(uuId);
 			update(session, objectNode, object);
 		} catch (PathNotFoundException pnfe) {
 			throw new ObjectContentManagerException("Impossible to update the object with UUID: " + uuId , pnfe);
@@ -341,7 +341,7 @@ public class ObjectConverterImpl impleme
         	if (currentItemUuid != null){
         		//The Node already exists so we need to update the existing node 
         		//rather than to replace it.
-        		return parentNode.getSession().getNodeByUUID(currentItemUuid);
+        		return parentNode.getSession().getNodeByIdentifier(currentItemUuid);
         	}
         	else{
         		throw new NullPointerException("Cannot locate the node to update since there is no UUID provided even though, " + classDescriptor.getClassName() + " has been mapped with a UUID field , " + uuidFieldName );
@@ -953,9 +953,9 @@ public class ObjectConverterImpl impleme
 		if (type.getName().equals("nt:versionedChild")) {
 
 			String uuid = node.getProperty("jcr:childVersionHistory").getValue().getString();
-			Node actualNode = session.getNodeByUUID(uuid);
+			Node actualNode = session.getNodeByIdentifier(uuid);
 			String name = actualNode.getName();
-			actualNode = session.getNodeByUUID(name);
+			actualNode = session.getNodeByIdentifier(name);
 
 			return actualNode;
 		}

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/SimpleFieldsHelper.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/SimpleFieldsHelper.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/SimpleFieldsHelper.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/manager/objectconverter/impl/SimpleFieldsHelper.java Thu Sep 30 12:55:39 2010
@@ -111,7 +111,7 @@ public class SimpleFieldsHelper
 							initializedBean = ReflectionUtils.newInstance(classDescriptor.getClassName());
 						}
 
-						ReflectionUtils.setNestedProperty(initializedBean, fieldName, node.getUUID());
+						ReflectionUtils.setNestedProperty(initializedBean, fieldName, node.getIdentifier());
 
 					} else {
 						initializedBean = retrieveSimpleField(classDescriptor, node, initializedBean, fieldDescriptor, fieldName, propertyName);
@@ -148,7 +148,7 @@ public class SimpleFieldsHelper
 			FieldDescriptor uuidField = classDescriptor.getUuidFieldDescriptor();
 			if (uuidField != null)
 			{
-				ReflectionUtils.setNestedProperty(initializedBean, uuidField.getFieldName(), node.getUUID());
+				ReflectionUtils.setNestedProperty(initializedBean, uuidField.getFieldName(), node.getIdentifier());
 			}
 			
 		} catch (ValueFormatException vfe) {

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NamespaceHelper.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NamespaceHelper.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NamespaceHelper.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NamespaceHelper.java Thu Sep 30 12:55:39 2010
@@ -18,7 +18,6 @@ package org.apache.jackrabbit.ocm.nodema
 
 import javax.jcr.NamespaceRegistry;
 
-import org.apache.jackrabbit.core.nodetype.ItemDef;
 
 import org.apache.jackrabbit.ocm.nodemanagement.impl.BaseNamespaceHelper;
 import org.apache.jackrabbit.spi.Name;
@@ -54,7 +53,8 @@ public class NamespaceHelper extends Bas
         {
             if (itemName.equals("*"))
             {
-                name = ItemDef.ANY_NAME;
+                //name = ItemDef.ANY_NAME;
+                NameFactoryImpl.getInstance().create(DEFAULT_NAMESPACE_URI, "*");
             }
             else
             {

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java Thu Sep 30 12:55:39 2010
@@ -18,6 +18,7 @@ package org.apache.jackrabbit.ocm.nodema
 
 import java.io.InputStream;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
@@ -25,18 +26,14 @@ import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.Workspace;
+import javax.jcr.nodetype.NodeTypeDefinition;
 import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.version.OnParentVersionAction;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException;
-import org.apache.jackrabbit.core.nodetype.NodeDef;
-import org.apache.jackrabbit.core.nodetype.NodeDefImpl;
-import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
-import org.apache.jackrabbit.core.nodetype.PropDef;
-import org.apache.jackrabbit.core.nodetype.PropDefImpl;
 import org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader;
 import org.apache.jackrabbit.ocm.mapper.model.BeanDescriptor;
 import org.apache.jackrabbit.ocm.mapper.model.ChildNodeDefDescriptor;
@@ -51,6 +48,14 @@ import org.apache.jackrabbit.ocm.nodeman
 import org.apache.jackrabbit.ocm.nodemanagement.exception.NodeTypeRemovalException;
 import org.apache.jackrabbit.ocm.nodemanagement.exception.OperationNotSupportedException;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.QNodeDefinition;
+import org.apache.jackrabbit.spi.QNodeTypeDefinition;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
+import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.QValueConstraint;
+import org.apache.jackrabbit.spi.commons.nodetype.QNodeDefinitionBuilder;
+import org.apache.jackrabbit.spi.commons.nodetype.QNodeTypeDefinitionBuilder;
+import org.apache.jackrabbit.spi.commons.nodetype.QPropertyDefinitionBuilder;
 
 /** This is the NodeTypeManager implementation for Apache Jackrabbit.
  *
@@ -62,6 +67,7 @@ public class NodeTypeManagerImpl impleme
      * Logging.
      */
     private static Log log = LogFactory.getLog(NodeTypeManagerImpl.class);
+    private static final boolean debug = false;
 
     /** Namespace helper class for Jackrabbit.
      */
@@ -160,12 +166,11 @@ public class NodeTypeManagerImpl impleme
             if (checkSuperTypes(session.getWorkspace().getNodeTypeManager(),
                     classDescriptor.getJcrSuperTypes()))
             {
-                NodeTypeDef nodeTypeDef = getNodeTypeDef(classDescriptor.getJcrType(),
-                        classDescriptor.getJcrSuperTypes(),
-                        classDescriptor.getClassName());
+                Name nodeTypeName = getNodeTypeName(classDescriptor.getJcrType(),
+			classDescriptor.getClassName());
 
-                List propDefs = new ArrayList();
-                List nodeDefs = new ArrayList();
+                List<QPropertyDefinition> propDefs = new ArrayList<QPropertyDefinition>();
+                List<QNodeDefinition> nodeDefs = new ArrayList<QNodeDefinition>();
                 if (classDescriptor.getFieldDescriptors() != null)
                 {
                     Iterator fieldIterator = classDescriptor.getFieldDescriptors().iterator();
@@ -173,7 +178,7 @@ public class NodeTypeManagerImpl impleme
                     {
                         FieldDescriptor field = (FieldDescriptor) fieldIterator.next();
                         if (!field.isPath()) {
-                            propDefs.add(getPropertyDefinition(field.getFieldName(), field, nodeTypeDef.getName()));
+                            propDefs.add(getPropertyDefinition(field.getFieldName(), field, nodeTypeName));
                         }
                     }
                 }
@@ -183,9 +188,9 @@ public class NodeTypeManagerImpl impleme
                     while (beanIterator.hasNext()) {
                         BeanDescriptor field = (BeanDescriptor) beanIterator.next();
                         if (this.isPropertyType(field.getJcrType())) {
-                            propDefs.add(getPropertyDefinition(field.getFieldName(), field, nodeTypeDef.getName()));
+                            propDefs.add(getPropertyDefinition(field.getFieldName(), field, nodeTypeName));
                         } else {
-                            nodeDefs.add(getNodeDefinition(field.getFieldName(), field, nodeTypeDef.getName()));
+                            nodeDefs.add(getNodeDefinition(field.getFieldName(), field, nodeTypeName));
                         }
                     }
                 }
@@ -195,15 +200,24 @@ public class NodeTypeManagerImpl impleme
                     while (collectionIterator.hasNext()) {
                         CollectionDescriptor field = (CollectionDescriptor) collectionIterator.next();
                         if (this.isPropertyType(field.getJcrType())) {
-                            propDefs.add(getPropertyDefinition(field.getFieldName(), field, nodeTypeDef.getName()));
+                            propDefs.add(getPropertyDefinition(field.getFieldName(), field, nodeTypeName));
                         } else {
-                            nodeDefs.add(getNodeDefinition(field.getFieldName(), field, nodeTypeDef.getName()));
+                            nodeDefs.add(getNodeDefinition(field.getFieldName(), field, nodeTypeName));
                         }
                     }
                 }
 
-                nodeTypeDef.setPropertyDefs((PropDef[]) propDefs.toArray(new PropDef[propDefs.size()]));
-                nodeTypeDef.setChildNodeDefs((NodeDef[]) nodeDefs.toArray(new NodeDef[nodeDefs.size()]));
+                 QNodeTypeDefinition nodeTypeDef = getNodeTypeDef(
+                         classDescriptor.getJcrType(),
+                         classDescriptor.getJcrSuperTypes(),
+                         classDescriptor.getClassName(),
+                         nodeTypeName,
+                         propDefs,
+                         nodeDefs,
+                         classDescriptor.getJcrMixinTypes(),
+                         classDescriptor.isAbstract(),
+                         //TODO:is this correkt, how to decide whether mixin or not?
+                         classDescriptor.isInterface());
 
                 list.add(nodeTypeDef);
                 createNodeTypesFromList(session, list);
@@ -255,30 +269,43 @@ public class NodeTypeManagerImpl impleme
         return exists;
     }
 
+        private Name getNodeTypeName(String jcrNodeType,String className) {
+                Name name = null;
+
+                if (jcrNodeType != null && (!jcrNodeType.equals(""))) {
+                        name = getNamespaceHelper().getName(jcrNodeType);
+
+                } else {
+                        name = getNamespaceHelper().getName(className);
+
+                }
+                return name;
+        }
+
     /** Creates a NodeTypeDef object.
      *
      * @param jcrNodeType Name of JCR node type
      * @param jcrSuperTypes JCR node super types
      * @return type
      */
-    public NodeTypeDef getNodeTypeDef(String jcrNodeType, String jcrSuperTypes,
-            String className)
-    {
-        NodeTypeDef type = new NodeTypeDef();
-        type.setMixin(false);
-
-        if (jcrNodeType != null && (! jcrNodeType.equals("")))
-        {
-            type.setName(getNamespaceHelper().getName(jcrNodeType));
-        }
-        else
-        {
-            type.setName(getNamespaceHelper().getName(className));
-        }
+    public QNodeTypeDefinition getNodeTypeDef(String jcrNodeType, String jcrSuperTypes, String className,
+            Name jcrNodeTypeName, List<QPropertyDefinition> propDefs, List<QNodeDefinition> nodeDefs,
+            String[] jcrMixinTypes, boolean isAbstract, boolean isMixin)
+    {
+        QNodeTypeDefinitionBuilder ntdb = new QNodeTypeDefinitionBuilder();
+        ntdb.setAbstract(isAbstract);
+        ntdb.setChildNodeDefs(nodeDefs.toArray(QNodeDefinition.EMPTY_ARRAY));
+        //ntdb.setMixin(classDescriptor.isAbstract());
+        ntdb.setMixin(isMixin);
+        ntdb.setName(jcrNodeTypeName);
+        ntdb.setOrderableChildNodes(false);
+        //ntdb.setPrimaryItemName(primaryItemName);
+        ntdb.setPropertyDefs(propDefs.toArray(QPropertyDefinition.EMPTY_ARRAY));
+        ntdb.setQueryable(true);
+        ntdb.setSupertypes( getJcrSuperTypes(jcrSuperTypes) );
+        ntdb.setSupportedMixinTypes( getJcrMixinTypes(jcrMixinTypes) );
 
-        type.setSupertypes(getJcrSuperTypes(jcrSuperTypes));
-        type.setPrimaryItemName(getNamespaceHelper().getName(jcrNodeType));
-        return type;
+        return ntdb.build();
     }
 
     /** Creates a PropDefImpl object.
@@ -288,45 +315,57 @@ public class NodeTypeManagerImpl impleme
      * @param declaringNodeType Node Type QName where the property belongs to
      * @return property
      */
-    public PropDefImpl getPropertyDefinition(String fieldName,
+    public QPropertyDefinition getPropertyDefinition(String fieldName,
             PropertyDefDescriptor field, Name declaringNodeType)
     {
-        PropDefImpl property = new PropDefImpl();
+            Name name = null;
 
         if (field.getJcrName() != null)
         {
-            property.setName(getNamespaceHelper().getName(field.getJcrName()));
-        	
+            name = getNamespaceHelper().getName(field.getJcrName());
         }
         else
         {
-            property.setName(getNamespaceHelper().getName(fieldName));
+            name = getNamespaceHelper().getName(fieldName);
         }
 
+        int requiredType = PropertyType.UNDEFINED;
+
         if (field.getJcrType() != null)
         {
-            property.setRequiredType(PropertyType.valueFromName(field.getJcrType()));
+            requiredType = PropertyType.valueFromName(field.getJcrType());
         }
         else
         {
-            log.info("No property type set for " + property.getName() +
+            log.info("No property type set for " + name.getLocalName() +
                     ". Setting 'String' type.");
-            property.setRequiredType(PropertyType.valueFromName("String"));
+            requiredType = PropertyType.STRING;
         }
 
-        property.setDeclaringNodeType(declaringNodeType);
-        property.setAutoCreated(field.isJcrAutoCreated());
-        property.setMandatory(field.isJcrMandatory());
-        property.setMultiple(field.isJcrMultiple());
+        int onParentVersion = OnParentVersionAction.IGNORE;
 
         if (field.getJcrOnParentVersion() != null &&
                 field.getJcrOnParentVersion().length() > 0)
         {
-            property.setOnParentVersion(OnParentVersionAction.valueFromName(field.getJcrOnParentVersion()));
+            onParentVersion = OnParentVersionAction.valueFromName(field.getJcrOnParentVersion());
         }
 
-        property.setProtected(field.isJcrProtected());
-        return property;
+        QPropertyDefinitionBuilder pdb = new QPropertyDefinitionBuilder();
+        pdb.setAutoCreated(field.isJcrAutoCreated());
+        pdb.setAvailableQueryOperators(new String[0]);
+        pdb.setDeclaringNodeType(declaringNodeType);
+        pdb.setDefaultValues(QValue.EMPTY_ARRAY);
+        pdb.setFullTextSearchable(false);
+        pdb.setMandatory(field.isJcrMandatory());
+        pdb.setMultiple(field.isJcrMultiple());
+        pdb.setName(name);
+        pdb.setOnParentVersion(onParentVersion);
+        pdb.setProtected(field.isJcrProtected());
+        pdb.setQueryOrderable(false);
+        pdb.setRequiredType(requiredType);
+        pdb.setValueConstraints(QValueConstraint.EMPTY_ARRAY);
+
+        return pdb.build();
     }
 
     /** Creates a NodeDefImpl object.
@@ -336,34 +375,36 @@ public class NodeTypeManagerImpl impleme
      * @param declaringNodeType Node Type QName where the chid node belongs to
      * @return child node definition
      */
-    private NodeDefImpl getNodeDefinition(String fieldName,
+    private QNodeDefinition getNodeDefinition(String fieldName,
         ChildNodeDefDescriptor field, Name declaringNodeType) {
 
-        NodeDefImpl node = new NodeDefImpl();
+            Name name = null;
 
         if (field.getJcrName() != null) {
-            node.setName(getNamespaceHelper().getName(field.getJcrName()));
+            name = getNamespaceHelper().getName(field.getJcrName());
         } else {
-            node.setName(getNamespaceHelper().getName("*"));
-        }
-
-        if (field.getJcrType() != null) {
-            node.setRequiredPrimaryTypes(getJcrSuperTypes(field.getJcrType()));
+            name = getNamespaceHelper().getName("*");
         }
 
-        node.setDeclaringNodeType(declaringNodeType);
-        node.setAutoCreated(field.isJcrAutoCreated());
-        node.setMandatory(field.isJcrMandatory());
-        node.setAllowsSameNameSiblings(field.isJcrSameNameSiblings());
-        node.setDefaultPrimaryType( getNamespaceHelper().getName( field.getDefaultPrimaryType() ) );
+        int onParentVersion = OnParentVersionAction.IGNORE;
 
         if (field.getJcrOnParentVersion() != null
             && field.getJcrOnParentVersion().length() > 0) {
-            node.setOnParentVersion(OnParentVersionAction.valueFromName(field.getJcrOnParentVersion()));
+            onParentVersion = OnParentVersionAction.valueFromName(field.getJcrOnParentVersion());
         }
 
-        node.setProtected(field.isJcrProtected());
-        return node;
+        QNodeDefinitionBuilder ndb = new QNodeDefinitionBuilder();
+        ndb.setAllowsSameNameSiblings(field.isJcrSameNameSiblings());
+        ndb.setAutoCreated(field.isJcrAutoCreated());
+        ndb.setDeclaringNodeType(declaringNodeType);
+        ndb.setDefaultPrimaryType(getNamespaceHelper().getName(field.getDefaultPrimaryType()));
+        ndb.setMandatory(field.isJcrMandatory());
+        ndb.setName(name);
+        ndb.setOnParentVersion(onParentVersion);
+        ndb.setProtected(field.isJcrProtected());
+        ndb.setRequiredPrimaryTypes(getJcrSuperTypes(field.getJcrType()));
+
+        return ndb.build();
     }
 
     /**
@@ -390,21 +431,32 @@ public class NodeTypeManagerImpl impleme
      */
     public Name[] getJcrSuperTypes(String superTypes)
     {
-    	Name[] nameSuperTypes = null;
-        if (superTypes != null && superTypes.length() > 0)
+        return getNames(superTypes.split(","), "super type");
+    }
+
+
+    public Name[] getJcrMixinTypes(String[] jcrMixinTypes)
+    {
+    	return getNames(jcrMixinTypes, "mixin type");
+    }
+
+
+    private Name[] getNames(String[] jcrTypeNames, String logTypeKind)
+    {
+    	Name[] names = null;
+        if (jcrTypeNames != null && jcrTypeNames.length > 0)
         {
-            String[] superTypesArray = superTypes.split(",");
-            log.debug("JCR super types found: " + superTypesArray.length);
-            nameSuperTypes = new Name[superTypesArray.length];
-            for (int i = 0; i < superTypesArray.length; i++)
+            log.debug("JCR " + logTypeKind + "'s types found: " + jcrTypeNames.length);
+            names = new Name[jcrTypeNames.length];
+            for (int i = 0; i < jcrTypeNames.length; i++)
             {
-                String superTypeName = superTypesArray[i].trim();
-                nameSuperTypes[i] = getNamespaceHelper().getName(superTypeName);
-                log.debug("Setting JCR super type: " + superTypeName);
+                String superTypeName = jcrTypeNames[i].trim();
+                names[i] = getNamespaceHelper().getName(superTypeName);
+                log.debug("Setting JCR " + logTypeKind +  ": " + superTypeName);
             }
         }
 
-        return nameSuperTypes;
+        return names;
     }
 
     /**
@@ -434,7 +486,7 @@ public class NodeTypeManagerImpl impleme
     {
         try
         {
-            NodeTypeDef[] types = NodeTypeReader.read(jcrRepositoryConfigurationFile);
+            QNodeTypeDefinition[] types = NodeTypeReader.read(jcrRepositoryConfigurationFile);
 
             ArrayList list = new ArrayList();
             for (int i = 0; i < types.length; i++)
@@ -473,13 +525,10 @@ public class NodeTypeManagerImpl impleme
     {
     	try
         {
-            NodeTypeDef[] types = NodeTypeReader.read(jcrRepositoryConfigurationFile);
+            QNodeTypeDefinition[] types = NodeTypeReader.read(jcrRepositoryConfigurationFile);
 
             ArrayList list = new ArrayList();
-            for (int i = 0; i < types.length; i++)
-            {
-                list.add(types[i]);
-            }
+            list.addAll(Arrays.asList(types));
 
             removeNodeTypesFromList(session, list);
             log.info("Registered " + list.size() + " nodetypes from xml configuration file.");
@@ -496,11 +545,11 @@ public class NodeTypeManagerImpl impleme
     {
         for (Iterator nodeTypeIterator = nodeTypes.iterator(); nodeTypeIterator.hasNext();)
         {
-			NodeTypeDef nodeTypeDef = (NodeTypeDef) nodeTypeIterator.next();
+			NodeTypeDefinition nodeTypeDef = (NodeTypeDefinition) nodeTypeIterator.next();
 			this.removeSingleNodeType(session, nodeTypeDef.getName());
-			
+
 		}
-    	
+
     }
 
     /**
@@ -600,6 +649,9 @@ public class NodeTypeManagerImpl impleme
     	        type.equals(PropertyType.TYPENAME_NAME) ||
     	        type.equals(PropertyType.TYPENAME_PATH) ||
     	        type.equals(PropertyType.TYPENAME_REFERENCE) ||
-    	        type.equals(PropertyType.TYPENAME_STRING));    	
+    	        type.equals(PropertyType.TYPENAME_WEAKREFERENCE) ||
+    	        type.equals(PropertyType.TYPENAME_DECIMAL) ||
+    	        type.equals(PropertyType.TYPENAME_URI) ||
+    	        type.equals(PropertyType.TYPENAME_STRING));
     }
 }

Modified: jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/version/Version.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/version/Version.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/version/Version.java (original)
+++ jackrabbit/commons/ocm/trunk/src/main/java/org/apache/jackrabbit/ocm/version/Version.java Thu Sep 30 12:55:39 2010
@@ -55,7 +55,7 @@ public class Version
 	{
 		try
 		{
-			return version.getUUID();
+			return version.getIdentifier();
 		}
 		catch (RepositoryException e)
 		{

Modified: jackrabbit/commons/ocm/trunk/src/test/java/org/apache/jackrabbit/ocm/AbstractTestBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/ocm/trunk/src/test/java/org/apache/jackrabbit/ocm/AbstractTestBase.java?rev=1003049&r1=1003048&r2=1003049&view=diff
==============================================================================
--- jackrabbit/commons/ocm/trunk/src/test/java/org/apache/jackrabbit/ocm/AbstractTestBase.java (original)
+++ jackrabbit/commons/ocm/trunk/src/test/java/org/apache/jackrabbit/ocm/AbstractTestBase.java Thu Sep 30 12:55:39 2010
@@ -33,6 +33,7 @@ import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.Workspace;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.nodetype.NodeTypeDefinition;
 import javax.jcr.nodetype.NodeTypeManager;
 
 import junit.framework.TestCase;
@@ -40,7 +41,6 @@ import junit.framework.TestCase;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException;
-import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
 import org.apache.jackrabbit.core.nodetype.NodeTypeManagerImpl;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.nodetype.xml.NodeTypeReader;
@@ -50,6 +50,7 @@ import org.apache.jackrabbit.ocm.mapper.
 import org.apache.jackrabbit.ocm.query.QueryManager;
 import org.apache.jackrabbit.ocm.reflection.ReflectionUtils;
 import org.apache.jackrabbit.ocm.repository.RepositoryUtil;
+import org.apache.jackrabbit.spi.QNodeTypeDefinition;
 import org.xml.sax.ContentHandler;
 
 /**
@@ -151,14 +152,14 @@ public abstract class AbstractTestBase e
                 "./src/test/test-config/nodetypes/custom_nodetypes.xml");
 
         // HINT: throws InvalidNodeTypeDefException, IOException
-        NodeTypeDef[] types = NodeTypeReader.read(xml);
+        QNodeTypeDefinition[] types = NodeTypeReader.read(xml);
 
         Workspace workspace = session.getWorkspace();
         NodeTypeManager ntMgr = workspace.getNodeTypeManager();
         NodeTypeRegistry ntReg = ((NodeTypeManagerImpl) ntMgr).getNodeTypeRegistry();
 
         for (int j = 0; j < types.length; j++) {
-            NodeTypeDef def = types[j];
+            QNodeTypeDefinition def = types[j];
 
             try {
                 ntReg.getNodeTypeDef(def.getName());



Mime
View raw message