diff --git a/.gitignore b/.gitignore
old mode 100644
new mode 100755
diff --git a/.gitmodules b/.gitmodules
old mode 100644
new mode 100755
diff --git a/AUTHORS b/AUTHORS
old mode 100644
new mode 100755
diff --git a/CMakeLists.txt b/CMakeLists.txt
old mode 100644
new mode 100755
diff --git a/COPYING b/COPYING
old mode 100644
new mode 100755
diff --git a/ChangeLog b/ChangeLog
old mode 100644
new mode 100755
diff --git a/GNUmakefile b/GNUmakefile
old mode 100644
new mode 100755
diff --git a/NEWS b/NEWS
old mode 100644
new mode 100755
diff --git a/README b/README
old mode 100644
new mode 100755
diff --git a/README-hacking b/README-hacking
old mode 100644
new mode 100755
diff --git a/matahari-broker.conf.in b/matahari-broker.conf.in
old mode 100644
new mode 100755
diff --git a/matahari-broker.sysconf.in b/matahari-broker.sysconf.in
old mode 100644
new mode 100755
diff --git a/matahari.init.in b/matahari.init.in
old mode 100644
new mode 100755
diff --git a/matahari.spec b/matahari.spec
old mode 100644
new mode 100755
diff --git a/matahari.sysconf.in b/matahari.sysconf.in
old mode 100644
new mode 100755
diff --git a/mingw32-matahari.spec b/mingw32-matahari.spec
old mode 100644
new mode 100755
diff --git a/src/.gitignore b/src/.gitignore
old mode 100644
new mode 100755
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
old mode 100644
new mode 100755
index b95bbc6..0572157
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -24,8 +24,9 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_P
 set(M_HOST "matahari-hostd")
 set(M_NET  "matahari-netd")
 set(M_SRV  "matahari-serviced")
+set(M_CFG  "matahari-configd")
 
-set(DAEMONS ${M_HOST} ${M_NET} ${M_SRV})
+set(DAEMONS ${M_HOST} ${M_NET} ${M_SRV} ${M_CFG})
 
 file(GLOB SCHEMAS "${CMAKE_CURRENT_SOURCE_DIR}/*.xml")
 
