celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1543339 - in /incubator/celix/trunk: framework/ framework/private/src/ framework/public/include/ launcher/private/src/
Date Tue, 19 Nov 2013 07:45:52 GMT
Author: abroekhuis
Date: Tue Nov 19 07:45:51 2013
New Revision: 1543339

URL: http://svn.apache.org/r1543339
Log:
CELIX-87: Added error logging to most functions. Small updates to the framework and bundle archive to fix bundle uninstall/install problems.

Modified:
    incubator/celix/trunk/framework/CMakeLists.txt
    incubator/celix/trunk/framework/private/src/attribute.c
    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/bundle_revision.c
    incubator/celix/trunk/framework/private/src/capability.c
    incubator/celix/trunk/framework/private/src/celix_log.c
    incubator/celix/trunk/framework/private/src/framework.c
    incubator/celix/trunk/framework/private/src/manifest.c
    incubator/celix/trunk/framework/private/src/manifest_parser.c
    incubator/celix/trunk/framework/private/src/requirement.c
    incubator/celix/trunk/framework/private/src/service_reference.c
    incubator/celix/trunk/framework/private/src/service_registration.c
    incubator/celix/trunk/framework/private/src/service_registry.c
    incubator/celix/trunk/framework/private/src/service_tracker.c
    incubator/celix/trunk/framework/private/src/service_tracker_customizer.c
    incubator/celix/trunk/framework/private/src/utils.c
    incubator/celix/trunk/framework/private/src/version.c
    incubator/celix/trunk/framework/private/src/version_range.c
    incubator/celix/trunk/framework/private/src/wire.c
    incubator/celix/trunk/framework/public/include/celix_log.h
    incubator/celix/trunk/framework/public/include/framework.h
    incubator/celix/trunk/launcher/private/src/launcher.c

Modified: incubator/celix/trunk/framework/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/CMakeLists.txt?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/CMakeLists.txt (original)
+++ incubator/celix/trunk/framework/CMakeLists.txt Tue Nov 19 07:45:51 2013
@@ -79,10 +79,18 @@ if (FRAMEWORK) 
 	    include_directories(${CPPUTEST_INCLUDE_DIR})
 	    include_directories(${CPPUTEST_EXT_INCLUDE_DIR})
 	    
-	    add_executable(version_test private/test/version_test.cpp private/src/version.c)
+	    add_executable(version_test 
+	        private/test/version_test.cpp 
+	        private/src/version.c
+	        private/src/celix_errorcodes.c
+            private/src/celix_log.c)
 		target_link_libraries(version_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY})
 		
-		add_executable(version_range_test private/test/version_range_test.cpp private/src/version_range.c)
+		add_executable(version_range_test 
+		    private/test/version_range_test.cpp 
+		    private/src/version_range.c
+		    private/src/celix_errorcodes.c
+            private/src/celix_log.c)
 		target_link_libraries(version_range_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY})
 		
 		add_executable(utils_test private/test/utils_test.cpp private/src/utils.c)
@@ -93,13 +101,17 @@ if (FRAMEWORK) 
 			private/mock/bundle_context_mock.c
 			private/mock/service_reference_mock.c 
 			private/mock/service_tracker_customizer_mock.c
-			private/src/service_tracker.c)
+			private/src/service_tracker.c
+			private/src/celix_errorcodes.c
+            private/src/celix_log.c)
 		target_link_libraries(service_tracker_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 		
 		add_executable(service_tracker_customizer_test 
 			private/test/service_tracker_customizer_test.cpp
 			private/mock/service_reference_mock.c
-			private/src/service_tracker_customizer.c) 
+			private/src/service_tracker_customizer.c
+			private/src/celix_errorcodes.c
+            private/src/celix_log.c) 
 		target_link_libraries(service_tracker_customizer_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 		
 		add_executable(service_registry_test 
@@ -110,21 +122,27 @@ if (FRAMEWORK) 
 			private/mock/service_reference_mock.c
 			private/mock/service_registration_mock.c
 			private/mock/properties_mock.c
-			private/src/service_registry.c) 
+			private/src/service_registry.c
+			private/src/celix_errorcodes.c
+            private/src/celix_log.c) 
 		target_link_libraries(service_registry_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 		
 		add_executable(service_registration_test 
 			private/test/service_registration_test.cpp
 			private/mock/properties_mock.c
 			private/mock/service_registry_mock.c
-			private/src/service_registration.c)
+			private/src/service_registration.c
+			private/src/celix_errorcodes.c
+            private/src/celix_log.c)
 		target_link_libraries(service_registration_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 		
 		add_executable(service_reference_test 
 			private/test/service_reference_test.cpp
 			private/mock/service_registration_mock.c
 			private/mock/service_registry_mock.c
-			private/src/service_reference.c)
+			private/src/service_reference.c
+			private/src/celix_errorcodes.c
+            private/src/celix_log.c)
 		target_link_libraries(service_reference_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 		
 		add_executable(resolver_test 
@@ -142,7 +160,9 @@ if (FRAMEWORK) 
 			private/mock/attribute_mock.c
 			private/mock/capability_mock.c
 			private/mock/version_range_mock.c
-			private/src/requirement.c)
+			private/src/requirement.c
+			private/src/celix_errorcodes.c
+            private/src/celix_log.c)
 		target_link_libraries(requirement_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 		
 		add_executable(properties_test 
@@ -166,7 +186,9 @@ if (FRAMEWORK) 
 			private/test/manifest_test.cpp
 			private/mock/properties_mock.c
 			private/src/utils.c
-			private/src/manifest.c)
+			private/src/manifest.c
+			private/src/celix_errorcodes.c
+            private/src/celix_log.c)
 		target_link_libraries(manifest_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 		
 		add_executable(manifest_parser_test 
@@ -177,7 +199,9 @@ if (FRAMEWORK) 
 			private/mock/requirement_mock.c
 			private/mock/version_mock.c
 			private/src/utils.c
-			private/src/manifest_parser.c)
+			private/src/manifest_parser.c
+			private/src/celix_errorcodes.c
+            private/src/celix_log.c)
 		target_link_libraries(manifest_parser_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 		
 		add_executable(framework_test 
@@ -211,7 +235,9 @@ if (FRAMEWORK) 
 			private/test/capability_test.cpp
 			private/mock/attribute_mock.c
 			private/mock/version_mock.c
-			private/src/capability.c)
+			private/src/capability.c
+			private/src/celix_errorcodes.c
+            private/src/celix_log.c)
 		target_link_libraries(capability_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 		
 		add_executable(bundle_test 
@@ -222,27 +248,35 @@ if (FRAMEWORK) 
 			private/mock/resolver_mock.c
 			private/mock/version_mock.c
 			private/src/utils.c
-			private/src/bundle.c)
+			private/src/bundle.c
+			private/src/celix_errorcodes.c
+            private/src/celix_log.c)
 		target_link_libraries(bundle_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 		
 		add_executable(bundle_revision_test 
 			private/test/bundle_revision_test.cpp
 			private/mock/miniunz_mock.c
-			private/src/bundle_revision.c)
+			private/src/bundle_revision.c
+			private/src/celix_errorcodes.c
+            private/src/celix_log.c)
 		target_link_libraries(bundle_revision_test ${ZLIB_LIBRARY} ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 		
 		add_executable(bundle_context_test 
 			private/test/bundle_context_test.cpp
 			private/mock/bundle_mock.c
 			private/mock/framework_mock.c
-			private/src/bundle_context.c)
+			private/src/bundle_context.c
+			private/src/celix_errorcodes.c
+            private/src/celix_log.c)
 		target_link_libraries(bundle_context_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 		
 		add_executable(bundle_cache_test 
 			private/test/bundle_cache_test.cpp
 			private/mock/bundle_archive_mock.c
 			private/mock/properties_mock.c
-			private/src/bundle_cache.c)
+			private/src/bundle_cache.c
+			private/src/celix_errorcodes.c
+			private/src/celix_log.c)
 		target_link_libraries(bundle_cache_test ${APR_LIBRARY} ${CPPUTEST_LIBRARY} ${CPPUTEST_EXT_LIBRARY} celix_utils)
 		
 		add_executable(bundle_archive_test 

Modified: incubator/celix/trunk/framework/private/src/attribute.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/attribute.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/attribute.c (original)
+++ incubator/celix/trunk/framework/private/src/attribute.c Tue Nov 19 07:45:51 2013
@@ -48,13 +48,7 @@ celix_status_t attribute_create(apr_pool
 		}
 	}
 
