jackrabbit-oak-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1300984 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk: ./ index/ simple/ wrapper/
Date Thu, 15 Mar 2012 13:57:10 GMT
Author: thomasm
Date: Thu Mar 15 13:57:09 2012
New Revision: 1300984

URL: http://svn.apache.org/viewvc?rev=1300984&view=rev
Log:
OAK-13 Rename "Wrapper" to "MicroKernelWrapper" to avoid confusion; move IndexWrapper to index
package

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java
      - copied, changed from r1300226, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/IndexWrapper.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapper.java
      - copied, changed from r1300226, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/Wrapper.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapperBase.java
      - copied, changed from r1300226, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/WrapperBase.java
Removed:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/IndexWrapper.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/Wrapper.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/WrapperBase.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/SimpleKernelImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/VirtualRepositoryWrapper.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java?rev=1300984&r1=1300983&r2=1300984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/MicroKernelFactory.java
Thu Mar 15 13:57:09 2012
@@ -21,9 +21,9 @@ import java.io.IOException;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.client.Client;
 import org.apache.jackrabbit.mk.fs.FileUtils;
+import org.apache.jackrabbit.mk.index.IndexWrapper;
 import org.apache.jackrabbit.mk.simple.SimpleKernelImpl;
 import org.apache.jackrabbit.mk.util.ExceptionFactory;