@@ -38,11 +39,14 @@ add_definitions(-DMATAHARI_BROKER="${MATAHARI_BROKER}")
 set(SCHEMA_SOURCES
         ${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/Host.cpp
 	${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/Network.cpp
+	${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/Config.cpp
+	${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/ConfigHelper.cpp
         ${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/Services.cpp
         ${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/Resources.cpp
         ${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/EventHeartbeat.cpp
         ${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/EventService_op.cpp
         ${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/EventResource_op.cpp
+        ${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/QmfPackage.cpp
         ${CMAKE_CURRENT_BINARY_DIR}/qmf/org/matahariproject/Package.cpp)
 
 ## Libraries and Common code
@@ -77,6 +81,9 @@ target_link_libraries(${M_NET} mnet)
 add_executable(${M_SRV}  service/matahari-srv.cpp ${SCHEMA_SOURCES} ${COMMON_SOURCES})
 target_link_libraries(${M_SRV} msrv)
 
+add_executable(${M_CFG}  config/matahari-config.cpp ${SCHEMA_SOURCES} ${COMMON_SOURCES})
+target_link_libraries(${M_CFG} )
+
 foreach(daemon ${DAEMONS}) 
    target_link_libraries(${daemon} mcommon)
    if(WIN32)
@@ -138,7 +145,7 @@ find_library(SIGAR sigar)
 if(NOT_SIGAR)
    message("SIGAR library not found.")
    set(SIGAR "")
-endif(NOT SIGAR)
+endif(NOT_SIGAR)
 
 string(REGEX REPLACE "\\." "" QPID_VERSION ${QPID_VERSION})
 
@@ -165,13 +172,15 @@ if (regen_schema)
     execute_process(COMMAND rm -f ${SCHEMA_SOURCES})
     execute_process(COMMAND ${QMFGEN} -o ./qmf ${SCHEMAS}
                     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+    execute_process(COMMAND ${QMFGEN} -2 -o ./qmf ${SCHEMAS}
+                    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
 else (regen_schema)
     message(STATUS "No need to generate QMF schema")
 endif (regen_schema)
 
 # Add QF libraries
 foreach(daemon ${DAEMONS}) 
-    target_link_libraries(${daemon} ${QPIDCOMMON_LIBRARY} ${QPIDCLIENT_LIBRARY} ${QMF_LIBRARY} ${SIGAR})
+    target_link_libraries(${daemon} ${QPIDCOMMON_LIBRARY} ${QPIDCLIENT_LIBRARY} ${QPIDMESSAGING_LIBRARY} ${QMF_LIBRARY} ${QMF2_LIBRARY} ${SIGAR})
     IF(QPIDTYPES_FOUND)
         target_link_libraries(${daemon} ${QPIDTYPES_LIBRARY})
     ENDIF(QPIDTYPES_FOUND)
@@ -180,6 +189,7 @@ endforeach(daemon ${DAEMONS})
 # Install targets
 install(TARGETS ${M_HOST}  DESTINATION sbin)
 install(TARGETS ${M_NET}   DESTINATION sbin)
+install(TARGETS ${M_CFG}   DESTINATION sbin)
 
 install(TARGETS mcommon mhost msrv DESTINATION lib${LIB_SUFFIX})
 
diff --git a/src/cmake/modules/FindQPID.cmake b/src/cmake/modules/FindQPID.cmake
old mode 100644
new mode 100755
index 66efb38..f8f9c8e
--- a/src/cmake/modules/FindQPID.cmake
+++ b/src/cmake/modules/FindQPID.cmake
@@ -14,15 +14,21 @@ if(MSVC)
 
 else(MSVC)
    find_library(QMF_LIBRARY qmf)
+   find_library(QMF2_LIBRARY qmf2)
    find_library(QPIDCLIENT_LIBRARY qpidclient)
-   find_library(QPIDCOMMON_LIBRARY qpidcommon)	
-   find_library(QPIDTYPES_LIBRARY qpidtypes)	
+   find_library(QPIDCOMMON_LIBRARY qpidcommon)
+   find_library(QPIDTYPES_LIBRARY qpidtypes)
+   find_library(QPIDMESSAGING_LIBRARY qpidmessaging)
 
    # Check if we found all libraries
    if(QMF_LIBRARY)
        set(QMF_FOUND true)
    endif(QMF_LIBRARY)
 
+   if(QMF2_LIBRARY)
+       set(QMF2_FOUND true)
+   endif(QMF2_LIBRARY)
+
    if(QPIDCLIENT_LIBRARY)
        set(QPIDCLIENT_FOUND true)
    endif(QPIDCLIENT_LIBRARY)
@@ -35,6 +41,10 @@ else(MSVC)
        set(QPIDTYPES_FOUND true)
    endif(QPIDTYPES_LIBRARY)
 
+   if(QPIDMESSAGING_LIBRARY)
+       set(QPIDMESSAGING_FOUND true)
+   endif(QPIDMESSAGING_LIBRARY)
+
    # Handle found/not found libraries
    if(QMF_FOUND)
        if(NOT QPID_FIND_QUIETLY)
@@ -46,6 +56,16 @@ else(MSVC)
        endif(QPID_FIND_REQUIRED)
    endif(QMF_FOUND)
 
+   if(QMF2_FOUND)
+       if(NOT QPID_FIND_QUIETLY)
+           message(STATUS "Found QMF2: ${QMF2_LIBRARY}")
+       endif(NOT QPID_FIND_QUIETLY)
+   else(QMF2_FOUND)
+       if(QPID_FIND_REQUIRED)
+           message(FATAL_ERROR "Could not find QMF2")
+       endif(QPID_FIND_REQUIRED)
+   endif(QMF2_FOUND)
+
    if(QPIDCLIENT_FOUND)
        if(NOT QPID_FIND_QUIETLY)
            message(STATUS "Found QPIDCLIENT: ${QPIDCLIENT_LIBRARY}")
@@ -78,6 +98,18 @@ else(MSVC)
        endif(QPID_FIND_REQUIRED)
    endif(QPIDTYPES_FOUND)
 
+   if(QPIDMESSAGING_FOUND)
+       if(NOT QPID_FIND_QUIETLY)
+           message(STATUS "Found QPIDMESSAGING: ${QPIDMESSAGING_LIBRARY}")
+       endif(NOT QPID_FIND_QUIETLY)
+   else(QPIDMESSAGING_FOUND)
+       if(QPID_FIND_REQUIRED)
+           # we don't want to fail now even we don't have QPIDMESSAGING!
+           # TODO: fix once QPIDMESSAGING available
+           message(STATUS "Could not find QPIDMESSAGING")
+       endif(QPID_FIND_REQUIRED)
+   endif(QPIDMESSAGING_FOUND)
+
    # Figure out the qpid version
    if(WIN32)
       find_file(QPIDD qpidd.exe)
diff --git a/src/config/matahari-config.cpp b/src/config/matahari-config.cpp
new file mode 100755
index 0000000..56a65d5
--- /dev/null
+++ b/src/config/matahari-config.cpp
@@ -0,0 +1,344 @@
+/* matahari-host.cpp - Copyright (C) 2009 Red Hat, Inc.
+ * Written by Carl Trieloff & Ted Ross
+ *
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * 
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#ifndef WIN32
+#include "config.h"
+#endif
+
+#include <set>
+#include "matahari/mh_agent.h"
+#include <qmf/Data.h>
+#include <qmf/ConsoleEvent.h>
+#include <qmf/ConsoleSession.h>
+#include <qpid/sys/Time.h>
+#include <sigar.h>
+#include <iostream>
+#include <string.h>
+#include <map>
+
+extern "C" {
+#include "matahari/host.h"
+}
+
+class ConfigAgent : public MatahariAgent
+{
+private:
+    qmf::ConsoleSession _console_session;
+    qmf::Data _helper;
+    qmf::Data _instance_config;
+	std::string _trust_key;
+	std::string _config_uuid;
+	std::string _my_ip_for_config;
+
+    class cacheItem{
+		public:
+    	qmf::Data _data;
+		qpid::sys::AbsTime timestamp;
+	    std::string _trust_key;
+		cacheItem() {timestamp = qpid::sys::AbsTime::now();};
+    };
+    std::map<std::string, cacheItem> _cache;
+	
+    int doPostBoot(qmf::Data& cached_config);
+    int setupCache();
+    std::string methodPreRegister(qmf::AgentEvent& event);
+	std::string methodUpdateCache(qmf::AgentEvent& event);
+	std::string methodRemove(qmf::AgentEvent& event);
+	std::string methodRemoveStale(qmf::AgentEvent& event);
+	virtual void setOptions();
+public:
+    int setup(ManagementAgent* agent);
+    void eventLoop();
+    ManagementObject* GetManagementObject() const { return 0; }
+    status_t ManagementMethod(uint32_t method, Args& arguments, string& text);
+};
+
+int
+main(int argc, char **argv)
+{
+    ConfigAgent agent; 
+    int rc = agent.init(argc, argv, "mantahari-config",true);
+    if (rc == 0)
+        agent.eventLoop();
+    return rc;
+}
+
+void ConfigAgent::setOptions() {
+	// overload  set a param on the Agent session.
+    _agent_session.setAttribute("cache", _local == 0);
+}
+
+int
+ConfigAgent::setup(ManagementAgent* agent)
+{
+    _console_session = qmf::ConsoleSession(_amqp_connection);
+    _console_session.open();
+
+    if (!_local){ // if cache, start ConfigHelper
+	
+        _helper = qmf::Data(_package.data_ConfigHelper.getSchemaId());
+        _agent_session.addData(_helper, "singleton");
+	
+        // setup cache.
+        return setupCache();
+	
+    } else { // start host config agent  format (UUID:IP:key)
+	
+        char * ch;
+		char* tok = ":; ,";
+		ch = strtok (_local,tok);
+		if (ch != NULL) {
+			_config_uuid = ch;
+			ch = strtok (NULL,tok);
+		}
+		if (ch != NULL) {
+			_my_ip_for_config = ch;
+			ch = strtok (NULL,tok);
+		}		
+		if (ch != NULL) {
+			_trust_key = ch;
+			ch = strtok (NULL,tok);
+		}
+	
+        _instance_config = qmf::Data(_package.data_Config.getSchemaId());
+        _instance_config.setProperty("uuid", _config_uuid);
+        _instance_config.setProperty("my_conf_addr", _my_ip_for_config);  
+        _instance_config.setProperty("status", "Waiting for configuration from cache");
+        _agent_session.addData(_instance_config);
+        _console_session.setAgentFilter("[and, [eq, _vendor, [quote, 'matahariproject.org']], [eq, _product, [quote, 'mantahari-config']], [eq, cache, [quote, True]]]");
+
+        qmf::Agent agent;
+        qmf::Data cached_config;
+
+        while (true) {  // later, remove polling with standing blocking query
+            if (_console_session.getAgentCount() > 0) {
+            // TODO: what if there are multiple matching agents?  
+                agent = _console_session.getAgent(0);
+                qmf::ConsoleEvent result(agent.query("{class:Config, package:'org.matahariproject', where:[eq, uuid, [quote, " + 
+                                                     std::string(_config_uuid) + "]]}"));
+                if (result.getType() == qmf::CONSOLE_QUERY_RESPONSE) {
+                    if (result.getDataCount() == 1) {
+                        cached_config = result.getData(0);
+                        _instance_config.setProperty("status", "Received configuration from cache");
+                        break;
+                    }
+                }
+            }
+            qpid::sys::sleep(1);
+        }
+    
+        _instance_config.setProperty("config_xml", cached_config.getProperty("config_xml").asString());
+		qpid::types::Variant::List cfhs;
+		cfhs.push_front(qpid::types::Variant(agent.getName())); // insert any other config hosts
+        _instance_config.setProperty("config_hosts", cfhs);   
+	  
+        return doPostBoot(cached_config);
+    }
+    return 0;
+}
+
+void
+ConfigAgent::eventLoop()
+{
+    qmf::AgentEvent event;
+
+    while (true) {
+        bool valid(_agent_session.nextEvent(event));
+        if (valid) {
+            switch (event.getType()) {
+            case qmf::AGENT_METHOD: {
+                const std::string& methodName(event.getMethodName());
+                std::string result;
+
+                if (methodName == "pre_register")
+                    result = methodPreRegister(event);
+                if (methodName == "update_cache")
+                    result = methodUpdateCache(event);
+                if (methodName == "remove")
+                    result = methodRemove(event);
+                if (methodName == "remove_stale")
+                    result = methodRemoveStale(event);
+
+                if (result.empty())
+                    _agent_session.methodSuccess(event);
+                else
+                    _agent_session.raiseException(event, result);
+            }
+                break;
+
+            default: {}
+            }
+        }
+    }
+}
+
+int
+ConfigAgent::doPostBoot(qmf::Data& cached_config)
+{
+    _instance_config.setProperty("status", "Starting post boot processing");
+
+
+
+// do post boot whada..
+// bla bla
+    
+// Insert code here....    
+
+	
+    // sync objects	back to the cache, use trust-key	
+    _console_session.setAgentFilter("[and, [eq, _vendor, [quote, 'matahariproject.org']], [eq, _product, [quote, 'mantahari-config']], [eq, cache, [quote, True]]]");
+    while (true) { // later, remove polling with standing blocking query
+		if (_console_session.getAgentCount() > 0) { 
+			// TODO: what if there are multiple matching agents? 
+			qmf::Agent agent; 
+			agent = _console_session.getAgent(0);
+			qmf::ConsoleEvent result(agent.query("{class:ConfigHelper, package:'org.matahariproject'}"));
+			if (result.getType() == qmf::CONSOLE_QUERY_RESPONSE) {
+    			if (result.getDataCount() == 1) {
+					qmf::Data helper = result.getData(0);
+					qpid::types::Variant::Map args;
+					args["uuid"] = _instance_config.getProperty("uuid").asString();
+					args["my_conf_addr"] = _instance_config.getProperty("my_conf_addr");
+					args["config_hosts"] = _instance_config.getProperty("config_hosts");
+					try {
+						qpid::types::Variant cd = _instance_config.getProperty("parameter_map");
+						if (!cd.isVoid()){
+							args["parameter_map"] = cd;
+						}
+					} catch (qmf::KeyNotFound &e){}
+
+					args["status"] = "Synced and running";
+					args["trust_key"] = _trust_key;
+
+					agent.callMethod("update_cache", args, helper.getAddr() );  
+					_instance_config.setProperty("status", "Synced and running");
+					return 1;
+    			}
+			}
+		}
+		qpid::sys::sleep(1);
+    }
+    return 0;  
+}
+
+int
+ConfigAgent::setupCache()
+{
+	// do any cache setup if required
+	return 1;
+}
+
+std::string
+ConfigAgent::methodPreRegister(qmf::AgentEvent& event)
+{
+    qpid::types::Variant::Map& args(event.getArguments());
+
+    std::string uuid(args["uuid"].asString());
+    std::string config_xml(args["config_xml"].asString());
+    std::string trust_key(args["trust_key"].asString());
+
+    qmf::Data item(_package.data_Config.getSchemaId());
+    item.setProperty("uuid", uuid);
+    item.setProperty("config_xml", config_xml);
+    item.setProperty("status", "Pending");
+    cacheItem ci;
+    ci._data = item;
+    ci._trust_key = trust_key;
+	
+  	std::map<std::string, cacheItem>::iterator it;
+	it = _cache.find(uuid);
+	if ( it != _cache.end()){
+		return std::string("Cache item already in use:"+ uuid);
+	}
+	
+    _cache[uuid] = ci;
+    _agent_session.addData(item);
+    return std::string();
+}
+
+std::string
+ConfigAgent::methodUpdateCache(qmf::AgentEvent& event)
+{
+    qpid::types::Variant::Map& args(event.getArguments());
+
+    std::string uuid(args["uuid"].asString());
+    std::string trust_key(args["trust_key"].asString());
+ 
+	cacheItem ci;
+ 	std::map<std::string, cacheItem>::iterator it;
+	it = _cache.find(uuid);
+	if ( it != _cache.end()){
+    	ci =(*it).second;
+		// check we are updating the right object
+ 		if (ci._data.getProperty("uuid") == uuid &&  ci._trust_key == trust_key) {
+
+			ci._data.setProperty("my_conf_addr", args["my_conf_addr"].asString());
+			ci._data.setProperty("status", args["status"].asString());
+			ci._data.setProperty("parameter_map", args["parameter_map"]);
+    		ci._data.setProperty("config_hosts", args["config_hosts"]);
+			return std::string();
+		}
+	}
+	return std::string("Cache miss for "+ uuid);
+}
+
+std::string
+ConfigAgent::methodRemove(qmf::AgentEvent& event)
+{
+    qpid::types::Variant::Map& args(event.getArguments());
+    std::string uuid(args["uuid"].asString());
+    std::string trust_key(args["trust_key"].asString());
+	// TODO do we want to check trust key...?
+ 	if (_cache.erase(uuid))
+		return std::string();
+
+	return std::string("Cache miss for "+ uuid);
+}
+
+std::string
+ConfigAgent::methodRemoveStale(qmf::AgentEvent& event)
+{
+    qpid::types::Variant::Map& args(event.getArguments());
+ 	int ticks = args["timeout"];
+	qpid::sys::AbsTime now = qpid::sys::AbsTime::now();
+	// now eval the cache.
+ 	std::map<std::string, cacheItem>::iterator it = _cache.begin();
+	int removed = 0;
+	while (it != _cache.end()) {
+	    qpid::sys::AbsTime item = qpid::sys::AbsTime((*it).second.timestamp, ticks*qpid::sys::TIME_SEC);
+		if ( item < now ) { // expire it
+			_agent_session.delData((*it).second._data.getAddr());
+			_cache.erase((*it).first);
+			removed++;
+		} 
+		it++;
+	}
+	args["removed"] = removed;
+	return std::string("Cleaned cache ");
+}
+
+// Refactor init for qmfv2 and remove schema registration and callback.
+Manageable::status_t
+ConfigAgent::ManagementMethod(uint32_t method, Args& arguments, string& text)
+{
+
+  return Manageable::STATUS_NOT_IMPLEMENTED;
+}
+
+
diff --git a/src/host/matahari-host.cpp b/src/host/matahari-host.cpp
old mode 100644
new mode 100755
index 98c9337..59ce566
--- a/src/host/matahari-host.cpp
+++ b/src/host/matahari-host.cpp
@@ -49,7 +49,7 @@ int
 main(int argc, char **argv)
 {
     HostAgent agent; 
-    int rc = agent.init(argc, argv);
+    int rc = agent.init(argc, argv, "matahari-host");
     while (rc == 0) {
 	qpid::sys::sleep(5);
 	agent.heartbeat();
diff --git a/src/include/config.h.in b/src/include/config.h.in
old mode 100644
new mode 100755
diff --git a/src/include/matahari.h.in b/src/include/matahari.h.in
old mode 100644
new mode 100755
diff --git a/src/include/matahari/host.h b/src/include/matahari/host.h
old mode 100644
new mode 100755
diff --git a/src/include/matahari/logging.h b/src/include/matahari/logging.h
old mode 100644
new mode 100755
diff --git a/src/include/matahari/mainloop.h b/src/include/matahari/mainloop.h
old mode 100644
new mode 100755
diff --git a/src/include/matahari/mh_agent.h b/src/include/matahari/mh_agent.h
old mode 100644
new mode 100755
index 04de759..a263245
--- a/src/include/matahari/mh_agent.h
+++ b/src/include/matahari/mh_agent.h
@@ -24,21 +24,30 @@
 #include <qpid/sys/Time.h>
 #include <qpid/agent/ManagementAgent.h>
 #include <qpid/management/Manageable.h>
+#include <qpid/messaging/Connection.h>
+#include <qmf/AgentEvent.h>
 
 using namespace qpid::management;
 using namespace std;
 
-#include "qmf/org/matahariproject/Package.h"
+#include "qmf/org/matahariproject/QmfPackage.h" // v2 schema
+#include "qmf/org/matahariproject/Package.h"  // v1 schema -- remove in time
 namespace _qmf = qmf::org::matahariproject;
 
 class MatahariAgent : public Manageable
 {
+ protected:
+    char* _local;
+    qpid::messaging::Connection _amqp_connection;
+    qmf::AgentSession _agent_session;
+    qmf::org::matahariproject::PackageDefinition _package;
+    virtual void setOptions() {};
   public:
     MatahariAgent() {};
     ~MatahariAgent() {};
     
     virtual int setup(ManagementAgent *agent) { return 0; };
-    int init(int argc, char **argv);
+    int init(int argc, char **argv, const std::string& procName="", bool v2 = false);
 };
 
 #endif // __MATAHARI_DAEMON_H
diff --git a/src/include/matahari/network.h b/src/include/matahari/network.h
old mode 100644
new mode 100755
diff --git a/src/include/matahari/services.h b/src/include/matahari/services.h
old mode 100644
new mode 100755
diff --git a/src/include/matahari/utilities.h b/src/include/matahari/utilities.h
old mode 100644
new mode 100755
diff --git a/src/lib/host.c b/src/lib/host.c
old mode 100644
new mode 100755
diff --git a/src/lib/host_linux.c b/src/lib/host_linux.c
old mode 100644
new mode 100755
diff --git a/src/lib/host_private.h b/src/lib/host_private.h
old mode 100644
new mode 100755
diff --git a/src/lib/host_windows.c b/src/lib/host_windows.c
old mode 100644
new mode 100755
diff --git a/src/lib/mainloop.c b/src/lib/mainloop.c
old mode 100644
new mode 100755
diff --git a/src/lib/mh_agent.cpp b/src/lib/mh_agent.cpp
old mode 100644
new mode 100755
index 283e0a7..19c072a
--- a/src/lib/mh_agent.cpp
+++ b/src/lib/mh_agent.cpp
@@ -28,6 +28,7 @@
 #include <iostream>
 #include <fstream>
 #include <string.h>
+#include <sstream>
 #include <errno.h>
 #include <vector>
 #include <exception>
@@ -38,8 +39,6 @@
 #include <qpid/sys/Time.h>
 #include <qpid/agent/ManagementAgent.h>
 #include <qpid/client/ConnectionSettings.h>
-
-#include "qmf/org/matahariproject/Package.h"
 #include "matahari/mh_agent.h"
 
 extern "C" {
@@ -72,11 +71,12 @@ print_usage()
     printf("\t-u | --username   username to use for authentication purproses.\n");
     printf("\t-s | --service    service name to use for authentication purproses.\n");
     printf("\t-p | --port       specify broker port.\n");
+    printf("\t-l | --local      specify uuid;secrete for local cache. \n");
 }
 #endif
 
 int
-MatahariAgent::init(int argc, char **argv)
+MatahariAgent::init(int argc, char **argv, const std::string& procName, bool v2)
 {
 #ifdef __linux__
     int arg;
@@ -90,6 +90,8 @@ MatahariAgent::init(int argc, char **argv)
     char *service = NULL;
     int serverport = MATAHARI_PORT;
 
+    _local = NULL;
+
     qpid::management::ConnectionSettings settings;
     ManagementAgent *agent;
 
@@ -102,12 +104,13 @@ MatahariAgent::init(int argc, char **argv)
 	{"username", required_argument, NULL, 'u'},
 	{"service", required_argument, NULL, 's'},
 	{"port", required_argument, NULL, 'p'},
+	{"local", required_argument, NULL, 'l'},
 	{0, 0, 0, 0}
     };
     mh_log_init(basename(argv[0]), LOG_DEBUG);
 
     // Get args
-    while ((arg = getopt_long(argc, argv, "hdb:gu:s:p:", opt, &idx)) != -1) {
+    while ((arg = getopt_long(argc, argv, "hdb:gu:s:p:l:", opt, &idx)) != -1) {
 	switch (arg) {
 	    case 'h':
 	    case '?':
@@ -147,6 +150,14 @@ MatahariAgent::init(int argc, char **argv)
 		    exit(1);
 		}
 		break;
+	    case 'l':
+		if (optarg) {
+		    _local = strdup(optarg);
+		} else {
+		    print_usage();
+		    exit(1);
+		}
+		break;
 	    case 'b':
 		if (optarg) {
 		    servername = strdup(optarg);
@@ -193,8 +204,28 @@ MatahariAgent::init(int argc, char **argv)
 	settings.mechanism = "GSSAPI";
     }
 
-    agent->init(settings, 5, false, ".magentdata");
-
+    if (v2) {
+	// Create a v2 API options map.
+	qpid::types::Variant::Map options;
+	if (username) options["username"] = username;
+	if (service) options["sasl-service"] = service;
+	if (gssapi) options["sasl-mechanism"] = "GSSAPI";
+	// if (transport) options["transport"] = transport; /// this will be needed to select serial IO
+	options["reconnect"] = bool(true);
+	std::stringstream url;
+	url << "localhost:" << serverport ;
+	_amqp_connection = qpid::messaging::Connection(url.str(), options);
+        _amqp_connection.open();
+    	_agent_session = qmf::AgentSession(_amqp_connection);
+    	_agent_session.setVendor("matahariproject.org");
+    	_agent_session.setProduct(procName);
+	setOptions();
+    	_package.configure(_agent_session);
+        _agent_session.open();
+    }else{
+    	agent->setName("matahariproject.org", procName);
+    	agent->init(settings, 5, false, ".magentdata");
+    }
     /* Do any setup required by our agent */
     if(this->setup(agent) < 0) {
 	fprintf(stderr, "Failed to set up agent\n");
diff --git a/src/lib/network.c b/src/lib/network.c
old mode 100644
new mode 100755
diff --git a/src/lib/network_linux.c b/src/lib/network_linux.c
old mode 100644
new mode 100755
diff --git a/src/lib/network_private.h b/src/lib/network_private.h
old mode 100644
new mode 100755
diff --git a/src/lib/network_windows.c b/src/lib/network_windows.c
old mode 100644
new mode 100755
diff --git a/src/lib/services.c b/src/lib/services.c
old mode 100644
new mode 100755
diff --git a/src/lib/services_linux.c b/src/lib/services_linux.c
old mode 100644
new mode 100755
diff --git a/src/lib/services_windows.c b/src/lib/services_windows.c
old mode 100644
new mode 100755
diff --git a/src/lib/utilities.c b/src/lib/utilities.c
old mode 100644
new mode 100755
diff --git a/src/net/matahari-net.cpp b/src/net/matahari-net.cpp
old mode 100644
new mode 100755
index 139cb54..be91c2a
--- a/src/net/matahari-net.cpp
+++ b/src/net/matahari-net.cpp
@@ -60,7 +60,7 @@ int
 main(int argc, char **argv)
 {
     NetAgent agent;
-    int rc = agent.init(argc, argv);
+    int rc = agent.init(argc, argv, "matahari-net");
     while (rc == 0) {
 	qpid::sys::sleep(1);
     }
diff --git a/src/schema.xml b/src/schema.xml
old mode 100644
new mode 100755
index ffe7a39..8d1a90a
--- a/src/schema.xml
+++ b/src/schema.xml
@@ -56,6 +56,45 @@
 
  <event name="heartbeat" args="timestamp,sequence" />
 
+<!-- boot config /config & param registory-->
+  <class name="Config">
+    <property name="uuid"          type="sstr" access="RO" desc="Host UUID" index="y" />
+    <property name="config_xml"    type="lstr" access="RO" desc="Host configuration XML" />
+    <property name="my_conf_addr"  type="sstr" access="RW" desc="Address for this machine config" />
+    <property name="status"        type="sstr" access="RW" desc="Status of Instance" />
+    <property name="parameter_map" type="map"  access="RW" desc="Host configuration metadata" />
+    <property name="config_hosts"  type="list" access="RW" desc="List of my Configuration hosts" />
+  </class>
+  
+  <class name="ConfigHelper">
+    <method name="pre_register"      desc="Associate a configuration with a UUID">
+      <arg name="uuid"               dir="I"  type="sstr" />
+      <arg name="config_xml"         dir="I"  type="lstr" />
+      <arg name="domain"             dir="I"  type="sstr" />
+      <arg name="trust_key"          dir="I"  type="sstr" />
+    </method>
+
+    <method name="update_cache"  desc="Update the instance fields in the cache">
+      <arg name="uuid"               dir="I"  type="sstr" />
+      <arg name="my_conf_addr"       dir="I"  type="sstr" />
+      <arg name="parameter_map"      dir="I"  type="map" />
+      <arg name="status"             dir="I"  type="sstr" />
+      <arg name="config_hosts"       dir="I"  type="list" />
+      <arg name="trust_key"          dir="I"  type="sstr" />
+    </method>
+  
+    <method name="remove"         desc="Delate configuartion for UUID">
+      <arg name="uuid"           dir="I"  type="sstr" />
+      <arg name="trust_key"          dir="I"  type="sstr" />
+    </method>
+  
+    <method name="remove_stale"           desc="Delate stale configuartions">
+      <arg name="timeout"           	dir="I"  type="uint32" />
+      <arg name="removed"           	dir="O"  type="uint32" />
+    </method>
+
+  </class>
+
  <!-- Network API -->
   <class name="Network">
    <property name="hostname"   type="sstr"  access="RO" desc="Hostname" index="y"/>
diff --git a/src/service/matahari-srv.cpp b/src/service/matahari-srv.cpp
old mode 100644
new mode 100755
index d34faaa..27cd77e
--- a/src/service/matahari-srv.cpp
+++ b/src/service/matahari-srv.cpp
@@ -65,7 +65,7 @@ int
 main(int argc, char **argv)
 {
     SrvAgent agent;
-    int rc = agent.init(argc, argv);
+    int rc = agent.init(argc, argv, "matahari-service");
     while (rc == 0) {
 	qpid::sys::sleep(1);
     }
diff --git a/src/tests/.gitignore b/src/tests/.gitignore
old mode 100644
new mode 100755
diff --git a/src/windows/autorun.inf b/src/windows/autorun.inf
old mode 100644
new mode 100755
diff --git a/src/windows/autorun.inf.in b/src/windows/autorun.inf.in
old mode 100644
new mode 100755
diff --git a/src/windows/install.bat b/src/windows/install.bat
old mode 100644
new mode 100755
diff --git a/src/windows/matahari-icon.ico b/src/windows/matahari-icon.ico
old mode 100644
new mode 100755
diff --git a/src/windows/matahari-install-banner.bmp b/src/windows/matahari-install-banner.bmp
old mode 100644
new mode 100755
