jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r773857 - /jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Date Tue, 12 May 2009 11:10:50 GMT
Author: angela
Date: Tue May 12 11:10:50 2009
New Revision: 773857

URL: http://svn.apache.org/viewvc?rev=773857&view=rev
Log:
JCR-2003: Add support for JCR 2.0

- new setProperty methods
- reorder methods

Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?rev=773857&r1=773856&r2=773857&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Tue May 12 11:10:50 2009
@@ -342,6 +342,15 @@
     }
 
     /**
+     * @see javax.jcr.Node#setProperty(String, Binary)
+     */
+    public Property setProperty(String name, Binary value) throws RepositoryException {
+        // validation performed in subsequent method
+        Value v = (value == null ? null : session.getValueFactory().createValue(value));
+        return setProperty(name, v, PropertyType.BINARY);
+    }
+
+    /**
      * @see Node#setProperty(String, boolean)
      */
     public Property setProperty(String name, boolean value) throws ValueFormatException,
VersionException, LockException, ConstraintViolationException, RepositoryException {
@@ -358,6 +367,15 @@
     }
 
     /**
+     * @see javax.jcr.Node#setProperty(String, BigDecimal)
+     */
+    public Property setProperty(String name, BigDecimal value) throws RepositoryException
{
+        // validation performed in subsequent method
+        Value v = (value == null ? null : session.getValueFactory().createValue(value));
+        return setProperty(name, v, PropertyType.DECIMAL);
+    }
+
+    /**
      * @see Node#setProperty(String, long)
      */
     public Property setProperty(String name, long value) throws ValueFormatException, VersionException,