-	if (status != CELIX_SUCCESS) {
-        if (error != NULL) {
-            fw_logCode(FW_LOG_ERROR, status, "Could not create attribute: [key=%s;value=%s]; cause: %s", key, value, error);
-        } else {
-            fw_logCode(FW_LOG_ERROR, status, "Could not create attribute: [key=%s;value=%s]", key, value);
-        }
-	}
+	framework_logIfError(status, error, "Could not create attribute: [key=%s;value=%s]", key, value);
 
 	return status;
 }

Modified: incubator/celix/trunk/framework/private/src/bundle.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle.c Tue Nov 19 07:45:51 2013
@@ -38,6 +38,7 @@
 #include "bundle_archive.h"
 #include "resolver.h"
 #include "utils.h"
+#include "celix_log.h"
 
 celix_status_t bundle_createModule(bundle_pt bundle, module_pt *module);
 celix_status_t bundle_closeRevisions(bundle_pt bundle);
@@ -81,6 +82,8 @@ celix_status_t bundle_create(bundle_pt *
         }
 	}
 
+	framework_logIfError(status, NULL, "Failed to create bundle");
+
 	return status;
 }
 
@@ -121,6 +124,8 @@ celix_status_t bundle_createFromArchive(
 	    status = CELIX_FILE_IO_EXCEPTION;
 	}
 
+	framework_logIfError(status, NULL, "Failed to create bundle");
+
 	return status;
 }
 
@@ -144,6 +149,8 @@ celix_status_t bundle_getArchive(bundle_
 		status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Failed to get bundle archive");
+
 	return status;
 }
 
@@ -156,6 +163,8 @@ celix_status_t bundle_getCurrentModule(b
 		*module = arrayList_get(bundle->modules, arrayList_size(bundle->modules) - 1);
 	}
 
+	framework_logIfError(status, NULL, "Failed to get bundle module");
+
 	return status;
 }
 
@@ -273,6 +282,8 @@ celix_status_t bundle_createModule(bundl
         }
 	}
 
+	framework_logIfError(status, NULL, "Failed to create module");
+
 	return status;
 }
 
@@ -293,6 +304,9 @@ celix_status_t bundle_startWithOptions(b
     		}
     	}
     }
+
+    framework_logIfError(status, NULL, "Failed to start bundle");
+
     return status;
 }
 
@@ -310,6 +324,9 @@ celix_status_t bundle_update(bundle_pt b
 			}
 		}
 	}
+
+	framework_logIfError(status, NULL, "Failed to update bundle");
+
 	return status;
 }
 
@@ -330,6 +347,9 @@ celix_status_t bundle_stopWithOptions(bu
 			}
 		}
 	}
+
+	framework_logIfError(status, NULL, "Failed to stop bundle");
+
 	return status;
 }
 
@@ -346,6 +366,9 @@ celix_status_t bundle_uninstall(bundle_p
 			}
 		}
 	}
+
+	framework_logIfError(status, NULL, "Failed to uninstall bundle");
+
 	return status;
 }
 
@@ -360,6 +383,8 @@ celix_status_t bundle_setPersistentState
 		}
 	}
 
+	framework_logIfError(status, NULL, "Failed to set persistent state to inactive");
+
 	return status;
 }
 
@@ -374,6 +399,8 @@ celix_status_t bundle_setPersistentState
 		}
 	}
 
+	framework_logIfError(status, NULL, "Failed to set persistent state to uninstalled");
+
     return status;
 }
 
@@ -418,6 +445,9 @@ celix_status_t bundle_revise(bundle_pt b
 			}
 		}
 	}
+
+	framework_logIfError(status, NULL, "Failed to revise bundle");
+
 	return status;
 }
 
@@ -445,6 +475,8 @@ celix_status_t bundle_isSystemBundle(bun
 		}
 	}
 
+	framework_logIfError(status, NULL, "Failed to check if bundle is the systembundle");
+
 	return status;
 }
 
@@ -468,6 +500,8 @@ celix_status_t bundle_isLockable(bundle_
 		}
 	}
 
+	framework_logIfError(status, NULL, "Failed to check if bundle is lockable");
+
 	return status;
 }
 
@@ -487,6 +521,8 @@ celix_status_t bundle_getLockingThread(b
 		}
 	}
 
+	framework_logIfError(status, NULL, "Failed to get locking thread");
+
 	return status;
 }
 
@@ -509,6 +545,8 @@ celix_status_t bundle_lock(bundle_pt bun
 
 	apr_thread_mutex_unlock(bundle->lock);
 
+	framework_logIfError(status, NULL, "Failed to lock bundle");
+
 	return status;
 }
 
@@ -537,6 +575,8 @@ celix_status_t bundle_unlock(bundle_pt b
 
 	apr_thread_mutex_unlock(bundle->lock);
 
+	framework_logIfError(status, NULL, "Failed to unlock bundle");
+
 	return status;
 }
 
@@ -552,6 +592,8 @@ celix_status_t bundle_close(bundle_pt bu
 		bundleArchive_close(archive);
     }
 
+    framework_logIfError(status, NULL, "Failed to close bundle");
+
     return status;
 }
 
@@ -567,6 +609,8 @@ celix_status_t bundle_closeAndDelete(bun
     	bundleArchive_closeAndDelete(archive);
     }
 
+    framework_logIfError(status, NULL, "Failed to close and delete bundle");
+
     return status;
 }
 
@@ -605,6 +649,9 @@ celix_status_t bundle_refresh(bundle_pt 
 			}
 		}
 	}
+
+	framework_logIfError(status, NULL, "Failed to refresh bundle");
+
     return status;
 }
 
@@ -615,6 +662,9 @@ celix_status_t bundle_getBundleId(bundle
 	if (status == CELIX_SUCCESS) {
 		status = bundleArchive_getId(archive, id);
 	}
+
+	framework_logIfError(status, NULL, "Failed to get bundle id");
+
 	return status;
 }
 
@@ -623,6 +673,8 @@ celix_status_t bundle_getRegisteredServi
 
 	status = fw_getBundleRegisteredServices(bundle->framework, pool, bundle, list);
 
+	framework_logIfError(status, NULL, "Failed to get registered services");
+
 	return status;
 }
 
