You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2012/12/11 14:18:46 UTC

svn commit: r1420142 - in /accumulo/trunk/core/src: main/java/org/apache/accumulo/core/conf/PropertyType.java test/java/org/apache/accumulo/core/conf/PropertyTest.java

Author: kturner
Date: Tue Dec 11 13:18:45 2012
New Revision: 1420142

URL: http://svn.apache.org/viewvc?rev=1420142&view=rev
Log:
ACCUMULO-895 allowed windows path for instance.dfs.dir

Modified:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java?rev=1420142&r1=1420141&r2=1420142&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/conf/PropertyType.java Tue Dec 11 13:18:45 2012
@@ -18,6 +18,8 @@ package org.apache.accumulo.core.conf;
 
 import java.util.regex.Pattern;
 
+import org.apache.hadoop.fs.Path;
+
 public enum PropertyType {
   PREFIX(null, null, null),
   
@@ -49,9 +51,13 @@ public enum PropertyType {
   
   PATH("path", ".*",
       "A string that represents a filesystem path, which can be either relative or absolute to some directory. The filesystem depends on the property."),
-  ABSOLUTEPATH("absolute path", "[/].*",
-      "An absolute filesystem path. The filesystem depends on the property. This is the same as path, but enforces that its root is explicitly specified."),
-  
+  ABSOLUTEPATH("absolute path", null,
+      "An absolute filesystem path. The filesystem depends on the property. This is the same as path, but enforces that its root is explicitly specified.") {
+    public boolean isValidFormat(String value) {
+      return new Path(value).isAbsolute();
+    }
+  },
+
   CLASSNAME("java class", "[\\w$.]*", "A fully qualified java class name representing a class on the classpath.<br />"
       + "An example is 'java.lang.String', rather than 'String'"),
   

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java?rev=1420142&r1=1420141&r2=1420142&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java (original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/conf/PropertyTest.java Tue Dec 11 13:18:45 2012
@@ -92,5 +92,8 @@ public class PropertyTest {
     typeCheckValidFormat(PropertyType.HOSTLIST, "localhost", "server1,server2,server3", "server1:1111,server2:3333", "localhost:1111", "server2:1111",
         "www.server", "www.server:1111", "www.server.com", "www.server.com:111");
     typeCheckInvalidFormat(PropertyType.HOSTLIST, ":111", "local host");
+    
+    typeCheckValidFormat(PropertyType.ABSOLUTEPATH, "d:\\foo12", "c:\\foo\\g", "c:\\foo\\c", "/foo", "/foo/c", "c:\\", "/");
+    typeCheckInvalidFormat(PropertyType.ABSOLUTEPATH, "foo12", "foo/g", "foo\\c");
   }
 }