LockException, ConstraintViolationException, RepositoryException {
@@ -433,12 +451,23 @@
     public NodeIterator getNodes(String namePattern) throws RepositoryException {
         checkStatus();
         ArrayList nodes = new ArrayList();
-        // traverse children using a special filtering 'collector'
+        // traverse children using a special filtering item visitor
         accept(new ChildrenCollectorFilter(namePattern, nodes, true, false, 1));
         return new NodeIteratorAdapter(nodes);
     }
 
     /**
+     * @see javax.jcr.Node#getNodes(String[])
+     */
+    public NodeIterator getNodes(String[] nameGlobs) throws RepositoryException {
+        checkStatus();
+        List nodes = new ArrayList();
+        // traverse child nodes using a filtering item visitor
+        accept(new ChildrenCollectorFilter(nameGlobs, nodes, true, false, 1));
+        return new NodeIteratorAdapter(nodes);
+    }
+
+    /**
      * @see Node#getProperty(String)
      */
     public Property getProperty(String relPath) throws PathNotFoundException, RepositoryException
{
@@ -480,12 +509,24 @@
     public PropertyIterator getProperties(String namePattern) throws RepositoryException
{
         checkStatus();
         ArrayList properties = new ArrayList();
-        // traverse children using a special filtering 'collector'
+        // traverse children using a filtering item visitor
         accept(new ChildrenCollectorFilter(namePattern, properties, false, true, 1));
         return new PropertyIteratorAdapter(properties);
     }
 
     /**
+     * TODO: method name is wrong! should be getProperties (Issue 736 of the pfd)
+     * @see javax.jcr.Node#getProperty(String)
+     */
+    public PropertyIterator getProperty(String[] nameGlobs) throws RepositoryException {
+        checkStatus();
+        List properties = new ArrayList();
+        // traverse child properties using a filtering item visitor
+        accept(new ChildrenCollectorFilter(nameGlobs, properties, true, false, 1));
+        return new PropertyIteratorAdapter(properties);
+    }
+
+    /**
      * @see Node#getPrimaryItem()
      */
     public Item getPrimaryItem() throws ItemNotFoundException, RepositoryException {
@@ -517,6 +558,15 @@
     }
 
     /**
+     * @see Node#getIdentifier()
+     */
+    public String getIdentifier() throws RepositoryException {
+        checkStatus();
+        // TODO: check again and add SPI method to create Node-Identifier from String
+        return getNodeEntry().getId().toString();
+    }
+
+    /**
      * @see Node#getIndex()
      */
     public int getIndex() throws RepositoryException {
@@ -536,6 +586,45 @@
     }
 
     /**
+     * @see javax.jcr.Node#getReferences(String)
+     */
+    public PropertyIterator getReferences(String name) throws RepositoryException {
+        checkStatus();
+        List refs = Arrays.asList(getNodeState().getNodeReferences());
+        if (name != null) {
+            // remove property ids that don't match the given name
+            Name qName = getQName(name);
+            refs = new ArrayList(refs);
+            for (Iterator iter = refs.iterator(); iter.hasNext();) {
+                PropertyId propId = (PropertyId) iter.next();
+                if (!propId.getName().equals(qName)) {
+                    refs.remove(propId);
+                }
+            }
+        } // else: name == null -> return all references
+
+        // create an property iterator for all or the matching property ids
+        // according to the specified name.
+        return new LazyItemIterator(getItemManager(), session.getHierarchyManager(), refs.iterator());
+    }
+
+    /**
+     * @see javax.jcr.Node#getWeakReferences()
+     */
+    public PropertyIterator getWeakReferences() throws RepositoryException {
+        // TODO: implementation missing
+        throw new UnsupportedRepositoryOperationException("JCR-1104");
+    }
+
+    /**
+     * @see javax.jcr.Node#getWeakReferences()
+     */
+    public PropertyIterator getWeakReferences(String name) throws RepositoryException {
+        // TODO: implementation missing
+        throw new UnsupportedRepositoryOperationException("JCR-1104");
+    }
+
+    /**
      * @see Node#hasNode(String)
      */
     public boolean hasNode(String relPath) throws RepositoryException {
@@ -590,6 +679,14 @@
     }
 
     /**
+     * @see javax.jcr.Node#setPrimaryType(String)
+     */
+    public void setPrimaryType(String nodeTypeName) throws RepositoryException {
+        // TODO: implementation missing
+        throw new UnsupportedRepositoryOperationException("JCR-1104");
+    }
+
+    /**
      * @see Node#getMixinNodeTypes()
      */
     public NodeType[] getMixinNodeTypes() throws RepositoryException {
@@ -1160,15 +1257,6 @@
         // lock can be inherited from a parent > do not check for node being lockable.
         checkStatus();
         return session.getLockStateManager().isLocked(getNodeState());
-    }         
-
-    /**
-     * @see Node#getIdentifier()
-     */
-    public String getIdentifier() throws RepositoryException {
-        checkStatus();
-        // TODO: check again and add SPI method to create Node-Identifier from String
-        return getNodeEntry().getId().toString();
     }
 
     /**
@@ -1188,68 +1276,6 @@
     }
 
     /**
-     * @see javax.jcr.Node#getNodes(String[])
-     */
-    public NodeIterator getNodes(String[] nameGlobs) throws RepositoryException {
-        checkStatus();
-        List nodes = new ArrayList();
-        // traverse child nodes using a filtering collector
-        accept(new ChildrenCollectorFilter(nameGlobs, nodes, true, false, 1));
-        return new NodeIteratorAdapter(nodes);
-    }
-
-    /**
-     * TODO: method name is wrong! should be getProperties (Issue 736 of the pfd)
-     * @see javax.jcr.Node#getProperty(String)
-     */
-    public PropertyIterator getProperty(String[] nameGlobs) throws RepositoryException {
-        checkStatus();
-        List properties = new ArrayList();
-        // traverse child properties using a filtering collector
-        accept(new ChildrenCollectorFilter(nameGlobs, properties, true, false, 1));
-        return new PropertyIteratorAdapter(properties);
-    }
-
-    /**
-     * @see javax.jcr.Node#getReferences(String)
-     */
-    public PropertyIterator getReferences(String name) throws RepositoryException {
-        checkStatus();
-        List refs = Arrays.asList(getNodeState().getNodeReferences());
-        if (name != null) {
-            // remove property ids that don't match the given name
-            Name qName = getQName(name);
-            refs = new ArrayList(refs);
-            for (Iterator iter = refs.iterator(); iter.hasNext();) {
-                PropertyId propId = (PropertyId) iter.next();
-                if (!propId.getName().equals(qName)) {
-                    refs.remove(propId);
-                }
-            }
-        } // else: name == null -> return all references
-
-        // create an property iterator for all or the matching property ids
-        // according to the specified name.
-        return new LazyItemIterator(getItemManager(), session.getHierarchyManager(), refs.iterator());
-    }
-
-    /**
-     * @see javax.jcr.Node#getWeakReferences()
-     */
-    public PropertyIterator getWeakReferences() throws RepositoryException {
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
-    }
-
-    /**
-     * @see javax.jcr.Node#getWeakReferences()
-     */
-    public PropertyIterator getWeakReferences(String name) throws RepositoryException {
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
-    }
-
-    /**
      * @see javax.jcr.Node#getSharedSet()
      */
     public NodeIterator getSharedSet() throws RepositoryException {
@@ -1272,30 +1298,6 @@
         throw new UnsupportedRepositoryOperationException("JCR-1104");
     }
 
-    /**
-     * @see javax.jcr.Node#setPrimaryType(String)
-     */
-    public void setPrimaryType(String nodeTypeName) throws RepositoryException {
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
-    }
-
-    /**
-     * @see javax.jcr.Node#setProperty(String, Binary)
-     */
-    public Property setProperty(String name, Binary value) throws RepositoryException {
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
-    }
-
-    /**
-     * @see javax.jcr.Node#setProperty(String, BigDecimal)
-     */
-    public Property setProperty(String name, BigDecimal value) throws RepositoryException
{
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
-    }
-
     //--------------------------------------------------------< public impl >---
     /**
      *



Mime
View raw message