jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1434364 - in /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr: NodeImpl.java SessionDelegate.java SessionImpl.java WorkspaceImpl.java query/QueryImpl.java version/VersionManagerImpl.java
Date Wed, 16 Jan 2013 20:23:39 GMT
Author: mduerig
Date: Wed Jan 16 20:23:38 2013
New Revision: 1434364

URL: http://svn.apache.org/viewvc?rev=1434364&view=rev
Log:
OAK-563: Rename SessionDelegate...OrThrow methods

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java?rev=1434364&r1=1434363&r2=1434364&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/NodeImpl.java
Wed Jan 16 20:23:38 2013
@@ -221,9 +221,9 @@ public class NodeImpl<T extends NodeDele
         return sessionDelegate.perform(new SessionOperation<Node>() {
             @Override
             public Node perform() throws RepositoryException {
-                String oakPath = sessionDelegate.getOakPathKeepIndexOrThrowNotFound(relPath);
+                String oakPath = sessionDelegate.getOakPathKeepIndex(relPath);
                 String oakName = PathUtils.getName(oakPath);
-                String parentPath = sessionDelegate.getOakPathOrThrow(PathUtils.getParentPath(oakPath));
+                String parentPath = sessionDelegate.getOakPath(PathUtils.getParentPath(oakPath));
 
                 // handle index
                 if (oakName.contains("[")) {
@@ -292,11 +292,11 @@ public class NodeImpl<T extends NodeDele
             @Override
             public Void perform() throws RepositoryException {
                 String oakSrcChildRelPath =
-                        sessionDelegate.getOakPathOrThrowNotFound(srcChildRelPath);
+                        sessionDelegate.getOakPath(srcChildRelPath);
                 String oakDestChildRelPath = null;
                 if (destChildRelPath != null) {
                     oakDestChildRelPath =
-                            sessionDelegate.getOakPathOrThrowNotFound(destChildRelPath);
+                            sessionDelegate.getOakPath(destChildRelPath);
                 }
                 dlg.orderBefore(oakSrcChildRelPath, oakDestChildRelPath);
                 return null;
@@ -478,7 +478,7 @@ public class NodeImpl<T extends NodeDele
         return sessionDelegate.perform(new SessionOperation<NodeImpl>() {
             @Override
             public NodeImpl perform() throws RepositoryException {
-                String oakPath = sessionDelegate.getOakPathOrThrowNotFound(relPath);
+                String oakPath = sessionDelegate.getOakPath(relPath);
 
                 NodeDelegate nd = dlg.getChild(oakPath);
                 if (nd == null) {
@@ -564,7 +564,7 @@ public class NodeImpl<T extends NodeDele
         return sessionDelegate.perform(new SessionOperation<PropertyImpl>() {
             @Override
             public PropertyImpl perform() throws RepositoryException {
-                String oakPath = sessionDelegate.getOakPathOrThrowNotFound(relPath);
+                String oakPath = sessionDelegate.getOakPath(relPath);
                 PropertyDelegate pd = dlg.getProperty(oakPath);
                 if (pd == null) {
                     throw new PathNotFoundException(relPath + " not found on " + getPath());
@@ -767,7 +767,7 @@ public class NodeImpl<T extends NodeDele
         return sessionDelegate.perform(new SessionOperation<Boolean>() {
             @Override
             public Boolean perform() throws RepositoryException {
-                String oakPath = sessionDelegate.getOakPathOrThrow(relPath);
+                String oakPath = sessionDelegate.getOakPath(relPath);
                 return dlg.getChild(oakPath) != null;
             }
         });
@@ -780,7 +780,7 @@ public class NodeImpl<T extends NodeDele
         return sessionDelegate.perform(new SessionOperation<Boolean>() {
             @Override
             public Boolean perform() throws RepositoryException {
-                String oakPath = sessionDelegate.getOakPathOrThrow(relPath);
+                String oakPath = sessionDelegate.getOakPath(relPath);
                 return dlg.getProperty(oakPath) != null;
             }
         });
@@ -1099,8 +1099,8 @@ public class NodeImpl<T extends NodeDele
      */
     @Override
     public boolean isLocked() throws RepositoryException {
-        String lockOwner = sessionDelegate.getOakPathOrThrow(JCR_LOCK_OWNER);
-        String lockIsDeep = sessionDelegate.getOakPathOrThrow(JCR_LOCK_IS_DEEP);
+        String lockOwner = sessionDelegate.getOakPath(JCR_LOCK_OWNER);
+        String lockIsDeep = sessionDelegate.getOakPath(JCR_LOCK_IS_DEEP);
 
         if (dlg.getProperty(lockOwner) != null) {
             return true;
@@ -1127,7 +1127,7 @@ public class NodeImpl<T extends NodeDele
      */
     @Override
     public boolean holdsLock() throws RepositoryException {
-        String lockOwner = sessionDelegate.getOakPathOrThrow(JCR_LOCK_OWNER);
+        String lockOwner = sessionDelegate.getOakPath(JCR_LOCK_OWNER);
         return dlg.getProperty(lockOwner) != null;
     }
 
@@ -1149,8 +1149,8 @@ public class NodeImpl<T extends NodeDele
             throws RepositoryException {
         final String userID = getSession().getUserID();
 
-        String lockOwner = sessionDelegate.getOakPathOrThrow(JCR_LOCK_OWNER);
-        String lockIsDeep = sessionDelegate.getOakPathOrThrow(JCR_LOCK_IS_DEEP);
+        String lockOwner = sessionDelegate.getOakPath(JCR_LOCK_OWNER);
+        String lockIsDeep = sessionDelegate.getOakPath(JCR_LOCK_IS_DEEP);
         try {
             ContentSession session = sessionDelegate.getContentSession();
             Root root = session.getLatestRoot();
@@ -1223,8 +1223,8 @@ public class NodeImpl<T extends NodeDele
      */
     @Override
     public void unlock() throws RepositoryException {
-        String lockOwner = sessionDelegate.getOakPathOrThrow(JCR_LOCK_OWNER);
-        String lockIsDeep = sessionDelegate.getOakPathOrThrow(JCR_LOCK_IS_DEEP);
+        String lockOwner = sessionDelegate.getOakPath(JCR_LOCK_OWNER);
+        String lockIsDeep = sessionDelegate.getOakPath(JCR_LOCK_IS_DEEP);
         try {
             Root root = sessionDelegate.getContentSession().getLatestRoot();
             Tree tree = root.getTree(dlg.getPath());
@@ -1407,7 +1407,7 @@ public class NodeImpl<T extends NodeDele
     // FIXME OAK-505: hack to filter for a subset of supported mixins for now
     // this allows only harmless mixin types so that other code like addMixin gets test coverage
     private boolean isSupportedMixinName(String mixinName) throws RepositoryException {
-        String oakName = sessionDelegate.getOakPathOrThrow(mixinName);
+        String oakName = sessionDelegate.getOakPath(mixinName);
         return "mix:title".equals(oakName) ||
             NodeTypeConstants.MIX_REFERENCEABLE.equals(oakName) ||
             NodeTypeConstants.MIX_VERSIONABLE.equals(oakName) ||
@@ -1435,7 +1435,7 @@ public class NodeImpl<T extends NodeDele
                 }
                 // TODO: END
 
-                String jcrPrimaryType = sessionDelegate.getOakPathOrThrow(Property.JCR_PRIMARY_TYPE);
+                String jcrPrimaryType = sessionDelegate.getOakPath(Property.JCR_PRIMARY_TYPE);
                 Value value = sessionDelegate.getValueFactory().createValue(nodeTypeName,
PropertyType.NAME);
                 dlg.setProperty(jcrPrimaryType, value);
                 return null;
@@ -1451,7 +1451,7 @@ public class NodeImpl<T extends NodeDele
         return sessionDelegate.perform(new SessionOperation<Property>() {
             @Override
             public Property perform() throws RepositoryException {
-                String oakName = sessionDelegate.getOakPathOrThrow(jcrName);
+                String oakName = sessionDelegate.getOakPath(jcrName);
                 if (value == null) {
                     if (hasProperty(jcrName)) {
                         Property property = getProperty(jcrName);
@@ -1491,7 +1491,7 @@ public class NodeImpl<T extends NodeDele
         return sessionDelegate.perform(new SessionOperation<Property>() {
             @Override
             public Property perform() throws RepositoryException {
-                String oakName = sessionDelegate.getOakPathOrThrow(jcrName);
+                String oakName = sessionDelegate.getOakPath(jcrName);
                 if (values == null) {
                     if (hasProperty(jcrName)) {
                         Property property = getProperty(jcrName);

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java?rev=1434364&r1=1434363&r2=1434364&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionDelegate.java
Wed Jan 16 20:23:38 2013
@@ -301,7 +301,7 @@ public class SessionDelegate {
      * @throws PathNotFoundException 
      */
     @Nonnull
-    public String getOakPathKeepIndexOrThrowNotFound(String jcrPath) throws PathNotFoundException
{
+    public String getOakPathKeepIndex(String jcrPath) throws PathNotFoundException {
         String oakPath = getNamePathMapper().getOakPathKeepIndex(jcrPath);
         if (oakPath != null) {
             return oakPath;
@@ -319,7 +319,7 @@ public class SessionDelegate {
      * @throws PathNotFoundException if the path can not be mapped
      */
     @Nonnull
-    public String getOakPathOrThrowNotFound(String jcrPath) throws PathNotFoundException
{
+    public String getOakPath(String jcrPath) throws PathNotFoundException {
         String oakPath = getOakPathOrNull(jcrPath);
         if (oakPath != null) {
             return oakPath;
@@ -328,25 +328,6 @@ public class SessionDelegate {
         }
     }
 
-    /**
-     * Returns the Oak path for the given JCR path, or throws a
-     * {@link RepositoryException} if the path can not be mapped.
-     *
-     * @param jcrPath JCR path
-     * @return Oak path
-     * @throws RepositoryException if the path can not be mapped
-     */
-    @Nonnull
-    public String getOakPathOrThrow(String jcrPath)
-            throws RepositoryException {
-        String oakPath = getOakPathOrNull(jcrPath);
-        if (oakPath != null) {
-            return oakPath;
-        } else {
-            throw new RepositoryException("Invalid name or path: " + jcrPath);
-        }
-    }
-
     //----------------------------------------------------------< Workspace >---
 
     @Nonnull

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1434364&r1=1434363&r2=1434364&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Wed Jan 16 20:23:38 2013
@@ -192,7 +192,7 @@ public class SessionImpl extends Abstrac
         return dlg.perform(new SessionOperation<NodeImpl>() {
             @Override
             public NodeImpl perform() throws RepositoryException {
-                String oakPath = dlg.getOakPathOrThrow(absPath);
+                String oakPath = dlg.getOakPath(absPath);
                 NodeDelegate d = dlg.getNode(oakPath);
                 if (d == null) {
                     throw new PathNotFoundException("Node with path " + absPath + " does
not exist.");
@@ -209,7 +209,7 @@ public class SessionImpl extends Abstrac
         return dlg.perform(new SessionOperation<Boolean>() {
             @Override
             public Boolean perform() throws RepositoryException {
-                String oakPath = dlg.getOakPathOrThrow(absPath);
+                String oakPath = dlg.getOakPath(absPath);
                 return dlg.getNode(oakPath) != null;
             }
         });
@@ -223,7 +223,7 @@ public class SessionImpl extends Abstrac
             return dlg.perform(new SessionOperation<PropertyImpl>() {
                 @Override
                 public PropertyImpl perform() throws RepositoryException {
-                    String oakPath = dlg.getOakPathOrThrowNotFound(absPath);
+                    String oakPath = dlg.getOakPath(absPath);
                     TreeLocation loc = dlg.getLocation(oakPath);
                     if (loc.getProperty() == null) {
                         throw new PathNotFoundException(absPath);
@@ -244,7 +244,7 @@ public class SessionImpl extends Abstrac
             return dlg.perform(new SessionOperation<Boolean>() {
                 @Override
                 public Boolean perform() throws RepositoryException {
-                    String oakPath = dlg.getOakPathOrThrowNotFound(absPath);
+                    String oakPath = dlg.getOakPath(absPath);
                     TreeLocation loc = dlg.getLocation(oakPath);
                     return loc.getProperty() != null;
                 }
@@ -260,7 +260,7 @@ public class SessionImpl extends Abstrac
             @Override
             public Void perform() throws RepositoryException {
                 dlg.checkProtectedNodes(Text.getRelativeParent(srcAbsPath, 1), Text.getRelativeParent(destAbsPath,
1));
-                String oakPath = dlg.getOakPathKeepIndexOrThrowNotFound(destAbsPath);
+                String oakPath = dlg.getOakPathKeepIndex(destAbsPath);
                 String oakName = PathUtils.getName(oakPath);
                 // handle index
                 if (oakName.contains("[")) {
@@ -268,8 +268,8 @@ public class SessionImpl extends Abstrac
                 }
 
                 dlg.move(
-                        dlg.getOakPathOrThrowNotFound(srcAbsPath),
-                        dlg.getOakPathOrThrowNotFound(oakPath),
+                        dlg.getOakPath(srcAbsPath),
+                        dlg.getOakPath(oakPath),
                         true);
 
                 return null;

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java?rev=1434364&r1=1434363&r2=1434364&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/WorkspaceImpl.java
Wed Jan 16 20:23:38 2013
@@ -99,7 +99,7 @@ public class WorkspaceImpl implements Ja
 
         sessionDelegate.checkProtectedNodes(Text.getRelativeParent(srcAbsPath, 1), Text.getRelativeParent(destAbsPath,
1));
 
-        String oakPath = sessionDelegate.getOakPathKeepIndexOrThrowNotFound(destAbsPath);
+        String oakPath = sessionDelegate.getOakPathKeepIndex(destAbsPath);
         String oakName = PathUtils.getName(oakPath);
         // handle index
         if (oakName.contains("[")) {
@@ -107,8 +107,8 @@ public class WorkspaceImpl implements Ja
         }
 
         sessionDelegate.copy(
-                sessionDelegate.getOakPathOrThrowNotFound(srcAbsPath),
-                sessionDelegate.getOakPathOrThrowNotFound(oakPath));
+                sessionDelegate.getOakPath(srcAbsPath),
+                sessionDelegate.getOakPath(oakPath));
     }
 
     @Override
@@ -127,7 +127,7 @@ public class WorkspaceImpl implements Ja
 
         sessionDelegate.checkProtectedNodes(Text.getRelativeParent(srcAbsPath, 1), Text.getRelativeParent(destAbsPath,
1));
 
-        String oakPath = sessionDelegate.getOakPathKeepIndexOrThrowNotFound(destAbsPath);
+        String oakPath = sessionDelegate.getOakPathKeepIndex(destAbsPath);
         String oakName = PathUtils.getName(oakPath);
         // handle index
         if (oakName.contains("[")) {
@@ -135,8 +135,8 @@ public class WorkspaceImpl implements Ja
         }
 
         sessionDelegate.move(
-                sessionDelegate.getOakPathOrThrowNotFound(srcAbsPath),
-                sessionDelegate.getOakPathOrThrowNotFound(oakPath),
+                sessionDelegate.getOakPath(srcAbsPath),
+                sessionDelegate.getOakPath(oakPath),
                 false);
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java?rev=1434364&r1=1434363&r2=1434364&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/query/QueryImpl.java
Wed Jan 16 20:23:38 2013
@@ -132,7 +132,7 @@ public class QueryImpl implements Query 
     public Node storeAsNode(String absPath) throws RepositoryException {
         manager.ensureIsAlive();
         SessionDelegate sessionDelegate = manager.getSessionDelegate();
-        String oakPath = sessionDelegate.getOakPathOrThrow(absPath);
+        String oakPath = sessionDelegate.getOakPath(absPath);
         String parent = PathUtils.getParentPath(oakPath);
         NodeDelegate parentDelegate = sessionDelegate.getNode(parent);
         if (parentDelegate == null) {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java?rev=1434364&r1=1434363&r2=1434364&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/VersionManagerImpl.java
Wed Jan 16 20:23:38 2013
@@ -115,7 +115,7 @@ public class VersionManagerImpl implemen
         return sessionDelegate.perform(new SessionOperation<Boolean>() {
             @Override
             public Boolean perform() throws RepositoryException {
-                String oakPath = sessionDelegate.getOakPathOrThrowNotFound(absPath);
+                String oakPath = sessionDelegate.getOakPath(absPath);
                 NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                 if (nodeDelegate == null) {
                     throw new PathNotFoundException(absPath);
@@ -132,7 +132,7 @@ public class VersionManagerImpl implemen
         return sessionDelegate.perform(new SessionOperation<VersionHistory>() {
             @Override
             public VersionHistory perform() throws RepositoryException {
-                String oakPath = sessionDelegate.getOakPathOrThrowNotFound(absPath);
+                String oakPath = sessionDelegate.getOakPath(absPath);
                 NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                 if (nodeDelegate == null) {
                     throw new PathNotFoundException(absPath);
@@ -149,7 +149,7 @@ public class VersionManagerImpl implemen
         return sessionDelegate.perform(new SessionOperation<Version>() {
             @Override
             public Version perform() throws RepositoryException {
-                String oakPath = sessionDelegate.getOakPathOrThrowNotFound(absPath);
+                String oakPath = sessionDelegate.getOakPath(absPath);
                 NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                 if (nodeDelegate == null) {
                     throw new PathNotFoundException(absPath);
@@ -195,7 +195,7 @@ public class VersionManagerImpl implemen
         sessionDelegate.perform(new SessionOperation<Void>() {
             @Override
             public Void perform() throws RepositoryException {
-                String oakPath = sessionDelegate.getOakPathOrThrowNotFound(absPath);
+                String oakPath = sessionDelegate.getOakPath(absPath);
                 NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                 if (nodeDelegate == null) {
                     throw new PathNotFoundException(absPath);
@@ -218,7 +218,7 @@ public class VersionManagerImpl implemen
         return sessionDelegate.perform(new SessionOperation<Version>() {
             @Override
             public Version perform() throws RepositoryException {
-                String oakPath = sessionDelegate.getOakPathOrThrowNotFound(absPath);
+                String oakPath = sessionDelegate.getOakPath(absPath);
                 NodeDelegate nodeDelegate = sessionDelegate.getNode(oakPath);
                 if (nodeDelegate == null) {
                     throw new PathNotFoundException(absPath);



Mime
View raw message