jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r896374 - in /jackrabbit/commons/jcr-rmi/trunk: ./ src/main/java/org/apache/jackrabbit/rmi/client/ src/main/java/org/apache/jackrabbit/rmi/remote/ src/main/java/org/apache/jackrabbit/rmi/server/ src/main/java/org/apache/jackrabbit/rmi/value/
Date Wed, 06 Jan 2010 10:43:36 GMT
Author: jukka
Date: Wed Jan  6 10:43:27 2010
New Revision: 896374

URL: http://svn.apache.org/viewvc?rev=896374&view=rev
Log:
JCRRMI-26: JSR-283 support

Implement a few more easy JCR 2.0 features.

Modified:
    jackrabbit/commons/jcr-rmi/trunk/pom.xml
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientNode.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNode.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerNode.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java
    jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/DecimalValue.java

Modified: jackrabbit/commons/jcr-rmi/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/pom.xml?rev=896374&r1=896373&r2=896374&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/pom.xml (original)
+++ jackrabbit/commons/jcr-rmi/trunk/pom.xml Wed Jan  6 10:43:27 2010
@@ -109,7 +109,6 @@
                 testAddVersionCheckVersionLabelsNodeJcr2
                 testAddVersionLabel
                 testAddVersionLabel2
-                testAdminPermission
                 testAnd
                 testAnd
                 testAnd
@@ -246,8 +245,6 @@
                 testDoubleLiteral
                 testDoubleOrder1
                 testDoubleOrder2
-                testDoubleSession
-                testDoubleValueSession
                 testDuplicateNodeType
                 testElementTest
                 testElementTestAnyNode
@@ -334,12 +331,10 @@
                 testGetNode
                 testGetNode
                 testGetNode
-                testGetNode
                 testGetNodeOnLockObtainedFromChild
                 testGetNodeOnLockObtainedFromNewChild
                 testGetNodes
                 testGetNodes
-                testGetNodesNamePatternArray
                 testGetNodeWithSelector
                 testGetParent
                 testGetParent
@@ -356,15 +351,11 @@
                 testGetPrimaryNodeType
                 testGetProperties
                 testGetProperties
-                testGetPropertiesNamePatternArray
-                testGetProperty
-                testGetProperty
                 testGetProperty
                 testGetProperty
                 testGetPropertyNames
                 testGetQuery
                 testGetReferences
-                testGetReferencesWithName
                 testGetRequiredPrimaryTypeNames
                 testGetScore
                 testGetScoreWithSelector
@@ -597,7 +588,6 @@
                 testMergeShallow
                 testMergeUnknownWorkspaceName
                 testMergeUnknownWorkspaceNameJcr2
-                testModifyDecimalPropertySession
                 testMoveLabel
                 testMoveLabelJcr2
                 testMoveNode
@@ -619,7 +609,6 @@
                 testNameLength
                 testNameLiteral
                 testNameLiteral
-                testNewDecimalPropertySession
                 testNewNodeTypeTemplate
                 testNodeAdded
                 testNodeAdded
@@ -700,8 +689,6 @@
                 testProtectedProperty
                 testRange
                 testRange
-                testReadOnlyPermission
-                testReadWritePermission
                 testReference
                 testReferenceLength
                 testReferenceLiteral
@@ -723,8 +710,6 @@
                 testRemovableProperty
                 testRemove
                 testRemove
-                testRemoveDecimalPropertySession
-                testRemoveDoubleSession
                 testRemoveLabel
                 testRemoveLockedChild
                 testRemoveLockToken

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientNode.java?rev=896374&r1=896373&r2=896374&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientNode.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientNode.java
Wed Jan  6 10:43:27 2010
@@ -277,6 +277,15 @@
     }
 
     /** {@inheritDoc} */
