jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1328665 - in /jackrabbit/oak/trunk: oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/principal/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/ oak-run/src...
Date Sat, 21 Apr 2012 14:17:18 GMT
Author: mduerig
Date: Sat Apr 21 14:17:18 2012
New Revision: 1328665

URL: http://svn.apache.org/viewvc?rev=1328665&view=rev
Log:
OAK-15: Clean up oak-jcr
- remove redundant throws 
- make fields finale where possible
- suppress unchecked warnings where applicable
- 

Modified:
    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/NamespaceRegistryImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/principal/PrincipalIteratorAdapter.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerConfig.java
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java

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=1328665&r1=1328664&r2=1328665&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
Sat Apr 21 14:17:18 2012
@@ -25,7 +25,6 @@ import org.apache.jackrabbit.oak.core.Ke
 import org.apache.jackrabbit.oak.jcr.util.Unchecked;
 
 import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -42,7 +41,7 @@ public class GlobalContext {
 
     private final Map<Class<?>, Object> instances = new HashMap<Class<?>,
Object>();
 
-    public GlobalContext(MicroKernel mk) throws RepositoryException {
+    public GlobalContext(MicroKernel mk) {
         put(ContentRepository.class, new KernelContentRepository(mk));
         put(Repository.class, new RepositoryImpl(this));
     }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NamespaceRegistryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NamespaceRegistryImpl.java?rev=1328665&r1=1328664&r2=1328665&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NamespaceRegistryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NamespaceRegistryImpl.java
Sat Apr 21 14:17:18 2012
@@ -16,22 +16,18 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.jcr.AccessDeniedException;
 import javax.jcr.NamespaceException;
 import javax.jcr.NamespaceRegistry;
 import javax.jcr.RepositoryException;
-import javax.jcr.UnsupportedRepositoryOperationException;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * A naive implementation of {@link NamespaceRegistry}, hard-wiring the
  * predefined namespaces for now.
  */
 public class NamespaceRegistryImpl implements NamespaceRegistry {
-
-    private Map<String, String> map;
+    private final Map<String, String> map;
 
     public NamespaceRegistryImpl() {
         map = new HashMap<String, String>();
@@ -44,15 +40,13 @@ public class NamespaceRegistryImpl imple
     }
 
     @Override
-    public void registerNamespace(String prefix, String uri) throws NamespaceException,
-            UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException
{
+    public void registerNamespace(String prefix, String uri) throws RepositoryException {
         // TODO
         throw new UnsupportedOperationException();
     }
 
     @Override
-    public void unregisterNamespace(String prefix) throws NamespaceException, UnsupportedRepositoryOperationException,
-            AccessDeniedException, RepositoryException {
+    public void unregisterNamespace(String prefix) throws RepositoryException {
         // TODO
         throw new UnsupportedOperationException();
     }
@@ -68,7 +62,7 @@ public class NamespaceRegistryImpl imple
     }
 
     @Override
-    public String getURI(String prefix) throws NamespaceException, RepositoryException {
+    public String getURI(String prefix) throws RepositoryException {
         String result = map.get(prefix);
         if (result == null) {
             throw new NamespaceException();
@@ -77,7 +71,7 @@ public class NamespaceRegistryImpl imple
     }
 
     @Override
-    public String getPrefix(String uri) throws NamespaceException, RepositoryException {
+    public String getPrefix(String uri) throws RepositoryException {
         for (Map.Entry<String, String> entry : map.entrySet()) {
             if (entry.getValue().equals(uri)) {
                 return entry.getKey();

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/principal/PrincipalIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/principal/PrincipalIteratorAdapter.java?rev=1328665&r1=1328664&r2=1328665&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/principal/PrincipalIteratorAdapter.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/principal/PrincipalIteratorAdapter.java
Sat Apr 21 14:17:18 2012
@@ -37,7 +37,9 @@ public class PrincipalIteratorAdapter ex
     /**
      * Static instance of an empty {@link PrincipalIterator}.
      */
-    public static final PrincipalIteratorAdapter EMPTY = new PrincipalIteratorAdapter((Iterator<?
extends Principal>) RangeIteratorAdapter.EMPTY);
+    @SuppressWarnings("unchecked")
+    public static final PrincipalIteratorAdapter EMPTY =
+            new PrincipalIteratorAdapter((Iterator<? extends Principal>) RangeIteratorAdapter.EMPTY);
 
     /**
      * Creates an adapter for the given {@link javax.jcr.RangeIterator}.

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerConfig.java?rev=1328665&r1=1328664&r2=1328665&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerConfig.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/security/user/UserManagerConfig.java
Sat Apr 21 14:17:18 2012
@@ -81,6 +81,7 @@ public class UserManagerConfig {
 //    }
 
     //--------------------------------------------------------< private >---
+    @SuppressWarnings("unchecked")
     private static <T> T convert(Property configProperty, T defaultValue) throws RepositoryException
{
         T value;
         String str;

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java?rev=1328665&r1=1328664&r2=1328665&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/run/RepositoryServlet.java
Sat Apr 21 14:17:18 2012
@@ -16,16 +16,15 @@
  */
 package org.apache.jackrabbit.oak.run;
 
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.servlet.ServletException;
-
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.jcr.GlobalContext;
 import org.apache.jackrabbit.oak.jcr.RepositoryImpl;
 import org.apache.jackrabbit.webdav.jcr.JCRWebdavServerServlet;
 
+import javax.jcr.Repository;
+import javax.servlet.ServletException;
+
 class RepositoryServlet extends JCRWebdavServerServlet {
 
     private final String path;
@@ -46,14 +45,7 @@ class RepositoryServlet extends JCRWebda
             kernel = new MicroKernelImpl();
         }
 
-        try {
-            repository = new RepositoryImpl(new GlobalContext(kernel));
-        } catch (RepositoryException e) {
-            kernel.dispose();
-            throw new ServletException(
-                    "Failed to start the repository at " + path, e);
-        }
-
+        repository = new RepositoryImpl(new GlobalContext(kernel));
         super.init();
     }
 



Mime
View raw message