@@ -631,6 +683,8 @@ celix_status_t bundle_getServicesInUse(b
 
 	status = fw_getBundleServicesInUse(bundle->framework, bundle, list);
 
+	framework_logIfError(status, NULL, "Failed to get in use services");
+
 	return status;
 }
 
@@ -643,6 +697,8 @@ celix_status_t bundle_getMemoryPool(bund
 		status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Failed to get memory pool");
+
 	return status;
 }
 
@@ -655,6 +711,8 @@ celix_status_t bundle_setFramework(bundl
 		status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Failed to set framework");
+
 	return status;
 }
 
@@ -667,5 +725,7 @@ celix_status_t bundle_getFramework(bundl
 		status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Failed to get framework");
+
 	return status;
 }

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=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_archive.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_archive.c Tue Nov 19 07:45:51 2013
@@ -100,13 +100,7 @@ celix_status_t bundleArchive_createSyste
         }
 	}
 
-	if (status != CELIX_SUCCESS) {
-        if (error != NULL) {
-            fw_logCode(FW_LOG_ERROR, status, "Could not create archive; cause: %s", error);
-        } else {
-            fw_logCode(FW_LOG_ERROR, status, "Could not create archive");
-        }
-    }
+	framework_logIfError(status, error, "Could not create archive");
 
     return status;
 }
@@ -149,13 +143,7 @@ celix_status_t bundleArchive_create(char
 		}
     }
 
-    if (status != CELIX_SUCCESS) {
-        if (error != NULL) {
-            fw_logCode(FW_LOG_ERROR, status, "Could not create archive; cause: %s", error);
-        } else {
-            fw_logCode(FW_LOG_ERROR, status, "Could not create archive");
-        }
-    }
+    framework_logIfError(status, error, "Could not create archive");
 
 	return status;
 }
@@ -170,6 +158,8 @@ static apr_status_t bundleArchive_destro
 	}
 	archive = NULL;
 
+	framework_logIfError(status, NULL, "Could not create archive");
+
 	return status;
 }
 
@@ -223,9 +213,7 @@ celix_status_t bundleArchive_recreate(ch
         }
 	}
 
-	if (status != CELIX_SUCCESS) {
-        fw_logCode(FW_LOG_ERROR, status, "Could not recreate archive");
-    }
+	framework_logIfError(status, NULL, "Could not create archive");
 
 	return status;
 }
@@ -263,9 +251,7 @@ celix_status_t bundleArchive_getId(bundl
 		*id = archive->id;
 	}
 
-	if (status != CELIX_SUCCESS) {
-        fw_logCode(FW_LOG_ERROR, status, "Could not get archive id");
-    }
+	framework_logIfError(status, NULL, "Could not get archive id");
 
 	return status;
 }
@@ -302,9 +288,7 @@ celix_status_t bundleArchive_getLocation
 		*location = archive->location;
 	}
 
-	if (status != CELIX_SUCCESS) {
-        fw_logCode(FW_LOG_ERROR, status, "Could not get archive location");
-    }
+    framework_logIfError(status, NULL, "Could not get archive location");
 
 	return status;
 }
@@ -322,9 +306,7 @@ celix_status_t bundleArchive_getCurrentR
 	status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
 	status = CELIX_DO_IF(status, bundleRevision_getNumber(revision, revisionNumber));
 
-    if (status != CELIX_SUCCESS) {
-        fw_logCode(FW_LOG_ERROR, status, "Could not get current revision number");
-    }
+    framework_logIfError(status, NULL, "Could not get current revision number");
 
 	return status;
 }
@@ -381,9 +363,7 @@ celix_status_t bundleArchive_getPersiste
         }
 	}
 
-	if (status != CELIX_SUCCESS) {
-        fw_logCode(FW_LOG_ERROR, status, "Could not get persistent state");
-    }
+    framework_logIfError(status, NULL, "Could not get persistent state");
 
 	return status;
 }
@@ -420,7 +400,7 @@ celix_status_t bundleArchive_setPersiste
                         s = "installed";
                         break;
                 }
-                status = CELIX_DO_IF(status, apr_file_printf(persistentStateLocationFile, "%s", s));
+                apr_file_printf(persistentStateLocationFile, "%s", s);
                 status = CELIX_DO_IF(status, apr_file_close(persistentStateLocationFile));
                 if (status == CELIX_SUCCESS) {
                     archive->persistentState = state;
@@ -430,9 +410,7 @@ celix_status_t bundleArchive_setPersiste
         apr_pool_destroy(subpool);
     }
 
-	if (status != CELIX_SUCCESS) {
-        fw_logCode(FW_LOG_ERROR, status, "Could not set persistent state");
-    }
+    framework_logIfError(status, NULL, "Could not set persistent state");
 
 	return status;
 }
@@ -477,9 +455,7 @@ celix_status_t bundleArchive_getRefreshC
 		*refreshCount = archive->refreshCount;
 	}
 
-	if (status != CELIX_SUCCESS) {
-        fw_logCode(FW_LOG_ERROR, status, "Could not get refresh count");
-    }
+    framework_logIfError(status, NULL, "Could not get refresh count");
 
 	return status;
 }
@@ -501,15 +477,13 @@ celix_status_t bundleArchive_setRefreshC
 	        strcat(refreshCounter, "/refresh.counter");
 	
 	        status = CELIX_DO_IF(status, apr_file_open(&refreshCounterFile, refreshCounter, APR_FOPEN_CREATE|APR_FOPEN_WRITE, APR_OS_DEFAULT, archive->mp));
-	        status = CELIX_DO_IF(status, apr_file_printf(refreshCounterFile, "%ld", archive->refreshCount));
+	        apr_file_printf(refreshCounterFile, "%ld", archive->refreshCount);
 	        status = CELIX_DO_IF(status, apr_file_close(refreshCounterFile));
 	    }
         apr_pool_destroy(subpool);
 	}
 
-	if (status != CELIX_SUCCESS) {
-        fw_logCode(FW_LOG_ERROR, status, "Could not set refresh count");
-    }
+    framework_logIfError(status, NULL, "Could not set refresh count");
 
 	return status;
 }
@@ -525,9 +499,7 @@ celix_status_t bundleArchive_getLastModi
 		*lastModified = archive->lastModified;
 	}
 
-	if (status != CELIX_SUCCESS) {
-        fw_logCode(FW_LOG_ERROR, status, "Could not get last modified");
-    }
+    framework_logIfError(status, NULL, "Could not get last modified");
 
 	return status;
 }
@@ -538,9 +510,7 @@ celix_status_t bundleArchive_setLastModi
 	archive->lastModified = lastModifiedTime;
 	status = CELIX_DO_IF(status, bundleArchive_writeLastModified(archive));
 
-	if (status != CELIX_SUCCESS) {
-        fw_logCode(FW_LOG_ERROR, status, "Could not set last modified");
-    }
+    framework_logIfError(status, NULL, "Could not set last modified");
 
 	return status;
 }
@@ -585,6 +555,8 @@ static celix_status_t bundleArchive_read
         apr_pool_destroy(subpool);
 	}
 
+	framework_logIfError(status, NULL, "Could not read last modified");
+
 	return status;
 }
 
@@ -613,6 +585,8 @@ static celix_status_t bundleArchive_writ
 		apr_file_close(lastModifiedFile);
 	}
 
