jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1164759 - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: hierarchy/ nodetype/ util/ version/
Date Fri, 02 Sep 2011 23:15:26 GMT
Author: mduerig
Date: Fri Sep  2 23:15:25 2011
New Revision: 1164759

URL: http://svn.apache.org/viewvc?rev=1164759&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP)
clean up

Added:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/Unsafe.java
Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeCache.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java?rev=1164759&r1=1164758&r2=1164759&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
Fri Sep  2 23:15:25 2011
@@ -16,9 +16,7 @@
  */
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
-import com.sun.org.apache.bcel.internal.classfile.Unknown;
 import org.apache.commons.collections.iterators.IteratorChain;
-import org.apache.jackrabbit.commons.iterator.RangeIteratorAdapter;
 import org.apache.jackrabbit.jcr2spi.operation.AddNode;
 import org.apache.jackrabbit.jcr2spi.operation.AddProperty;
 import org.apache.jackrabbit.jcr2spi.operation.Move;
@@ -64,6 +62,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+import static org.apache.jackrabbit.jcr2spi.util.Unsafe.cast;
+
 /**
  * <code>NodeEntryImpl</code> implements common functionality for child
  * node entry implementations.
@@ -591,7 +591,7 @@ public class NodeEntryImpl extends Hiera
                 entries.add(entry);
             }
         }
-        return new RangeIteratorAdapter(Collections.unmodifiableCollection(entries));
+        return entries.iterator();
     }
 
     @Override
@@ -694,7 +694,7 @@ public class NodeEntryImpl extends Hiera
             // no need to filter out properties, there are no removed properties
             props = properties.getPropertyEntries();
         }
-        return new RangeIteratorAdapter(Collections.unmodifiableCollection(props));
+        return props.iterator();
     }
 
     @Override
@@ -1253,7 +1253,7 @@ public class NodeEntryImpl extends Hiera
         synchronized (childNodeEntries) {
             chain.addIterator(childNodeEntries.iterator());
         }
-        return chain;
+        return cast(chain);
     }
 
     /**

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java?rev=1164759&r1=1164758&r2=1164759&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/UniqueIdResolver.java
Fri Sep  2 23:15:25 2011
@@ -31,6 +31,8 @@ import javax.jcr.RepositoryException;
 import javax.jcr.ItemNotFoundException;
 import java.util.Map;
 
+import static org.apache.jackrabbit.jcr2spi.util.Unsafe.cast;
+
 /**
  * <code>UniqueIdResolver</code> allows to retrieve <code>NodeEntry</code>
instances
  * that are identified by a uniqueID.
@@ -49,7 +51,7 @@ public class UniqueIdResolver implements
      * Creates a new <code>UniqueIdResolver</code>.
      */
     public UniqueIdResolver(ItemStateFactory isf) {
-        lookUp = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT);
+        lookUp = cast(new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT));
         this.isf = isf;
         isf.addCreationListener(this);
     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeCache.java?rev=1164759&r1=1164758&r2=1164759&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeCache.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeCache.java
Fri Sep  2 23:15:25 2011
@@ -31,6 +31,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.ArrayList;
 
+import static org.apache.jackrabbit.jcr2spi.util.Unsafe.cast;
+
 /**
  * <code>NodeTypeCache</code> implements a cache for <code>QNodeTypeDefinition</code>s
  * on a userId basis.
@@ -64,7 +66,7 @@ public final class NodeTypeCache {
             caches = CACHES_PER_SERVICE.get(service);
             if (caches == null) {
                 // use soft references for the node type caches
-                caches = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT);
+                caches = cast(new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT));
                 CACHES_PER_SERVICE.put(service, caches);
             }
         }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java?rev=1164759&r1=1164758&r2=1164759&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeManagerImpl.java
Fri Sep  2 23:15:25 2011
@@ -53,6 +53,8 @@ import org.apache.jackrabbit.spi.commons
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static org.apache.jackrabbit.jcr2spi.util.Unsafe.cast;
+
 /**
  * A <code>NodeTypeManagerImpl</code> implements a session dependant
  * NodeTypeManager.
@@ -113,9 +115,9 @@ public class NodeTypeManagerImpl extends
         valueFactory = mgrProvider.getJcrValueFactory();
 
         // setup caches with soft references to node type
-        ntCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT);
-        pdCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT);
-        ndCache = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT);
+        ntCache = cast(new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT));
+        pdCache = cast(new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT));
+        ndCache = cast(new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT));
     }
 
     private EffectiveNodeTypeProvider entProvider() {

Added: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/Unsafe.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/Unsafe.java?rev=1164759&view=auto
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/Unsafe.java
(added)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/Unsafe.java
Fri Sep  2 23:15:25 2011
@@ -0,0 +1,26 @@
+/*
+ * 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.jcr2spi.util;
+
+public final class Unsafe {
+    private Unsafe() {}
+
+    @SuppressWarnings("unchecked")
+    public static <T> T cast(Object o) {
+        return (T) o;
+    }
+}

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java?rev=1164759&r1=1164758&r2=1164759&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
Fri Sep  2 23:15:25 2011
@@ -107,7 +107,7 @@ public class VersionHistoryImpl extends 
                 versionEntries.add(entry);
             }
         }
-        return new LazyItemIterator(getItemManager(), new RangeIteratorAdapter(versionEntries));
+        return new LazyItemIterator(getItemManager(), versionEntries.iterator());
     }
 
     @Override



Mime
View raw message