directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szoer...@apache.org
Subject svn commit: r714050 - in /directory/sandbox/szoerner/syspropPartition/src: main/java/org/apache/directory/samples/partition/sysprops/backend/ test/java/org/apache/directory/samples/partition/sysprops/backend/
Date Fri, 14 Nov 2008 16:00:28 GMT
Author: szoerner
Date: Fri Nov 14 08:00:27 2008
New Revision: 714050

URL: http://svn.apache.org/viewvc?rev=714050&view=rev
Log:
minor changes in documentation

Added:
    directory/sandbox/szoerner/syspropPartition/src/test/java/org/apache/directory/samples/partition/sysprops/backend/SystemPropertyGeneratorTest.java
Modified:
    directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/PropertyNode.java
    directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/PropertyStorage.java
    directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/SystemPropertyGenerator.java
    directory/sandbox/szoerner/syspropPartition/src/test/java/org/apache/directory/samples/partition/sysprops/backend/PropertyStorageTest.java

Modified: directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/PropertyNode.java
URL: http://svn.apache.org/viewvc/directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/PropertyNode.java?rev=714050&r1=714049&r2=714050&view=diff
==============================================================================
--- directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/PropertyNode.java
(original)
+++ directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/PropertyNode.java
Fri Nov 14 08:00:27 2008
@@ -3,6 +3,9 @@
 import java.util.ArrayList;
 import java.util.List;
 
