jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1136375 - in /jackrabbit/sandbox/spi2microkernel/src: main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
Date Thu, 16 Jun 2011 11:04:24 GMT
Author: mduerig
Date: Thu Jun 16 11:04:24 2011
New Revision: 1136375

URL: http://svn.apache.org/viewvc?rev=1136375&view=rev
Log:
spi2microkernel prototype (WIP)
node type registry

Modified:
    jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
    jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java

Modified: jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java?rev=1136375&r1=1136374&r2=1136375&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/main/java/org/apache/jackrabbit/spi2microkernel/RepositoryServiceImpl.java
Thu Jun 16 11:04:24 2011
@@ -34,6 +34,7 @@ import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.PropertyId;
 import org.apache.jackrabbit.spi.PropertyInfo;
 import org.apache.jackrabbit.spi.QNodeDefinition;
+import org.apache.jackrabbit.spi.QNodeTypeDefinition;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.SessionInfo;
 import org.apache.jackrabbit.spi.commons.AbstractRepositoryService;
@@ -301,6 +302,20 @@ public class RepositoryServiceImpl exten
         deleteWorkspace(rev, name);
     }
 
+    //------------------------------------------< Node type management >---
+
+    @Override
+    public void registerNodeTypes(SessionInfo sessionInfo, QNodeTypeDefinition[] nodeTypeDefinitions,
boolean allowUpdate)
+            throws RepositoryException {
+
+        nodeTypeDefs.registerNodeTypes(nodeTypeDefinitions, true);
+    }
+
+    @Override
+    public void unregisterNodeTypes(SessionInfo sessionInfo, Name[] nodeTypeNames) throws
RepositoryException {
+        nodeTypeDefs.unregisterNodeTypes(nodeTypeNames);
+    }
+
     //------------------------------------------< private >---
 
     private static ChangeLog changeLog(Batch batch) throws RepositoryException {

Modified: jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java?rev=1136375&r1=1136374&r2=1136375&view=diff
==============================================================================
--- jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
(original)
+++ jackrabbit/sandbox/spi2microkernel/src/test/java/org/apache/jackrabbit/spi2microkernel/RepositoryTest.java
Thu Jun 16 11:04:24 2011
@@ -41,6 +41,8 @@ import javax.jcr.RepositoryFactory;
 import javax.jcr.Session;
 import javax.jcr.Value;
 import javax.jcr.nodetype.NodeType;
+import javax.jcr.nodetype.NodeTypeManager;
+import javax.jcr.nodetype.NodeTypeTemplate;
 import java.io.ByteArrayInputStream;
 import java.io.InputStream;
 import java.math.BigDecimal;
@@ -755,6 +757,20 @@ public class RepositoryTest {
         }
     }
 
+    @Test
+    public void nodeTypeRegistry() throws RepositoryException {
+        NodeTypeManager ntMgr = getSession().getWorkspace().getNodeTypeManager();
+        assertFalse(ntMgr.hasNodeType("foo"));
+
+        NodeTypeTemplate ntd = ntMgr.createNodeTypeTemplate();
+        ntd.setName("foo");
+        ntMgr.registerNodeType(ntd, false);
+        assertTrue(ntMgr.hasNodeType("foo"));
+
+        ntMgr.unregisterNodeType("foo");
+        assertFalse(ntMgr.hasNodeType("foo"));
+    }
+
     //------------------------------------------< private >---
 
     private void addProperty(Node parentNode, String name, Value value) throws RepositoryException
{



Mime
View raw message