jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r896184 - 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 Tue, 05 Jan 2010 19:16:06 GMT
Author: jukka
Date: Tue Jan  5 19:16:05 2010
New Revision: 896184

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

Implement a few 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/SerialValueFactory.java

Modified: jackrabbit/commons/jcr-rmi/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/pom.xml?rev=896184&r1=896183&r2=896184&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/pom.xml (original)
+++ jackrabbit/commons/jcr-rmi/trunk/pom.xml Tue Jan  5 19:16:05 2010
@@ -114,13 +114,11 @@
                 testAnd
                 testAnd
                 testAutocreatedRootVersion
-                testAutomaticNewLocalPrefix
                 testBaseVersionAfterCheckin
                 testBaseVersionAfterCheckinJcr2
                 testBinaryLength
                 testBinaryLiteral
                 testBinaryLiteral
-                testBinaryParentJcr2
                 testBindVariableNames
                 testBindVariableValue
                 testBoolean
@@ -197,8 +195,6 @@
                 testCreateConfigWithBaseline
                 testCreateConfigWithExistentConfigFromBaselineFails
                 testCreateConfigWithNonExistentParentFails
-                testCreateMultiplePathValue
-                testCreatePathValue
                 testCreateQuery
                 testCreateQueryFromSource
                 testCreateQueryFromSourceWithConstraint
@@ -272,7 +268,6 @@
                 testExpandColumnsForNodeType
                 testExpandedNameValue
                 testExpandedNameValueProperty
-                testExtendedNameBasedPathValue
                 testFailIfCorrespondingNodeIsSuccessor
                 testFailIfCorrespondingNodeIsSuccessorJcr2
                 testFollowLifecycleTransition
@@ -313,7 +308,6 @@
                 testGetIdentifier
                 testGetIndex
                 testGetIndex
-                testGetItem
                 testGetLanguage
                 testGetLinearPredecessorSuccessor
                 testGetLock
@@ -341,7 +335,6 @@
                 testGetNode
                 testGetNode
                 testGetNode
-                testGetNodeByIdentifier
                 testGetNodeOnLockObtainedFromChild
                 testGetNodeOnLockObtainedFromNewChild
                 testGetNodes
@@ -368,12 +361,6 @@
                 testGetProperty
                 testGetProperty
                 testGetProperty
-                testGetProperty
-                testGetProperty
-                testGetProperty
-                testGetProperty
-                testGetProperty
-                testGetProperty
                 testGetPropertyNames
                 testGetQuery
                 testGetReferences
@@ -434,7 +421,6 @@
                 testHoldsLockNewChild
                 testHoldsLockNewChild
                 testHoldsLockNewChild
-                testIdentifierBasedPropertyValue
                 testIllegalArgumentException
                 testImplicitUnlock
                 testImplicitUnlock2
@@ -492,7 +478,6 @@
                 testIsLockOwningSession
                 testIsModified
                 testIsModified
-                testIsMultiple
                 testIsNew
                 testIsNew
                 testIsNode
@@ -506,7 +491,6 @@
                 testIsSame
                 testIsSame
                 testIsSameJcr2
-                testIsSameMustNotCompareStates
                 testIsSessionScoped
                 testIsSessionScoped
                 testIsSessionScoped
@@ -672,7 +656,6 @@
                 testNotAssigned
                 testNotEqualTo
                 testNotEqualTo
-                testNotNormalizedPathValue
                 testNullOwnerHint
                 testOr
                 testOr
@@ -740,17 +723,10 @@
                 testRemovableProperty
                 testRemove
                 testRemove
-                testRemoveCheckedInItem
                 testRemoveDecimalPropertySession
                 testRemoveDoubleSession
-                testRemoveItem
-                testRemoveItem2
-                testRemoveItem3
-                testRemoveItem4
                 testRemoveLabel
                 testRemoveLockedChild
-                testRemoveLockedChildItem
-                testRemoveLockedNode
                 testRemoveLockToken
                 testRemoveLockToken2
                 testRemoveLockToken3
@@ -992,7 +968,6 @@
                 testURILiteral
                 testUserData
                 testUUID