+    framework_logIfError(status, NULL, "Could not write last modified");
+
 	return status;
 }
 
@@ -627,11 +601,14 @@ celix_status_t bundleArchive_revise(bund
 	if (status == CELIX_SUCCESS) {
 		status = bundleArchive_reviseInternal(archive, false, revNr, location, inputFile);
 	}
+
+    framework_logIfError(status, NULL, "Could not revise bundle archive");
+
 	return status;
 }
 
 static celix_status_t bundleArchive_reviseInternal(bundle_archive_pt archive, bool isReload, long revNr, char * location, char *inputFile) {
-    celix_status_t status;
+    celix_status_t status = CELIX_SUCCESS;
     bundle_revision_pt revision = NULL;
 
     if (inputFile != NULL) {
@@ -648,6 +625,8 @@ static celix_status_t bundleArchive_revi
         linkedList_addElement(archive->revisions, revision);
 	}
 
+	framework_logIfError(status, NULL, "Could not revise bundle archive");
+
 	return status;
 }
 
@@ -682,11 +661,13 @@ static celix_status_t bundleArchive_crea
 		}
     }
 
+    framework_logIfError(status, NULL, "Could not create revision [location=%s,inputFile=%s]", location, inputFile);
+
 	return status;
 }
 
 static celix_status_t bundleArchive_getRevisionLocation(bundle_archive_pt archive, long revNr, char **revision_location) {
-    celix_status_t status;
+    celix_status_t status = CELIX_SUCCESS;
 	char revisionLocation[256];
 	long refreshCount;
 
@@ -710,6 +691,9 @@ static celix_status_t bundleArchive_getR
 		}
 	}
 
+
+    framework_logIfError(status, NULL, "Failed to get revision location");
+
 	return status;
 }
 
@@ -733,6 +717,8 @@ static celix_status_t bundleArchive_setR
 		}
 	}
 
+	framework_logIfError(status, NULL, "Failed to set revision location");
+
 	return status;
 }
 
@@ -750,6 +736,8 @@ celix_status_t bundleArchive_closeAndDel
 		status = bundleArchive_deleteTree(archive->archiveRoot, archive->mp);
 	}
 
+	framework_logIfError(status, NULL, "Failed to close and delete archive");
+
 	return status;
 }
 
@@ -808,6 +796,8 @@ static celix_status_t bundleArchive_init
 		}
 	}
 
+	framework_logIfError(status, NULL, "Failed to initialize archive");
+
 	return status;
 }
 
@@ -860,5 +850,7 @@ static celix_status_t bundleArchive_dele
 		}
 	}
 
+	framework_logIfError(status, NULL, "Failed to delete tree");
+
 	return status;
 }

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=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_cache.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_cache.c Tue Nov 19 07:45:51 2013
@@ -36,6 +36,7 @@
 #include "bundle_cache_private.h"
 #include "bundle_archive.h"
 #include "constants.h"
+#include "celix_log.h"
 
 static celix_status_t bundleCache_deleteTree(char * directory, apr_pool_t *mp);
 static apr_status_t bundleCache_destroy(void *cacheP);
@@ -66,6 +67,8 @@ celix_status_t bundleCache_create(proper
         }
     }
 
+    framework_logIfError(status, NULL, "Failed to create bundle cache");
+
 	return status;
 }
 
@@ -130,6 +133,8 @@ celix_status_t bundleCache_getArchives(b
 	    status = CELIX_FILE_IO_EXCEPTION;
 	}
 
+	framework_logIfError(status, NULL, "Failed to get bundle archives");
+
 	return status;
 }
 
@@ -143,6 +148,8 @@ celix_status_t bundleCache_createArchive
         status = bundleArchive_create(archiveRoot, id, location, inputFile, bundlePool, bundle_archive);
 	}
 
+	framework_logIfError(status, NULL, "Failed to create archive");
+
 	return status;
 }
 
@@ -176,5 +183,7 @@ static celix_status_t bundleCache_delete
 	    status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Failed to delete tree");
+
 	return status;
 }

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=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_context.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_context.c Tue Nov 19 07:45:51 2013
@@ -30,6 +30,7 @@
 #include "bundle_context_private.h"
 #include "framework_private.h"
 #include "bundle.h"
+#include "celix_log.h"
 
 celix_status_t bundleContext_create(framework_pt framework, bundle_pt bundle, bundle_context_pt *bundle_context) {
 	celix_status_t status = CELIX_SUCCESS;
@@ -61,6 +62,8 @@ celix_status_t bundleContext_create(fram
 
 	}
 
+	framework_logIfError(status, NULL, "Failed to create context");
+
 	return status;
 }
 
@@ -75,6 +78,8 @@ celix_status_t bundleContext_destroy(bun
 		status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Failed to destroy context");
+
 	return status;
 }
 
@@ -87,6 +92,8 @@ celix_status_t bundleContext_getBundle(b
 		*bundle = context->bundle;
 	}
 
+	framework_logIfError(status, NULL, "Failed to get bundle");
+
 	return status;
 }
 
@@ -99,6 +106,8 @@ celix_status_t bundleContext_getFramewor
 		*framework = context->framework;
 	}
 
+	framework_logIfError(status, NULL, "Failed to get framework");
+
 	return status;
 }
 
@@ -111,6 +120,8 @@ celix_status_t bundleContext_getMemoryPo
 		*memory_pool = context->pool;
 	}
 
+	framework_logIfError(status, NULL, "Failed to get memory pool");
+
 	return status;
 }
 
@@ -132,6 +143,8 @@ celix_status_t bundleContext_installBund
         status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Failed to install bundle");
+
 	return status;
 }
 
@@ -147,6 +160,8 @@ celix_status_t bundleContext_registerSer
 	    status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Failed to register service");
+
 	return status;
 }
 
@@ -162,6 +177,8 @@ celix_status_t bundleContext_registerSer
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
+    framework_logIfError(status, NULL, "Failed to register service factory");
+
     return status;
 }
 
@@ -174,6 +191,8 @@ celix_status_t bundleContext_getServiceR
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
+    framework_logIfError(status, NULL, "Failed to get service references");
+
 	return status;
 }
 
@@ -194,6 +213,8 @@ celix_status_t bundleContext_getServiceR
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
+    framework_logIfError(status, NULL, "Failed to get service reference");
+
 	return status;
 }
 
@@ -206,6 +227,8 @@ celix_status_t bundleContext_getService(
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
+    framework_logIfError(status, NULL, "Failed to get service");
+
     return status;
 }
 
@@ -218,6 +241,8 @@ celix_status_t bundleContext_ungetServic
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
+    framework_logIfError(status, NULL, "Failed to unget service");
+
     return status;
 }
 
@@ -230,6 +255,8 @@ celix_status_t bundleContext_getBundles(
 		*bundles = framework_getBundles(context->framework);
 	}
 
+	framework_logIfError(status, NULL, "Failed to get bundles");
+
 	return status;
 }
 
@@ -242,6 +269,8 @@ celix_status_t bundleContext_getBundleBy
         *bundle = framework_getBundleById(context->framework, id);
     }
 
+    framework_logIfError(status, NULL, "Failed to get bundle [id=%ld]", id);
+
 	return status;
 }
 
@@ -254,6 +283,8 @@ celix_status_t bundleContext_addServiceL
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
+    framework_logIfError(status, NULL, "Failed to add service listener");
+
     return status;
 }
 
