jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clomb...@apache.org
Subject svn commit: r599132 - in /jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement: ./ src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/
Date Wed, 28 Nov 2007 20:21:26 GMT
Author: clombart
Date: Wed Nov 28 12:21:26 2007
New Revision: 599132

URL: http://svn.apache.org/viewvc?rev=599132&view=rev
Log:
Refactor the code and add new dependencies (spi) in order to support the Jackrabbit 1.4. 
Qname has been replaced by Name.

Modified:
    jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/pom.xml
    jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NamespaceHelper.java
    jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java

Modified: jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/pom.xml?rev=599132&r1=599131&r2=599132&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/pom.xml (original)
+++ jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/pom.xml Wed Nov 28 12:21:26
2007
@@ -26,11 +26,11 @@
 	<!-- ====================================================================== -->
 	<!-- P R O J E C T  D E S C R I P T I O N                                   -->
 	<!-- ====================================================================== -->
-    <parent>
-      <groupId>org.apache.jackrabbit</groupId>
-      <artifactId>jackrabbit</artifactId>
-      <version>1.4-SNAPSHOT</version>
-    </parent>
+	<parent>
+		<groupId>org.apache.jackrabbit</groupId>
+		<artifactId>jackrabbit</artifactId>
+		<version>1.4-SNAPSHOT</version>
+	</parent>
 	<artifactId>jackrabbit-ocm-nodemanagement</artifactId>
 	<packaging>jar</packaging>
 	<name>Jackrabbit OCM Node management</name>
@@ -65,15 +65,27 @@
 			<version>1.4-SNAPSHOT</version>
 		</dependency>
 		<dependency>
+			<groupId>org.apache.jackrabbit</groupId>
+			<artifactId>jackrabbit-jcr-commons</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.jackrabbit</groupId>
+			<artifactId>jackrabbit-spi-commons</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.jackrabbit</groupId>
+			<artifactId>jackrabbit-spi</artifactId>
+		</dependency>
+		<dependency>
 			<groupId>org.apache.lucene</groupId>
 			<artifactId>lucene-core</artifactId>
 			<version>2.2.0</version>
 		</dependency>
-		 <dependency>
-		      <groupId>org.slf4j</groupId>
-		      <artifactId>slf4j-api</artifactId>
-	    </dependency>
-	    
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+		</dependency>
+
 		<!-- Test -->
 		<dependency>
 			<groupId>xerces</groupId>
@@ -100,11 +112,11 @@
 			<scope>test</scope>
 		</dependency>
 		<dependency>
-    	  <groupId>org.slf4j</groupId>
-	      <artifactId>slf4j-log4j12</artifactId>	      
-	      <scope>test</scope>
-	    </dependency>	
-		
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-log4j12</artifactId>
+			<scope>test</scope>
+		</dependency>
+
 	</dependencies>
 	<build>
 		<plugins>
@@ -128,7 +140,7 @@
 						</goals>
 					</execution>
 				</executions>
-			</plugin>			
+			</plugin>
 		</plugins>
 	</build>
 </project>

Modified: jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NamespaceHelper.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NamespaceHelper.java?rev=599132&r1=599131&r2=599132&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NamespaceHelper.java
(original)
+++ jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NamespaceHelper.java
Wed Nov 28 12:21:26 2007
@@ -19,8 +19,9 @@
 import javax.jcr.NamespaceRegistry;
 
 import org.apache.jackrabbit.core.nodetype.ItemDef;
-import org.apache.jackrabbit.name.QName;
+import org.apache.jackrabbit.name.NameFactoryImpl;
 import org.apache.jackrabbit.ocm.nodemanagement.impl.BaseNamespaceHelper;
+import org.apache.jackrabbit.spi.Name;
 
 
 /** Jackrabbit namespace helper class.
@@ -44,33 +45,32 @@
      * @param nodeName JCR item name
      * @return qName
      */