-                testUUID
                 testValueFormatException
                 testVersioning
                 testVersioningExceptionFileChildSessionContentHandler

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=896184&r1=896183&r2=896184&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
Tue Jan  5 19:16:05 2010
@@ -228,6 +228,28 @@
     }
 
     /** {@inheritDoc} */
+    public Property setProperty(String name, Binary value)
+            throws RepositoryException {
+        if (value == null) {
+            return setProperty(name, (Value) null);
+        } else {
+            return setProperty(
+                    name, getSession().getValueFactory().createValue(value));
+        }
+    }
+
+    /** {@inheritDoc} */
+    public Property setProperty(String name, BigDecimal value)
+            throws RepositoryException {
+        if (value == null) {
+            return setProperty(name, (Value) null);
+        } else {
+            return setProperty(
+                    name, getSession().getValueFactory().createValue(value));
+        }
+    }
+
+    /** {@inheritDoc} */
     public Node getNode(String path) throws RepositoryException {
         try {
             return getNode(getSession(), remote.getNode(path));
@@ -293,6 +315,15 @@
     }
 
     /** {@inheritDoc} */
+    public String getIdentifier() throws RepositoryException {
+        try {
+            return remote.getIdentifier();
+        } catch (RemoteException ex) {
+            throw new RemoteRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
     public String getUUID() throws RepositoryException {
         try {
             return remote.getUUID();
@@ -670,10 +701,6 @@
         throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
     }
 
-    public String getIdentifier() throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
     public NodeIterator getNodes(String[] nameGlobs) throws RepositoryException {
         throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
     }
@@ -714,14 +741,4 @@
         throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
     }
 
-    public Property setProperty(String name, Binary value)
-            throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
-    public Property setProperty(String name, BigDecimal value)
-            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=896184&r1=896183&r2=896184&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
Tue Jan  5 19:16:05 2010
@@ -25,12 +25,13 @@
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.ItemVisitor;
 import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
 import javax.jcr.Property;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.Value;
+import javax.jcr.ValueFactory;
 import javax.jcr.ValueFormatException;
 import javax.jcr.nodetype.PropertyDefinition;
 
@@ -118,10 +119,31 @@
 
     /**
      * Returns the binary value of this property. Implemented as
+     * getValue().getBinary().
+     *
+     * {@inheritDoc}
+     */
+    public Binary getBinary() throws RepositoryException {
+        return getValue().getBinary();
+    }
+
+    /**
+     * Returns the decimal value of this property. Implemented as
+     * getValue().getDecimal().
+     *
+     * {@inheritDoc}
+     */
+    public BigDecimal getDecimal() throws RepositoryException {
+        return getValue().getDecimal();
+    }
+
+    /**
+     * Returns the binary value of this property. Implemented as
      * getValue().getStream().
      *
      * {@inheritDoc}
      */
+    @SuppressWarnings("deprecation")
     public InputStream getStream() throws RepositoryException {
         return getValue().getStream();
     }
@@ -198,7 +220,13 @@
         if (value == null) {
             setValue((Value) null);
         } else {
-            setValue(getSession().getValueFactory().createValue(value));
+            ValueFactory factory = getSession().getValueFactory();
+            Binary binary = factory.createBinary(value);
+            try {
+                setValue(factory.createValue(binary));
+            } finally {
+                binary.dispose();
+            }
         }
     }
 
@@ -213,6 +241,25 @@
     }
 
     /**
+     * Sets the binary value of this property.
+     *
+     * {@inheritDoc}
+     */
+    public void setValue(Binary value) throws RepositoryException {
+        setValue(getSession().getValueFactory().createValue(value));
+    }
+
+    /**
+     * Sets the decimal value of this property.
+     *
+     * {@inheritDoc}
+     */
+    public void setValue(BigDecimal value) throws RepositoryException {
+        setValue(getSession().getValueFactory().createValue(value));
+    }
+
+
+    /**
      * Sets the reference value of this property. Implemented as
      * setValue(new ReferenceValue(value)).
      *
@@ -287,16 +334,42 @@
      * {@inheritDoc}
      */
     public Node getNode() throws RepositoryException {
-        String uuid = getString();
+        String value = getString();
         try {
-            return getSession().getNodeByUUID(uuid);
+            if (getType() != PropertyType.PATH) {
+                return getSession().getNodeByIdentifier(value);
+            } else if (value.startsWith("/")) {
+                return getSession().getNode(value);
+            } 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
                     || getType() == PropertyType.REFERENCE) {
                 throw e;
             } else {
-                throw new ValueFormatException("Invalid UUID: " + uuid, e);
+                throw new ValueFormatException("Invalid identifier: " + value, e);
+            }
+        }
+    }
+
+    /** {@inheritDoc} */
+    public Property getProperty() throws RepositoryException {
+        if (getType() != PropertyType.PATH) {
+            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);
             }
         }
     }