@@ -266,6 +297,8 @@ celix_status_t bundleContext_removeServi
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
+    framework_logIfError(status, NULL, "Failed to remove service listener");
+
     return status;
 }
 
@@ -278,6 +311,8 @@ celix_status_t bundleContext_addBundleLi
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
+    framework_logIfError(status, NULL, "Failed to add bundle listener");
+
     return status;
 }
 
@@ -290,6 +325,8 @@ celix_status_t bundleContext_removeBundl
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
+    framework_logIfError(status, NULL, "Failed to remove bundle listener");
+
     return status;
 }
 
@@ -302,6 +339,8 @@ celix_status_t bundleContext_addFramewor
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
+    framework_logIfError(status, NULL, "Failed to add framework listener");
+
     return status;
 }
 
@@ -314,6 +353,8 @@ celix_status_t bundleContext_removeFrame
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
+    framework_logIfError(status, NULL, "Failed to remove framework listener");
+
     return status;
 }
 
@@ -326,5 +367,7 @@ celix_status_t bundleContext_getProperty
 		fw_getProperty(context->framework, name, value);
 	}
 
+	framework_logIfError(status, NULL, "Failed to get property [name=%s]", name);
+
 	return status;
 }

Modified: incubator/celix/trunk/framework/private/src/bundle_revision.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_revision.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_revision.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_revision.c Tue Nov 19 07:45:51 2013
@@ -31,6 +31,7 @@
 
 #include "bundle_revision_private.h"
 #include "archive.h"
+#include "celix_log.h"
 
 static apr_status_t bundleRevision_destroy(void *revisionP);
 
@@ -66,6 +67,8 @@ celix_status_t bundleRevision_create(apr
         }
     }
 
+    framework_logIfError(status, NULL, "Failed to create revision");
+
 	return status;
 }
 
@@ -81,6 +84,9 @@ celix_status_t bundleRevision_getNumber(
     } else {
     	*revisionNr = revision->revisionNr;
     }
+
+    framework_logIfError(status, NULL, "Failed to get revision number");
+
 	return status;
 }
 
@@ -91,6 +97,9 @@ celix_status_t bundleRevision_getLocatio
 	} else {
 		*location = revision->location;
 	}
+
+	framework_logIfError(status, NULL, "Failed to get revision location");
+
 	return status;
 }
 
@@ -101,5 +110,8 @@ celix_status_t bundleRevision_getRoot(bu
 	} else {
 		*root = revision->root;
 	}
+
+	framework_logIfError(status, NULL, "Failed to get revision root");
+
 	return status;
 }

Modified: incubator/celix/trunk/framework/private/src/capability.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/capability.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/capability.c (original)
+++ incubator/celix/trunk/framework/private/src/capability.c Tue Nov 19 07:45:51 2013
@@ -27,6 +27,7 @@
 
 #include "capability_private.h"
 #include "attribute.h"
+#include "celix_log.h"
 
 apr_status_t capability_destroy(void *capabilityP);
 
@@ -60,6 +61,8 @@ celix_status_t capability_create(apr_poo
 		}
 	}
 
+	framework_logIfError(status, NULL, "Failed to create capability");
+
 	return status;
 }
 

Modified: incubator/celix/trunk/framework/private/src/celix_log.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/celix_log.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/celix_log.c (original)
+++ incubator/celix/trunk/framework/private/src/celix_log.c Tue Nov 19 07:45:51 2013
@@ -46,3 +46,4 @@ void framework_logCode(framework_log_lev
 
     framework_log(level, func, file, line, "%s [%d]: %s", message, code, msg);
 }
+

Modified: incubator/celix/trunk/framework/private/src/framework.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Tue Nov 19 07:45:51 2013
@@ -194,7 +194,7 @@ struct request {
 
 typedef struct request *request_pt;
 
-struct celix_status framework_create(framework_pt *framework, apr_pool_t *memoryPool, properties_pt config) {
+celix_status_t framework_create(framework_pt *framework, apr_pool_t *memoryPool, properties_pt config) {
     celix_status_t status = CELIX_SUCCESS;
     char *error = NULL;
 
@@ -246,10 +246,7 @@ struct celix_status framework_create(fra
         fw_logCode(FW_LOG_ERROR, CELIX_ENOMEM, "Could not create framework");
     }
 
-    struct celix_status stat;
-    stat.code = status;
-    stat.error = error;
-    return stat;
+    return status;
 }
 
 celix_status_t framework_destroy(framework_pt framework) {
@@ -849,7 +846,7 @@ celix_status_t fw_stopBundle(framework_p
 	celix_status_t status = CELIX_SUCCESS;
 	bundle_state_e state;
     activator_pt activator;
-    bundle_context_pt context;
+    bundle_context_pt context = NULL;
     module_pt module = NULL;
     manifest_pt manifest = NULL;
     bool wasActive = false;
@@ -914,11 +911,13 @@ celix_status_t fw_stopBundle(framework_p
 	    status = CELIX_DO_IF(status, bundle_getCurrentModule(bundle, &module));
 	    if (status == CELIX_SUCCESS) {
             if (strcmp(module_getId(module), "0") != 0) {
-                activator->start = NULL;
-                activator->stop = NULL;
-                activator->userData = NULL;
-                //free(activator);
-                status = CELIX_DO_IF(status, bundle_setActivator(bundle, NULL));
+                if (activator != NULL) {
+                    activator->start = NULL;
+                    activator->stop = NULL;
+                    activator->userData = NULL;
+                    //free(activator);
+                    status = CELIX_DO_IF(status, bundle_setActivator(bundle, NULL));
+                }
 
                 status = CELIX_DO_IF(status, serviceRegistry_unregisterServices(framework->registry, bundle));
                 if (status == CELIX_SUCCESS) {
@@ -929,8 +928,10 @@ celix_status_t fw_stopBundle(framework_p
                 // #TODO enable dlclose call
 //              dlclose(bundle_getHandle(bundle));
 
-                status = CELIX_DO_IF(status, bundleContext_destroy(context));
-                status = CELIX_DO_IF(status, bundle_setContext(bundle, NULL));
+                if (context != NULL) {
+                    status = CELIX_DO_IF(status, bundleContext_destroy(context));
+                    status = CELIX_DO_IF(status, bundle_setContext(bundle, NULL));
+                }
 
                 status = CELIX_DO_IF(status, framework_setBundleStateAndNotify(framework, bundle, BUNDLE_RESOLVED));
             }
@@ -1031,11 +1032,8 @@ celix_status_t fw_uninstallBundle(framew
         bundle_getCurrentModule(bundle, &module);
         module_getSymbolicName(module, &symbolicName);
         bundle_getBundleId(bundle, &id);
-        if (error != NULL) {
-            fw_logCode(FW_LOG_ERROR, status, "Cannot uninstall bundle: %s [%ld]; cause: %s", symbolicName, id, error);
-        } else {
-            fw_logCode(FW_LOG_ERROR, status, "Cannot uninstall bundle: %s [%ld]", symbolicName, id);
-        }
+
+        framework_logIfError(status, error, "Cannot uninstall bundle: %s [%ld]", symbolicName, id);
     }
 
     return status;
@@ -1106,6 +1104,8 @@ celix_status_t fw_refreshBundles(framewo
         framework_releaseGlobalLock(framework);
     }
 
+    framework_logIfError(status, NULL, "Cannot refresh bundles");
+
     return status;
 }
 
@@ -1130,6 +1130,9 @@ celix_status_t fw_refreshBundle(framewor
 
         framework_releaseBundleLock(framework, bundle);
     }
+
+    framework_logIfError(status, NULL, "Cannot refresh bundle");
+
     return status;
 }
 
@@ -1188,6 +1191,8 @@ celix_status_t fw_getDependentBundles(fr
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
+    framework_logIfError(status, NULL, "Cannot get dependent bundles");
+
     return status;
 }
 
@@ -1210,6 +1215,8 @@ celix_status_t fw_populateDependentGraph
         status = CELIX_ILLEGAL_ARGUMENT;
     }
 
+    framework_logIfError(status, NULL, "Cannot populate dependent graph");
+
     return status;
 }
 
@@ -1291,13 +1298,7 @@ celix_status_t fw_registerService(framew
         }
 	}
 
-	if (status != CELIX_SUCCESS) {
-		if (error != NULL) {
-            fw_logCode(FW_LOG_ERROR, status, "Cannot register service: %s; cause: %s", serviceName, error);
-        } else {
-            fw_logCode(FW_LOG_ERROR, status, "Cannot register service: %s", serviceName);
-        }
-	}
+    framework_logIfError(status, error, "Cannot register service: %s", serviceName);
 
 	return status;
 }
@@ -1317,14 +1318,7 @@ celix_status_t fw_registerServiceFactory
         error = "Could not release bundle lock";
     }
 
-
-    if (status != CELIX_SUCCESS) {
-        if (error != NULL) {
-            fw_logCode(FW_LOG_ERROR, status, "Cannot register service factory: %s; cause: %s", serviceName, error);
-        } else {
-            fw_logCode(FW_LOG_ERROR, status, "Cannot register service factory: %s", serviceName);
-        }
-    }
+    framework_logIfError(status, error, "Cannot register service factory: %s", serviceName);
 
     return CELIX_SUCCESS;
 }