-import org.apache.jackrabbit.mk.wrapper.IndexWrapper;
 import org.apache.jackrabbit.mk.wrapper.LogWrapper;
 import org.apache.jackrabbit.mk.wrapper.SecurityWrapper;
 import org.apache.jackrabbit.mk.wrapper.VirtualRepositoryWrapper;

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java
(from r1300226, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/IndexWrapper.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/IndexWrapper.java&r1=1300226&r2=1300984&rev=1300984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/IndexWrapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/index/IndexWrapper.java
Thu Mar 15 13:57:09 2012
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.mk.wrapper;
+package org.apache.jackrabbit.mk.index;
 
 import java.io.InputStream;
 import java.util.HashMap;
@@ -22,9 +22,6 @@ import java.util.Iterator;
 import org.apache.jackrabbit.mk.MicroKernelFactory;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.api.MicroKernelException;
-import org.apache.jackrabbit.mk.index.Indexer;
-import org.apache.jackrabbit.mk.index.PrefixIndex;
-import org.apache.jackrabbit.mk.index.PropertyIndex;
 import org.apache.jackrabbit.mk.json.JsopReader;
 import org.apache.jackrabbit.mk.json.JsopStream;
 import org.apache.jackrabbit.mk.json.JsopTokenizer;
@@ -32,25 +29,27 @@ import org.apache.jackrabbit.mk.simple.N
 import org.apache.jackrabbit.mk.simple.NodeMap;
 import org.apache.jackrabbit.mk.util.ExceptionFactory;
 import org.apache.jackrabbit.mk.util.PathUtils;
+import org.apache.jackrabbit.mk.wrapper.MicroKernelWrapper;
+import org.apache.jackrabbit.mk.wrapper.MicroKernelWrapperBase;
 
 /**
  * The index mechanism, as a wrapper.
  */
-public class IndexWrapper extends WrapperBase implements MicroKernel {
+public class IndexWrapper extends MicroKernelWrapperBase implements MicroKernel {
 
     private static final String INDEX_PATH = "/index";
     private static final String TYPE_PREFIX = "prefix:";
     private static final String TYPE_PROPERTY = "property:";
     private static final String UNIQUE = "unique";
 
-    private final Wrapper mk;
+    private final MicroKernelWrapper mk;
     private final Indexer indexer;
     private final NodeMap map = new NodeMap();
     private final HashMap<String, PrefixIndex> prefixIndexes = new HashMap<String,
PrefixIndex>();
     private final HashMap<String, PropertyIndex> propertyIndexes = new HashMap<String,
PropertyIndex>();
 
     public IndexWrapper(MicroKernel mk) {
-        this.mk = WrapperBase.wrap(mk);
+        this.mk = MicroKernelWrapperBase.wrap(mk);
         this.indexer = new Indexer(mk);
     }
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/SimpleKernelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/SimpleKernelImpl.java?rev=1300984&r1=1300983&r2=1300984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/SimpleKernelImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/simple/SimpleKernelImpl.java
Thu Mar 15 13:57:09 2012
@@ -31,7 +31,7 @@ import org.apache.jackrabbit.mk.util.Cac
 import org.apache.jackrabbit.mk.util.CommitGate;
 import org.apache.jackrabbit.mk.util.ExceptionFactory;
 import org.apache.jackrabbit.mk.util.PathUtils;
-import org.apache.jackrabbit.mk.wrapper.WrapperBase;
+import org.apache.jackrabbit.mk.wrapper.MicroKernelWrapperBase;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -60,7 +60,7 @@ Node structure:
 /**
  * A simple MicroKernel implementation.
  */
-public class SimpleKernelImpl extends WrapperBase implements MicroKernel {
+public class SimpleKernelImpl extends MicroKernelWrapperBase implements MicroKernel {
 
     private static final HashMap<String, SimpleKernelImpl> INSTANCES = new HashMap<String,
SimpleKernelImpl>();
 

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapper.java
(from r1300226, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/Wrapper.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapper.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapper.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/Wrapper.java&r1=1300226&r2=1300984&rev=1300984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/Wrapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapper.java
Thu Mar 15 13:57:09 2012
@@ -20,7 +20,11 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.mk.api.MicroKernelException;
 import org.apache.jackrabbit.mk.json.JsopReader;
 
-public interface Wrapper extends MicroKernel {
+/**
+ * This interface allows a MicroKernel client to use a JsopReader instead of
+ * having to use strings.
+ */
+public interface MicroKernelWrapper extends MicroKernel {
 
     JsopReader getRevisionsStream(long since, int maxEntries) throws MicroKernelException;
 

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapperBase.java
(from r1300226, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/WrapperBase.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapperBase.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapperBase.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/WrapperBase.java&r1=1300226&r2=1300984&rev=1300984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/WrapperBase.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/MicroKernelWrapperBase.java
Thu Mar 15 13:57:09 2012
@@ -22,7 +22,11 @@ import org.apache.jackrabbit.mk.api.Micr
 import org.apache.jackrabbit.mk.json.JsopReader;
 import org.apache.jackrabbit.mk.json.JsopTokenizer;
 
-public abstract class WrapperBase implements MicroKernel, Wrapper {
+/**
+ * A MicroKernel implementation that extends this interface can use a JsopReader
+ * instead of having to use strings.
+ */
+public abstract class MicroKernelWrapperBase implements MicroKernel, MicroKernelWrapper {
 
     public final String commit(String path, String jsonDiff, String revisionId, String message)
{
         return commitStream(path, new JsopTokenizer(jsonDiff), revisionId, message);
@@ -48,11 +52,18 @@ public abstract class WrapperBase implem
         return getRevisionsStream(since, maxEntries).toString();
     }
 
-    public static Wrapper wrap(final MicroKernel mk) {
-        if (mk instanceof Wrapper) {
-            return (Wrapper) mk;
+    /**
+     * Wrap a MicroKernel implementation so that the MicroKernelWrapper
+     * interface can be used.
+     *
+     * @param mk the MicroKernel implementation to wrap
+     * @return the wrapped instance
+     */
+    public static MicroKernelWrapper wrap(final MicroKernel mk) {
+        if (mk instanceof MicroKernelWrapper) {
+            return (MicroKernelWrapper) mk;
         }
-        return new Wrapper() {
+        return new MicroKernelWrapper() {
 
             MicroKernel wrapped = mk;
 

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java?rev=1300984&r1=1300983&r2=1300984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/SecurityWrapper.java
Thu Mar 15 13:57:09 2012
@@ -41,9 +41,9 @@ import org.apache.jackrabbit.mk.util.Sim
  * This implementation is not meant for production, it is only used to find
  * (performance and other) problems when using such an approach.
  */
-public class SecurityWrapper extends WrapperBase implements MicroKernel {
+public class SecurityWrapper extends MicroKernelWrapperBase implements MicroKernel {
 
-    private final Wrapper mk;
+    private final MicroKernelWrapper mk;
     private final boolean admin, write;
     private final String[] userRights;
     private final NodeMap map = new NodeMap();
@@ -52,7 +52,7 @@ public class SecurityWrapper extends Wra
 
     private SecurityWrapper(MicroKernel mk, String[] rights) {
         // TODO security for the index mechanism
-        this.mk = WrapperBase.wrap(mk);
+        this.mk = MicroKernelWrapperBase.wrap(mk);
         this.userRights = rights;
         boolean isAdmin = false, canWrite = false;
         for (String r : rights) {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/VirtualRepositoryWrapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/VirtualRepositoryWrapper.java?rev=1300984&r1=1300983&r2=1300984&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/VirtualRepositoryWrapper.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/mk/wrapper/VirtualRepositoryWrapper.java
Thu Mar 15 13:57:09 2012
@@ -38,7 +38,7 @@ import org.apache.jackrabbit.mk.util.Pat
  * All mounted repositories contains the configuration as follows:
  * /:mount/rep1 { url: "mk:...", paths: "/a,/b" }.
  */
-public class VirtualRepositoryWrapper extends WrapperBase implements MicroKernel {
+public class VirtualRepositoryWrapper extends MicroKernelWrapperBase implements MicroKernel
{
 
     private static final String PREFIX = "virtual:";
     private static final String MOUNT = "/:mount";
@@ -46,7 +46,7 @@ public class VirtualRepositoryWrapper ex
     /**
      * The 'main' (wrapped) implementation.
      */
-    private final Wrapper mk;
+    private final MicroKernelWrapper mk;
 
     /**
      * Path map.
@@ -64,7 +64,7 @@ public class VirtualRepositoryWrapper ex
      * Mount map.
      * Key: mount name, value: microkernel implementation.
      */
-    private final HashMap<String, Wrapper> mounts = new HashMap<String, Wrapper>();
+    private final HashMap<String, MicroKernelWrapper> mounts = new HashMap<String,
MicroKernelWrapper>();
 
     /**
      * Head revision map.
@@ -75,7 +75,7 @@ public class VirtualRepositoryWrapper ex
     private final NodeMap map = new NodeMap();
 
     private VirtualRepositoryWrapper(MicroKernel mk) {
-        this.mk = WrapperBase.wrap(mk);
+        this.mk = MicroKernelWrapperBase.wrap(mk);
     }
 
     public static synchronized VirtualRepositoryWrapper get(String url) {
@@ -111,7 +111,7 @@ public class VirtualRepositoryWrapper ex
 
     private void addMount(String mount, String url, String[] paths) {
         MicroKernel mk = MicroKernelFactory.getInstance(url);
-        mounts.put(mount, WrapperBase.wrap(mk));
+        mounts.put(mount, MicroKernelWrapperBase.wrap(mk));
         for (String p : paths) {
             dir.put(p, mount);
         }
@@ -247,7 +247,7 @@ public class VirtualRepositoryWrapper ex
         StringBuilder buff = new StringBuilder();
         if (revisions.size() != mounts.size()) {
             revisions.clear();
-            for (Entry<String, Wrapper> e : mounts.entrySet()) {
+            for (Entry<String, MicroKernelWrapper> e : mounts.entrySet()) {
                 String m = e.getKey();
                 String r = e.getValue().getHeadRevision();
                 revisions.put(m, r);
@@ -286,7 +286,7 @@ public class VirtualRepositoryWrapper ex
             throw ExceptionFactory.get("Not mapped: " + path);
         }
         String rev = getRevision(mount, revisionId);
-        Wrapper mk = mounts.get(mount);
+        MicroKernelWrapper mk = mounts.get(mount);
         return mk.getNodesStream(path, rev, depth, offset, count, filter);
     }
 



Mime
View raw message