+    public NodeIterator getNodes(String[] globs) throws RepositoryException {
+        try {
+            return getFactory().getNodeIterator(getSession(), remote.getNodes(globs));
+        } catch (RemoteException ex) {
+            throw new RemoteRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
     public Property getProperty(String path) throws RepositoryException {
         try {
             RemoteProperty property = remote.getProperty(path);
@@ -306,6 +315,16 @@
     }
 
     /** {@inheritDoc} */
+    public PropertyIterator getProperties(String[] globs)
+            throws RepositoryException {
+        try {
+            return getFactory().getPropertyIterator(getSession(), remote.getProperties(globs));
+        } catch (RemoteException ex) {
+            throw new RemoteRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
     public Item getPrimaryItem() throws RepositoryException {
         try {
             return getItem(getSession(), remote.getPrimaryItem());
@@ -342,6 +361,16 @@
     }
 
     /** {@inheritDoc} */
+    public PropertyIterator getReferences(String name)
+            throws RepositoryException {
+        try {
+            return getFactory().getPropertyIterator(getSession(), remote.getReferences(name));
+        } catch (RemoteException ex) {
+            throw new RemoteRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
     public boolean hasNode(String path) throws RepositoryException {
         try {
             return remote.hasNode(path);
@@ -701,20 +730,6 @@
         throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
     }
 
-    public NodeIterator getNodes(String[] nameGlobs) throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
-    public PropertyIterator getProperties(String[] nameGlobs)
-            throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
-    public PropertyIterator getReferences(String name)
-            throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
     public NodeIterator getSharedSet() throws RepositoryException {
         throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
     }

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java?rev=896374&r1=896373&r2=896374&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientProperty.java
Wed Jan  6 10:43:27 2010
@@ -343,8 +343,6 @@
             } else {
                 return getParent().getNode(value);
             }
-        } catch (PathNotFoundException e) {
-            throw new ItemNotFoundException("Path not found: " + value, e);
         } catch (RepositoryException e) {
             // JCRRMI-15: Throw ValueFormatException where appropriate
             if (e instanceof ItemNotFoundException
@@ -358,18 +356,14 @@
 
     /** {@inheritDoc} */
     public Property getProperty() throws RepositoryException {
-        if (getType() != PropertyType.PATH) {
+        if (getType() != PropertyType.PATH && getType() != PropertyType.NAME) {
             throw new ValueFormatException("Not a path property");
         } else {
             String value = getString();
-            try {
-                if (value.startsWith("/")) {
-                    return getSession().getProperty(value);
-                } else {
-                    return getParent().getProperty(value);
-                }
-            } catch (PathNotFoundException e) {
-                throw new ItemNotFoundException("Path not found: " + value, e);
+            if (value.startsWith("/")) {
+                return getSession().getProperty(value);
+            } else {
+                return getParent().getProperty(value);
             }
         }
     }

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java?rev=896374&r1=896373&r2=896374&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/client/ClientSession.java
Wed Jan  6 10:43:27 2010
@@ -307,8 +307,17 @@
     /** {@inheritDoc} */
     public void checkPermission(String path, String actions)
             throws AccessControlException, RepositoryException {
+        if (!hasPermission(path, actions)) {
+            throw new AccessControlException(
+                    "No permission for " + actions + " on " + path);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public boolean hasPermission(String path, String actions)
+            throws RepositoryException {
         try {
-            remote.checkPermission(path, actions);
+            return remote.hasPermission(path, actions);
         } catch (RemoteException ex) {
             throw new RemoteRuntimeException(ex);
         }
@@ -563,12 +572,8 @@
         throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
     }
 
-    public boolean hasCapability(String methodName, Object target,
-            Object[] arguments) throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
-    public boolean hasPermission(String absPath, String actions)
+    public boolean hasCapability(
+            String methodName, Object target, Object[] arguments)
             throws RepositoryException {
         throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
     }

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNode.java?rev=896374&r1=896373&r2=896374&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNode.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteNode.java
Wed Jan  6 10:43:27 2010
@@ -114,6 +114,19 @@
 
     /**
      * Remote version of the
+     * {@link javax.jcr.Node#getProperties(String[]) Node.getProperties(String[])}
+     * method.
+     *
+     * @param globs property name globs
+     * @return matching node properties
+     * @throws RepositoryException on repository errors
+     * @throws RemoteException on RMI errors
+     */
+    RemoteIterator getProperties(String[] globs)
+            throws RepositoryException, RemoteException;
+
+    /**
+     * Remote version of the
      * {@link javax.jcr.Node#getPrimaryItem() Node.getPrimaryItem()} method.
      *
      * @return primary item
@@ -154,6 +167,17 @@
 
     /**
      * Remote version of the
+     * {@link javax.jcr.Node#getReferences(String) Node.getReferences(String)} method.
+     *
+     * @param name reference property name
+     * @return reference properties
+     * @throws RepositoryException on repository errors
+     * @throws RemoteException on RMI errors
+     */
+    RemoteIterator getReferences(String name) throws RepositoryException, RemoteException;
+
+    /**
+     * Remote version of the
      * {@link javax.jcr.Node#getNodes() Node.getNodes()} method.
      *
      * @return child nodes
@@ -176,6 +200,18 @@
 
     /**
      * Remote version of the
+     * {@link javax.jcr.Node#getNodes(String[]) Node.getNodes(String[])} method.
+     *
+     * @param globs node name globs
+     * @return matching child nodes
+     * @throws RepositoryException on repository errors
+     * @throws RemoteException on RMI errors
+     */
+    RemoteIterator getNodes(String[] globs)
+            throws RepositoryException, RemoteException;
+
+    /**
+     * Remote version of the
      * {@link javax.jcr.Node#hasNode(String) Node.hasNode(String)} method.
      *
      * @param path relative path

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java?rev=896374&r1=896373&r2=896374&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/remote/RemoteSession.java
Wed Jan  6 10:43:27 2010
@@ -293,17 +293,18 @@
 
     /**
      * Remote version of the
-     * {@link javax.jcr.Session#checkPermission(String,String) Session.checkPermission(String,String)}
+     * {@link javax.jcr.Session#hasPermission(String,String) Session.hasPermission(String,String)}
      * method.
      *
      * @param path item path
      * @param actions actions
-     * @throws AccessControlException if permission is denied
+     * @return <code>true</code> if permission is granted,
+     *         <code>false</code> otherwise
      * @throws RepositoryException on repository errors
      * @throws RemoteException on RMI errors
      */
-    void checkPermission(String path, String actions)
-            throws AccessControlException, RepositoryException, RemoteException;
+    boolean hasPermission(String path, String actions)
+            throws RepositoryException, RemoteException;
 
     /**
      * Imports the system or document view XML data into a subtree of

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerNode.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerNode.java?rev=896374&r1=896373&r2=896374&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerNode.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerNode.java
Wed Jan  6 10:43:27 2010
@@ -124,6 +124,16 @@
     }
 
     /** {@inheritDoc} */
+    public RemoteIterator getProperties(String[] globs)
+            throws RepositoryException, RemoteException {
+        try {
+            return getFactory().getRemotePropertyIterator(node.getProperties(globs));
+        } catch (RepositoryException ex) {
+            throw getRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
     public RemoteIterator getReferences()
             throws RepositoryException, RemoteException {
         try {
@@ -134,6 +144,16 @@
     }
 
     /** {@inheritDoc} */
+    public RemoteIterator getReferences(String name)
+            throws RepositoryException, RemoteException {
+        try {
+            return getFactory().getRemotePropertyIterator(node.getReferences(name));
+        } catch (RepositoryException ex) {
+            throw getRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
     public String getIdentifier() throws RepositoryException, RemoteException {
         try {
             return node.getIdentifier();
@@ -230,6 +250,16 @@
     }
 
     /** {@inheritDoc} */
+    public RemoteIterator getNodes(String[] globs)
+            throws RepositoryException, RemoteException {
+        try {
+            return getFactory().getRemoteNodeIterator(node.getNodes(globs));
+        } catch (RepositoryException ex) {
+            throw getRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
     public RemoteNode getNode(String path)
             throws RepositoryException, RemoteException {
         try {

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java?rev=896374&r1=896373&r2=896374&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/server/ServerSession.java
Wed Jan  6 10:43:27 2010
@@ -20,7 +20,6 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.rmi.RemoteException;
-import java.security.AccessControlException;
 
 import javax.jcr.Credentials;
 import javax.jcr.RepositoryException;
@@ -105,9 +104,9 @@
     }
 
     /** {@inheritDoc} */
-    public void checkPermission(String path, String actions)
-            throws AccessControlException, RepositoryException, RemoteException {
-        session.checkPermission(path, actions);
+    public boolean hasPermission(String path, String actions)
+            throws RepositoryException, RemoteException {
+        return session.hasPermission(path, actions);
     }
 
     /** {@inheritDoc} */

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/DecimalValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/DecimalValue.java?rev=896374&r1=896373&r2=896374&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/DecimalValue.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/DecimalValue.java
Wed Jan  6 10:43:27 2010
@@ -20,6 +20,7 @@
 import java.util.Calendar;
 
 import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
 import javax.jcr.ValueFormatException;
 
 /**
@@ -63,6 +64,11 @@
         return date;
     }
 
+    @Override
+    public BigDecimal getDecimal() throws RepositoryException {
+        return value;
+    }
+
     /**
      * The decimal is converted using {@link BigDecimal#longValue()}.
      */



Mime
View raw message