http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/SessionConfig.cc
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/SessionConfig.cc
 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/SessionConfig.cc
index 0611d67..cd46288 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/SessionConfig.cc
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/SessionConfig.cc
@@ -29,8 +29,8 @@
 namespace hdfs {
 namespace internal {
 
-template<typename T>
-static void CheckRangeGE(const char *key, T const & value, T const & target) {
+template <typename T>
+static void CheckRangeGE(const char *key, T const &value, T const &target) {
     if (!(value >= target)) {
         std::stringstream ss;
         ss << "Invalid configure item: \"" << key << "\", value: " << value
@@ -39,99 +39,73 @@ static void CheckRangeGE(const char *key, T const & value, 
T const & target) {
     }
 }
 
-template<typename T>
-static void CheckMultipleOf(const char *key, const T & value, int unit) {
+template <typename T>
+static void CheckMultipleOf(const char *key, const T &value, int unit) {
     if (value <= 0 || value % unit != 0) {
-        THROW(HdfsConfigInvalid, "%s should be larger than 0 and be the 
multiple of %d.", key, unit);
+        THROW(HdfsConfigInvalid,
+              "%s should be larger than 0 and be the multiple of %d.", key,
+              unit);
     }
 }
 
-SessionConfig::SessionConfig(const Config & conf) {
-    ConfigDefault<bool> boolValues [] = {
-        {
-            &rpcTcpNoDelay, "rpc.client.connect.tcpnodelay", true
-        }, {
-            &readFromLocal, "dfs.client.read.shortcircuit", true
-        }, {
-            &addDatanode, "output.replace-datanode-on-failure", true
-        }, {
-            &notRetryAnotherNode, "input.notretry-another-node", false
-        }, {
-            &useMappedFile, "input.localread.mappedfile", true
-        }
-    };
+SessionConfig::SessionConfig(const ConfigImpl &conf) {
+    ConfigDefault<bool> boolValues[] = {
+        {&rpcTcpNoDelay, "rpc.client.connect.tcpnodelay", true},
+        {&readFromLocal, "dfs.client.read.shortcircuit", true},
+        {&addDatanode, "output.replace-datanode-on-failure", true},
+        {&notRetryAnotherNode, "input.notretry-another-node", false},
+        {&useMappedFile, "input.localread.mappedfile", true}};
     ConfigDefault<int32_t> i32Values[] = {
-        {
-            &rpcMaxIdleTime, "rpc.client.max.idle", 10 * 1000, 
bind(CheckRangeGE<int32_t>, _1, _2, 1)
-        }, {
-            &rpcPingTimeout, "rpc.client.ping.interval", 10 * 1000
-        }, {
-            &rpcConnectTimeout, "rpc.client.connect.timeout", 600 * 1000
-        }, {
-            &rpcReadTimeout, "rpc.client.read.timeout", 3600 * 1000
-        }, {
-            &rpcWriteTimeout, "rpc.client.write.timeout", 3600 * 1000
-        }, {
-            &rpcSocketLingerTimeout, "rpc.client.socekt.linger.timeout", -1
-        }, {
-            &rpcMaxRetryOnConnect, "rpc.client.connect.retry", 10, 
bind(CheckRangeGE<int32_t>, _1, _2, 1)
-        }, {
-            &rpcTimeout, "rpc.client.timeout", 3600 * 1000
-        }, {
-            &defaultReplica, "dfs.default.replica", 3, 
bind(CheckRangeGE<int32_t>, _1, _2, 1)
-        }, {
-            &inputConnTimeout, "input.connect.timeout", 600 * 1000
-        }, {
-            &inputReadTimeout, "input.read.timeout", 3600 * 1000
-        }, {
-            &inputWriteTimeout, "input.write.timeout", 3600 * 1000
-        }, {
-            &localReadBufferSize, "input.localread.default.buffersize", 1 * 
1024 * 1024, bind(CheckRangeGE<int32_t>, _1, _2, 1)
-        }, {
-            &prefetchSize, "dfs.prefetchsize", 10, bind(CheckRangeGE<int32_t>, 
_1, _2, 1)
-        }, {
-            &maxGetBlockInfoRetry, "input.read.getblockinfo.retry", 3, 
bind(CheckRangeGE<int32_t>, _1, _2, 1)
-        }, {
-            &maxLocalBlockInfoCacheSize, 
"input.localread.blockinfo.cachesize", 1000, bind(CheckRangeGE<int32_t>, _1, 
_2, 1)
-        }, {
-            &maxReadBlockRetry, "input.read.max.retry", 60, 
bind(CheckRangeGE<int32_t>, _1, _2, 1)
-        }, {
-            &chunkSize, "output.default.chunksize", 512, 
bind(CheckMultipleOf<int32_t>, _1, _2, 512)
-        }, {
-            &packetSize, "output.default.packetsize", 64 * 1024
-        }, {
-            &blockWriteRetry, "output.default.write.retry", 10, 
bind(CheckRangeGE<int32_t>, _1, _2, 1)
-        }, {
-            &outputConnTimeout, "output.connect.timeout", 600 * 1000
-        }, {
-            &outputReadTimeout, "output.read.timeout", 3600 * 1000
-        }, {
-            &outputWriteTimeout, "output.write.timeout", 3600 * 1000
-        }, {
-            &closeFileTimeout, "output.close.timeout", 3600 * 1000
-        }, {
-            &packetPoolSize, "output.packetpool.size", 1024
-        }, {
-            &heartBeatInterval, "output.heeartbeat.interval", 10 * 1000
-        }, {
-            &rpcMaxHARetry, "dfs.client.failover.max.attempts", 15, 
bind(CheckRangeGE<int32_t>, _1, _2, 0)
-        }
-    };
-    ConfigDefault<int64_t> i64Values [] = {
-        {
-            &defaultBlockSize, "dfs.default.blocksize", 64 * 1024 * 1024, 
bind(CheckMultipleOf<int64_t>, _1, _2, 512)
-        }
-    };
-    ConfigDefault<std::string> strValues [] = {
-        {&defaultUri, "dfs.default.uri", "hdfs://localhost:9000" },
-        {&rpcAuthMethod, "hadoop.security.authentication", "simple" },
-        {&kerberosCachePath, "hadoop.security.kerberos.ticket.cache.path", "" 
},
-        {&logSeverity, "dfs.client.log.severity", "INFO" }
-    };
+        {&rpcMaxIdleTime, "rpc.client.max.idle", 10 * 1000,
+         bind(CheckRangeGE<int32_t>, _1, _2, 1)},
+        {&rpcPingTimeout, "rpc.client.ping.interval", 10 * 1000},
+        {&rpcConnectTimeout, "rpc.client.connect.timeout", 600 * 1000},
+        {&rpcReadTimeout, "rpc.client.read.timeout", 3600 * 1000},
+        {&rpcWriteTimeout, "rpc.client.write.timeout", 3600 * 1000},
+        {&rpcSocketLingerTimeout, "rpc.client.socekt.linger.timeout", -1},
+        {&rpcMaxRetryOnConnect, "rpc.client.connect.retry", 10,
+         bind(CheckRangeGE<int32_t>, _1, _2, 1)},
+        {&rpcTimeout, "rpc.client.timeout", 3600 * 1000},
+        {&defaultReplica, "dfs.default.replica", 3,
+         bind(CheckRangeGE<int32_t>, _1, _2, 1)},
+        {&inputConnTimeout, "input.connect.timeout", 600 * 1000},
+        {&inputReadTimeout, "input.read.timeout", 3600 * 1000},
+        {&inputWriteTimeout, "input.write.timeout", 3600 * 1000},
+        {&localReadBufferSize, "input.localread.default.buffersize",
+         1 * 1024 * 1024, bind(CheckRangeGE<int32_t>, _1, _2, 1)},
+        {&prefetchSize, "dfs.prefetchsize", 10,
+         bind(CheckRangeGE<int32_t>, _1, _2, 1)},
+        {&maxGetBlockInfoRetry, "input.read.getblockinfo.retry", 3,
+         bind(CheckRangeGE<int32_t>, _1, _2, 1)},
+        {&maxLocalBlockInfoCacheSize, "input.localread.blockinfo.cachesize",
+         1000, bind(CheckRangeGE<int32_t>, _1, _2, 1)},
+        {&maxReadBlockRetry, "input.read.max.retry", 60,
+         bind(CheckRangeGE<int32_t>, _1, _2, 1)},
+        {&chunkSize, "output.default.chunksize", 512,
+         bind(CheckMultipleOf<int32_t>, _1, _2, 512)},
+        {&packetSize, "output.default.packetsize", 64 * 1024},
+        {&blockWriteRetry, "output.default.write.retry", 10,
+         bind(CheckRangeGE<int32_t>, _1, _2, 1)},
+        {&outputConnTimeout, "output.connect.timeout", 600 * 1000},
+        {&outputReadTimeout, "output.read.timeout", 3600 * 1000},
+        {&outputWriteTimeout, "output.write.timeout", 3600 * 1000},
+        {&closeFileTimeout, "output.close.timeout", 3600 * 1000},
+        {&packetPoolSize, "output.packetpool.size", 1024},
+        {&heartBeatInterval, "output.heeartbeat.interval", 10 * 1000},
+        {&rpcMaxHARetry, "dfs.client.failover.max.attempts", 15,
+         bind(CheckRangeGE<int32_t>, _1, _2, 0)}};
+    ConfigDefault<int64_t> i64Values[] = {
+        {&defaultBlockSize, "dfs.default.blocksize", 64 * 1024 * 1024,
+         bind(CheckMultipleOf<int64_t>, _1, _2, 512)}};
+    ConfigDefault<std::string> strValues[] = {
+        {&defaultUri, "dfs.default.uri", "hdfs://localhost:9000"},
+        {&rpcAuthMethod, "hadoop.security.authentication", "simple"},
+        {&kerberosCachePath, "hadoop.security.kerberos.ticket.cache.path", ""},
+        {&logSeverity, "dfs.client.log.severity", "INFO"}};
 
     for (size_t i = 0; i < ARRAYSIZE(boolValues); ++i) {
-        *boolValues[i].variable = conf.getBool(boolValues[i].key,
-                                               boolValues[i].value);
+        *boolValues[i].variable =
+            conf.getBool(boolValues[i].key, boolValues[i].value);
 
         if (boolValues[i].check) {
             boolValues[i].check(boolValues[i].key, *boolValues[i].variable);
@@ -139,8 +113,8 @@ SessionConfig::SessionConfig(const Config & conf) {
     }
 
     for (size_t i = 0; i < ARRAYSIZE(i32Values); ++i) {
-        *i32Values[i].variable = conf.getInt32(i32Values[i].key,
-                                               i32Values[i].value);
+        *i32Values[i].variable =
+            conf.getInt32(i32Values[i].key, i32Values[i].value);
 
         if (i32Values[i].check) {
             i32Values[i].check(i32Values[i].key, *i32Values[i].variable);
@@ -148,8 +122,8 @@ SessionConfig::SessionConfig(const Config & conf) {
     }
 
     for (size_t i = 0; i < ARRAYSIZE(i64Values); ++i) {
-        *i64Values[i].variable = conf.getInt64(i64Values[i].key,
-                                               i64Values[i].value);
+        *i64Values[i].variable =
+            conf.getInt64(i64Values[i].key, i64Values[i].value);
 
         if (i64Values[i].check) {
             i64Values[i].check(i64Values[i].key, *i64Values[i].variable);
@@ -157,14 +131,13 @@ SessionConfig::SessionConfig(const Config & conf) {
     }
 
     for (size_t i = 0; i < ARRAYSIZE(strValues); ++i) {
-        *strValues[i].variable = conf.getString(strValues[i].key,
-                                                strValues[i].value);
+        *strValues[i].variable =
+            conf.getString(strValues[i].key, strValues[i].value.c_str());
 
         if (strValues[i].check) {
             strValues[i].check(strValues[i].key, *strValues[i].variable);
         }
     }
 }
-
 }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/SessionConfig.h
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/SessionConfig.h
 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/SessionConfig.h
index 9d9462d..242d899 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/SessionConfig.h
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/SessionConfig.h
@@ -19,11 +19,11 @@
 #ifndef _HDFS_LIBHDFS3_COMMON_SESSIONCONFIG_H_
 #define _HDFS_LIBHDFS3_COMMON_SESSIONCONFIG_H_
 
+#include "ConfigImpl.h"
 #include "Exception.h"
 #include "ExceptionInternal.h"
 #include "Function.h"
 #include "Logger.h"
-#include "XmlConfig.h"
 
 #include <cassert>
 #include <stdint.h>
@@ -32,18 +32,18 @@
 namespace hdfs {
 namespace internal {
 
-template<typename T>
+template <typename T>
 struct ConfigDefault {
-    T *variable; //variable this configure item should be bound to.
-    const char *key; //configure key.
-    T value; //default value.
-    function<void(const char *, T const &)> check;   //the function to 
validate the value.
+    T *variable;      // variable this configure item should be bound to.
+    const char *key;  // configure key.
+    T value;          // default value.
+    function<void(const char *, T const &)>
+        check;  // the function to validate the value.
 };
 
 class SessionConfig {
 public:
-
-    SessionConfig(const Config &conf);
+    SessionConfig(const ConfigImpl &conf);
 
     /*
      * rpc configure
@@ -308,16 +308,14 @@ public:
     bool addDatanode;
     int32_t chunkSize;
     int32_t packetSize;
-    int32_t blockWriteRetry; //retry on block not replicated yet.
+    int32_t blockWriteRetry;  // retry on block not replicated yet.
     int32_t outputConnTimeout;
     int32_t outputReadTimeout;
     int32_t outputWriteTimeout;
     int32_t packetPoolSize;
     int32_t heartBeatInterval;
     int32_t closeFileTimeout;
-
 };
-
 }
 }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/Status.cc
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/Status.cc 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/Status.cc
new file mode 100644
index 0000000..809dbaa
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/Status.cc
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Status.h"
+#include "ExceptionInternal.h"
+
+namespace hdfs {
+
+Status::Status() : code(0), msg("Success") {
+}
+
+Status::Status(int code)
+    : code(code), msg(hdfs::internal::GetSystemErrorInfo(code)) {
+}
+
+Status::Status(int code, const std::string &msg) : code(code), msg(msg) {
+}
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/Status.h
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/Status.h 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/Status.h
new file mode 100644
index 0000000..fc7a9b2
--- /dev/null
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/Status.h
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _HDFS_LIBHDFS3_COMMON_STATUS_H_
+#define _HDFS_LIBHDFS3_COMMON_STATUS_H_
+
+#include <string>
+
+namespace hdfs {
+
+class Status {
+public:
+    Status();
+
+    Status(int code);
+
+    Status(int code, const std::string &msg);
+
+    bool operator==(const Status &other) const {
+        return code == other.code;
+    }
+
+    bool isError() const {
+        return code != 0;
+    }
+
+    int getCode() const {
+        return code;
+    }
+
+    const char *getErrorMsg() {
+        return msg.c_str();
+    }
+
+    static Status OK() {
+        return Status();
+    }
+
+private:
+    int code;
+    std::string msg;
+};
+}
+
+#endif /* _HDFS_LIBHDFS3_COMMON_STATUS_H_ */

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/StatusInternal.h
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/StatusInternal.h
 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/StatusInternal.h
new file mode 100644
index 0000000..b6291f4
--- /dev/null
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/StatusInternal.h
@@ -0,0 +1,137 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _HDFS_LIBHDFS3_COMMON_STATUSINTERNAL_H_
+#define _HDFS_LIBHDFS3_COMMON_STATUSINTERNAL_H_
+
+#include "Exception.h"
+#include "ExceptionInternal.h"
+#include "Status.h"
+
+namespace hdfs {
+namespace internal {
+
+#define CHECK_PARAMETER(cond, code, msg) \
+    if (!(cond)) {                       \
+        return Status((code), (msg));    \
+    }
+
+static inline Status CreateStatusFromException(exception_ptr e) {
+    try {
+        hdfs::rethrow_exception(e);
+    } catch (const hdfs::AccessControlException &e) {
+        errno = EACCES;
+        return Status(errno, e.what());
+    } catch (const hdfs::AlreadyBeingCreatedException &e) {
+        errno = EACCES;
+        return Status(errno, e.what());
+    } catch (const hdfs::ChecksumException &e) {
+        errno = EIO;
+        return Status(errno, e.what());
+    } catch (const hdfs::DSQuotaExceededException &e) {
+        errno = ENOSPC;
+        return Status(errno, e.what());
+    } catch (const hdfs::FileAlreadyExistsException &e) {
+        errno = EEXIST;
+        return Status(errno, e.what());
+    } catch (const hdfs::FileNotFoundException &e) {
+        errno = ENOENT;
+        return Status(errno, e.what());
+    } catch (const hdfs::HdfsBadBoolFoumat &e) {
+        errno = EINVAL;
+        return Status(errno, e.what());
+    } catch (const hdfs::HdfsBadConfigFoumat &e) {
+        errno = EINVAL;
+        return Status(errno, e.what());
+    } catch (const hdfs::HdfsBadNumFoumat &e) {
+        errno = EINVAL;
+        return Status(errno, e.what());
+    } catch (const hdfs::HdfsCanceled &e) {
+        errno = EIO;
+        return Status(errno, e.what());
+    } catch (const hdfs::HdfsConfigInvalid &e) {
+        errno = EINVAL;
+        return Status(errno, e.what());
+    } catch (const hdfs::HdfsConfigNotFound &e) {
+        errno = EINVAL;
+        return Status(errno, e.what());
+    } catch (const hdfs::HdfsEndOfStream &e) {
+        errno = EOVERFLOW;
+        return Status(errno, e.what());
+    } catch (const hdfs::HdfsInvalidBlockToken &e) {
+        errno = EPERM;
+        return Status(errno, e.what());
+    } catch (const hdfs::HdfsTimeoutException &e) {
+        errno = EIO;
+        return Status(errno, e.what());
+    } catch (const hdfs::InvalidParameter &e) {
+        errno = EINVAL;
+        return Status(errno, e.what());
+    } catch (const hdfs::InvalidPath &e) {
+        errno = EINVAL;
+        return Status(errno, e.what());
+    } catch (const hdfs::NotReplicatedYetException &e) {
+        errno = EINVAL;
+        return Status(errno, e.what());
+    } catch (const hdfs::NSQuotaExceededException &e) {
+        errno = EINVAL;
+        return Status(errno, e.what());
+    } catch (const hdfs::ParentNotDirectoryException &e) {
+        errno = EACCES;
+        return Status(errno, e.what());
+    } catch (const hdfs::ReplicaNotFoundException &e) {
+        errno = EACCES;
+        return Status(errno, e.what());
+    } catch (const hdfs::SafeModeException &e) {
+        errno = EIO;
+        return Status(errno, e.what());
+    } catch (const hdfs::UnresolvedLinkException &e) {
+        errno = EACCES;
+        return Status(errno, e.what());
+    } catch (const hdfs::HdfsRpcException &e) {
+        errno = EIO;
+        return Status(errno, e.what());
+    } catch (const hdfs::HdfsNetworkException &e) {
+        errno = EIO;
+        return Status(errno, e.what());
+    } catch (const hdfs::RpcNoSuchMethodException &e) {
+        errno = ENOTSUP;
+        return Status(errno, e.what());
+    } catch (const hdfs::SaslException &e) {
+        errno = EACCES;
+        return Status(errno, e.what());
+    } catch (const hdfs::NameNodeStandbyException &e) {
+        errno = EIO;
+        return Status(errno, e.what());
+    } catch (const hdfs::HdfsIOException &e) {
+        errno = EIO;
+        return Status(errno, e.what());
+    } catch (const hdfs::HdfsException &e) {
+        errno = EIO;
+        return Status(errno, e.what());
+    } catch (std::exception &e) {
+        errno = EIO;
+        return Status(errno, e.what());
+    }
+
+    return Status(EIO, "Unknown Error");
+}
+}
+}
+
+#endif /* _HDFS_LIBHDFS3_COMMON_STATUSINTERNAL_H_ */

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/UnorderedMap.h
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/UnorderedMap.h
 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/UnorderedMap.h
index 8c2c549..e6b2e04 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/UnorderedMap.h
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/UnorderedMap.h
@@ -22,24 +22,26 @@
 #ifdef _LIBCPP_VERSION
 
 #include <unordered_map>
+#include <unordered_set>
 
 namespace hdfs {
 namespace internal {
 
+using std::unordered_set;
 using std::unordered_map;
-
 }
 }
 
 #else
 
 #include <tr1/unordered_map>
+#include <tr1/unordered_set>
 
 namespace hdfs {
 namespace internal {
 
+using std::tr1::unordered_set;
 using std::tr1::unordered_map;
-
 }
 }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfig.cc
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfig.cc 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfig.cc
deleted file mode 100644
index 7de532c..0000000
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfig.cc
+++ /dev/null
@@ -1,395 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Exception.h"
-#include "ExceptionInternal.h"
-#include "Hash.h"
-#include "XmlConfig.h"
-
-#include <cassert>
-#include <errno.h>
-#include <fstream>
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-#include <limits>
-#include <string.h>
-#include <unistd.h>
-#include <vector>
-
-using namespace hdfs::internal;
-
-using std::map;
-using std::string;
-using std::vector;
-
-namespace hdfs {
-
-typedef map<string, string>::const_iterator Iterator;
-typedef map<string, string> Map;
-
-static int32_t StrToInt32(const char *str) {
-    long retval;
-    char *end = NULL;
-    errno = 0;
-    retval = strtol(str, &end, 0);
-
-    if (EINVAL == errno || 0 != *end) {
-        THROW(HdfsBadNumFoumat, "Invalid int32_t type: %s", str);
-    }
-
-    if (ERANGE == errno || retval > std::numeric_limits<int32_t>::max()
-            || retval < std::numeric_limits<int32_t>::min()) {
-        THROW(HdfsBadNumFoumat, "Underflow/Overflow int32_t type: %s", str);
-    }
-
-    return retval;
-}
-
-static int64_t StrToInt64(const char *str) {
-    long long retval;
-    char *end = NULL;
-    errno = 0;
-    retval = strtoll(str, &end, 0);
-
-    if (EINVAL == errno || 0 != *end) {
-        THROW(HdfsBadNumFoumat, "Invalid int64_t type: %s", str);
-    }
-
-    if (ERANGE == errno || retval > std::numeric_limits<int64_t>::max()
-            || retval < std::numeric_limits<int64_t>::min()) {
-        THROW(HdfsBadNumFoumat, "Underflow/Overflow int64_t type: %s", str);
-    }
-
-    return retval;
-}
-
-static bool StrToBool(const char *str) {
-    bool retval = false;
-
-    if (!strcasecmp(str, "true") || !strcmp(str, "1")) {
-        retval = true;
-    } else if (!strcasecmp(str, "false") || !strcmp(str, "0")) {
-        retval = false;
-    } else {
-        THROW(HdfsBadBoolFoumat, "Invalid bool type: %s", str);
-    }
-
-    return retval;
-}
-
-static double StrToDouble(const char *str) {
-    double retval;
-    char *end = NULL;
-    errno = 0;
-    retval = strtod(str, &end);
-
-    if (EINVAL == errno || 0 != *end) {
-        THROW(HdfsBadNumFoumat, "Invalid double type: %s", str);
-    }
-
-    if (ERANGE == errno || retval > std::numeric_limits<double>::max()
-            || retval < std::numeric_limits<double>::min()) {
-        THROW(HdfsBadNumFoumat, "Underflow/Overflow int64_t type: %s", str);
-    }
-
-    return retval;
-}
-
-static void readConfigItem(xmlNodePtr root, Map & kv, const char *path) {
-    std::string key, value;
-    xmlNodePtr curNode;
-    bool hasname = false, hasvalue = false;
-
-    for (curNode = root; NULL != curNode; curNode = curNode->next) {
-        if (curNode->type != XML_ELEMENT_NODE) {
-            continue;
-        }
-
-        if (!hasname && !strcmp((const char *) curNode->name, "name")) {
-            if (NULL != curNode->children
-                    && XML_TEXT_NODE == curNode->children->type) {
-                key = (const char *) curNode->children->content;
-                hasname = true;
-            }
-        } else if (!hasvalue
-                   && !strcmp((const char *) curNode->name, "value")) {
-            if (NULL != curNode->children
-                    && XML_TEXT_NODE == curNode->children->type) {
-                value = (const char *) curNode->children->content;
-                hasvalue = true;
-            }
-        } else {
-            continue;
-        }
-    }
-
-    if (hasname && hasvalue) {
-        kv[key] = value;
-        return;
-    } else if (hasname) {
-        kv[key] = "";
-        return;
-    }
-
-    THROW(HdfsBadConfigFoumat, "Config cannot parse configure file: \"%s\"",
-          path);
-}
-
-static void readConfigItems(xmlDocPtr doc, Map & kv, const char *path) {
-    xmlNodePtr root, curNode;
-    root = xmlDocGetRootElement(doc);
-
-    if (NULL == root || strcmp((const char *) root->name, "configuration")) {
-        THROW(HdfsBadConfigFoumat, "Config cannot parse configure file: 
\"%s\"",
-              path);
-    }
-
-    /*
-     * for each property
-     */
-    for (curNode = root->children; NULL != curNode; curNode = curNode->next) {
-        if (curNode->type != XML_ELEMENT_NODE) {
-            continue;
-        }
-
-        if (strcmp((const char *) curNode->name, "property")) {
-            THROW(HdfsBadConfigFoumat,
-                  "Config cannot parse configure file: \"%s\"", path);
-        }
-
-        readConfigItem(curNode->children, kv, path);
-    }
-}
-
-Config::Config(const char *p) :
-    path(p) {
-    update(p);
-}
-
-void Config::update(const char *p) {
-    char msg[64];
-    xmlDocPtr doc; /* the resulting document tree */
-    LIBXML_TEST_VERSION
-    kv.clear();
-    path = p;
-
-    if (access(path.c_str(), R_OK)) {
-        strerror_r(errno, msg, sizeof(msg));
-        THROW(HdfsBadConfigFoumat, "Cannot read configure file: \"%s\", %s",
-              path.c_str(), msg);
-    }
-
-    /* parse the file */
-    doc = xmlReadFile(path.c_str(), NULL, 0);
-
-    try {
-        /* check if parsing succeeded */
-        if (doc == NULL) {
-            THROW(HdfsBadConfigFoumat,
-                  "Config cannot parse configure file: \"%s\"", path.c_str());
-        } else {
-            readConfigItems(doc, kv, path.c_str());
-            /* free up the resulting document */
-            xmlFreeDoc(doc);
-        }
-    } catch (...) {
-        xmlFreeDoc(doc);
-        throw;
-    }
-}
-
-const char *Config::getString(const char *key) const {
-    Iterator it = kv.find(key);
-
-    if (kv.end() == it) {
-        THROW(HdfsConfigNotFound, "Config key: %s not found", key);
-    }
-
-    return it->second.c_str();
-}
-
-const char *Config::getString(const char *key, const char *def) const {
-    Iterator it = kv.find(key);
-
-    if (kv.end() == it) {
-        return def;
-    } else {
-        return it->second.c_str();
-    }
-}
-
-const char *Config::getString(const std::string & key) const {
-    return getString(key.c_str());
-}
-
-const char *Config::getString(const std::string & key,
-                               const std::string & def) const {
-    return getString(key.c_str(), def.c_str());
-}
-
-int64_t Config::getInt64(const char *key) const {
-    int64_t retval;
-    Iterator it = kv.find(key);
-
-    if (kv.end() == it) {
-        THROW(HdfsConfigNotFound, "Config key: %s not found", key);
-    }
-
-    try {
-        retval = StrToInt64(it->second.c_str());
-    } catch (const HdfsBadNumFoumat & e) {
-        NESTED_THROW(HdfsConfigNotFound, "Config key: %s not found", key);
-    }
-
-    return retval;
-}
-
-int64_t Config::getInt64(const char *key, int64_t def) const {
-    int64_t retval;
-    Iterator it = kv.find(key);
-
-    if (kv.end() == it) {
-        return def;
-    }
-
-    try {
-        retval = StrToInt64(it->second.c_str());
-    } catch (const HdfsBadNumFoumat & e) {
-        NESTED_THROW(HdfsConfigNotFound, "Config key: %s not found", key);
-    }
-
-    return retval;
-}
-
-int32_t Config::getInt32(const char *key) const {
-    int32_t retval;
-    Iterator it = kv.find(key);
-
-    if (kv.end() == it) {
-        THROW(HdfsConfigNotFound, "Config key: %s not found", key);
-    }
-
-    try {
-        retval = StrToInt32(it->second.c_str());
-    } catch (const HdfsBadNumFoumat & e) {
-        NESTED_THROW(HdfsConfigNotFound, "Config key: %s not found", key);
-    }
-
-    return retval;
-}
-
-int32_t Config::getInt32(const char *key, int32_t def) const {
-    int32_t retval;
-    Iterator it = kv.find(key);
-
-    if (kv.end() == it) {
-        return def;
-    }
-
-    try {
-        retval = StrToInt32(it->second.c_str());
-    } catch (const HdfsBadNumFoumat & e) {
-        NESTED_THROW(HdfsConfigNotFound, "Config key: %s not found", key);
-    }
-
-    return retval;
-}
-
-double Config::getDouble(const char *key) const {
-    double retval;
-    Iterator it = kv.find(key);
-
-    if (kv.end() == it) {
-        THROW(HdfsConfigNotFound, "Config key: %s not found", key);
-    }
-
-    try {
-        retval = StrToDouble(it->second.c_str());
-    } catch (const HdfsBadNumFoumat & e) {
-        NESTED_THROW(HdfsConfigNotFound, "Config key: %s not found", key);
-    }
-
-    return retval;
-}
-
-double Config::getDouble(const char *key, double def) const {
-    double retval;
-    Iterator it = kv.find(key);
-
-    if (kv.end() == it) {
-        return def;
-    }
-
-    try {
-        retval = StrToDouble(it->second.c_str());
-    } catch (const HdfsBadNumFoumat & e) {
-        NESTED_THROW(HdfsConfigNotFound, "Config key: %s not found", key);
-    }
-
-    return retval;
-}
-
-bool Config::getBool(const char *key) const {
-    bool retval;
-    Iterator it = kv.find(key);
-
-    if (kv.end() == it) {
-        THROW(HdfsConfigNotFound, "Config key: %s not found", key);
-    }
-
-    try {
-        retval = StrToBool(it->second.c_str());
-    } catch (const HdfsBadBoolFoumat & e) {
-        NESTED_THROW(HdfsConfigNotFound, "Config key: %s not found", key);
-    }
-
-    return retval;
-}
-
-bool Config::getBool(const char *key, bool def) const {
-    bool retval;
-    Iterator it = kv.find(key);
-
-    if (kv.end() == it) {
-        return def;
-    }
-
-    try {
-        retval = StrToBool(it->second.c_str());
-    } catch (const HdfsBadNumFoumat & e) {
-        NESTED_THROW(HdfsConfigNotFound, "Config key: %s not found", key);
-    }
-
-    return retval;
-}
-
-size_t Config::hash_value() const {
-    vector<size_t> values;
-    map<string, string>::const_iterator s, e;
-    e = kv.end();
-
-    for (s = kv.begin(); s != e; ++s) {
-        values.push_back(StringHasher(s->first));
-        values.push_back(StringHasher(s->second));
-    }
-
-    return CombineHasher(&values[0], values.size());
-}
-
-}
-

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfig.h
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfig.h 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfig.h
deleted file mode 100644
index cb9459d..0000000
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfig.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef _HDFS_LIBHDFS3_COMMON_XMLCONFIG_H_
-#define _HDFS_LIBHDFS3_COMMON_XMLCONFIG_H_
-
-#include <stdint.h>
-#include <string>
-#include <sstream>
-#include <map>
-
-namespace hdfs {
-
-/**
- * A configure file parser.
- */
-class Config {
-public:
-    /**
-     * Construct a empty Config instance.
-     */
-    Config() {
-    }
-
-    /**
-     * Construct a Config with given configure file.
-     * @param path The path of configure file.
-     * @throw HdfsBadConfigFoumat
-     */
-    Config(const char *path);
-
-    /**
-     * Parse the configure file.
-     * @throw HdfsBadConfigFoumat
-     */
-    void update(const char *path);
-
-    /**
-     * Get a string with given configure key.
-     * @param key The key of the configure item.
-     * @return The value of configure item.
-     * @throw HdfsConfigNotFound
-     */
-    const char *getString(const char *key) const;
-
-    /**
-     * Get a string with given configure key.
-     * Return the default value def if key is not found.
-     * @param key The key of the configure item.
-     * @param def The defalut value.
-     * @return The value of configure item.
-     */
-    const char *getString(const char *key, const char *def) const;
-
-    /**
-     * Get a string with given configure key.
-     * @param key The key of the configure item.
-     * @return The value of configure item.
-     * @throw HdfsConfigNotFound
-     */
-    const char *getString(const std::string & key) const;
-
-    /**
-     * Get a string with given configure key.
-     * Return the default value def if key is not found.
-     * @param key The key of the configure item.
-     * @param def The defalut value.
-     * @return The value of configure item.
-     */
-    const char *getString(const std::string & key,
-                           const std::string & def) const;
-
-    /**
-     * Get a 64 bit integer with given configure key.
-     * @param key The key of the configure item.
-     * @return The value of configure item.
-     * @throw HdfsConfigNotFound
-     */
-    int64_t getInt64(const char *key) const;
-
-    /**
-     * Get a 64 bit integer with given configure key.
-     * Return the default value def if key is not found.
-     * @param key The key of the configure item.
-     * @param def The defalut value.
-     * @return The value of configure item.
-     */
-    int64_t getInt64(const char *key, int64_t def) const;
-
-    /**
-     * Get a 32 bit integer with given configure key.
-     * @param key The key of the configure item.
-     * @return The value of configure item.
-     * @throw HdfsConfigNotFound
-     */
-    int32_t getInt32(const char *key) const;
-
-    /**
-     * Get a 32 bit integer with given configure key.
-     * Return the default value def if key is not found.
-     * @param key The key of the configure item.
-     * @param def The defalut value.
-     * @return The value of configure item.
-     */
-    int32_t getInt32(const char *key, int32_t def) const;
-
-    /**
-     * Get a double with given configure key.
-     * @param key The key of the configure item.
-     * @return The value of configure item.
-     * @throw HdfsConfigNotFound
-     */
-    double getDouble(const char *key) const;
-
-    /**
-     * Get a double with given configure key.
-     * Return the default value def if key is not found.
-     * @param key The key of the configure item.
-     * @param def The defalut value.
-     * @return The value of configure item.
-     */
-    double getDouble(const char *key, double def) const;
-
-    /**
-     * Get a boolean with given configure key.
-     * @param key The key of the configure item.
-     * @return The value of configure item.
-     * @throw HdfsConfigNotFound
-     */
-    bool getBool(const char *key) const;
-
-    /**
-     * Get a boolean with given configure key.
-     * Return the default value def if key is not found.
-     * @param key The key of the configure item.
-     * @param def The default value.
-     * @return The value of configure item.
-     */
-    bool getBool(const char *key, bool def) const;
-
-    /**
-     * Set a configure item
-     * @param key The key will set.
-     * @param value The value will be set to.
-     */
-    template<typename T>
-    void set(const char *key, T const & value) {
-        std::stringstream ss;
-        ss << value;
-        kv[key] = ss.str();
-    }
-
-    /**
-     * Get the hash value of this object
-     *
-     * @return The hash value
-     */
-    size_t hash_value() const;
-
-private:
-    std::string path;
-    std::map<std::string, std::string> kv;
-};
-
-}
-
-#endif /* _HDFS_LIBHDFS3_COMMON_XMLCONFIG_H_ */

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfigParser.cc
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfigParser.cc
 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfigParser.cc
new file mode 100644
index 0000000..8088fe7
--- /dev/null
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfigParser.cc
@@ -0,0 +1,154 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "Exception.h"
+#include "ExceptionInternal.h"
+#include "XmlConfigParser.h"
+
+#include <cassert>
+#include <errno.h>
+#include <fstream>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <limits>
+#include <string.h>
+#include <unistd.h>
+#include <vector>
+
+using namespace hdfs::internal;
+
+using std::map;
+using std::string;
+using std::vector;
+
+namespace hdfs {
+namespace internal {
+
+typedef map<string, string>::const_iterator Iterator;
+typedef map<string, string> Map;
+
+static void readXmlConfigParserItem(xmlNodePtr root, Map &kv,
+                                    const char *path) {
+    std::string key, value;
+    xmlNodePtr curNode;
+    bool hasname = false, hasvalue = false;
+
+    for (curNode = root; NULL != curNode; curNode = curNode->next) {
+        if (curNode->type != XML_ELEMENT_NODE) {
+            continue;
+        }
+
+        if (!hasname && !strcmp((const char *)curNode->name, "name")) {
+            if (NULL != curNode->children &&
+                XML_TEXT_NODE == curNode->children->type) {
+                key = (const char *)curNode->children->content;
+                hasname = true;
+            }
+        } else if (!hasvalue && !strcmp((const char *)curNode->name, "value")) 
{
+            if (NULL != curNode->children &&
+                XML_TEXT_NODE == curNode->children->type) {
+                value = (const char *)curNode->children->content;
+                hasvalue = true;
+            }
+        } else {
+            continue;
+        }
+    }
+
+    if (hasname && hasvalue) {
+        kv[key] = value;
+        return;
+    } else if (hasname) {
+        kv[key] = "";
+        return;
+    }
+
+    THROW(HdfsBadConfigFoumat,
+          "XmlConfigParser cannot parse XmlConfigParserure file: \"%s\"", 
path);
+}
+
+static void readXmlConfigParserItems(xmlDocPtr doc, Map &kv, const char *path) 
{
+    xmlNodePtr root, curNode;
+    root = xmlDocGetRootElement(doc);
+
+    if (NULL == root ||
+        strcmp((const char *)root->name, "XmlConfigParseruration")) {
+        THROW(HdfsBadConfigFoumat,
+              "XmlConfigParser cannot parse XmlConfigParserure file: \"%s\"",
+              path);
+    }
+
+    /*
+     * for each property
+     */
+    for (curNode = root->children; NULL != curNode; curNode = curNode->next) {
+        if (curNode->type != XML_ELEMENT_NODE) {
+            continue;
+        }
+
+        if (strcmp((const char *)curNode->name, "property")) {
+            THROW(
+                HdfsBadConfigFoumat,
+                "XmlConfigParser cannot parse XmlConfigParserure file: \"%s\"",
+                path);
+        }
+
+        readXmlConfigParserItem(curNode->children, kv, path);
+    }
+}
+
+XmlConfigParser::XmlConfigParser(const char *p) : path(p) {
+    update(p);
+}
+
+void XmlConfigParser::update(const char *p) {
+    char msg[64];
+    xmlDocPtr doc; /* the resulting document tree */
+    LIBXML_TEST_VERSION
+    kv.clear();
+    path = p;
+
+    if (access(path.c_str(), R_OK)) {
+        strerror_r(errno, msg, sizeof(msg));
+        THROW(HdfsBadConfigFoumat,
+              "Cannot read XmlConfigParserure file: \"%s\", %s", path.c_str(),
+              msg);
+    }
+
+    /* parse the file */
+    doc = xmlReadFile(path.c_str(), NULL, 0);
+
+    try {
+        /* check if parsing succeeded */
+        if (doc == NULL) {
+            THROW(
+                HdfsBadConfigFoumat,
+                "XmlConfigParser cannot parse XmlConfigParserure file: \"%s\"",
+                path.c_str());
+        } else {
+            readXmlConfigParserItems(doc, kv, path.c_str());
+            /* free up the resulting document */
+            xmlFreeDoc(doc);
+        }
+    } catch (...) {
+        xmlFreeDoc(doc);
+        throw;
+    }
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfigParser.h
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfigParser.h
 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfigParser.h
new file mode 100644
index 0000000..1d17c8d
--- /dev/null
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/common/XmlConfigParser.h
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _HDFS_LIBHDFS3_COMMON_XMLCONFIGPARSER_H_
+#define _HDFS_LIBHDFS3_COMMON_XMLCONFIGPARSER_H_
+
+#include <stdint.h>
+#include <string>
+#include <sstream>
+#include <map>
+
+namespace hdfs {
+namespace internal {
+
+/**
+ * A configure file parser.
+ */
+class XmlConfigParser {
+public:
+    /**
+     * Construct a empty Config instance.
+     */
+    XmlConfigParser() {
+    }
+
+    /**
+     * Construct a Config with given configure file.
+     * @param path The path of configure file.
+     * @throw HdfsBadConfigFoumat
+     */
+    XmlConfigParser(const char *path);
+
+    /**
+     * Parse the configure file.
+     * @throw HdfsBadConfigFoumat
+     */
+    void update(const char *path);
+
+    /**
+     * Get Key Values
+     * @return Return the Key Value pairs.
+     */
+    std::map<std::string, std::string> getKeyValue() {
+        return kv;
+    }
+
+private:
+    std::string path;
+    std::map<std::string, std::string> kv;
+};
+}
+}
+
+#endif /* _HDFS_LIBHDFS3_COMMON_XMLCONFIGPARSER_H_ */

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/LocatedBlocks.cc
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/LocatedBlocks.cc
 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/LocatedBlocks.cc
index 794a0ea..bd12f28 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/LocatedBlocks.cc
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/LocatedBlocks.cc
@@ -15,7 +15,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 #include "Exception.h"
 #include "ExceptionInternal.h"
 #include "LocatedBlock.h"
@@ -28,22 +27,19 @@
 namespace hdfs {
 namespace internal {
 
-const LocatedBlock *LocatedBlocksImpl::findBlock(int64_t position) {
+const LocatedBlock *LocatedBlocks::findBlock(int64_t position) {
     if (position < fileLength) {
         LocatedBlock target(position);
         std::vector<LocatedBlock>::iterator bound;
-
         if (blocks.empty()) {
             return NULL;
         }
-
-        /*
-         * up is the first block which offset is not less than position.
-         */
+        // Find first block whose offset is equal to or greater than the
+        // requested position.
         bound = std::lower_bound(blocks.begin(), blocks.end(), target,
                                  std::less<LocatedBlock>());
         assert(bound == blocks.end() || bound->getOffset() >= position);
-        LocatedBlock * retval = NULL;
+        LocatedBlock *retval = NULL;
 
         if (bound == blocks.end()) {
             retval = &blocks.back();
@@ -53,17 +49,14 @@ const LocatedBlock *LocatedBlocksImpl::findBlock(int64_t 
position) {
         } else {
             retval = &(*bound);
         }
-
-        if (position < retval->getOffset()
-                || position >= retval->getOffset() + retval->getNumBytes()) {
+        if (position < retval->getOffset() ||
+            position >= retval->getOffset() + retval->getNumBytes()) {
             return NULL;
         }
-
         return retval;
     } else {
         return lastBlock.get();
     }
 }
-
 }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/LocatedBlocks.h
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/LocatedBlocks.h
 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/LocatedBlocks.h
index 8d7281b..52792f6 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/LocatedBlocks.h
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/LocatedBlocks.h
@@ -20,44 +20,15 @@
 #define _HDFS_LIBHDFS3_SERVER_LOCATEDBLOCKS_H_
 
 #include "LocatedBlock.h"
-#include "common/SharedPtr.h"
+#include "SharedPtr.h"
 
 #include <cassert>
-#include <vector>
 
 namespace hdfs {
 namespace internal {
 
 class LocatedBlocks {
 public:
-    virtual ~LocatedBlocks() {}
-
-    virtual int64_t getFileLength() const = 0;
-
-    virtual void setFileLength(int64_t fileLength) = 0;
-
-    virtual bool isLastBlockComplete() const = 0;
-
-    virtual void setIsLastBlockComplete(bool lastBlockComplete) = 0;
-
-    virtual shared_ptr<LocatedBlock> getLastBlock() = 0;
-
-    virtual void setLastBlock(shared_ptr<LocatedBlock> lastBlock) = 0;
-
-    virtual bool isUnderConstruction() const = 0;
-
-    virtual void setUnderConstruction(bool underConstruction) = 0;
-
-    virtual const LocatedBlock *findBlock(int64_t position) = 0;
-
-    virtual std::vector<LocatedBlock> &getBlocks() = 0;
-};
-
-/**
- * Collection of blocks with their locations and the file length.
- */
-class LocatedBlocksImpl : public LocatedBlocks {
-public:
     int64_t getFileLength() const {
         return fileLength;
     }
@@ -91,9 +62,9 @@ public:
         this->underConstruction = underConstruction;
     }
 
-    const LocatedBlock * findBlock(int64_t position);
+    const LocatedBlock *findBlock(int64_t position);
 
-    std::vector<LocatedBlock> & getBlocks() {
+    std::vector<LocatedBlock> &getBlocks() {
         return blocks;
     }
 
@@ -103,9 +74,7 @@ private:
     int64_t fileLength;
     shared_ptr<LocatedBlock> lastBlock;
     std::vector<LocatedBlock> blocks;
-
 };
-
 }
 }
 #endif /* _HDFS_LIBHDFS3_SERVER_LOCATEDBLOCKS_H_ */

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/Namenode.h
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/Namenode.h 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/Namenode.h
index 4dbf517..0c9a23d 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/Namenode.h
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/Namenode.h
@@ -42,6 +42,9 @@ namespace internal {
 
 class Namenode {
 public:
+    Namenode() {
+    }
+
     /**
      * Destroy the namenode.
      */
@@ -49,7 +52,8 @@ public:
     }
 
     /**
-     * Get locations of the blocks of the specified file within the specified 
range.
+     * Get locations of the blocks of the specified file within the specified
+     *range.
      * DataNode locations for each block are sorted by
      * the proximity to the client.
      * <p>
@@ -72,10 +76,10 @@ public:
      * @throw UnresolvedLinkException If <code>src</code> contains a symlink
      * @throw HdfsIOException If an I/O error occurred
      */
-    //Idempotent
+    // Idempotent
     virtual void getBlockLocations(const std::string &src, int64_t offset,
                                    int64_t length, LocatedBlocks &lbs)
-      /* throw (AccessControlException,
+        /* throw (AccessControlException,
              FileNotFoundException, UnresolvedLinkException,
              HdfsIOException) */ = 0;
 
@@ -86,20 +90,27 @@ public:
      * The path should reflect a full path originated at the root.
      * The name-node does not have a notion of "current" directory for a 
client.
      * <p>
-     * Once created, the file is visible and available for read to other 
clients.
-     * Although, other clients cannot {//link #delete(const std::string &, 
bool)}, re-create or
-     * {//link #rename(const std::string &, const std::string &)} it until the 
file is completed
+     * Once created, the file is visible and available for read to other
+     *clients.
+     * Although, other clients cannot {//link #delete(const std::string &,
+     *bool)},
+     *re-create or
+     * {//link #rename(const std::string &, const std::string &)} it until the
+     *file is completed
      * or explicitly as a result of lease expiration.
      * <p>
      * Blocks have a maximum size.  Clients that intend to create
      * multi-block files must also use
-     * {//link #addBlock(const std::string &, const std::string &, 
ExtendedBlock, DatanodeInfo[])}
+     * {//link #addBlock(const std::string &, const std::string &,
+     *ExtendedBlock,
+     *DatanodeInfo[])}
      *
      * @param src path of the file being created.
      * @param masked masked permission.
      * @param clientName name of the current client.
      * @param flag indicates whether the file should be
-     * overwritten if it already exists or create if it does not exist or 
append.
+     * overwritten if it already exists or create if it does not exist or
+     *append.
      * @param createParent create missing parent directory if true
      * @param replication block replication factor.
      * @param blockSize maximum block size.
@@ -123,9 +134,9 @@ public:
      * @throw InvalidPathException Path <code>src</code> is invalid
      */
     virtual void create(const std::string &src, const Permission &masked,
-                        const std::string &clientName, int flag, bool 
createParent,
-                        short replication, int64_t blockSize)
-      /* throw (AccessControlException,
+                        const std::string &clientName, int flag,
+                        bool createParent, short replication, int64_t 
blockSize)
+        /* throw (AccessControlException,
              AlreadyBeingCreatedException, DSQuotaExceededException,
              FileAlreadyExistsException, FileNotFoundException,
              NSQuotaExceededException, ParentNotDirectoryException,
@@ -158,7 +169,7 @@ public:
      */
     virtual shared_ptr<LocatedBlock> append(const std::string &src,
                                             const std::string &clientName)
-    /* throw (AccessControlException,
+        /* throw (AccessControlException,
              DSQuotaExceededException, FileNotFoundException,
              SafeModeException, UnresolvedLinkException, HdfsIOException) */ = 
0;
 
@@ -184,9 +195,9 @@ public:
      * @throw UnresolvedLinkException if <code>src</code> contains a symlink
      * @throw HdfsIOException If an I/O error occurred
      */
-    //Idempotent
+    // Idempotent
     virtual bool setReplication(const std::string &src, short replication)
-    /* throw (AccessControlException, DSQuotaExceededException,
+        /* throw (AccessControlException, DSQuotaExceededException,
      FileNotFoundException, SafeModeException, UnresolvedLinkException,
      HdfsIOException) */ = 0;
 
@@ -199,9 +210,10 @@ public:
      * @throw UnresolvedLinkException If <code>src</code> contains a symlink
      * @throw HdfsIOException If an I/O error occurred
      */
-    //Idempotent
-    virtual void setPermission(const std::string &src,
-                               const Permission &permission) /* throw 
(AccessControlException,
+    // Idempotent
+    virtual void setPermission(
+        const std::string &src,
+        const Permission &permission) /* throw (AccessControlException,
              FileNotFoundException, SafeModeException,
              UnresolvedLinkException, HdfsIOException) */ = 0;
 
@@ -218,9 +230,10 @@ public:
      * @throw UnresolvedLinkException If <code>src</code> contains a symlink
      * @throw HdfsIOException If an I/O error occurred
      */
-    //Idempotent
-    virtual void setOwner(const std::string &src, const std::string &username,
-                          const std::string &groupname) /* throw 
(AccessControlException,
+    // Idempotent
+    virtual void setOwner(
+        const std::string &src, const std::string &username,
+        const std::string &groupname) /* throw (AccessControlException,
              FileNotFoundException, SafeModeException,
              UnresolvedLinkException, HdfsIOException) */ = 0;
 
@@ -235,8 +248,9 @@ public:
      * @throw UnresolvedLinkException If <code>src</code> contains a symlink
      * @throw HdfsIOException If an I/O error occurred
      */
-    virtual void abandonBlock(const ExtendedBlock &b, const std::string &src,
-                              const std::string &holder) /* throw 
(AccessControlException,
+    virtual void abandonBlock(
+        const ExtendedBlock &b, const std::string &src,
+        const std::string &holder) /* throw (AccessControlException,
              FileNotFoundException, UnresolvedLinkException,
              HdfsIOException) */ = 0;
 
@@ -270,10 +284,11 @@ public:
      * @throw UnresolvedLinkException If <code>src</code> contains a symlink
      * @throw HdfsIOException If an I/O error occurred
      */
-    virtual shared_ptr<LocatedBlock> addBlock(const std::string &src,
-            const std::string &clientName, const ExtendedBlock *previous,
-            const std::vector<DatanodeInfo> &excludeNodes)
-    /* throw (AccessControlException, FileNotFoundException,
+    virtual shared_ptr<LocatedBlock> addBlock(
+        const std::string &src, const std::string &clientName,
+        const ExtendedBlock *previous,
+        const std::vector<DatanodeInfo> &excludeNodes)
+        /* throw (AccessControlException, FileNotFoundException,
      NotReplicatedYetException, SafeModeException,
      UnresolvedLinkException, HdfsIOException) */ = 0;
 
@@ -296,14 +311,14 @@ public:
      * @throw UnresolvedLinkException If <code>src</code> contains a symlink
      * @throw HdfsIOException If an I/O error occurred
      */
-    //Idempotent
-    virtual shared_ptr<LocatedBlock> getAdditionalDatanode(const std::string 
&src,
-            const ExtendedBlock &blk,
-            const std::vector<DatanodeInfo> &existings,
-            const std::vector<std::string> &storageIDs,
-            const std::vector<DatanodeInfo> &excludes, int numAdditionalNodes,
-            const std::string &clientName)
-    /* throw (AccessControlException, FileNotFoundException,
+    // Idempotent
+    virtual shared_ptr<LocatedBlock> getAdditionalDatanode(
+        const std::string &src, const ExtendedBlock &blk,
+        const std::vector<DatanodeInfo> &existings,
+        const std::vector<std::string> &storageIDs,
+        const std::vector<DatanodeInfo> &excludes, int numAdditionalNodes,
+        const std::string &clientName)
+        /* throw (AccessControlException, FileNotFoundException,
      SafeModeException, UnresolvedLinkException, HdfsIOException) */ = 0;
 
     /**
@@ -328,9 +343,9 @@ public:
      * @throw UnresolvedLinkException If <code>src</code> contains a symlink
      * @throw HdfsIOException If an I/O error occurred
      */
-    virtual bool complete(const std::string &src,
-                          const std::string &clientName, const ExtendedBlock 
*last)
-    /* throw (AccessControlException, FileNotFoundException,
+    virtual bool complete(const std::string &src, const std::string 
&clientName,
+                          const ExtendedBlock *last)
+        /* throw (AccessControlException, FileNotFoundException,
      SafeModeException, UnresolvedLinkException, HdfsIOException) */ = 0;
 
     /**
@@ -338,7 +353,7 @@ public:
      * locations on datanodes).
      * @param blocks Array of located blocks to report
      */
-    //Idempotent
+    // Idempotent
     /*    virtual void reportBadBlocks(const std::vector<LocatedBlock> &blocks)
          throw (HdfsIOException)  = 0;*/
 
@@ -352,7 +367,7 @@ public:
      * @throw HdfsIOException an I/O error occurred
      */
     virtual bool rename(const std::string &src, const std::string &dst)
-    /* throw (UnresolvedLinkException, HdfsIOException) */ = 0;
+        /* throw (UnresolvedLinkException, HdfsIOException) */ = 0;
 
     /**
      * Moves blocks from srcs to trg and delete srcs
@@ -364,7 +379,8 @@ public:
      *           contains a symlink
      */
     /*    virtual void concat(const std::string &trg,
-                            const std::vector<std::string> &srcs)  throw 
(HdfsIOException,
+                            const std::vector<std::string> &srcs)  throw
+       (HdfsIOException,
                  UnresolvedLinkException)  = 0;*/
 
     /**
@@ -425,7 +441,7 @@ public:
      * @throw HdfsIOException If an I/O error occurred
      */
     virtual bool deleteFile(const std::string &src, bool recursive)
-    /* throw (AccessControlException, FileNotFoundException,
+        /* throw (AccessControlException, FileNotFoundException,
      SafeModeException, UnresolvedLinkException, HdfsIOException) */ = 0;
 
     /**
@@ -442,7 +458,8 @@ public:
      * @throw FileAlreadyExistsException If <code>src</code> already exists
      * @throw FileNotFoundException If parent of <code>src</code> does not 
exist
      *           and <code>createParent</code> is false
-     * @throw NSQuotaExceededException If file creation violates quota 
restriction
+     * @throw NSQuotaExceededException If file creation violates quota
+     *restriction
      * @throw ParentNotDirectoryException If parent of <code>src</code>
      *           is not a directory
      * @throw SafeModeException create not allowed in safemode
@@ -452,9 +469,10 @@ public:
      * RunTimeExceptions:
      * @throw InvalidPathException If <code>src</code> is invalid
      */
-    //Idempotent
-    virtual bool mkdirs(const std::string &src, const Permission &masked,
-                        bool createParent) /* throw (AccessControlException,
+    // Idempotent
+    virtual bool mkdirs(
+        const std::string &src, const Permission &masked,
+        bool createParent) /* throw (AccessControlException,
              FileAlreadyExistsException, FileNotFoundException,
              NSQuotaExceededException, ParentNotDirectoryException,
              SafeModeException, UnresolvedLinkException, HdfsIOException) */ = 
0;
@@ -474,10 +492,11 @@ public:
      * @throw UnresolvedLinkException If <code>src</code> contains a symlink
      * @throw HdfsIOException If an I/O error occurred
      */
-    //Idempotent
-    virtual bool getListing(const std::string &src,
-                            const std::string &startAfter, bool needLocation,
-                            std::vector<FileStatus> &dl) /* throw 
(AccessControlException,
+    // Idempotent
+    virtual bool getListing(
+        const std::string &src, const std::string &startAfter,
+        bool needLocation,
+        std::vector<FileStatus> &dl) /* throw (AccessControlException,
              FileNotFoundException, UnresolvedLinkException,
              HdfsIOException) */ = 0;
 
@@ -500,9 +519,9 @@ public:
      * @throw AccessControlException permission denied
      * @throw HdfsIOException If an I/O error occurred
      */
-    //Idempotent
+    // Idempotent
     virtual void renewLease(const std::string &clientName)
-    /* throw (AccessControlException, HdfsIOException) */ = 0;
+        /* throw (AccessControlException, HdfsIOException) */ = 0;
 
     /**
      * Start lease recovery.
@@ -513,7 +532,7 @@ public:
      * @param true if the file is already closed
      * @throw HdfsIOException
      */
-    //Idempotent
+    // Idempotent
     virtual bool recoverLease(const std::string &src,
                               const std::string &clientName) = 0;
 
@@ -521,7 +540,8 @@ public:
      * Get a set of statistics about the filesystem.
      * Right now, only seven values are returned.
      * <ul>
-     * <li> [0] contains the total storage capacity of the system, in 
bytes.</li>
+     * <li> [0] contains the total storage capacity of the system, in
+     * bytes.</li>
      * <li> [1] contains the total used space of the system, in bytes.</li>
      * <li> [2] contains the available storage of the system, in bytes.</li>
      * <li> [3] contains number of under replicated blocks in the system.</li>
@@ -531,7 +551,7 @@ public:
      * Use  constants like {//link #GET_STATS_CAPACITY_IDX} in place of
      * actual numbers to index into the array.
      */
-    //Idempotent
+    // Idempotent
     virtual std::vector<int64_t> getFsStats() /* throw (HdfsIOException) */ = 
0;
 
     /**
@@ -554,9 +574,9 @@ public:
      * @throw UnresolvedLinkException if the path contains a symlink.
      * @throw HdfsIOException If an I/O error occurred
      */
-    //Idempotent
+    // Idempotent
     virtual FileStatus getFileInfo(const std::string &src)
-    /* throw (AccessControlException, FileNotFoundException,
+        /* throw (AccessControlException, FileNotFoundException,
      UnresolvedLinkException, HdfsIOException) */ = 0;
 
     /**
@@ -571,7 +591,7 @@ public:
      * @throw UnresolvedLinkException if <code>src</code> contains a symlink
      * @throw HdfsIOException If an I/O error occurred
      */
-    //Idempotent
+    // Idempotent
     /*    virtual FileStatus getFileLinkInfo(const std::string &src)
          throw (AccessControlException, UnresolvedLinkException,
          HdfsIOException)  = 0;*/
@@ -585,14 +605,15 @@ public:
      * @throw UnresolvedLinkException if <code>path</code> contains a symlink.
      * @throw HdfsIOException If an I/O error occurred
      */
-    //Idempotent
+    // Idempotent
     /*    virtual ContentSummary getContentSummary(const std::string &path)
          throw (AccessControlException, FileNotFoundException,
          UnresolvedLinkException, HdfsIOException)  = 0;*/
 
     /**
      * Set the quota for a directory.
-     * @param path  The const std::string &representation of the path to the 
directory
+     * @param path  The const std::string &representation of the path to the
+     *directory
      * @param namespaceQuota Limit on the number of names in the tree rooted
      *                       at the directory
      * @param diskspaceQuota Limit on disk space occupied all the files under
@@ -600,7 +621,8 @@ public:
      * <br><br>
      *
      * The quota can have three types of values : (1) 0 or more will set
-     * the quota to that value, (2) {//link HdfsConstants#QUOTA_DONT_SET}  
implies
+     * the quota to that value, (2) {//link HdfsConstants#QUOTA_DONT_SET}
+     *implies
      * the quota will not be changed, and (3) {//link 
HdfsConstants#QUOTA_RESET}
      * implies the quota will be reset. Any other value is a runtime error.
      *
@@ -608,13 +630,15 @@ public:
      * @throw FileNotFoundException file <code>path</code> is not found
      * @throw QuotaExceededException if the directory size
      *           is greater than the given quota
-     * @throw UnresolvedLinkException if the <code>path</code> contains a 
symlink.
+     * @throw UnresolvedLinkException if the <code>path</code> contains a
+     *symlink.
      * @throw HdfsIOException If an I/O error occurred
      */
-    //Idempotent
+    // Idempotent
     /*
         virtual void setQuota(const std::string &path, int64_t namespaceQuota,
-                              int64_t diskspaceQuota)  throw 
(AccessControlException,
+                              int64_t diskspaceQuota)  throw
+       (AccessControlException,
                  FileNotFoundException, UnresolvedLinkException,
                  HdfsIOException)  = 0;
     */
@@ -630,16 +654,18 @@ public:
      * @throw UnresolvedLinkException if <code>src</code> contains a symlink.
      * @throw HdfsIOException If an I/O error occurred
      */
-    //Idempotent
+    // Idempotent
     virtual void fsync(const std::string &src, const std::string &client)
-    /* throw (AccessControlException, FileNotFoundException,
+        /* throw (AccessControlException, FileNotFoundException,
      UnresolvedLinkException, HdfsIOException) */ = 0;
 
     /**
      * Sets the modification and access time of the file to the specified time.
      * @param src The const std::string &representation of the path
      * @param mtime The number of milliseconds since Jan 1, 1970.
-     *              Setting mtime to -1 means that modification time should 
not be set
+     *              Setting mtime to -1 means that modification time should not
+     *be
+     *set
      *              by this call.
      * @param atime The number of milliseconds since Jan 1, 1970.
      *              Setting atime to -1 means that access time should not be 
set
@@ -650,9 +676,9 @@ public:
      * @throw UnresolvedLinkException if <code>src</code> contains a symlink.
      * @throw HdfsIOException If an I/O error occurred
      */
-    //Idempotent
+    // Idempotent
     virtual void setTimes(const std::string &src, int64_t mtime, int64_t atime)
-    /* throw (AccessControlException, FileNotFoundException,
+        /* throw (AccessControlException, FileNotFoundException,
      UnresolvedLinkException, HdfsIOException) */ = 0;
 
     /**
@@ -665,17 +691,22 @@ public:
      *                       if false then parent must exist
      *
      * @throw AccessControlException permission denied
-     * @throw FileAlreadyExistsException If file <code>link</code> already 
exists
-     * @throw FileNotFoundException If parent of <code>link</code> does not 
exist
+     * @throw FileAlreadyExistsException If file <code>link</code> already
+     *exists
+     * @throw FileNotFoundException If parent of <code>link</code> does not
+     *exist
      *           and <code>createParent</code> is false
-     * @throw ParentNotDirectoryException If parent of <code>link</code> is 
not a
+     * @throw ParentNotDirectoryException If parent of <code>link</code> is not
+     *a
      *           directory.
      * @throw UnresolvedLinkException if <code>link</target> contains a 
symlink.
      * @throw HdfsIOException If an I/O error occurred
      */
     /*    virtual void createSymlink(const std::string &target,
-                                   const std::string &link, const Permission 
&dirPerm,
-                                   bool createParent)  throw 
(AccessControlException,
+                                   const std::string &link, const Permission
+       &dirPerm,
+                                   bool createParent)  throw
+       (AccessControlException,
                  FileAlreadyExistsException, FileNotFoundException,
                  ParentNotDirectoryException, SafeModeException,
                  UnresolvedLinkException, HdfsIOException)  = 0;*/
@@ -692,7 +723,7 @@ public:
      * @throw HdfsIOException If the given path does not refer to a symlink
      *           or an I/O error occurred
      */
-    //Idempotent
+    // Idempotent
     /*    virtual std::string getLinkTarget(const std::string &path)
          throw (AccessControlException, FileNotFoundException,
          HdfsIOException)  = 0;*/
@@ -710,10 +741,10 @@ public:
      * @param lb output the returned block.
      * @throw HdfsIOException if any error occurs
      */
-    //Idempotent
-    virtual shared_ptr<LocatedBlock> updateBlockForPipeline(const 
ExtendedBlock &block,
-            const std::string &clientName)
-    /* throw (HdfsIOException) */ = 0;
+    // Idempotent
+    virtual shared_ptr<LocatedBlock> updateBlockForPipeline(
+        const ExtendedBlock &block, const std::string &clientName)
+        /* throw (HdfsIOException) */ = 0;
 
     /**
      * Update a pipeline for a block under construction
@@ -724,10 +755,12 @@ public:
      * @param newNodes datanodes in the pipeline
      * @throw HdfsIOException if any error occurs
      */
-    virtual void updatePipeline(const std::string &clientName,
-                                const ExtendedBlock &oldBlock, const 
ExtendedBlock &newBlock,
-                                const std::vector<DatanodeInfo> &newNodes,
-                                const std::vector<std::string> &storageIDs) /* 
throw (HdfsIOException) */ = 0;
+    virtual void updatePipeline(
+        const std::string &clientName, const ExtendedBlock &oldBlock,
+        const ExtendedBlock &newBlock,
+        const std::vector<DatanodeInfo> &newNodes,
+        const std::vector<std::string> &
+            storageIDs) /* throw (HdfsIOException) */ = 0;
 
     /**
       * Get a valid Delegation Token.
@@ -737,7 +770,7 @@ public:
       * @throws IOException
       */
     virtual Token getDelegationToken(const std::string &renewer)
-    /* throws IOException*/ = 0;
+        /* throws IOException*/ = 0;
 
     /**
      * Renew an existing delegation token.
@@ -747,7 +780,7 @@ public:
      * @throws IOException
      */
     virtual int64_t renewDelegationToken(const Token &token)
-    /*throws IOException*/ = 0;
+        /*throws IOException*/ = 0;
 
     /**
      * Cancel an existing delegation token.
@@ -756,14 +789,17 @@ public:
      * @throws IOException
      */
     virtual void cancelDelegationToken(const Token &token)
-    /*throws IOException*/ = 0;
+        /*throws IOException*/ = 0;
 
     /**
      * close the namenode connection.
      */
-    virtual void close() {};
-};
+    virtual void close(){};
 
+private:
+    Namenode(const Namenode &other);
+    Namenode &operator=(const Namenode &other);
+};
 }
 }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/e559ce04/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/NamenodeImpl.h
----------------------------------------------------------------------
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/NamenodeImpl.h
 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/NamenodeImpl.h
index 809d643..961fc22 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/NamenodeImpl.h
+++ 
b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/server/NamenodeImpl.h
@@ -24,70 +24,76 @@
 namespace hdfs {
 namespace internal {
 
-class NamenodeImpl: public Namenode {
+class NamenodeImpl : public Namenode {
 public:
     NamenodeImpl(const char *host, const char *port,
-            const std::string &tokenService, const SessionConfig &c,
-            const RpcAuth &a);
+                 const std::string &tokenService, const SessionConfig &c,
+                 const RpcAuth &a);
 
     ~NamenodeImpl();
 
-    //Idempotent
-    void getBlockLocations(const std::string &src, int64_t offset,
-                           int64_t length, LocatedBlocks &lbs) /* throw 
(AccessControlException,
+    // Idempotent
+    void getBlockLocations(
+        const std::string &src, int64_t offset, int64_t length,
+        LocatedBlocks &lbs) /* throw (AccessControlException,
              FileNotFoundException, UnresolvedLinkException,
              HdfsIOException) */;
 
     void create(const std::string &src, const Permission &masked,
                 const std::string &clientName, int flag, bool createParent,
-                short replication, int64_t blockSize) /* throw 
(AccessControlException,
+                short replication,
+                int64_t blockSize) /* throw (AccessControlException,
              AlreadyBeingCreatedException, DSQuotaExceededException,
              FileAlreadyExistsException, FileNotFoundException,
              NSQuotaExceededException, ParentNotDirectoryException,
              SafeModeException, UnresolvedLinkException, HdfsIOException) */;
 
-    shared_ptr<LocatedBlock> append(const std::string &src, const std::string 
&clientName)
-    /* throw (AccessControlException,
+    shared_ptr<LocatedBlock> append(const std::string &src,
+                                    const std::string &clientName)
+        /* throw (AccessControlException,
              DSQuotaExceededException, FileNotFoundException,
              SafeModeException, UnresolvedLinkException, HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     bool setReplication(const std::string &src, short replication)
-    /* throw (AccessControlException, DSQuotaExceededException,
+        /* throw (AccessControlException, DSQuotaExceededException,
      FileNotFoundException, SafeModeException, UnresolvedLinkException,
      HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     void setPermission(const std::string &src, const Permission &permission)
-    /* throw (AccessControlException, FileNotFoundException,
+        /* throw (AccessControlException, FileNotFoundException,
      SafeModeException, UnresolvedLinkException, HdfsIOException) */;
 
-    //Idempotent
-    void setOwner(const std::string &src, const std::string &username,
-                  const std::string &groupname) /* throw 
(AccessControlException,
+    // Idempotent
+    void setOwner(
+        const std::string &src, const std::string &username,
+        const std::string &groupname) /* throw (AccessControlException,
              FileNotFoundException, SafeModeException,
              UnresolvedLinkException, HdfsIOException) */;
 
-    void abandonBlock(const ExtendedBlock &b, const std::string &src,
-                      const std::string &holder) /* throw 
(AccessControlException,
+    void abandonBlock(
+        const ExtendedBlock &b, const std::string &src,
+        const std::string &holder) /* throw (AccessControlException,
              FileNotFoundException, UnresolvedLinkException,
              HdfsIOException) */;
 
-    shared_ptr<LocatedBlock> addBlock(const std::string &src, const 
std::string &clientName,
-                                      const ExtendedBlock *previous,
-                                      const std::vector<DatanodeInfo> 
&excludeNodes)
-    /* throw (AccessControlException, FileNotFoundException,
+    shared_ptr<LocatedBlock> addBlock(
+        const std::string &src, const std::string &clientName,
+        const ExtendedBlock *previous,
+        const std::vector<DatanodeInfo> &excludeNodes)
+        /* throw (AccessControlException, FileNotFoundException,
      NotReplicatedYetException, SafeModeException,
      UnresolvedLinkException, HdfsIOException) */;
 
-    //Idempotent
-    shared_ptr<LocatedBlock> getAdditionalDatanode(const std::string &src,
-            const ExtendedBlock &blk,
-            const std::vector<DatanodeInfo> &existings,
-            const std::vector<std::string> &storageIDs,
-            const std::vector<DatanodeInfo> &excludes, int numAdditionalNodes,
-            const std::string &clientName)
-    /* throw (AccessControlException, FileNotFoundException,
+    // Idempotent
+    shared_ptr<LocatedBlock> getAdditionalDatanode(
+        const std::string &src, const ExtendedBlock &blk,
+        const std::vector<DatanodeInfo> &existings,
+        const std::vector<std::string> &storageIDs,
+        const std::vector<DatanodeInfo> &excludes, int numAdditionalNodes,
+        const std::string &clientName)
+        /* throw (AccessControlException, FileNotFoundException,
      SafeModeException, UnresolvedLinkException, HdfsIOException) */;
 
     bool complete(const std::string &src, const std::string &clientName,
@@ -95,15 +101,15 @@ public:
              FileNotFoundException, SafeModeException,
              UnresolvedLinkException, HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     void reportBadBlocks(const std::vector<LocatedBlock> &blocks)
-    /* throw (HdfsIOException) */;
+        /* throw (HdfsIOException) */;
 
     bool rename(const std::string &src, const std::string &dst)
-    /* throw (UnresolvedLinkException, HdfsIOException) */;
+        /* throw (UnresolvedLinkException, HdfsIOException) */;
 
     void concat(const std::string &trg, const std::vector<std::string> &srcs)
-    /* throw (HdfsIOException, UnresolvedLinkException) */;
+        /* throw (HdfsIOException, UnresolvedLinkException) */;
 
     /*void rename2(const std::string &src, const std::string &dst)
      throw (AccessControlException, DSQuotaExceededException,
@@ -112,43 +118,43 @@ public:
      SafeModeException, UnresolvedLinkException, HdfsIOException) ;*/
 
     bool deleteFile(const std::string &src, bool recursive)
-    /* throw (AccessControlException, FileNotFoundException,
+        /* throw (AccessControlException, FileNotFoundException,
      SafeModeException, UnresolvedLinkException, HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     bool mkdirs(const std::string &src, const Permission &masked,
                 bool createParent) /* throw (AccessControlException,
              FileAlreadyExistsException, FileNotFoundException,
              NSQuotaExceededException, ParentNotDirectoryException,
              SafeModeException, UnresolvedLinkException, HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     bool getListing(const std::string &src, const std::string &startAfter,
                     bool needLocation, std::vector<FileStatus> &dl)
-    /* throw (AccessControlException, FileNotFoundException,
+        /* throw (AccessControlException, FileNotFoundException,
      UnresolvedLinkException, HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     void renewLease(const std::string &clientName)
-    /* throw (AccessControlException, HdfsIOException) */;
+        /* throw (AccessControlException, HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     bool recoverLease(const std::string &src, const std::string &clientName)
-    /* throw (HdfsIOException) */;
+        /* throw (HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     std::vector<int64_t> getFsStats() /* throw (HdfsIOException) */;
 
     void metaSave(const std::string &filename) /* throw (HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     FileStatus getFileInfo(const std::string &src)
-    /* throw (AccessControlException, FileNotFoundException,
+        /* throw (AccessControlException, FileNotFoundException,
      UnresolvedLinkException, HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     FileStatus getFileLinkInfo(const std::string &src)
-    /* throw (AccessControlException, UnresolvedLinkException,
+        /* throw (AccessControlException, UnresolvedLinkException,
      HdfsIOException) */;
 
     /*    //Idempotent
@@ -156,66 +162,68 @@ public:
          throw (AccessControlException, FileNotFoundException,
          UnresolvedLinkException, HdfsIOException) ;*/
 
-    //Idempotent
+    // Idempotent
     void setQuota(const std::string &path, int64_t namespaceQuota,
                   int64_t diskspaceQuota) /* throw (AccessControlException,
              FileNotFoundException, UnresolvedLinkException,
              HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     void fsync(const std::string &src, const std::string &client)
-    /* throw (AccessControlException, FileNotFoundException,
+        /* throw (AccessControlException, FileNotFoundException,
      UnresolvedLinkException, HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     void setTimes(const std::string &src, int64_t mtime, int64_t atime)
-    /* throw (AccessControlException, FileNotFoundException,
+        /* throw (AccessControlException, FileNotFoundException,
      UnresolvedLinkException, HdfsIOException) */;
 
     void createSymlink(const std::string &target, const std::string &link,
                        const Permission &dirPerm, bool createParent)
-    /* throw (AccessControlException, FileAlreadyExistsException,
+        /* throw (AccessControlException, FileAlreadyExistsException,
      FileNotFoundException, ParentNotDirectoryException,
      SafeModeException, UnresolvedLinkException, HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     std::string getLinkTarget(const std::string &path)
-    /* throw (AccessControlException, FileNotFoundException,
+        /* throw (AccessControlException, FileNotFoundException,
      HdfsIOException) */;
 
-    //Idempotent
-    shared_ptr<LocatedBlock> updateBlockForPipeline(const ExtendedBlock &block,
-            const std::string &clientName)
-    /* throw (HdfsIOException) */;
+    // Idempotent
+    shared_ptr<LocatedBlock> updateBlockForPipeline(
+        const ExtendedBlock &block, const std::string &clientName)
+        /* throw (HdfsIOException) */;
 
     void updatePipeline(const std::string &clientName,
-                        const ExtendedBlock &oldBlock, const ExtendedBlock 
&newBlock,
+                        const ExtendedBlock &oldBlock,
+                        const ExtendedBlock &newBlock,
                         const std::vector<DatanodeInfo> &newNodes,
-                        const std::vector<std::string> &storageIDs) /* throw 
(HdfsIOException) */;
+                        const std::vector<std::string> &
+                            storageIDs) /* throw (HdfsIOException) */;
 
-    //Idempotent
+    // Idempotent
     Token getDelegationToken(const std::string &renewer)
-    /* throws IOException*/;
+        /* throws IOException*/;
 
-    //Idempotent
+    // Idempotent
     int64_t renewDelegationToken(const Token &token)
-    /*throws IOException*/;
+        /*throws IOException*/;
 
-    //Idempotent
+    // Idempotent
     void cancelDelegationToken(const Token &token)
-    /*throws IOException*/;
+        /*throws IOException*/;
 
 private:
     void invoke(const RpcCall &call);
+    NamenodeImpl(const NamenodeImpl &other);
+    NamenodeImpl &operator=(const NamenodeImpl &other);
 
-private:
     RpcAuth auth;
     RpcClient &client;
     RpcConfig conf;
     RpcProtocolInfo protocol;
     RpcServerInfo server;
 };
-
 }
 }
 

Reply via email to