@@ -1367,6 +1361,8 @@ celix_status_t fw_getServiceReferences(f
         }
 	}
 
+	framework_logIfError(status, NULL, "Failed to get service references");
+
 	return status;
 }
 
@@ -1524,6 +1520,8 @@ celix_status_t fw_addBundleListener(fram
 		arrayList_add(framework->bundleListeners, bundleListener);
 	}
 
+	framework_logIfError(status, NULL, "Failed to add bundle listener");
+
 	return status;
 }
 
@@ -1540,6 +1538,8 @@ celix_status_t fw_removeBundleListener(f
 		}
 	}
 
+	framework_logIfError(status, NULL, "Failed to remove bundle listener");
+
 	return status;
 }
 
@@ -1560,6 +1560,8 @@ celix_status_t fw_addFrameworkListener(f
 		arrayList_add(framework->frameworkListeners, frameworkListener);
 	}
 
+	framework_logIfError(status, NULL, "Failed to add framework listener");
+
 	return status;
 }
 
@@ -1576,6 +1578,8 @@ celix_status_t fw_removeFrameworkListene
 		}
 	}
 
+	framework_logIfError(status, NULL, "Failed to remove framework listener");
+
 	return status;
 }
 
@@ -1670,6 +1674,9 @@ celix_status_t getManifest(bundle_archiv
 			}
 		}
 	}
+
+	framework_logIfError(status, NULL, "Failed to get manifest");
+
 	return status;
 }
 
@@ -1807,7 +1814,6 @@ celix_status_t framework_acquireBundleLo
 	bool locked;
 	apr_os_thread_t lockingThread = 0;
 
-	printf("Acq bundle lock\n");
 	int err = apr_thread_mutex_lock(framework->bundleLock);
 	if (err != APR_SUCCESS) {
 		fw_log(FW_LOG_ERROR,  "Failed to lock");
@@ -1861,14 +1867,15 @@ celix_status_t framework_acquireBundleLo
 		apr_thread_mutex_unlock(framework->bundleLock);
 	}
 
-	return CELIX_SUCCESS;
+	framework_logIfError(status, NULL, "Failed to get bundle lock");
+
+	return status;
 }
 
 bool framework_releaseBundleLock(framework_pt framework, bundle_pt bundle) {
     bool unlocked;
     apr_os_thread_t lockingThread = 0;
 
-    printf("Rel bundle lock\n");
     apr_thread_mutex_lock(framework->bundleLock);
 
     bundle_unlock(bundle, &unlocked);
@@ -1921,7 +1928,7 @@ bool framework_acquireGlobalLock(framewo
 }
 
 celix_status_t framework_releaseGlobalLock(framework_pt framework) {
-	int ret = CELIX_SUCCESS;
+	int status = CELIX_SUCCESS;
 	if (apr_thread_mutex_lock(framework->bundleLock) != 0) {
 		fw_log(FW_LOG_ERROR,  "Error locking framework bundle lock");
 		return CELIX_FRAMEWORK_EXCEPTION;
@@ -1933,7 +1940,7 @@ celix_status_t framework_releaseGlobalLo
 			framework->globalLockThread = 0;
 			if (apr_thread_cond_broadcast(framework->condition) != 0) {
 				fw_log(FW_LOG_ERROR,  "Failed to broadcast global lock release.");
-				ret = CELIX_FRAMEWORK_EXCEPTION;
+				status = CELIX_FRAMEWORK_EXCEPTION;
 				// still need to unlock before returning
 			}
 		}
@@ -1945,7 +1952,10 @@ celix_status_t framework_releaseGlobalLo
 		fw_log(FW_LOG_ERROR,  "Error unlocking framework bundle lock");
 		return CELIX_FRAMEWORK_EXCEPTION;
 	}
-	return ret;
+
+	framework_logIfError(status, NULL, "Failed to release global lock");
+
+	return status;
 }
 
 celix_status_t framework_waitForStop(framework_pt framework) {
@@ -2038,6 +2048,8 @@ celix_status_t framework_getFrameworkBun
 		status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Failed to get framework bundle");
+
 	return status;
 }
 
@@ -2073,6 +2085,8 @@ celix_status_t fw_fireBundleEvent(framew
 		}
 	}
 
+	framework_logIfError(status, NULL, "Failed to fire bundle event");
+
 	return status;
 }
 
@@ -2110,6 +2124,8 @@ celix_status_t fw_fireFrameworkEvent(fra
 		}
 	}
 
+	framework_logIfError(status, NULL, "Failed to fire framework event");
+
 	return status;
 }
 
@@ -2222,6 +2238,9 @@ celix_status_t bundleActivator_stop(void
 	} else {
 		status = CELIX_FRAMEWORK_EXCEPTION;
 	}
+
+	framework_logIfError(status, NULL, "Failed to stop framework activator");
+
 	return status;
 }
 

Modified: incubator/celix/trunk/framework/private/src/manifest.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/manifest.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/manifest.c (original)
+++ incubator/celix/trunk/framework/private/src/manifest.c Tue Nov 19 07:45:51 2013
@@ -30,6 +30,7 @@
 
 #include "manifest.h"
 #include "utils.h"
+#include "celix_log.h"
 
 int fpeek(FILE *stream);
 celix_status_t manifest_readAttributes(manifest_pt manifest, properties_pt properties, FILE *file);
@@ -48,6 +49,8 @@ celix_status_t manifest_create(apr_pool_
 		(*manifest)->attributes = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
 	}
 
