incubator-celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1063446 - in /incubator/celix/trunk: ./ celix_test/ dependency_manager/ echo_service/client/ echo_service/server/ framework/ framework/private/include/ framework/private/src/ hello_world/ launcher/ receiver-2.0/ receiver/ sender/ shell/ sh...
Date Tue, 25 Jan 2011 20:39:06 GMT
Author: abroekhuis
Date: Tue Jan 25 20:39:04 2011
New Revision: 1063446

URL: http://svn.apache.org/viewvc?rev=1063446&view=rev
Log:
Moved generic source files to a utils sub directory. Added dependency to APR for testing purposes.

Added:
    incubator/celix/trunk/utils/
    incubator/celix/trunk/utils/CMakeLists.txt   (with props)
    incubator/celix/trunk/utils/private/
    incubator/celix/trunk/utils/private/include/
    incubator/celix/trunk/utils/private/include/array_list_private.h
      - copied unchanged from r1059643, incubator/celix/trunk/framework/private/include/array_list_private.h
    incubator/celix/trunk/utils/private/include/hash_map_private.h
      - copied unchanged from r1059643, incubator/celix/trunk/framework/private/include/hash_map_private.h
    incubator/celix/trunk/utils/private/include/linked_list_private.h
      - copied unchanged from r1059643, incubator/celix/trunk/framework/private/include/linked_list_private.h
    incubator/celix/trunk/utils/private/src/
    incubator/celix/trunk/utils/private/src/array_list.c
      - copied unchanged from r1059643, incubator/celix/trunk/framework/private/src/array_list.c
    incubator/celix/trunk/utils/private/src/hash_map.c
      - copied unchanged from r1059643, incubator/celix/trunk/framework/private/src/hash_map.c
    incubator/celix/trunk/utils/private/src/linked_list_iterator.c
      - copied unchanged from r1059643, incubator/celix/trunk/framework/private/src/linked_list_iterator.c
    incubator/celix/trunk/utils/private/src/linkedlist.c
      - copied unchanged from r1059643, incubator/celix/trunk/framework/private/src/linkedlist.c
    incubator/celix/trunk/utils/public/
    incubator/celix/trunk/utils/public/include/
    incubator/celix/trunk/utils/public/include/array_list.h
      - copied unchanged from r1059643, incubator/celix/trunk/framework/private/include/array_list.h
    incubator/celix/trunk/utils/public/include/hash_map.h
      - copied unchanged from r1059643, incubator/celix/trunk/framework/private/include/hash_map.h
    incubator/celix/trunk/utils/public/include/linked_list_iterator.h
      - copied unchanged from r1059643, incubator/celix/trunk/framework/private/include/linked_list_iterator.h
    incubator/celix/trunk/utils/public/include/linkedlist.h
      - copied unchanged from r1059643, incubator/celix/trunk/framework/private/include/linkedlist.h
Removed:
    incubator/celix/trunk/framework/private/include/array_list.h
    incubator/celix/trunk/framework/private/include/array_list_private.h
    incubator/celix/trunk/framework/private/include/hash_map.h
    incubator/celix/trunk/framework/private/include/hash_map_private.h
    incubator/celix/trunk/framework/private/include/hashtable.h
    incubator/celix/trunk/framework/private/include/hashtable_itr.h
    incubator/celix/trunk/framework/private/include/hashtable_private.h
    incubator/celix/trunk/framework/private/include/hashtable_utility.h
    incubator/celix/trunk/framework/private/include/linked_list_iterator.h
    incubator/celix/trunk/framework/private/include/linked_list_private.h
    incubator/celix/trunk/framework/private/include/linkedlist.h
    incubator/celix/trunk/framework/private/src/array_list.c
    incubator/celix/trunk/framework/private/src/hash_map.c
    incubator/celix/trunk/framework/private/src/hashtable.c
    incubator/celix/trunk/framework/private/src/hashtable_itr.c
    incubator/celix/trunk/framework/private/src/hashtable_utility.c
    incubator/celix/trunk/framework/private/src/linked_list_iterator.c
    incubator/celix/trunk/framework/private/src/linkedlist.c
Modified:
    incubator/celix/trunk/CMakeLists.txt
    incubator/celix/trunk/Hello World.launch
    incubator/celix/trunk/celix_test/CMakeLists.txt
    incubator/celix/trunk/dependency_manager/CMakeLists.txt
    incubator/celix/trunk/echo_service/client/CMakeLists.txt
    incubator/celix/trunk/echo_service/server/CMakeLists.txt
    incubator/celix/trunk/framework/CMakeLists.txt
    incubator/celix/trunk/framework/private/include/bundle.h
    incubator/celix/trunk/framework/private/include/bundle_archive.h
    incubator/celix/trunk/framework/private/include/bundle_cache.h
    incubator/celix/trunk/framework/private/include/bundle_context.h
    incubator/celix/trunk/framework/private/include/filter.h
    incubator/celix/trunk/framework/private/include/framework.h
    incubator/celix/trunk/framework/private/include/headers.h
    incubator/celix/trunk/framework/private/include/properties.h
    incubator/celix/trunk/framework/private/src/bundle.c
    incubator/celix/trunk/framework/private/src/bundle_archive.c
    incubator/celix/trunk/framework/private/src/bundle_cache.c
    incubator/celix/trunk/framework/private/src/bundle_context.c
    incubator/celix/trunk/framework/private/src/filter.c
    incubator/celix/trunk/framework/private/src/framework.c
    incubator/celix/trunk/framework/private/src/manifest.c
    incubator/celix/trunk/framework/private/src/properties.c
    incubator/celix/trunk/framework/private/src/service_registration.c
    incubator/celix/trunk/hello_world/CMakeLists.txt
    incubator/celix/trunk/launcher/CMakeLists.txt
    incubator/celix/trunk/launcher/launcher.c
    incubator/celix/trunk/receiver-2.0/CMakeLists.txt
    incubator/celix/trunk/receiver-2.0/activator.c
    incubator/celix/trunk/receiver/CMakeLists.txt
    incubator/celix/trunk/receiver/activator.c
    incubator/celix/trunk/sender/CMakeLists.txt
    incubator/celix/trunk/shell/CMakeLists.txt
    incubator/celix/trunk/shell/shell.c
    incubator/celix/trunk/shell_tui/CMakeLists.txt
    incubator/celix/trunk/test/CMakeLists.txt
    incubator/celix/trunk/test/main.c
    incubator/celix/trunk/whiteboard/publisherA/CMakeLists.txt
    incubator/celix/trunk/whiteboard/publisherB/CMakeLists.txt
    incubator/celix/trunk/whiteboard/tracker/CMakeLists.txt
    incubator/celix/trunk/whiteboard/tracker_depman/CMakeLists.txt

Modified: incubator/celix/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/CMakeLists.txt (original)
+++ incubator/celix/trunk/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -18,7 +18,7 @@
 cmake_minimum_required (VERSION 2.6)
 project (Celix)
 
-SET(CMAKE_VERBOSE_MAKEFILE ON)
+#SET(CMAKE_VERBOSE_MAKEFILE ON)
 
 SET(CMAKE_BUILD_TYPE "Debug")
 SET(CMAKE_C_FLAGS "-std=c99")
