jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1311731 - in /jackrabbit/oak/trunk: oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/configuration/
Date Tue, 10 Apr 2012 14:05:29 GMT
Author: mduerig
Date: Tue Apr 10 14:05:28 2012
New Revision: 1311731

URL: http://svn.apache.org/viewvc?rev=1311731&view=rev
Log:
OAK-15: Clean up oak-jcr
remove cache size from RepositoryConfiguration
add RepositoryConfiguration to GlobalContext

Modified:
    jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/GlobalContext.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/configuration/OakRepositoryConfiguration.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/configuration/RepositoryConfiguration.java

Modified: jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java?rev=1311731&r1=1311730&r2=1311731&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
(original)
+++ jackrabbit/oak/trunk/oak-it/jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
Tue Apr 10 14:05:28 2012
@@ -16,28 +16,28 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import java.security.Principal;
-import java.util.Properties;
+import org.apache.jackrabbit.test.NotExecutableException;
+import org.apache.jackrabbit.test.RepositoryStub;
 
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
-
-import org.apache.jackrabbit.test.NotExecutableException;
-import org.apache.jackrabbit.test.RepositoryStub;
+import java.security.Principal;
+import java.util.Properties;
 
 public class OakRepositoryStub extends RepositoryStub {
 
-    private final Repository repository = new RepositoryImpl();
+    private final Repository repository;
 
     /**
      * Constructor as required by the JCR TCK.
      *
      * @param settings repository settings
      */
-    public OakRepositoryStub(Properties settings) {
+    public OakRepositoryStub(Properties settings) throws RepositoryException {
         super(settings);
+        repository = new RepositoryImpl();
     }
 
     /**
@@ -45,6 +45,7 @@ public class OakRepositoryStub extends R
      *
      * @return the configured repository instance.
      */
+    @Override
     public synchronized Repository getRepository() {
         return repository;
     }
@@ -55,6 +56,7 @@ public class OakRepositoryStub extends R
     }
 
     private static Principal UNKNOWN_PRINCIPAL = new Principal() {
+        @Override
         public String getName() {
             return "an_unknown_user";
         }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/GlobalContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/GlobalContext.java?rev=1311731&r1=1311730&r2=1311731&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/GlobalContext.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/GlobalContext.java
Tue Apr 10 14:05:28 2012
@@ -21,11 +21,13 @@ package org.apache.jackrabbit.oak.jcr;
 
 import org.apache.jackrabbit.oak.api.RepositoryService;
 import org.apache.jackrabbit.oak.core.TmpRepositoryService;
+import org.apache.jackrabbit.oak.jcr.configuration.OakRepositoryConfiguration;
 import org.apache.jackrabbit.oak.jcr.configuration.RepositoryConfiguration;
 import org.apache.jackrabbit.oak.jcr.util.Unchecked;
 
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -42,14 +44,14 @@ public class GlobalContext {
     private final Map<Class<?>, Object> instances = new HashMap<Class<?>,
Object>();
     
     public GlobalContext(RepositoryConfiguration repositoryConfiguration) throws RepositoryException
{
-        this(repositoryConfiguration.getMicrokernelUrl());
         put(RepositoryConfiguration.class, repositoryConfiguration);
+        put(RepositoryService.class, new TmpRepositoryService(repositoryConfiguration.getMicrokernelUrl()));
+        put(Repository.class, new RepositoryImpl(this));
     }
 
-    public GlobalContext(String microKernelUrl) {
-        RepositoryService repositoryService = new TmpRepositoryService(microKernelUrl);
-        put(RepositoryService.class, repositoryService);
-        put(Repository.class, new RepositoryImpl(this));
+    public GlobalContext(String microKernelUrl) throws RepositoryException {
+        this(OakRepositoryConfiguration.create(Collections.singletonMap(
+                RepositoryConfiguration.MICROKERNEL_URL, microKernelUrl)));
     }
 
     public <T> T getInstance(Class<T> forClass) {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java?rev=1311731&r1=1311730&r2=1311731&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
Tue Apr 10 14:05:28 2012
@@ -46,7 +46,7 @@ public class RepositoryImpl implements R
      * Utility constructor that creates a JCR binding for an initially empty,
      * newly constructed Oak repository.
      */
-    public RepositoryImpl() {
+    public RepositoryImpl() throws RepositoryException {
         context = new GlobalContext("mem:oak");
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/configuration/OakRepositoryConfiguration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/configuration/OakRepositoryConfiguration.java?rev=1311731&r1=1311730&r2=1311731&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/configuration/OakRepositoryConfiguration.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/configuration/OakRepositoryConfiguration.java
Tue Apr 10 14:05:28 2012
@@ -28,7 +28,6 @@ import static java.text.MessageFormat.fo
 public class OakRepositoryConfiguration implements RepositoryConfiguration {
     private final Map<String, String> parameters;
     private final String microkernelUrl;
-    private final int nodeStateCacheSize;
 
     private OakRepositoryConfiguration(Map<String, String> parameters) throws RepositoryException
{
         this.parameters = Collections.unmodifiableMap(parameters);
@@ -37,16 +36,6 @@ public class OakRepositoryConfiguration 
         if (microkernelUrl == null) {
             throw new RepositoryException(format("Missing configuration value for {0}", MICROKERNEL_URL));
         }
-
-        String size = getParameterMap().get(NODE_STATE_CACHE_SIZE);
-        try {
-            nodeStateCacheSize = size == null ? 0 : Integer.parseInt(size);
-        }
-        catch (NumberFormatException e) {
-            throw new RepositoryException(format("Invalid configuration value {0} for {1}",
-                    size, NODE_STATE_CACHE_SIZE), e);
-        }
-
     }
 
     public static RepositoryConfiguration create(Map<String, String> parameters) throws
RepositoryException {
@@ -63,8 +52,4 @@ public class OakRepositoryConfiguration 
         return microkernelUrl;
     }
 
-    @Override
-    public int getNodeStateCacheSize() {
-        return nodeStateCacheSize;
-    }
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/configuration/RepositoryConfiguration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/configuration/RepositoryConfiguration.java?rev=1311731&r1=1311730&r2=1311731&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/configuration/RepositoryConfiguration.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/configuration/RepositoryConfiguration.java
Tue Apr 10 14:05:28 2012
@@ -24,9 +24,7 @@ import java.util.Map;
 
 public interface RepositoryConfiguration {
     String MICROKERNEL_URL = RepositoryConfiguration.class.getName() + ".microkernel-url";
-    String NODE_STATE_CACHE_SIZE = RepositoryConfiguration.class.getName() + ".node-state-cache-size";
 
     Map<String, String> getParameterMap();
     String getMicrokernelUrl() throws RepositoryException;
-    int getNodeStateCacheSize();
 }



Mime
View raw message