+	framework_logIfError(status, NULL, "Cannot create manifest");
+
 	return status;
 }
 
@@ -71,6 +74,8 @@ celix_status_t manifest_createFromFile(a
 		manifest_read(*manifest, filename);
 	}
 
+	framework_logIfError(status, NULL, "Cannot create manifest from file");
+
 	return status;
 }
 
@@ -174,10 +179,11 @@ celix_status_t manifest_read(manifest_pt
 		apr_pool_destroy(subpool);
 		fclose(file);
 	} else {
-		printf("Could not read manifest file.\n");
 		status = CELIX_FILE_IO_EXCEPTION;
 	}
 
+	framework_logIfError(status, NULL, "Cannot read manifest");
+
 	return status;
 }
 

Modified: incubator/celix/trunk/framework/private/src/manifest_parser.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/manifest_parser.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/manifest_parser.c (original)
+++ incubator/celix/trunk/framework/private/src/manifest_parser.c Tue Nov 19 07:45:51 2013
@@ -36,6 +36,7 @@
 #include "hash_map.h"
 #include "celix_errno.h"
 #include "linked_list_iterator.h"
+#include "celix_log.h"
 
 struct manifestParser {
 	module_pt owner;
@@ -88,6 +89,8 @@ celix_status_t manifestParser_create(mod
         status = CELIX_ENOMEM;
 	}
 
+	framework_logIfError(status, NULL, "Cannot create manifest parser");
+
 	return status;
 }
 

Modified: incubator/celix/trunk/framework/private/src/requirement.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/requirement.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/requirement.c (original)
+++ incubator/celix/trunk/framework/private/src/requirement.c Tue Nov 19 07:45:51 2013
@@ -28,6 +28,7 @@
 #include "requirement_private.h"
 #include "version_range.h"
 #include "attribute.h"
+#include "celix_log.h"
 
 apr_status_t requirement_destroy(void *requirementP);
 
@@ -63,6 +64,8 @@ celix_status_t requirement_create(apr_po
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot create requirement");
+
 	return status;
 }
 
@@ -107,5 +110,7 @@ celix_status_t requirement_isSatisfied(r
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot check if requirement is satisfied");
+
 	return status;
 }

Modified: incubator/celix/trunk/framework/private/src/service_reference.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_reference.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_reference.c (original)
+++ incubator/celix/trunk/framework/private/src/service_reference.c Tue Nov 19 07:45:51 2013
@@ -32,6 +32,7 @@
 #include "module.h"
 #include "wire.h"
 #include "bundle.h"
+#include "celix_log.h"
 
 apr_status_t serviceReference_destroy(void *referenceP);
 
@@ -48,6 +49,8 @@ celix_status_t serviceReference_create(a
 		(*reference)->registration = registration;
 	}
 
+	framework_logIfError(status, NULL, "Cannot create service reference");
+
 	return status;
 }
 

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=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registration.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registration.c Tue Nov 19 07:45:51 2013
@@ -33,7 +33,7 @@
 #include "constants.h"
 #include "service_factory.h"
 #include "service_reference.h"
-
+#include "celix_log.h"
 
 static celix_status_t serviceRegistration_initializeProperties(service_registration_pt registration, properties_pt properties);
 
@@ -138,6 +138,8 @@ celix_status_t serviceRegistration_unreg
 		serviceRegistry_unregisterService(registration->registry, registration->bundle, registration);
 	}
 
+	framework_logIfError(status, NULL, "Cannot unregister service registration");
+
 	return status;
 }
 
@@ -160,6 +162,8 @@ celix_status_t serviceRegistration_getPr
 		status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Cannot get registration properties");
+
 	return status;
 }
 
@@ -182,6 +186,8 @@ celix_status_t serviceRegistration_getRe
 		status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Cannot get registry");
+
 	return status;
 }
 
@@ -194,6 +200,8 @@ celix_status_t serviceRegistration_getSe
 		status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Cannot get service reference");
+
 	return status;
 }
 
@@ -206,6 +214,8 @@ celix_status_t serviceRegistration_getBu
 		status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Cannot get bundle");
+
 	return status;
 }
 
@@ -218,5 +228,7 @@ celix_status_t serviceRegistration_getSe
 		status = CELIX_ILLEGAL_ARGUMENT;
 	}
 
+	framework_logIfError(status, NULL, "Cannot get service name");
+
 	return status;
 }

Modified: incubator/celix/trunk/framework/private/src/service_registry.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_registry.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registry.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registry.c Tue Nov 19 07:45:51 2013
@@ -34,6 +34,7 @@
 #include "constants.h"
 #include "service_reference.h"
 #include "framework_private.h"
+#include "celix_log.h"
 
 apr_status_t serviceRegistry_destroy(void *handle);
 
@@ -71,6 +72,8 @@ celix_status_t serviceRegistry_create(ap
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot create service registry");
+
 	return status;
 }
 
@@ -179,6 +182,9 @@ celix_status_t serviceRegistry_getRegist
 			}
 		}
 	}
+
+	framework_logIfError(status, NULL, "Cannot get registered services");
+
 	return status;
 }
 
@@ -326,6 +332,8 @@ celix_status_t serviceRegistry_createSer
 	serviceRegistration_getServiceReferences(registration, &references);
 	arrayList_add(references, *reference);
 
+	framework_logIfError(status, NULL, "Cannot create service reference");
+
 	return status;
 }
 
@@ -377,6 +385,8 @@ celix_status_t serviceRegistry_getServic
 	hashMapIterator_destroy(iterator);
 	hashMapValues_destroy(registrations);
 
+	framework_logIfError(status, NULL, "Cannot get service references");
+
 	return status;
 }
 
@@ -569,6 +579,8 @@ celix_status_t serviceRegistry_getListen
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot get listener hooks");
+
 	return status;
 }
 

Modified: incubator/celix/trunk/framework/private/src/service_tracker.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_tracker.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_tracker.c (original)
+++ incubator/celix/trunk/framework/private/src/service_tracker.c Tue Nov 19 07:45:51 2013
@@ -33,6 +33,7 @@
 #include "bundle_context.h"
 #include "constants.h"
 #include "service_reference.h"
+#include "celix_log.h"
 
 static apr_status_t serviceTracker_destroy(void *trackerP);
 static celix_status_t serviceTracker_addingService(service_tracker_pt tracker, service_reference_pt reference, void **service);
@@ -56,6 +57,7 @@ celix_status_t serviceTracker_create(apr
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot create service tracker");
 
 	return status;
 }
@@ -80,6 +82,8 @@ celix_status_t serviceTracker_createWith
 		(*tracker)->listener = NULL;
 	}
 
+	framework_logIfError(status, NULL, "Cannot create service tracker [filter=%s]", filter);
+
 	return status;
 }
 
@@ -122,6 +126,8 @@ celix_status_t serviceTracker_open(servi
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot open tracker");
+
 	return status;
 }
 
@@ -141,6 +147,8 @@ celix_status_t serviceTracker_close(serv
 		arrayList_destroy(refs);
 	}
 
+	framework_logIfError(status, NULL, "Cannot close tracker");
+
 	return status;
 }
 
@@ -272,6 +280,8 @@ static celix_status_t serviceTracker_tra
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot track reference");
+
 	return status;
 }
 