@@ -37,6 +37,7 @@ include_directories("framework/public/in
 include_directories("/opt/local/include")
 link_directories("/opt/local/lib")
 
+add_subdirectory(utils)
 add_subdirectory(framework)
 
 #include(CPackConfig.in)

Modified: incubator/celix/trunk/Hello World.launch
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/Hello%20World.launch?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/Hello World.launch (original)
+++ incubator/celix/trunk/Hello World.launch Tue Jan 25 20:39:04 2011
@@ -27,6 +27,7 @@
 <listEntry value="4"/>
 </listAttribute>
 <mapAttribute key="org.eclipse.debug.core.environmentVariables">
-<mapEntry key="DYLD_LIBRARY_PATH" value="${workspace_loc:celix/build/framework}"/>
+<mapEntry key="DYLD_LIBRARY_PATH" value="${workspace_loc:celix/build/framework}:${workspace_loc:celix/build/utils}"/>
 </mapAttribute>
+<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;memoryBlockExpressionList context=&quot;reserved-for-future-use&quot;/&gt;&#10;"/>
 </launchConfiguration>

Modified: incubator/celix/trunk/celix_test/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/celix_test/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/celix_test/CMakeLists.txt (original)
+++ incubator/celix/trunk/celix_test/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -17,6 +17,8 @@
 
 include_directories("${PROJECT_SOURCE_DIR}/celix")
 include_directories("/opt/local/include")
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/utils/private/include")
 link_directories("/opt/local/lib")
 
 add_executable(hash_map_test hash_map_test.c)

Modified: incubator/celix/trunk/dependency_manager/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/dependency_manager/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/dependency_manager/CMakeLists.txt (original)
+++ incubator/celix/trunk/dependency_manager/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -16,4 +16,5 @@
 # under the License.
 
 add_library(dependency_manager STATIC dependency_manager.c dependency_activator_base.c service_component.c service_dependency.c)
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 target_link_libraries(dependency_manager framework)
\ No newline at end of file

Modified: incubator/celix/trunk/echo_service/client/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/echo_service/client/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/echo_service/client/CMakeLists.txt (original)
+++ incubator/celix/trunk/echo_service/client/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -1,5 +1,6 @@
 add_library(echo_client SHARED echo_client_activator echo_client)
 include_directories("${PROJECT_SOURCE_DIR}/celix")
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories("../server")
 target_link_libraries(echo_client framework)
 

Modified: incubator/celix/trunk/echo_service/server/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/echo_service/server/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/echo_service/server/CMakeLists.txt (original)
+++ incubator/celix/trunk/echo_service/server/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -1,5 +1,6 @@
 add_library(echo_server SHARED echo_server_activator echo_server)
 include_directories("${PROJECT_SOURCE_DIR}/celix")
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 target_link_libraries(echo_server framework)
 
 bundle(echo_server)

Modified: incubator/celix/trunk/framework/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/CMakeLists.txt (original)
+++ incubator/celix/trunk/framework/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -19,7 +19,8 @@ cmake_minimum_required(VERSION 2.8)
 add_definitions(-DUSE_FILE32API)
 aux_source_directory("private/src" SRC)
 include_directories("private/include")
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 add_library(framework SHARED ${SRC})
-target_link_libraries(framework z apr-1)
+target_link_libraries(framework utils z apr-1)
 
 install(TARGETS framework LIBRARY DESTINATION lib COMPONENT framework)

Modified: incubator/celix/trunk/framework/private/include/bundle.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/bundle.h?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle.h (original)
+++ incubator/celix/trunk/framework/private/include/bundle.h Tue Jan 25 20:39:04 2011
@@ -26,9 +26,11 @@
 #ifndef BUNDLE_H_
 #define BUNDLE_H_
 
+#include <apr-1/apr_general.h>
+
 #include "headers.h"
 
-BUNDLE bundle_create();
+BUNDLE bundle_create(apr_pool_t *mp);
 
 BUNDLE bundle_createFromArchive(FRAMEWORK framework, BUNDLE_ARCHIVE archive);
 

Modified: incubator/celix/trunk/framework/private/include/bundle_archive.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/bundle_archive.h?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle_archive.h (original)
+++ incubator/celix/trunk/framework/private/include/bundle_archive.h Tue Jan 25 20:39:04 2011
@@ -26,13 +26,15 @@
 #ifndef BUNDLE_ARCHIVE_H_
 #define BUNDLE_ARCHIVE_H_
 
+#include <apr-1/apr_general.h>
+
 #include "bundle_state.h"
 
 typedef struct bundleArchive * BUNDLE_ARCHIVE;
 
-BUNDLE_ARCHIVE bundleArchive_create(char * archiveRoot, long id, char * location);
-BUNDLE_ARCHIVE bundleArchive_createSystemBundleArchive();
-BUNDLE_ARCHIVE bundleArchive_recreate(char * archiveRoot);
+BUNDLE_ARCHIVE bundleArchive_create(char * archiveRoot, long id, char * location, apr_pool_t *mp);
+BUNDLE_ARCHIVE bundleArchive_createSystemBundleArchive(apr_pool_t *mp);
+BUNDLE_ARCHIVE bundleArchive_recreate(char * archiveRoot, apr_pool_t *mp);
 long bundleArchive_getId(BUNDLE_ARCHIVE archive);
 char * bundleArchive_getLocation(BUNDLE_ARCHIVE archive);
 char * bundleArchive_getArchiveRoot(BUNDLE_ARCHIVE archive);

Modified: incubator/celix/trunk/framework/private/include/bundle_cache.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/bundle_cache.h?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle_cache.h (original)
+++ incubator/celix/trunk/framework/private/include/bundle_cache.h Tue Jan 25 20:39:04 2011
@@ -32,7 +32,7 @@
 
 typedef struct bundleCache * BUNDLE_CACHE;
 
-BUNDLE_CACHE bundleCache_create(PROPERTIES configurationMap);
+BUNDLE_CACHE bundleCache_create(PROPERTIES configurationMap, apr_pool_t *mp);
 ARRAY_LIST bundleCache_getArchives(BUNDLE_CACHE cache);
 BUNDLE_ARCHIVE bundleCache_createArchive(BUNDLE_CACHE cache, long id, char * location);
 void bundleCache_delete(BUNDLE_CACHE cache);

Modified: incubator/celix/trunk/framework/private/include/bundle_context.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/bundle_context.h?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle_context.h (original)
+++ incubator/celix/trunk/framework/private/include/bundle_context.h Tue Jan 25 20:39:04 2011
@@ -34,7 +34,7 @@ FRAMEWORK bundleContext_getFramework(BUN
 
 BUNDLE bundleContext_installBundle(BUNDLE_CONTEXT context, char * location);
 
-SERVICE_REGISTRATION bundleContext_registerService(BUNDLE_CONTEXT context, char * serviceName, void * svcObj, HASHTABLE properties);
+SERVICE_REGISTRATION bundleContext_registerService(BUNDLE_CONTEXT context, char * serviceName, void * svcObj, PROPERTIES properties);
 
 ARRAY_LIST getServiceReferences(BUNDLE_CONTEXT context, char * serviceName, char * filter);
 SERVICE_REFERENCE bundleContext_getServiceReference(BUNDLE_CONTEXT context, char * serviceName);

Modified: incubator/celix/trunk/framework/private/include/filter.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/filter.h?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/filter.h (original)
+++ incubator/celix/trunk/framework/private/include/filter.h Tue Jan 25 20:39:04 2011
@@ -31,6 +31,6 @@ typedef struct filter * FILTER;
 FILTER filter_create(char * filterString);
 void filter_destroy(FILTER filter);
 
-int filter_match(FILTER filter, HASHTABLE properties);
+int filter_match(FILTER filter, PROPERTIES properties);
 
 #endif /* FILTER_H_ */

Modified: incubator/celix/trunk/framework/private/include/framework.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/framework.h?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/framework.h (original)
+++ incubator/celix/trunk/framework/private/include/framework.h Tue Jan 25 20:39:04 2011
@@ -40,7 +40,7 @@ BUNDLE fw_installBundle(FRAMEWORK framew
 void fw_startBundle(FRAMEWORK framework, BUNDLE bundle, int options);
 void fw_stopBundle(FRAMEWORK framework, BUNDLE bundle, int options);
 
-SERVICE_REGISTRATION fw_registerService(FRAMEWORK framework, BUNDLE bundle, char * serviceName, void * svcObj, HASHTABLE properties);
+SERVICE_REGISTRATION fw_registerService(FRAMEWORK framework, BUNDLE bundle, char * serviceName, void * svcObj, PROPERTIES properties);
 void fw_unregisterService(SERVICE_REGISTRATION registration);
 
 ARRAY_LIST fw_getServiceReferences(FRAMEWORK framework, BUNDLE bundle, char * serviceName, char * filter);
@@ -49,7 +49,7 @@ bool framework_ungetService(FRAMEWORK fr
 
 void fw_addServiceListener(BUNDLE bundle, SERVICE_LISTENER listener, char * filter);
 void fw_removeServiceListener(BUNDLE bundle, SERVICE_LISTENER listener);
-void fw_serviceChanged(SERVICE_EVENT event, HASHTABLE oldprops);
+void fw_serviceChanged(SERVICE_EVENT event, PROPERTIES oldprops);
 
 //BUNDLE_ARCHIVE fw_createArchive(long id, char * location);
 //void revise(BUNDLE_ARCHIVE archive, char * location);

Modified: incubator/celix/trunk/framework/private/include/headers.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/headers.h?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/headers.h (original)
+++ incubator/celix/trunk/framework/private/include/headers.h Tue Jan 25 20:39:04 2011
@@ -42,6 +42,8 @@
 #include "bundle_state.h"
 #include "bundle_cache.h"
 
+#include "apr-1/apr_general.h"
+
 #if defined(__GNUC__)
 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
 #else
@@ -71,6 +73,8 @@ struct framework {
 	int globalLockCount;
 
 	bool interrupted;
+
+	apr_pool_t *mp;
 };
 
 typedef struct framework * FRAMEWORK;
@@ -127,7 +131,7 @@ struct serviceRegistration {
 	SERVICE_REGISTRY registry;
 	char * className;
 	SERVICE_REFERENCE reference;
-	HASHTABLE properties;
+	PROPERTIES properties;
 	void * svcObj;
 	long serviceId;
 

Modified: incubator/celix/trunk/framework/private/include/properties.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/properties.h?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/properties.h (original)
+++ incubator/celix/trunk/framework/private/include/properties.h Tue Jan 25 20:39:04 2011
@@ -26,27 +26,16 @@
 #ifndef PROPERTIES_H_
 #define PROPERTIES_H_
 
-#include "hashtable.h"
+#include "hash_map.h"
 
-struct key {
-	char * key;
-};
+typedef HASH_MAP PROPERTIES;
 
-struct value {
-	char * value;
-};
+PROPERTIES properties_create(void);
+PROPERTIES properties_load(char * filename);
+void properties_store(PROPERTIES properties, char * file, char * header);
 
-typedef struct hashtable * HASHTABLE;
-typedef struct hashtable * PROPERTIES;
-
-typedef struct entry * ENTRY;
-
-HASHTABLE createProperties(void);
-HASHTABLE loadProperties(char * filename);
-void storeProperties(HASHTABLE properties, char * file, char * header);
-
-char * getProperty(HASHTABLE properties, char * key);
-char * getPropertyWithDefault(HASHTABLE properties, char * key, char * defaultValue);
-char * setProperty(HASHTABLE properties, char * key, char * value);
+char * properties_get(PROPERTIES properties, char * key);
+char * properties_getWithDefault(PROPERTIES properties, char * key, char * defaultValue);
+char * properties_set(PROPERTIES properties, char * key, char * value);
 
 #endif /* PROPERTIES_H_ */

Modified: incubator/celix/trunk/framework/private/src/bundle.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle.c Tue Jan 25 20:39:04 2011
@@ -52,9 +52,9 @@ struct bundle {
 
 MODULE bundle_createModule(BUNDLE bundle);
 
-BUNDLE bundle_create() {
+BUNDLE bundle_create(apr_pool_t *mp) {
 	BUNDLE bundle = (BUNDLE) malloc(sizeof(*bundle));
-	BUNDLE_ARCHIVE archive = bundleArchive_createSystemBundleArchive();
+	BUNDLE_ARCHIVE archive = bundleArchive_createSystemBundleArchive(mp);
 	bundle->archive = archive;
 	bundle->activator = NULL;
 	bundle->context = NULL;

Modified: incubator/celix/trunk/framework/private/src/bundle_archive.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_archive.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_archive.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_archive.c Tue Jan 25 20:39:04 2011
@@ -25,12 +25,14 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <dirent.h>
-#include <sys/stat.h>
+//#include <dirent.h>
+//#include <sys/stat.h>
 
 #include "bundle_archive.h"
 #include "headers.h"
 
+#include <apr-1/apr_file_io.h>
+
 struct bundleArchive {
 	long id;
 	char * location;
@@ -39,12 +41,15 @@ struct bundleArchive {
 	char * revision;
 
 	BUNDLE_STATE persistentState;
+
+	apr_pool_t *mp;
 };
 
-BUNDLE_ARCHIVE bundleArchive_createSystemBundleArchive() {
+BUNDLE_ARCHIVE bundleArchive_createSystemBundleArchive(apr_pool_t *mp) {
 	BUNDLE_ARCHIVE archive = (BUNDLE_ARCHIVE) malloc(sizeof(*archive));
 	archive->id = 0l;
 	archive->location = "System Bundle";
+	archive->mp = mp;
 	return archive;
 }
 
@@ -53,9 +58,9 @@ void bundleArchive_setRevisionLocation(B
 
 void bundleArchive_initialize(BUNDLE_ARCHIVE archive);
 
-void bundleArchive_deleteTree(char * directory);
+void bundleArchive_deleteTree(char * directory, apr_pool_t *mp);
 
-BUNDLE_ARCHIVE bundleArchive_create(char * archiveRoot, long id, char * location) {
+BUNDLE_ARCHIVE bundleArchive_create(char * archiveRoot, long id, char * location, apr_pool_t *mp) {
 	BUNDLE_ARCHIVE archive = (BUNDLE_ARCHIVE) malloc(sizeof(*archive));
 
 	archive->id = id;
@@ -63,6 +68,8 @@ BUNDLE_ARCHIVE bundleArchive_create(char
 	archive->archiveRootDir = NULL;
 	archive->archiveRoot = archiveRoot;
 
+	archive->mp = mp;
+
 	bundleArchive_initialize(archive);
 
 	bundleArchive_revise(archive, location);
@@ -70,13 +77,14 @@ BUNDLE_ARCHIVE bundleArchive_create(char
 	return archive;
 }
 
-BUNDLE_ARCHIVE bundleArchive_recreate(char * archiveRoot) {
+BUNDLE_ARCHIVE bundleArchive_recreate(char * archiveRoot, apr_pool_t *mp) {
 	BUNDLE_ARCHIVE archive = (BUNDLE_ARCHIVE) malloc(sizeof(*archive));
 	archive->archiveRoot = archiveRoot;
 	archive->archiveRootDir = opendir(archiveRoot);
 	archive->id = -1;
 	archive->persistentState = -1;
 	archive->location = NULL;
+	archive->mp = mp;
 
 	char * location = bundleArchive_getRevisionLocation(archive);
 	bundleArchive_revise(archive, location);
@@ -92,10 +100,15 @@ long bundleArchive_getId(BUNDLE_ARCHIVE 
 	char bundleId[strlen(archive->archiveRoot) + 11];
 	strcpy(bundleId, archive->archiveRoot);
 	strcat(bundleId, "/bundle.id");
-	FILE * bundleIdFile = fopen(bundleId, "r");
+
+	apr_file_t *bundleIdFile;
+	apr_status_t rv;
+	if ((rv = apr_file_open(&bundleIdFile, bundleId, APR_FOPEN_READ, APR_OS_DEFAULT, archive->mp)) != APR_SUCCESS) {
+
+	}
 	char id[256];
-	fgets (id , sizeof(id) , bundleIdFile);
-	fclose(bundleIdFile);
+	apr_file_gets(id, sizeof(id), bundleIdFile);
+	apr_file_close(bundleIdFile);
 
 	return atol(id);
 }
@@ -221,7 +234,7 @@ void bundleArchive_close(BUNDLE_ARCHIVE 
 
 void bundleArchive_closeAndDelete(BUNDLE_ARCHIVE archive) {
 	bundleArchive_close(archive);
-	bundleArchive_deleteTree(archive->archiveRoot);
+	bundleArchive_deleteTree(archive->archiveRoot, archive->mp);
 }
 
 void bundleArchive_initialize(BUNDLE_ARCHIVE archive) {
@@ -229,39 +242,55 @@ void bundleArchive_initialize(BUNDLE_ARC
 		return;
 	}
 
-	mkdir(archive->archiveRoot, 0755);
+	apr_dir_make(archive->archiveRoot, APR_UREAD|APR_UWRITE|APR_UEXECUTE, archive->mp);
 	archive->archiveRootDir = opendir(archive->archiveRoot);
 
 	char bundleId[strlen(archive->archiveRoot) + 10];
 	strcpy(bundleId, archive->archiveRoot);
 	strcat(bundleId, "/bundle.id");
-	FILE * bundleIdFile = fopen(bundleId, "w");
-	fprintf(bundleIdFile, "%ld", archive->id);
-	fclose(bundleIdFile);
+	apr_file_t *bundleIdFile;
+	apr_status_t status = apr_file_open(&bundleIdFile, bundleId, APR_FOPEN_CREATE|APR_FOPEN_WRITE, APR_OS_DEFAULT, archive->mp);
+	apr_file_printf(bundleIdFile, "%ld", archive->id);
+	apr_file_close(bundleIdFile);
+
+//	FILE * bundleIdFile = fopen(bundleId, "w");
+//	fprintf(bundleIdFile, "%ld", archive->id);
+//	fclose(bundleIdFile);
 
 	char bundleLocation[strlen(archive->archiveRoot) + 16];
 	strcpy(bundleLocation,archive->archiveRoot);
 	strcat(bundleLocation, "/bundle.location");
-	FILE * bundleLocationFile = fopen(bundleLocation, "w");
-	fprintf(bundleLocationFile, "%s", archive->location);
-	fclose(bundleLocationFile);
-}
-
-void bundleArchive_deleteTree(char * directory) {
-	DIR * dir = opendir(directory);
-	struct dirent * dp;
-	while ((dp = readdir(dir))) {
-		if ((strcmp((dp->d_name), ".") != 0) && (strcmp((dp->d_name), "..") != 0)) {
-			char subdir[strlen(directory) + strlen(dp->d_name) + 2];
+	apr_file_t *bundleLocationFile;
+	status = apr_file_open(&bundleLocationFile, bundleLocation, APR_FOPEN_CREATE|APR_FOPEN_WRITE, APR_OS_DEFAULT, archive->mp);
+	apr_file_printf(bundleLocationFile, "%ld", archive->id);
+	apr_file_close(bundleLocationFile);
+
+//	FILE * bundleLocationFile = fopen(bundleLocation, "w");
+//	fprintf(bundleLocationFile, "%s", archive->location);
+//	fclose(bundleLocationFile);
+}
+
+void bundleArchive_deleteTree(char * directory, apr_pool_t *mp) {
+	apr_dir_t *dir;
+	apr_dir_open(&dir, directory, mp);
+	apr_finfo_t dp;
+	while (apr_dir_read(&dp, APR_FINFO_DIRENT|APR_FINFO_TYPE, dir)) {
+
+	//DIR * dir = opendir(directory);
+//	struct dirent * dp;
+//	while ((dp = readdir(dir))) {
+		if ((strcmp((dp.name), ".") != 0) && (strcmp((dp.name), "..") != 0)) {
+			char subdir[strlen(directory) + strlen(dp.name) + 2];
 			strcpy(subdir, directory);
 			strcat(subdir, "/");
-			strcat(subdir, dp->d_name);
+			strcat(subdir, dp.name);
 
-			struct stat s;
-			stat(dp->d_name, &s);
-			if (S_ISDIR(s.st_mode)) {
+//			struct stat s;
+//			stat(dp->d_name, &s);
+			if (dp.filetype = APR_DIR) {
+//			if (S_ISDIR(s.st_mode)) {
 //			if (dp->d_type == DT_DIR) {
-				bundleCache_deleteTree(subdir);
+				bundleCache_deleteTree(subdir, mp);
 			} else {
 				remove(subdir);
 			}

Modified: incubator/celix/trunk/framework/private/src/bundle_cache.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_cache.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_cache.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_cache.c Tue Jan 25 20:39:04 2011
@@ -26,7 +26,9 @@
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <sys/stat.h>
+//#include <sys/stat.h>
+
+#include <apr-1/apr_file_io.h>
 
 #include "bundle_cache.h"
 #include "bundle_archive.h"
@@ -36,42 +38,50 @@
 struct bundleCache {
 	PROPERTIES configurationMap;
 	char * cacheDir;
+	apr_pool_t *mp;
 };
 
-void bundleCache_deleteTree(char * directory);
+void bundleCache_deleteTree(char * directory, apr_pool_t *mp);
 
-BUNDLE_CACHE bundleCache_create(PROPERTIES configurationMap) {
+BUNDLE_CACHE bundleCache_create(PROPERTIES configurationMap, apr_pool_t *mp) {
 	BUNDLE_CACHE cache = (BUNDLE_CACHE) malloc(sizeof(*cache));
 
 	cache->configurationMap = configurationMap;
-	char * cacheDir = getProperty(configurationMap, (char *) FRAMEWORK_STORAGE);
+	char * cacheDir = properties_get(configurationMap, (char *) FRAMEWORK_STORAGE);
 	if (cacheDir == NULL) {
 		cacheDir = ".cache";
 	}
 	cache->cacheDir = cacheDir;
+	cache->mp = mp;
 
 	return cache;
 }
 
 void bundleCache_delete(BUNDLE_CACHE cache) {
-	bundleCache_deleteTree(cache->cacheDir);
+	bundleCache_deleteTree(cache->cacheDir, cache->mp);
 }
 
-void bundleCache_deleteTree(char * directory) {
-	DIR * dir = opendir(directory);
-	struct dirent * dp;
-	while ((dp = readdir(dir))) {
-		if ((strcmp((dp->d_name), ".") != 0) && (strcmp((dp->d_name), "..") != 0)) {
-			char subdir[strlen(directory) + strlen(dp->d_name) + 2];
+void bundleCache_deleteTree(char * directory, apr_pool_t *mp) {
+	apr_dir_t *dir;
+	apr_dir_open(&dir, directory, mp);
+	apr_finfo_t dp;
+	while (apr_dir_read(&dp, APR_FINFO_DIRENT|APR_FINFO_TYPE, dir)) {
+
+	//DIR * dir = opendir(directory);
+//	struct dirent * dp;
+//	while ((dp = readdir(dir))) {
+		if ((strcmp((dp.name), ".") != 0) && (strcmp((dp.name), "..") != 0)) {
+			char subdir[strlen(directory) + strlen(dp.name) + 2];
 			strcpy(subdir, directory);
 			strcat(subdir, "/");
-			strcat(subdir, dp->d_name);
+			strcat(subdir, dp.name);
 
-			struct stat s;
-			stat(dp->d_name, &s);
-			if (S_ISDIR(s.st_mode)) {
+//			struct stat s;
+//			stat(dp->d_name, &s);
+			if (dp.filetype = APR_DIR) {
+//			if (S_ISDIR(s.st_mode)) {
 //			if (dp->d_type == DT_DIR) {
-				bundleCache_deleteTree(subdir);
+				bundleCache_deleteTree(subdir, mp);
 			} else {
 				remove(subdir);
 			}
@@ -81,34 +91,37 @@ void bundleCache_deleteTree(char * direc
 }
 
 ARRAY_LIST bundleCache_getArchives(BUNDLE_CACHE cache) {
-	DIR * dir = opendir(cache->cacheDir);
-	if (dir == NULL) {
-		mkdir(cache->cacheDir, 0755);
-		dir = opendir(cache->cacheDir);
-		if (dir == NULL) {
-			printf("Problem opening/creating cache.\n");
-			return NULL;
-		}
+	apr_dir_t *dir;
+	apr_status_t status = apr_dir_open(&dir, cache->cacheDir, cache->mp);
+
+	//DIR * dir = opendir(cache->cacheDir);
+	if (status == APR_ENOENT) {
+		apr_dir_make(cache->cacheDir, APR_UREAD|APR_UWRITE|APR_UEXECUTE, cache->mp);
+		status = apr_dir_open(&dir, cache->cacheDir, cache->mp);
 	}
 
 	ARRAY_LIST list = arrayList_create();
-	struct dirent * dp;
-	while ((dp = readdir(dir))) {
-		char archiveRoot[strlen(cache->cacheDir) + strlen(dp->d_name) + 2];
+	apr_finfo_t dp;
+	//apr_dir_read(&dp, APR_FINFO_DIRENT|APR_FINFO_TYPE, dir);
+	while ((apr_dir_read(&dp, APR_FINFO_DIRENT|APR_FINFO_TYPE, dir))) {
+	//struct dirent * dp;
+	//while ((dp = readdir(dir))) {
+		char archiveRoot[strlen(cache->cacheDir) + strlen(dp.name) + 2];
 		strcpy(archiveRoot, cache->cacheDir);
 		strcat(archiveRoot, "/");
-		strcat(archiveRoot, dp->d_name);
+		strcat(archiveRoot, dp.name);
 
-		struct stat s;
-		stat(archiveRoot, &s);
-		if (S_ISDIR(s.st_mode)
+		if (dp.filetype == APR_DIR
+//		struct stat s;
+//		stat(archiveRoot, &s);
+//		if (S_ISDIR(s.st_mode)
 //		if (dp->d_type == DT_DIR
-				&& (strcmp((dp->d_name), ".") != 0)
-				&& (strcmp((dp->d_name), "..") != 0)
-				&& (strncmp(dp->d_name, "bundle", 6) == 0)
-				&& (strcmp(dp->d_name, "bundle0") != 0)) {
+				&& (strcmp((dp.name), ".") != 0)
+				&& (strcmp((dp.name), "..") != 0)
+				&& (strncmp(dp.name, "bundle", 6) == 0)
+				&& (strcmp(dp.name, "bundle0") != 0)) {
 
-			BUNDLE_ARCHIVE archive = bundleArchive_recreate(strdup(archiveRoot));
+			BUNDLE_ARCHIVE archive = bundleArchive_recreate(strdup(archiveRoot), cache->mp);
 			arrayList_add(list, archive);
 		}
 	}
@@ -120,5 +133,5 @@ BUNDLE_ARCHIVE bundleCache_createArchive
 	char archiveRoot[256];
 	sprintf(archiveRoot, "%s/bundle%ld",  cache->cacheDir, id);
 
-	return bundleArchive_create(strdup(archiveRoot), id, location);
+	return bundleArchive_create(strdup(archiveRoot), id, location, cache->mp);
 }

Modified: incubator/celix/trunk/framework/private/src/bundle_context.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_context.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_context.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_context.c Tue Jan 25 20:39:04 2011
@@ -51,7 +51,7 @@ BUNDLE bundleContext_installBundle(BUNDL
 	return fw_installBundle(context->framework, location);
 }
 
-SERVICE_REGISTRATION bundleContext_registerService(BUNDLE_CONTEXT context, char * serviceName, void * svcObj, HASHTABLE properties) {
+SERVICE_REGISTRATION bundleContext_registerService(BUNDLE_CONTEXT context, char * serviceName, void * svcObj, PROPERTIES properties) {
 	return fw_registerService(context->framework, context->bundle, serviceName, svcObj, properties);
 }
 

Modified: incubator/celix/trunk/framework/private/src/filter.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/filter.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/filter.c (original)
+++ incubator/celix/trunk/framework/private/src/filter.c Tue Jan 25 20:39:04 2011
@@ -404,7 +404,7 @@ ARRAY_LIST filter_parseSubstring(char * 
 	return operands;
 }
 
-int filter_match(FILTER filter, HASHTABLE properties) {
+int filter_match(FILTER filter, PROPERTIES properties) {
 	switch (filter->operand) {
 		case AND: {
 			ARRAY_LIST filters = (ARRAY_LIST) filter->value;
@@ -437,12 +437,12 @@ int filter_match(FILTER filter, HASHTABL
 		case GREATER :
 		case LESS :
 		case APPROX : {
-			char * value = (properties == NULL) ? NULL: getProperty(properties, filter->attribute);
+			char * value = (properties == NULL) ? NULL: properties_get(properties, filter->attribute);
 
 			return filter_compare(filter->operand, (char *) value, filter->value);
 		}
 		case PRESENT: {
-			char * value = (properties == NULL) ? NULL: getProperty(properties, filter->attribute);
+			char * value = (properties == NULL) ? NULL: properties_get(properties, filter->attribute);
 			return value != NULL;
 		}
 	}

Modified: incubator/celix/trunk/framework/private/src/framework.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Tue Jan 25 20:39:04 2011
@@ -36,7 +36,6 @@
 #include "filter.h"
 #include "constants.h"
 #include "archive.h"
-#include "hashtable_itr.h"
 #include "bundle.h"
 #include "wire.h"
 #include "resolver.h"
@@ -86,7 +85,14 @@ typedef struct fw_serviceListener * FW_S
 FRAMEWORK framework_create() {
 	FRAMEWORK framework = (FRAMEWORK) malloc(sizeof(*framework));
 
-	BUNDLE bundle = bundle_create();
+	apr_status_t rv = apr_initialize();
+	if (rv != APR_SUCCESS) {
+		return NULL;
+	}
+
+	apr_pool_create(&framework->mp, NULL);
+
+	BUNDLE bundle = bundle_create(framework->mp);
 	framework->bundle = bundle;
 
 	framework->installedBundleMap = NULL;
@@ -112,9 +118,9 @@ void fw_init(FRAMEWORK framework) {
 	framework_acquireBundleLock(framework, framework->bundle, BUNDLE_INSTALLED|BUNDLE_RESOLVED|BUNDLE_STARTING|BUNDLE_ACTIVE);
 
 	if ((bundle_getState(framework->bundle) == BUNDLE_INSTALLED) || (bundle_getState(framework->bundle) == BUNDLE_RESOLVED)) {
-		PROPERTIES props = createProperties();
-		setProperty(props, (char *) FRAMEWORK_STORAGE, ".cache");
-		framework->cache = bundleCache_create(props);
+		PROPERTIES props = properties_create();
+		properties_set(props, (char *) FRAMEWORK_STORAGE, ".cache");
+		framework->cache = bundleCache_create(props, framework->mp);
 
 		if (bundle_getState(framework->bundle) == BUNDLE_INSTALLED) {
 			// clean cache
@@ -136,7 +142,7 @@ void fw_init(FRAMEWORK framework) {
 	int arcIdx;
 	for (arcIdx = 0; arcIdx < arrayList_size(archives); arcIdx++) {
 		BUNDLE_ARCHIVE archive = (BUNDLE_ARCHIVE) arrayList_get(archives, arcIdx);
-		framework->nextBundleId = fmaxl(framework->nextBundleId, bundleArchive_getId(archive) + 1);
+//		framework->nextBundleId = fmaxl(framework->nextBundleId, bundleArchive_getId(archive) + 1);
 
 		if (bundleArchive_getPersistentState(archive) == BUNDLE_UNINSTALLED) {
 			bundleArchive_closeAndDelete(archive);
@@ -411,7 +417,7 @@ void fw_stopBundle(FRAMEWORK framework, 
 	framework_releaseBundleLock(framework, bundle);
 }
 
-SERVICE_REGISTRATION fw_registerService(FRAMEWORK framework, BUNDLE bundle, char * serviceName, void * svcObj, HASHTABLE properties) {
+SERVICE_REGISTRATION fw_registerService(FRAMEWORK framework, BUNDLE bundle, char * serviceName, void * svcObj, PROPERTIES properties) {
 	if (serviceName == NULL) {
 		printf("Service name cannot be null");
 		return NULL;
@@ -448,7 +454,7 @@ ARRAY_LIST fw_getServiceReferences(FRAME
 	for (refIdx = 0; (references != NULL) && refIdx < arrayList_size(references); refIdx++) {
 		SERVICE_REFERENCE ref = (SERVICE_REFERENCE) arrayList_get(references, refIdx);
 		SERVICE_REGISTRATION reg = ref->registration;
-		char * serviceName = getProperty(reg->properties, (char *) OBJECTCLASS);
+		char * serviceName = properties_get(reg->properties, (char *) OBJECTCLASS);
 		if (!serviceReference_isAssignableTo(ref, bundle, serviceName)) {
 			arrayList_remove(references, refIdx);
 			refIdx--;
@@ -496,7 +502,7 @@ void fw_removeServiceListener(BUNDLE bun
 	}
 }
 
-void fw_serviceChanged(SERVICE_EVENT event, HASHTABLE oldprops) {
+void fw_serviceChanged(SERVICE_EVENT event, PROPERTIES oldprops) {
 	unsigned int i;
 	FW_SERVICE_LISTENER element;
 	SERVICE_REGISTRATION registration = event->reference->registration;

Modified: incubator/celix/trunk/framework/private/src/manifest.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/manifest.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/manifest.c (original)
+++ incubator/celix/trunk/framework/private/src/manifest.c Tue Jan 25 20:39:04 2011
@@ -41,7 +41,7 @@ PROPERTIES manifest_getMainAttributes(MA
 
 MANIFEST manifest_read(char * filename) {
 	MANIFEST mf = (MANIFEST) malloc(sizeof(*mf));
-	PROPERTIES mainAttributes = createProperties();
+	PROPERTIES mainAttributes = properties_create();
 
 	mf->mainAttributes = mainAttributes;
 
@@ -113,7 +113,7 @@ MANIFEST manifest_read(char * filename) 
 				value[len - i] = '\0';
 			}
 
-			if ((setProperty(mainAttributes, name, value) != NULL) && (!lineContinued)) {
+			if ((properties_set(mainAttributes, name, value) != NULL) && (!lineContinued)) {
 				printf("Duplicate entry: %s", name);
 			}
 		}
@@ -129,7 +129,7 @@ void manifest_write(MANIFEST manifest, c
 }
 
 char * manifest_getValue(MANIFEST manifest, const char * name) {
-	char * val = getProperty(manifest->mainAttributes, (char *) name);
+	char * val = properties_get(manifest->mainAttributes, (char *) name);
 	return val;
 }
 

Modified: incubator/celix/trunk/framework/private/src/properties.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/properties.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/properties.c (original)
+++ incubator/celix/trunk/framework/private/src/properties.c Tue Jan 25 20:39:04 2011
@@ -27,58 +27,57 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include "properties.h"
-#include "hashtable_itr.h"
 #include "utils.h"
 
-DEFINE_HASHTABLE_INSERT(prop_insert, struct key, struct value);
-DEFINE_HASHTABLE_REMOVE(prop_remove, struct key, struct value);
-DEFINE_HASHTABLE_SEARCH(prop_search, struct key, struct value);
-
-static unsigned int hashfromkey(void * ks) {
-	struct key *k = (struct key *) ks;
-	unsigned long hash = 5381;
-	int i;
-	char * ck = strdup(k->key);
-	for (i=0; i<strlen(ck); ++i) hash = 33*hash + ck[i];
-	//int c;
-	//while (c = *ck++) {
-	//	hash = ((hash << 5) + hash) + c;
-	//}
-	free(ck);
-	return hash;
-}
-
-static int equalskey(void * k1, void * k2) {
-	struct key * key1 = (struct key *) k1;
-	struct key * key2 = (struct key *) k2;
-	return (strcmp(key1->key, key2->key) == 0);
-}
-
-char * addEntry(HASHTABLE properties, char * k, char * v);
-char * addEntry(HASHTABLE properties, char * k, char * v) {
-	struct key * search_key = (struct key *) malloc(sizeof(*search_key));
-	struct key * s_key = (struct key *) malloc(sizeof(*s_key));
-	struct value * s_value = (struct value *) malloc(sizeof(*s_value));
-	struct value * oldValue = NULL;
-	s_key->key = k;
-	search_key->key = k;
-	s_value->value = v;
-	oldValue = prop_search(properties, search_key);
-	if (oldValue != NULL) {
-		prop_remove(properties, search_key);
-	}
-	free(search_key);
-	prop_insert(properties, s_key, s_value);
-
-	return oldValue == NULL ? NULL : oldValue->value;
-}
+//DEFINE_HASHTABLE_INSERT(prop_insert, struct key, struct value);
+//DEFINE_HASHTABLE_REMOVE(prop_remove, struct key, struct value);
+//DEFINE_HASHTABLE_SEARCH(prop_search, struct key, struct value);
+//
+//static unsigned int hashfromkey(void * ks) {
+//	struct key *k = (struct key *) ks;
+//	unsigned long hash = 5381;
+//	int i;
+//	char * ck = strdup(k->key);
+//	for (i=0; i<strlen(ck); ++i) hash = 33*hash + ck[i];
+//	//int c;
+//	//while (c = *ck++) {
+//	//	hash = ((hash << 5) + hash) + c;
+//	//}
+//	free(ck);
+//	return hash;
+//}
+//
+//static int equalskey(void * k1, void * k2) {
+//	struct key * key1 = (struct key *) k1;
+//	struct key * key2 = (struct key *) k2;
+//	return (strcmp(key1->key, key2->key) == 0);
+//}
+//
+//char * addEntry(HASHTABLE properties, char * k, char * v);
+//char * addEntry(HASHTABLE properties, char * k, char * v) {
+//	struct key * search_key = (struct key *) malloc(sizeof(*search_key));
+//	struct key * s_key = (struct key *) malloc(sizeof(*s_key));
+//	struct value * s_value = (struct value *) malloc(sizeof(*s_value));
+//	struct value * oldValue = NULL;
+//	s_key->key = k;
+//	search_key->key = k;
+//	s_value->value = v;
+//	oldValue = prop_search(properties, search_key);
+//	if (oldValue != NULL) {
+//		prop_remove(properties, search_key);
+//	}
+//	free(search_key);
+//	prop_insert(properties, s_key, s_value);
+//
+//	return oldValue == NULL ? NULL : oldValue->value;
+//}
 
-HASHTABLE createProperties(void) {
-	return create_hashtable(1, hashfromkey, equalskey);
+PROPERTIES properties_create(void) {
+	return hashMap_create(string_hash, string_hash, string_equals, string_equals);
 }
 
-HASHTABLE loadProperties(char * filename) {
-	HASHTABLE props = create_hashtable(1, hashfromkey, equalskey);
+PROPERTIES properties_load(char * filename) {
+	PROPERTIES props = properties_create();
 	FILE *file = fopen ( filename, "r" );
 
 	char * cont = strdup("\\");
@@ -100,7 +99,7 @@ HASHTABLE loadProperties(char * filename
 							split = 1;
 							value = string_ndup(value, strlen(value)-1);
 						} else {
-							char * old = addEntry(props, key, value);
+							char * old = hashMap_put(props, key, value);
 						}
 					}
 				}
@@ -111,7 +110,7 @@ HASHTABLE loadProperties(char * filename
 				} else {
 					split = 0;
 					strcat(value, string_trim(line));
-					char * old = addEntry(props, key, value);
+					char * old = hashMap_put(props, key, value);
 				}
 			}
 		}
@@ -125,24 +124,20 @@ HASHTABLE loadProperties(char * filename
 /**
  * Header is ignored for now, cannot handle comments yet
  */
-void storeProperties(HASHTABLE properties, char * filename, char * header) {
+void properties_store(PROPERTIES properties, char * filename, char * header) {
 	FILE *file = fopen ( filename, "w+" );
 	if (file != NULL) {
-		if (hashtable_count(properties) > 0)
-		{
-			struct hashtable_itr * itr = hashtable_iterator(properties);
-			do {
-				char * line = NULL;
-				struct key * k = hashtable_iterator_key(itr);
-				struct value * v = hashtable_iterator_value(itr);
+		if (hashMap_size(properties) > 0) {
+			HASH_MAP_ITERATOR iterator = hashMapIterator_create(properties);
+			while (hashMapIterator_hasNext(iterator)) {
+				HASH_MAP_ENTRY entry = hashMapIterator_nextEntry(iterator);
 
-				line = strdup(k->key);
+				char * line = strdup(hashMapEntry_getKey(entry));
 				strcat(line, "=");
-				strcat(line, strdup(v->value));
+				strcat(line, strdup(hashMapEntry_getValue(entry)));
 				strcat(line, "\n");
 				fputs(line, file);
-			} while (hashtable_iterator_advance(itr));
-			free(itr);
+			}
 		}
 		fclose(file);
 	} else {
@@ -150,19 +145,15 @@ void storeProperties(HASHTABLE propertie
 	}
 }
 
-char * getProperty(HASHTABLE properties, char * key) {
-	struct key * s_key = (struct key *) malloc(sizeof(struct key));
-	s_key->key = key;
-	struct value * value = prop_search(properties, s_key);
-	free(s_key);
-	return value == NULL ? NULL : value->value;
+char * properties_get(PROPERTIES properties, char * key) {
+	return hashMap_get(properties, key);
 }
 
-char * getPropertyWithDefault(HASHTABLE properties, char * key, char * defaultValue) {
-	char * value = getProperty(properties, key);
+char * properties_getWithDefault(PROPERTIES properties, char * key, char * defaultValue) {
+	char * value = properties_get(properties, key);
 	return value == NULL ? defaultValue : value;
 }
 
-char * setProperty(HASHTABLE properties, char * key, char * value) {
-	return addEntry(properties, key, value);
+char * properties_set(PROPERTIES properties, char * key, char * value) {
+	return hashMap_put(properties, key, value);
 }

Modified: incubator/celix/trunk/framework/private/src/service_registration.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_registration.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registration.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registration.c Tue Jan 25 20:39:04 2011
@@ -36,13 +36,13 @@ SERVICE_REGISTRATION serviceRegistration
 	registration->className = serviceName;
 
 	if (dictionary == NULL) {
-		dictionary = createProperties();
+		dictionary = properties_create();
 	}
 
 	char sId[sizeof(serviceId) + 1];
 	sprintf(sId, "%ld", serviceId);
-	setProperty(dictionary, (char *) SERVICE_ID, strdup(sId));
-	setProperty(dictionary, (char *) OBJECTCLASS, serviceName);
+	properties_set(dictionary, (char *) SERVICE_ID, strdup(sId));
+	properties_set(dictionary, (char *) OBJECTCLASS, serviceName);
 
 	registration->properties = dictionary;
 

Modified: incubator/celix/trunk/hello_world/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/hello_world/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/hello_world/CMakeLists.txt (original)
+++ incubator/celix/trunk/hello_world/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -16,6 +16,7 @@
 # under the License.
 
 add_library(hello_world SHARED activator)
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 target_link_libraries(hello_world framework)
 
 bundle(hello_world)

Modified: incubator/celix/trunk/launcher/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/launcher/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/launcher/CMakeLists.txt (original)
+++ incubator/celix/trunk/launcher/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -17,7 +17,7 @@
 
 add_executable(launcher launcher.c)
 
-include_directories("${PROJECT_SOURCE_DIR}/celix")
 target_link_libraries(launcher framework)
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 
 install(TARGETS launcher RUNTIME DESTINATION bin COMPONENT framework)
\ No newline at end of file

Modified: incubator/celix/trunk/launcher/launcher.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/launcher/launcher.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/launcher/launcher.c (original)
+++ incubator/celix/trunk/launcher/launcher.c Tue Jan 25 20:39:04 2011
@@ -28,7 +28,7 @@
 #include "bundle.h"
 
 static void launcher_load_custom_bundles(void);
-void shutdown(int signal);
+void launcher_shutdown(int signal);
 
 int running = 0;
 
@@ -38,9 +38,9 @@ FRAMEWORK framework;
 
 int main(void) {
 	// Set signal handler
-	(void) signal(SIGINT, shutdown);
-    HASHTABLE config = loadProperties("config.properties");
-    char * autoStart = getProperty(config, "cosgi.auto.start.1");
+	(void) signal(SIGINT, launcher_shutdown);
+    PROPERTIES config = properties_load("config.properties");
+    char * autoStart = properties_get(config, "cosgi.auto.start.1");
     framework = framework_create();
     fw_init(framework);
 
@@ -71,7 +71,7 @@ int main(void) {
     return 0;
 }
 
-void shutdown(int signal) {
+void launcher_shutdown(int signal) {
 	framework_stop(framework);
 	framework_waitForStop(framework);
 }

Modified: incubator/celix/trunk/receiver-2.0/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/receiver-2.0/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/receiver-2.0/CMakeLists.txt (original)
+++ incubator/celix/trunk/receiver-2.0/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -16,7 +16,8 @@
 # under the License.
 
 add_library(receiver-2.0 SHARED activator serviceTest)
-include_directories("${PROJECT_SOURCE_DIR}/celix" "${PROJECT_SOURCE_DIR}/dependency_manager") 
+include_directories("${PROJECT_SOURCE_DIR}/celix" "${PROJECT_SOURCE_DIR}/dependency_manager")
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include") 
 target_link_libraries(receiver-2.0 dependency_manager framework)
 
 bundle(receiver-2.0)

Modified: incubator/celix/trunk/receiver-2.0/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/receiver-2.0/activator.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/receiver-2.0/activator.c (original)
+++ incubator/celix/trunk/receiver-2.0/activator.c Tue Jan 25 20:39:04 2011
@@ -49,8 +49,8 @@ void * dm_create() {
 void dm_init(void * userData, BUNDLE_CONTEXT context, DEPENDENCY_MANAGER manager) {
 	m_test = (SERVICE_TEST) malloc(sizeof(*m_test));
 
-	HASHTABLE props = createProperties();
-	setProperty(props, "test", "test");
+	PROPERTIES props = properties_create();
+	properties_set(props, "test", "test");
 	//setProperty(props, "a", "b");
 	m_test->handle = serviceTest_construct();
 	m_test->doo = doo;

Modified: incubator/celix/trunk/receiver/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/receiver/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/receiver/CMakeLists.txt (original)
+++ incubator/celix/trunk/receiver/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -17,6 +17,7 @@
 
 add_library(receiver SHARED activator serviceTest)
 include_directories("${PROJECT_SOURCE_DIR}/celix")
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 target_link_libraries(receiver framework)
 
 bundle(receiver)

Modified: incubator/celix/trunk/receiver/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/receiver/activator.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/receiver/activator.c (original)
+++ incubator/celix/trunk/receiver/activator.c Tue Jan 25 20:39:04 2011
@@ -35,8 +35,8 @@ SERVICE_TEST m_test;
 
 void bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
 	m_test = (SERVICE_TEST) malloc(sizeof(*m_test));
-	HASHTABLE props = createProperties();
-	setProperty(props, "test", "test");
+	PROPERTIES props = properties_create();
+	properties_set(props, "test", "test");
 	//setProperty(props, "a", "b");
 	m_test->handle = serviceTest_construct();
 	m_test->doo = doo;

Modified: incubator/celix/trunk/sender/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/sender/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/sender/CMakeLists.txt (original)
+++ incubator/celix/trunk/sender/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -18,6 +18,7 @@
 add_library(sender SHARED test_activator listenerTest)
 include_directories("${PROJECT_SOURCE_DIR}/celix" "${PROJECT_SOURCE_DIR}/dependency_manager")
 include_directories("${PROJECT_SOURCE_DIR}/receiver")
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 target_link_libraries(sender framework dependency_manager)
 
 bundle(sender)

Modified: incubator/celix/trunk/shell/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/shell/CMakeLists.txt (original)
+++ incubator/celix/trunk/shell/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -16,7 +16,7 @@
 # under the License.
 
 add_library(shell SHARED shell command ps_command start_command stop_command)
-include_directories("${PROJECT_SOURCE_DIR}/celix")
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 target_link_libraries(shell framework)
 
 bundle(shell)

Modified: incubator/celix/trunk/shell/shell.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/shell.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/shell/shell.c (original)
+++ incubator/celix/trunk/shell/shell.c Tue Jan 25 20:39:04 2011
@@ -30,7 +30,6 @@
 #include "command_private.h"
 #include "headers.h"
 #include "bundle_context.h"
-#include "hashtable_itr.h"
 #include "service_registration.h"
 
 #include "ps_command.h"

Modified: incubator/celix/trunk/shell_tui/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell_tui/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/shell_tui/CMakeLists.txt (original)
+++ incubator/celix/trunk/shell_tui/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -16,7 +16,7 @@
 # under the License.
 
 add_library(shell_tui SHARED shell_tui)
-include_directories("${PROJECT_SOURCE_DIR}/celix")
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 include_directories("${PROJECT_SOURCE_DIR}/shell")
 target_link_libraries(shell_tui framework)
 

Modified: incubator/celix/trunk/test/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/test/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/test/CMakeLists.txt (original)
+++ incubator/celix/trunk/test/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -16,7 +16,7 @@
 # under the License.
 
 add_executable(main main)
-include_directories("${PROJECT_SOURCE_DIR}/celix")
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 target_link_libraries(main framework)
 
 add_definitions(-DUSE_FILE32API)
\ No newline at end of file

Modified: incubator/celix/trunk/test/main.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/test/main.c?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/test/main.c (original)
+++ incubator/celix/trunk/test/main.c Tue Jan 25 20:39:04 2011
@@ -33,8 +33,6 @@
 #include "bundle_activator.h"
 #include "framework.h"
 #include "properties.h"
-#include "hashtable.h"
-#include "hashtable_itr.h"
 #include "filter.h"
 #include "bundle_context.h"
 #include "bundle.h"

Added: incubator/celix/trunk/utils/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/utils/CMakeLists.txt?rev=1063446&view=auto
==============================================================================
--- incubator/celix/trunk/utils/CMakeLists.txt (added)
+++ incubator/celix/trunk/utils/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -0,0 +1,26 @@
+# 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.
+cmake_minimum_required(VERSION 2.8)
+
+add_definitions(-DUSE_FILE32API)
+aux_source_directory("private/src" SRC)
+include_directories("private/include")
+include_directories("public/include")
+add_library(utils SHARED ${SRC})
+target_link_libraries(utils)
+
+install(TARGETS utils LIBRARY DESTINATION lib COMPONENT framework)

Propchange: incubator/celix/trunk/utils/CMakeLists.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/celix/trunk/whiteboard/publisherA/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/whiteboard/publisherA/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/whiteboard/publisherA/CMakeLists.txt (original)
+++ incubator/celix/trunk/whiteboard/publisherA/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -18,6 +18,7 @@
 add_library(publisherA SHARED activator publisher)
 include_directories("${PROJECT_SOURCE_DIR}/celix")
 include_directories("../publisherService")
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 target_link_libraries(publisherA framework)
 
 bundle(publisherA)

Modified: incubator/celix/trunk/whiteboard/publisherB/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/whiteboard/publisherB/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/whiteboard/publisherB/CMakeLists.txt (original)
+++ incubator/celix/trunk/whiteboard/publisherB/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -19,6 +19,7 @@ add_library(publisherB SHARED activator 
 include_directories("${PROJECT_SOURCE_DIR}/celix")
 include_directories("../publisherService")
 target_link_libraries(publisherB framework)
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 
 bundle(publisherB)
 package(publisherB FILES ../publisherService/publisher.h)
\ No newline at end of file

Modified: incubator/celix/trunk/whiteboard/tracker/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/whiteboard/tracker/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/whiteboard/tracker/CMakeLists.txt (original)
+++ incubator/celix/trunk/whiteboard/tracker/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -18,6 +18,7 @@
 add_library(tracker SHARED activator)
 include_directories("${PROJECT_SOURCE_DIR}/celix")
 include_directories("../publisherService")
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 target_link_libraries(tracker framework)
 
 bundle(tracker)

Modified: incubator/celix/trunk/whiteboard/tracker_depman/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/whiteboard/tracker_depman/CMakeLists.txt?rev=1063446&r1=1063445&r2=1063446&view=diff
==============================================================================
--- incubator/celix/trunk/whiteboard/tracker_depman/CMakeLists.txt (original)
+++ incubator/celix/trunk/whiteboard/tracker_depman/CMakeLists.txt Tue Jan 25 20:39:04 2011
@@ -19,6 +19,7 @@ add_library(tracker_depman SHARED depend
 include_directories("${PROJECT_SOURCE_DIR}/celix")
 include_directories("${PROJECT_SOURCE_DIR}/dependency_manager")
 include_directories("../publisherService")
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
 target_link_libraries(tracker_depman framework dependency_manager)
 
 bundle(tracker_depman)



Mime
View raw message