chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1181069 - /chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrRepository.java
Date Mon, 10 Oct 2011 17:00:36 GMT
Author: mduerig
Date: Mon Oct 10 17:00:36 2011
New Revision: 1181069

URL: http://svn.apache.org/viewvc?rev=1181069&view=rev
Log:
CMIS-437: JcrRepository need not be final

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrRepository.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrRepository.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrRepository.java?rev=1181069&r1=1181068&r2=1181069&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrRepository.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrRepository.java
Mon Oct 10 17:00:36 2011
@@ -86,7 +86,7 @@ import java.util.Set;
 /**
  * JCR back-end for CMIS server.
  */
-public final class JcrRepository {
+public class JcrRepository {
     private static final Log log = LogFactory.getLog(JcrRepository.class);
 
     private final Repository repository;
@@ -931,9 +931,9 @@ public final class JcrRepository {
         }
     }
 
-    //------------------------------------------< private >---
+    //------------------------------------------< protected >---
 
-    private RepositoryInfo compileRepositoryInfo(String repositoryId) {
+    protected RepositoryInfo compileRepositoryInfo(String repositoryId) {
         RepositoryInfoImpl fRepositoryInfo = new RepositoryInfoImpl();
 
         fRepositoryInfo.setId(repositoryId);
@@ -969,11 +969,11 @@ public final class JcrRepository {
         return fRepositoryInfo;
     }
 
-    private String getRepositoryName() {
+    protected String getRepositoryName() {
         return repository.getDescriptor(Repository.REP_NAME_DESC);
     }
 
-    private String getRepositoryDescription() {
+    protected String getRepositoryDescription() {
         StringBuilder description = new StringBuilder();
 
         for (String key : repository.getDescriptorKeys()) {
@@ -987,6 +987,67 @@ public final class JcrRepository {
         return description.toString();
     }
 
+    protected JcrNode getJcrNode(Session session, String id) {
+        try {
+            if (id == null || id.length() == 0) {
+                throw new CmisInvalidArgumentException("Null or empty id");
+            }
+
+            if (id.equals(PathManager.CMIS_ROOT_ID)) {
+                return nodeFactory.create(getRootNode(session));
+            }
+
+            int k = id.indexOf('/');
+            if (k >= 0) {
+                String nodeId = id.substring(0, k);
+                String versionName = id.substring(k + 1);
+
+                Node node = session.getNodeByIdentifier(nodeId);
+
+                JcrNode jcrNode = nodeFactory.create(node);
+                if (JcrPrivateWorkingCopy.denotesPwc(versionName)) {
+                    return jcrNode.asVersion().getPwc();
+                }
+                else {
+                    return jcrNode.asVersion().getVersion(versionName);
+                }
+            }
+            else {
+                Node node = session.getNodeByIdentifier(id);
+                return nodeFactory.create(node);
+            }
+
+        }
+        catch (ItemNotFoundException e) {
+            log.debug(e.getMessage(), e);
+            throw new CmisObjectNotFoundException(e.getMessage(), e);
+        }
+        catch (RepositoryException e) {
+            log.debug(e.getMessage(), e);
+            throw new CmisRuntimeException(e.getMessage(), e);
+        }
+    }
+
+    protected Node getRootNode(Session session) {
+        try {
+            return session.getNode(pathManager.getJcrRootPath());
+        }
+        catch (PathNotFoundException e) {
+            log.debug(e.getMessage(), e);
+            throw new CmisObjectNotFoundException(e.getMessage(), e);
+        }
+        catch (ItemNotFoundException e) {
+            log.debug(e.getMessage(), e);
+            throw new CmisObjectNotFoundException(e.getMessage(), e);
+        }
+        catch (RepositoryException e) {
+            log.debug(e.getMessage(), e);
+            throw new CmisRuntimeException(e.getMessage(), e);
+        }
+    }
+
+    //------------------------------------------< private >---
+
     /**
      * Transitively gather the children of a node down to a specific depth
      */
@@ -1057,63 +1118,4 @@ public final class JcrRepository {
 
         return result;
     }
-
-    private JcrNode getJcrNode(Session session, String id) {
-        try {
-            if (id == null || id.length() == 0) {
-                throw new CmisInvalidArgumentException("Null or empty id");
-            }
-
-            if (id.equals(PathManager.CMIS_ROOT_ID)) {
-                return nodeFactory.create(getRootNode(session));
-            }
-
-            int k = id.indexOf('/');
-            if (k >= 0) {
-                String nodeId = id.substring(0, k);
-                String versionName = id.substring(k + 1);
-
-                Node node = session.getNodeByIdentifier(nodeId);
-
-                JcrNode jcrNode = nodeFactory.create(node);
-                if (JcrPrivateWorkingCopy.denotesPwc(versionName)) {
-                    return jcrNode.asVersion().getPwc();
-                }
-                else {
-                    return jcrNode.asVersion().getVersion(versionName);
-                }
-            }
-            else {
-                Node node = session.getNodeByIdentifier(id);
-                return nodeFactory.create(node);
-            }
-
-        }
-        catch (ItemNotFoundException e) {
-            log.debug(e.getMessage(), e);
-            throw new CmisObjectNotFoundException(e.getMessage(), e);
-        }
-        catch (RepositoryException e) {
-            log.debug(e.getMessage(), e);
-            throw new CmisRuntimeException(e.getMessage(), e);
-        }
-    }
-
-    private Node getRootNode(Session session) {
-        try {
-            return session.getNode(pathManager.getJcrRootPath());
-        }
-        catch (PathNotFoundException e) {
-            log.debug(e.getMessage(), e);
-            throw new CmisObjectNotFoundException(e.getMessage(), e);
-        }
-        catch (ItemNotFoundException e) {
-            log.debug(e.getMessage(), e);
-            throw new CmisObjectNotFoundException(e.getMessage(), e);
-        }
-        catch (RepositoryException e) {
-            log.debug(e.getMessage(), e);
-            throw new CmisRuntimeException(e.getMessage(), e);
-        }
-    }
 }



Mime
View raw message