jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1225492 - in /jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit: NodeImpl.java PropertyImpl.java
Date Thu, 29 Dec 2011 10:54:52 GMT
Author: mduerig
Date: Thu Dec 29 10:54:52 2011
New Revision: 1225492

URL: http://svn.apache.org/viewvc?rev=1225492&view=rev
Log:
Microkernel based prototype of JCR implementation (WIP)
- minor improvements

Modified:
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/PropertyImpl.java

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java?rev=1225492&r1=1225491&r2=1225492&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/NodeImpl.java
Thu Dec 29 10:54:52 2011
@@ -86,7 +86,7 @@ public class NodeImpl extends ItemImpl i
 
     @Override
     public String getName() throws RepositoryException {
-        return path().getName();
+        return nodeState.getName();
     }
 
     @Override
@@ -219,6 +219,7 @@ public class NodeImpl extends ItemImpl i
         return setProperty(name, values);
     }
 
+    // todo json encode values without prior conversion to JCR values
     @Override
     public Property setProperty(String name, String value) throws RepositoryException {
         ValueFactory valueFactory = sessionContext.getValueFactory();

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/PropertyImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/PropertyImpl.java?rev=1225492&r1=1225491&r2=1225492&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/PropertyImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/PropertyImpl.java
Thu Dec 29 10:54:52 2011
@@ -146,13 +146,15 @@ public class PropertyImpl extends ItemIm
 
     @Override
     public void setValue(Value[] values) throws RepositoryException {
-        int type = values.length == 0
-            ? PropertyType.STRING
-            : values[0].getType();
-
-        parentState.setProperty(name, ValueConverter.toJsonValue(values));
+        if (value == null) {
+            remove();
+        }
+        else {
+            parentState.setProperty(name, ValueConverter.toJsonValue(values));
+        }
     }
 
+    // todo json encode values without prior conversion to JCR values
     @Override
     public void setValue(String value) throws RepositoryException {
         if (value == null) {
@@ -166,12 +168,17 @@ public class PropertyImpl extends ItemIm
 
     @Override
     public void setValue(String[] stringValues) throws RepositoryException {
-        ValueFactory valueFactory = sessionContext.getValueFactory();
-        Value[] values = new Value[stringValues.length];
-        for (int k = 0; k < values.length; k++) {
-            values[k] = valueFactory.createValue(stringValues[k]);
+        if (value == null) {
+            remove();
+        }
+        else {
+            ValueFactory valueFactory = sessionContext.getValueFactory();
+            Value[] values = new Value[stringValues.length];
+            for (int k = 0; k < values.length; k++) {
+                values[k] = valueFactory.createValue(stringValues[k]);
+            }
+            setValue(values);
         }
-        setValue(values);
     }
 
     @Override



Mime
View raw message