@@ -337,28 +410,10 @@
         }
     }
 
-    public Binary getBinary() throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
-    public BigDecimal getDecimal() throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
-    public Property getProperty() throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
+    /** {@inheritDoc} */
     public boolean isMultiple() throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
-    public void setValue(Binary value) throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
-    public void setValue(BigDecimal value) throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
+        // TODO: Direct remote call for this?
+        return getDefinition().isMultiple();
     }
 
 }

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=896184&r1=896183&r2=896184&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
Tue Jan  5 19:16:05 2010
@@ -179,6 +179,15 @@
     }
 
     /** {@inheritDoc} */
+    public Node getNodeByIdentifier(String id) throws RepositoryException {
+        try {
+            return getNode(this, remote.getNodeByIdentifier(id));
+        } catch (RemoteException ex) {
+            throw new RemoteRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
     public Node getNodeByUUID(String uuid) throws RepositoryException {
         try {
             return getNode(this, remote.getNodeByUUID(uuid));
@@ -197,6 +206,24 @@
     }
 
     /** {@inheritDoc} */
+    public Node getNode(String path) throws RepositoryException {
+        try {
+            return getNode(this, remote.getNode(path));
+        } catch (RemoteException ex) {
+            throw new RemoteRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public Property getProperty(String path) throws RepositoryException {
+        try {
+            return (Property) getItem(this, remote.getProperty(path));
+        } catch (RemoteException ex) {
+            throw new RemoteRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
     public boolean itemExists(String path) throws RepositoryException {
         try {
             return remote.itemExists(path);
@@ -206,6 +233,33 @@
     }
 
     /** {@inheritDoc} */
+    public boolean nodeExists(String path) throws RepositoryException {
+        try {
+            return remote.nodeExists(path);
+        } catch (RemoteException ex) {
+            throw new RemoteRuntimeException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public boolean propertyExists(String path) throws RepositoryException {
+        try {
+            return remote.propertyExists(path);
+        } catch (RemoteException ex) {
+            throw new RemoteRuntimeException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public void removeItem(String path) throws RepositoryException {
+        try {
+            remote.removeItem(path);
+        } catch (RemoteException ex) {
+            throw new RemoteRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
     public void move(String from, String to) throws RepositoryException {
         try {
             remote.move(from, to);
@@ -504,18 +558,6 @@
         throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
     }
 
-    public Node getNode(String absPath) throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
-    public Node getNodeByIdentifier(String id) throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
-    public Property getProperty(String absPath) throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
     public RetentionManager getRetentionManager()
             throws RepositoryException {
         throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
@@ -531,15 +573,4 @@
         throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
     }
 
-    public boolean nodeExists(String absPath) throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
-    public boolean propertyExists(String absPath) throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("TODO: JCRRMI-26");
-    }
-
-    public void removeItem(String absPath) 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=896184&r1=896183&r2=896184&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
Tue Jan  5 19:16:05 2010
@@ -124,6 +124,16 @@
 
     /**
      * Remote version of the
+     * {@link javax.jcr.Node#getIdentifier() Node.getIdentifier()} method.
+     *
+     * @return node identifier
+     * @throws RepositoryException on repository errors
+     * @throws RemoteException on RMI errors
+     */
+    String getIdentifier() throws RepositoryException, RemoteException;
+
+    /**
+     * Remote version of the
      * {@link javax.jcr.Node#getUUID() Node.getUUID()} method.
      *
      * @return node uuid

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=896184&r1=896183&r2=896184&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
Tue Jan  5 19:16:05 2010
@@ -105,6 +105,19 @@
 
     /**
      * Remote version of the
+     * {@link javax.jcr.Session#getNodeByIdentifier(String) Session.getNodeByIdentifier(String)}
+     * method.
+     *
+     * @param id node identifier
+     * @return node
+     * @throws RepositoryException on repository errors
+     * @throws RemoteException on RMI errors
+     */
+    RemoteNode getNodeByIdentifier(String id)
+            throws RepositoryException, RemoteException;
+
+    /**
+     * Remote version of the
      * {@link javax.jcr.Session#getNodeByUUID(String) Session.getNodeByUUID(String)}
      * method.
      *
@@ -130,6 +143,30 @@
 
     /**
      * Remote version of the
+     * {@link javax.jcr.Session#getNode(String) Session.getNode(String)}
+     * method.
+     *
+     * @param path node path
+     * @return node
+     * @throws RepositoryException on repository errors
+     * @throws RemoteException on RMI errors
+     */
+    RemoteNode getNode(String path) throws RepositoryException, RemoteException;
+
+    /**
+     * Remote version of the
+     * {@link javax.jcr.Session#getProperty(String) Session.getProperty(String)}
+     * method.
+     *
+     * @param path property path
+     * @return property
+     * @throws RepositoryException on repository errors
+     * @throws RemoteException on RMI errors
+     */
+    RemoteProperty getProperty(String path) throws RepositoryException, RemoteException;
+
+    /**
+     * Remote version of the
      * {@link javax.jcr.Session#itemExists(String) Session.itemExists(String)}
      * method.
      *
@@ -143,6 +180,43 @@
 
     /**
      * Remote version of the
+     * {@link javax.jcr.Session#nodeExists(String) Session.nodeExists(String)}
+     * method.
+     *
+     * @param path node path
+     * @return <code>true</code> if the node exists,
+     *         <code>false</code> otherwise
+     * @throws RepositoryException on repository exception
+     * @throws RemoteException on RMI errors
+     */
+    boolean nodeExists(String path) throws RepositoryException, RemoteException;
+
+    /**
+     * Remote version of the
+     * {@link javax.jcr.Session#propertyExists(String) Session.propertyExists(String)}
+     * method.
+     *
+     * @param path property path
+     * @return <code>true</code> if the property exists,
+     *         <code>false</code> otherwise
+     * @throws RepositoryException on repository exception
+     * @throws RemoteException on RMI errors
+     */
+    boolean propertyExists(String path) throws RepositoryException, RemoteException;
+
+    /**
+     * Remote version of the
+     * {@link javax.jcr.Session#removeItem(String) Session.removeItem(String)}
+     * method.
+     *
+     * @param path item path
+     * @throws RepositoryException on repository errors
+     * @throws RemoteException on RMI errors
+     */
+    void removeItem(String path) throws RepositoryException, RemoteException;
+
+    /**
+     * Remote version of the
      * {@link javax.jcr.Session#move(String,String) Session.move(String,String)}
      * method.
      *

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=896184&r1=896183&r2=896184&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
Tue Jan  5 19:16:05 2010
@@ -134,6 +134,16 @@
     }
 
     /** {@inheritDoc} */
+    public String getIdentifier() throws RepositoryException, RemoteException {
+        try {
+            return node.getIdentifier();
+        } catch (RepositoryException ex) {
+            throw getRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("deprecation")
     public String getUUID() throws RepositoryException, RemoteException {
         try {
             return node.getUUID();

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=896184&r1=896183&r2=896184&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
Tue Jan  5 19:16:05 2010
@@ -28,6 +28,7 @@
 
 import org.apache.jackrabbit.rmi.remote.RemoteItem;
 import org.apache.jackrabbit.rmi.remote.RemoteNode;
+import org.apache.jackrabbit.rmi.remote.RemoteProperty;
 import org.apache.jackrabbit.rmi.remote.RemoteSession;
 import org.apache.jackrabbit.rmi.remote.RemoteWorkspace;
 
@@ -155,6 +156,27 @@
     }
 
     /** {@inheritDoc} */
+    public boolean nodeExists(String path) throws RepositoryException, RemoteException {
+        return session.nodeExists(path);
+    }
+
+    /** {@inheritDoc} */
+    public boolean propertyExists(String path) throws RepositoryException, RemoteException
{
+        return session.propertyExists(path);
+    }
+
+    /** {@inheritDoc} */
+    public RemoteNode getNodeByIdentifier(String id)
+            throws RepositoryException, RemoteException {
+        try {
+            return getRemoteNode(session.getNodeByIdentifier(id));
+        } catch (RepositoryException ex) {
+            throw getRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @SuppressWarnings("deprecation")
     public RemoteNode getNodeByUUID(String uuid)
             throws RepositoryException, RemoteException {
         try {
@@ -185,6 +207,26 @@
     }
 
     /** {@inheritDoc} */
+    public RemoteNode getNode(String path)
+            throws RepositoryException, RemoteException {
+        try {
+            return getRemoteNode(session.getNode(path));
+        } catch (RepositoryException ex) {
+            throw getRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
+    public RemoteProperty getProperty(String path)
+            throws RepositoryException, RemoteException {
+        try {
+            return (RemoteProperty) getRemoteItem(session.getProperty(path));
+        } catch (RepositoryException ex) {
+            throw getRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
     public boolean hasPendingChanges()
             throws RepositoryException, RemoteException {
         try {
@@ -195,6 +237,16 @@
     }
 
     /** {@inheritDoc} */
+    public void removeItem(String path)
+            throws RepositoryException, RemoteException {
+        try {
+            session.removeItem(path);
+        } catch (RepositoryException ex) {
+            throw getRepositoryException(ex);
+        }
+    }
+
+    /** {@inheritDoc} */
     public void move(String from, String to)
             throws RepositoryException, RemoteException {
         try {

Modified: jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/SerialValueFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/SerialValueFactory.java?rev=896184&r1=896183&r2=896184&view=diff
==============================================================================
--- jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/SerialValueFactory.java
(original)
+++ jackrabbit/commons/jcr-rmi/trunk/src/main/java/org/apache/jackrabbit/rmi/value/SerialValueFactory.java
Tue Jan  5 19:16:05 2010
@@ -172,6 +172,8 @@
             return new BooleanValue(value.getBoolean());
         case PropertyType.DATE:
             return new DateValue(value.getDate());
+        case PropertyType.DECIMAL:
+            return new DecimalValue(value.getDecimal());
         case PropertyType.DOUBLE:
             return new DoubleValue(value.getDouble());
         case PropertyType.LONG:
@@ -206,7 +208,7 @@
 
     /** {@inheritDoc} */
     public Value createValue(BigDecimal value) {
-        return null;
+        return new DecimalValue(value);
     }
 
     /** {@inheritDoc} */
@@ -228,22 +230,27 @@
         return createValue(value.getUUID(), PropertyType.REFERENCE);
     }
 
-    //---------- API to overwrite to use extended classes ----------------------
-
     public Binary createBinary(InputStream stream) throws RepositoryException {
-        // TODO Auto-generated method stub
-        return null;
+        try {
+            return new BinaryValue(stream).getBinary();
+        } catch (IOException e) {
+            throw new RepositoryException("Unable to read binary stream", e);
+        }
     }
 
     public Value createValue(Binary value) {
-        // TODO Auto-generated method stub
-        return null;
+        try {
+            return new BinaryValue(value.getStream());
+        } catch (IOException e) {
+            throw new RuntimeException("Unable to read binary stream", e);
+        } catch (RepositoryException e) {
+            throw new RuntimeException("Unable to create binary stream", e);
+        }
     }
 
     public Value createValue(Node value, boolean weak)
             throws RepositoryException {
-        // TODO Auto-generated method stub
-        return null;
+        return new ReferenceValue(value.getUUID());
     }
 
 }



Mime
View raw message