+/**
+ * A node in the property storage tree. It holds the children.
+ */
 public class PropertyNode {
 
     public PropertyNode() {
@@ -10,10 +13,10 @@
     }
 
     public PropertyNode(String name, String key, String value) {
+        this();
         this.name = name;
         this.key = key;
         this.value = value;
-        this.children = new ArrayList<PropertyNode>();
     }
 
     public PropertyNode(String name, String key) {

Modified: directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/PropertyStorage.java
URL: http://svn.apache.org/viewvc/directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/PropertyStorage.java?rev=714050&r1=714049&r2=714050&view=diff
==============================================================================
--- directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/PropertyStorage.java
(original)
+++ directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/PropertyStorage.java
Fri Nov 14 08:00:27 2008
@@ -2,28 +2,47 @@
 
 import java.util.Iterator;
 
-
+/**
+ * A datastructure which stores properties in a tree. It does only provide the
+ * addition and lookup of values. For simplicity, modification, deletion etc. is
+ * not implemented.
+ */
 public class PropertyStorage {
 
-    PropertyNode root = new PropertyNode();
+    private PropertyNode root = new PropertyNode();
 
+    /**
+     * Add a property with value.
+     * 
+     * @param property name of the property in dot notation
+     * @param value value of the property
+     */
     public final void addProperty(String property, String value) {
         this.addProperty(property, value, null);
     }
-    
-    public final void addProperty(String property, String value, String description) {
+
+    /**
+     * Add a property with value and description.
+     * 
+     * @param property name of the property in dot notation
+     * @param value value of the property
+     * @param description description, or null
+     */
+    public final void addProperty(String property, String value,
+            String description) {
         PropertyNode node = ensureNodeExists(property);
         node.setValue(value);
         if (description != null) {
             node.setDescription(description);
         }
     }
-    
+
     /**
-     * Finds a propertyNode fpr a given property, or creates one if necessary
+     * Finds a propertyNode for a given property, or creates one if necessary
      * 
-     * @param property a property in dot notation
-     * @return the property node for the given proverty
+     * @param property
+     *            a property in dot notation
+     * @return the property node for the given property
      */
     PropertyNode ensureNodeExists(String property) {
 
@@ -55,7 +74,7 @@
         return current;
     }
 
-    public PropertyNode getRoot() {
+    public final PropertyNode getRoot() {
         return root;
     }
 
@@ -63,6 +82,13 @@
         return findByKey(this.getRoot(), key);
     }
 
+    /**
+     * Searches a property node in the tree recursivly.
+     * 
+     * @param node starting point
+     * @param key 
+     * @return the node, or null if not found
+     */
     PropertyNode findByKey(PropertyNode node, String key) {
         PropertyNode result = null;
 
@@ -77,5 +103,4 @@
         return result;
     }
 
-
 }

Modified: directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/SystemPropertyGenerator.java
URL: http://svn.apache.org/viewvc/directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/SystemPropertyGenerator.java?rev=714050&r1=714049&r2=714050&view=diff
==============================================================================
--- directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/SystemPropertyGenerator.java
(original)
+++ directory/sandbox/szoerner/syspropPartition/src/main/java/org/apache/directory/samples/partition/sysprops/backend/SystemPropertyGenerator.java
Fri Nov 14 08:00:27 2008
@@ -5,7 +5,7 @@
 import java.util.TreeSet;
 
 /**
- * A tool class to fill zhe System properties into a property storage 
+ * A tool class to fill the System properties into a property storage 
  */
 public class SystemPropertyGenerator {
 

Modified: directory/sandbox/szoerner/syspropPartition/src/test/java/org/apache/directory/samples/partition/sysprops/backend/PropertyStorageTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/szoerner/syspropPartition/src/test/java/org/apache/directory/samples/partition/sysprops/backend/PropertyStorageTest.java?rev=714050&r1=714049&r2=714050&view=diff
==============================================================================
--- directory/sandbox/szoerner/syspropPartition/src/test/java/org/apache/directory/samples/partition/sysprops/backend/PropertyStorageTest.java
(original)
+++ directory/sandbox/szoerner/syspropPartition/src/test/java/org/apache/directory/samples/partition/sysprops/backend/PropertyStorageTest.java
Fri Nov 14 08:00:27 2008
@@ -6,62 +6,58 @@
 import junit.framework.TestCase;
 
 public class PropertyStorageTest extends TestCase {
-    
+
     public void testSimpleAddition() {
-        
+
         PropertyStorage s = new PropertyStorage();
-        s.addProperty("a", "1");        
+        s.addProperty("a", "1");
         s.addProperty("b", "2");
-        
+
         assertEquals(2, s.getRoot().getChildren().size());
-        
+
         PropertyNode a = s.findByKey("a");
         assertNotNull(a);
         assertEquals("1", a.getValue());
-        
+
         PropertyNode b = s.findByKey("b");
         assertNotNull(b);
         assertEquals("2", b.getValue());
     }
-    
+
     public void testAdvancedAddition() {
-        
         PropertyStorage s = new PropertyStorage();
         s.addProperty("a.a", "11");
-        s.addProperty("a.b", "12");        
-              
+        s.addProperty("a.b", "12");
+
         assertEquals(1, s.getRoot().getChildren().size());
         assertEquals("a", s.getRoot().getChildren().get(0).getName());
-        
+
         PropertyNode a = s.getRoot().getChildren().get(0);
-        System.out.println(a.getChildren());
         assertEquals(2, a.getChildren().size());
     }
-    
+
     public void testAdditionReverseOrder() {
-        
         PropertyStorage s = new PropertyStorage();
         s.addProperty("a.b.c", "123");
-        s.addProperty("a.b", "12");        
+        s.addProperty("a.b", "12");
         s.addProperty("a", "1");
-        
-        assertEquals(1, s.getRoot().getChildren().size());        
+
+        assertEquals(1, s.getRoot().getChildren().size());
         PropertyNode a = s.getRoot().getChildren().get(0);
         assertEquals(1, a.getChildren().size());
     }
-    
+
     public void testFindByKey() {
         PropertyStorage s = new PropertyStorage();
         s.addProperty("a.a", "11");
-        s.addProperty("a.b", "12"); 
+        s.addProperty("a.b", "12");
 
         assertNotNull(s.findByKey("a"));
         assertNotNull(s.findByKey("a.a"));
         assertNotNull(s.findByKey("a.b"));
-        
+
         assertNull(s.findByKey("b"));
         assertNull(s.findByKey("a.c"));
-        
     }
 
 }

Added: directory/sandbox/szoerner/syspropPartition/src/test/java/org/apache/directory/samples/partition/sysprops/backend/SystemPropertyGeneratorTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/szoerner/syspropPartition/src/test/java/org/apache/directory/samples/partition/sysprops/backend/SystemPropertyGeneratorTest.java?rev=714050&view=auto
==============================================================================
--- directory/sandbox/szoerner/syspropPartition/src/test/java/org/apache/directory/samples/partition/sysprops/backend/SystemPropertyGeneratorTest.java
(added)
+++ directory/sandbox/szoerner/syspropPartition/src/test/java/org/apache/directory/samples/partition/sysprops/backend/SystemPropertyGeneratorTest.java
Fri Nov 14 08:00:27 2008
@@ -0,0 +1,12 @@
+package org.apache.directory.samples.partition.sysprops.backend;
+
+import junit.framework.TestCase;
+
+public class SystemPropertyGeneratorTest extends TestCase {
+    
+    public void testFilling() {
+        PropertyStorage storage = new PropertyStorage();
+        SystemPropertyGenerator.fill(storage);
+    }
+
+}



Mime
View raw message