@@ -297,6 +307,8 @@ static celix_status_t  serviceTracker_ad
 		status = bundleContext_getService(tracker->context, reference, service);
 	}
 
+    framework_logIfError(status, NULL, "Cannot handle addingService");
+
     return status;
 }
 
@@ -334,5 +346,7 @@ static celix_status_t serviceTracker_unt
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot untrack reference");
+
 	return status;
 }

Modified: incubator/celix/trunk/framework/private/src/service_tracker_customizer.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_tracker_customizer.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_tracker_customizer.c (original)
+++ incubator/celix/trunk/framework/private/src/service_tracker_customizer.c Tue Nov 19 07:45:51 2013
@@ -27,6 +27,7 @@
 #include <stdlib.h>
 
 #include "service_tracker_customizer_private.h"
+#include "celix_log.h"
 
 static apr_status_t serviceTrackerCustomizer_destroy(void *customizerPointer);
 
@@ -52,6 +53,8 @@ celix_status_t serviceTrackerCustomizer_
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot create customizer");
+
 	return status;
 }
 

Modified: incubator/celix/trunk/framework/private/src/utils.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/utils.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/utils.c (original)
+++ incubator/celix/trunk/framework/private/src/utils.c Tue Nov 19 07:45:51 2013
@@ -28,6 +28,7 @@
 #include <apr_portable.h>
 
 #include "utils.h"
+#include "celix_log.h"
 
 unsigned int utils_stringHash(void * string) {
 	char * str = (char *) string;

Modified: incubator/celix/trunk/framework/private/src/version.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/version.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/version.c (original)
+++ incubator/celix/trunk/framework/private/src/version.c Tue Nov 19 07:45:51 2013
@@ -30,6 +30,7 @@
 #include "celix_errno.h"
 #include "framework_log.h"
 #include "version_private.h"
+#include "celix_log.h"
 
 static apr_status_t version_destroy(void *handle);
 
@@ -89,6 +90,8 @@ celix_status_t version_createVersion(apr
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot create version");
+
 	return status;
 }
 
@@ -171,6 +174,9 @@ celix_status_t version_createVersionFrom
 	if (status == CELIX_SUCCESS) {
 		status = version_createVersion(pool, major, minor, micro, qualifier, version);
 	}
+
+	framework_logIfError(status, NULL, "Cannot create version [versionString=%s]", versionStr);
+
 	return status;
 }
 
@@ -225,6 +231,8 @@ celix_status_t version_compareTo(version
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot compare versions");
+
 	return status;
 }
 

Modified: incubator/celix/trunk/framework/private/src/version_range.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/version_range.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/version_range.c (original)
+++ incubator/celix/trunk/framework/private/src/version_range.c Tue Nov 19 07:45:51 2013
@@ -28,6 +28,7 @@
 #include <string.h>
 
 #include "version_range_private.h"
+#include "celix_log.h"
 
 apr_status_t versionRange_destroy(void *rangeP);
 
@@ -46,6 +47,8 @@ celix_status_t versionRange_createVersio
 		(*range)->isHighInclusive = isHighInclusive;
 	}
 
+	framework_logIfError(status, NULL, "Cannot create version range");
+
 	return status;
 }
 
@@ -67,6 +70,8 @@ celix_status_t versionRange_createInfini
 		status = versionRange_createVersionRange(pool, version, true, NULL, true, range);
 	}
 
+	framework_logIfError(status, NULL, "Cannot create infinite range");
+
 	return status;
 }
 
@@ -116,6 +121,8 @@ celix_status_t versionRange_isInRange(ve
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot check if version in in range");
+
 	return status;
 }
 
@@ -173,5 +180,7 @@ celix_status_t versionRange_parse(apr_po
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot parse version range");
+
 	return status;
 }

Modified: incubator/celix/trunk/framework/private/src/wire.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/wire.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/wire.c (original)
+++ incubator/celix/trunk/framework/private/src/wire.c Tue Nov 19 07:45:51 2013
@@ -27,6 +27,7 @@
 #include <string.h>
 
 #include "wire.h"
+#include "celix_log.h"
 
 struct wire {
 	module_pt importer;
@@ -57,6 +58,8 @@ celix_status_t wire_create(apr_pool_t *p
 		}
 	}
 
+	framework_logIfError(status, NULL, "Cannot create wire");
+
 	return status;
 }
 

Modified: incubator/celix/trunk/framework/public/include/celix_log.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/celix_log.h?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/celix_log.h (original)
+++ incubator/celix/trunk/framework/public/include/celix_log.h Tue Nov 19 07:45:51 2013
@@ -35,6 +35,14 @@
 #define celix_log(msg) printf("%s\n\tat %s(%s:%d)\n", msg, __func__, __FILE__, __LINE__);
 #define fw_log(level, fmsg, args...) framework_log(level, __func__, __FILE__, __LINE__, fmsg, ## args)
 #define fw_logCode(level, code, fmsg, args...) framework_logCode(level, __func__, __FILE__, __LINE__, code, fmsg, ## args)
+#define framework_logIfError(status, error, fmsg, args...) \
+    if (status != CELIX_SUCCESS) { \
+        if (error != NULL) { \
+            fw_logCode(FW_LOG_ERROR, status, #fmsg"; cause: "#error, ## args); \
+        } else { \
+            fw_logCode(FW_LOG_ERROR, status, #fmsg, ## args); \
+        } \
+    }
 #endif
 
 enum framework_log_level

Modified: incubator/celix/trunk/framework/public/include/framework.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/framework.h?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/framework.h (original)
+++ incubator/celix/trunk/framework/public/include/framework.h Tue Nov 19 07:45:51 2013
@@ -36,7 +36,7 @@ typedef struct framework * framework_pt;
 #include "properties.h"
 
 // #TODO: Move to FrameworkFactory according the OSGi Spec
-FRAMEWORK_EXPORT struct celix_status framework_create(framework_pt *framework, apr_pool_t *memoryPool, properties_pt config);
+FRAMEWORK_EXPORT celix_status_t framework_create(framework_pt *framework, apr_pool_t *memoryPool, properties_pt config);
 // #TODO: Replace with a pool hook when this is possible
 FRAMEWORK_EXPORT celix_status_t framework_destroy(framework_pt framework);
 

Modified: incubator/celix/trunk/launcher/private/src/launcher.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/launcher/private/src/launcher.c?rev=1543339&r1=1543338&r2=1543339&view=diff
==============================================================================
--- incubator/celix/trunk/launcher/private/src/launcher.c (original)
+++ incubator/celix/trunk/launcher/private/src/launcher.c Tue Nov 19 07:45:51 2013
@@ -69,8 +69,8 @@ int main(void) {
     autoStart = properties_get(config, "cosgi.auto.start.1");
     framework = NULL;
     celix_status_t status = CELIX_SUCCESS;
-    struct celix_status stat = framework_create(&framework, memoryPool, config);
-    if (stat.code == CELIX_SUCCESS) {
+    status = framework_create(&framework, memoryPool, config);
+    if (status == CELIX_SUCCESS) {
 		status = fw_init(framework);
 		if (status == CELIX_SUCCESS) {
             // Start the system bundle
@@ -128,8 +128,6 @@ int main(void) {
             framework_destroy(framework);
             properties_destroy(config);
 		}
-    } else {
-        printf("Error: %s,%s\n", stat.error);
     }
 
     if (status != CELIX_SUCCESS) {



Mime
View raw message