-    public QName getQName(String itemName)
+    public Name getName(String itemName)
     {
-        QName qName = null;
+        Name name = null;
         
         if (itemName != null && itemName.length() > 0)
         {
             if (itemName.equals("*"))
             {
-                qName = ItemDef.ANY_NAME;
+                name = ItemDef.ANY_NAME;
             }
             else
             {
                 String[] parts = itemName.split(":");
                 if (parts.length == 2)
-                {
-                    qName = new QName(getNamespaceUri(parts[0]),
-                            parts[1]);
+                {                    
+                    name = NameFactoryImpl.getInstance().create(getNamespaceUri(parts[0]),parts[1]);
                 }
                 else if (parts.length == 1) 
                 {
-                    // no namespace set, use default  namespace
-                    qName = new QName(DEFAULT_NAMESPACE_URI, parts[0]);
+                    // no namespace set, use default  namespace                	
+                	name = NameFactoryImpl.getInstance().create(DEFAULT_NAMESPACE_URI, parts[0]);
                 }
             }
         }
         
-        return qName;
+        return name;
     }
 
     /** Returns the namespace URI from a given namespace prefix.

Modified: jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java?rev=599132&r1=599131&r2=599132&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-jcr-mapping/jcr-nodemanagement/src/main/java/org/apache/jackrabbit/ocm/nodemanagement/impl/jackrabbit/NodeTypeManagerImpl.java
Wed Nov 28 12:21:26 2007
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.ocm.nodemanagement.impl.jackrabbit;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -39,7 +38,6 @@
 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.name.QName;
 import org.apache.jackrabbit.ocm.mapper.model.BeanDescriptor;
 import org.apache.jackrabbit.ocm.mapper.model.ChildNodeDefDescriptor;
 import org.apache.jackrabbit.ocm.mapper.model.ClassDescriptor;
@@ -52,6 +50,7 @@
 import org.apache.jackrabbit.ocm.nodemanagement.exception.NodeTypeCreationException;
 import org.apache.jackrabbit.ocm.nodemanagement.exception.NodeTypeRemovalException;
 import org.apache.jackrabbit.ocm.nodemanagement.exception.OperationNotSupportedException;
+import org.apache.jackrabbit.spi.Name;
 
 /** This is the NodeTypeManager implementation for Apache Jackrabbit.
  *
@@ -271,15 +270,15 @@
         
         if (jcrNodeType != null && (! jcrNodeType.equals("")))
         {
-            type.setName(getNamespaceHelper().getQName(jcrNodeType));
+            type.setName(getNamespaceHelper().getName(jcrNodeType));
         }
         else
         {
-            type.setName(getNamespaceHelper().getQName(className));
+            type.setName(getNamespaceHelper().getName(className));
         }
         
         type.setSupertypes(getJcrSuperTypes(jcrSuperTypes));
-        type.setPrimaryItemName(getNamespaceHelper().getQName(jcrNodeType));
+        type.setPrimaryItemName(getNamespaceHelper().getName(jcrNodeType));
         return type;
     }
     
@@ -291,17 +290,18 @@
      * @return property
      */
     public PropDefImpl getPropertyDefinition(String fieldName,
-            PropertyDefDescriptor field, QName declaringNodeType)
+            PropertyDefDescriptor field, Name declaringNodeType)
     {
         PropDefImpl property = new PropDefImpl();
         
         if (field.getJcrName() != null)
         {
-            property.setName(getNamespaceHelper().getQName(field.getJcrName()));
+            property.setName(getNamespaceHelper().getName(field.getJcrName()));
+        	
         }
         else
         {
-            property.setName(getNamespaceHelper().getQName(fieldName));
+            property.setName(getNamespaceHelper().getName(fieldName));
         }
         
         if (field.getJcrType() != null)
@@ -338,14 +338,14 @@
      * @return child node definition
      */
     private NodeDefImpl getNodeDefinition(String fieldName,
-        ChildNodeDefDescriptor field, QName declaringNodeType) {
+        ChildNodeDefDescriptor field, Name declaringNodeType) {
         
         NodeDefImpl node = new NodeDefImpl();
 
         if (field.getJcrName() != null) {
-            node.setName(getNamespaceHelper().getQName(field.getJcrName()));
+            node.setName(getNamespaceHelper().getName(field.getJcrName()));
         } else {
-            node.setName(getNamespaceHelper().getQName("*"));
+            node.setName(getNamespaceHelper().getName("*"));
         }
 
         if (field.getJcrType() != null) {
@@ -356,7 +356,7 @@
         node.setAutoCreated(field.isJcrAutoCreated());
         node.setMandatory(field.isJcrMandatory());
         node.setAllowsSameNameSiblings(field.isJcrSameNameSiblings());
-        node.setDefaultPrimaryType( getNamespaceHelper().getQName( field.getDefaultPrimaryType()
) );
+        node.setDefaultPrimaryType( getNamespaceHelper().getName( field.getDefaultPrimaryType()
) );
         
         if (field.getJcrOnParentVersion() != null
             && field.getJcrOnParentVersion().length() > 0) {
@@ -389,23 +389,23 @@
      * @param superTypes JCR super types 
      * @return qNameSuperTypes
      */
-    public QName[] getJcrSuperTypes(String superTypes)
+    public Name[] getJcrSuperTypes(String superTypes)
     {
-        QName[] qNameSuperTypes = null;
+    	Name[] nameSuperTypes = null;
         if (superTypes != null && superTypes.length() > 0)
         {
             String[] superTypesArray = superTypes.split(",");
             log.debug("JCR super types found: " + superTypesArray.length);
-            qNameSuperTypes = new QName[superTypesArray.length];
+            nameSuperTypes = new Name[superTypesArray.length];
             for (int i = 0; i < superTypesArray.length; i++)
             {
                 String superTypeName = superTypesArray[i].trim();
-                qNameSuperTypes[i] = getNamespaceHelper().getQName(superTypeName);
+                nameSuperTypes[i] = getNamespaceHelper().getName(superTypeName);
                 log.debug("Setting JCR super type: " + superTypeName);
             }
         }
 
-        return qNameSuperTypes;
+        return nameSuperTypes;
     }
 
     /**
@@ -512,12 +512,12 @@
     {
     }
     
-    public void removeSingleNodeType(Session session, QName qName)
+    public void removeSingleNodeType(Session session, Name name)
     throws NodeTypeRemovalException
     {
         try
         {
-            getNodeTypeRegistry(session).unregisterNodeType(qName);
+            getNodeTypeRegistry(session).unregisterNodeType(name);
         }
         catch (Exception e)
         {
@@ -533,7 +533,7 @@
     {
         try
         {
-            getNodeTypeRegistry(session).unregisterNodeType(getNamespaceHelper().getQName(jcrNodeType));
+            getNodeTypeRegistry(session).unregisterNodeType(getNamespaceHelper().getName(jcrNodeType));
         }
         catch (Exception e)
         {



Mime
View raw message