You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by ab...@apache.org on 2014/01/14 10:21:54 UTC
svn commit: r1557991 [1/2] - in /incubator/celix/trunk:
framework/private/include/
framework/private/integration-test/test_launcher/src/
framework/private/mock/ framework/private/src/ framework/private/test/
framework/public/include/ launcher/private/s...
Author: abroekhuis
Date: Tue Jan 14 09:21:53 2014
New Revision: 1557991
URL: http://svn.apache.org/r1557991
Log:
CELIX-106: Added global/extern variable for framework logger. Updated log calls to use this logger. (+1 squashed commit)
Squashed commits:
[a529aa2] Started adding FrameworkLogger to be able to override framework logging.
Modified:
incubator/celix/trunk/framework/private/include/bundle_cache.h
incubator/celix/trunk/framework/private/include/bundle_cache_private.h
incubator/celix/trunk/framework/private/include/bundle_context_private.h
incubator/celix/trunk/framework/private/include/bundle_revision_private.h
incubator/celix/trunk/framework/private/include/framework_private.h
incubator/celix/trunk/framework/private/integration-test/test_launcher/src/launcher.c
incubator/celix/trunk/framework/private/mock/bundle_archive_mock.c
incubator/celix/trunk/framework/private/mock/bundle_cache_mock.c
incubator/celix/trunk/framework/private/mock/bundle_context_mock.c
incubator/celix/trunk/framework/private/mock/bundle_mock.c
incubator/celix/trunk/framework/private/mock/bundle_revision_mock.c
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/version.c
incubator/celix/trunk/framework/private/src/version_range.c
incubator/celix/trunk/framework/private/src/wire.c
incubator/celix/trunk/framework/private/test/attribute_test.cpp
incubator/celix/trunk/framework/private/test/bundle_cache_test.cpp
incubator/celix/trunk/framework/private/test/bundle_context_test.cpp
incubator/celix/trunk/framework/private/test/bundle_revision_test.cpp
incubator/celix/trunk/framework/private/test/bundle_test.cpp
incubator/celix/trunk/framework/private/test/capability_test.cpp
incubator/celix/trunk/framework/private/test/manifest_parser_test.cpp
incubator/celix/trunk/framework/private/test/manifest_test.cpp
incubator/celix/trunk/framework/private/test/requirement_test.cpp
incubator/celix/trunk/framework/private/test/service_reference_test.cpp
incubator/celix/trunk/framework/private/test/service_registration_test.cpp
incubator/celix/trunk/framework/private/test/service_registry_test.cpp
incubator/celix/trunk/framework/private/test/service_tracker_customizer_test.cpp
incubator/celix/trunk/framework/private/test/service_tracker_test.cpp
incubator/celix/trunk/framework/private/test/version_range_test.cpp
incubator/celix/trunk/framework/private/test/version_test.cpp
incubator/celix/trunk/framework/public/include/bundle.h
incubator/celix/trunk/framework/public/include/bundle_archive.h
incubator/celix/trunk/framework/public/include/bundle_context.h
incubator/celix/trunk/framework/public/include/bundle_revision.h
incubator/celix/trunk/framework/public/include/celix_log.h
incubator/celix/trunk/launcher/private/src/launcher.c
incubator/celix/trunk/remote_services/remote_service_admin_http/private/src/export_registration_impl.c
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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle_cache.h (original)
+++ incubator/celix/trunk/framework/private/include/bundle_cache.h Tue Jan 14 09:21:53 2014
@@ -36,6 +36,7 @@
#include "properties.h"
#include "array_list.h"
#include "bundle_archive.h"
+#include "celix_log.h"
/**
* Type definition for the bundle_cache_pt abstract data type.
@@ -53,7 +54,7 @@ typedef struct bundleCache *bundle_cache
* - CELIX_ILLEGAL_ARGUMENT If <code>bundle_cache</code> not is null.
* - CELIX_ENOMEM If allocating memory for <code>bundle_cache</code> failed.
*/
-celix_status_t bundleCache_create(properties_pt configurationMap, apr_pool_t *mp, bundle_cache_pt *bundle_cache);
+celix_status_t bundleCache_create(properties_pt configurationMap, apr_pool_t *mp, framework_logger_pt logger, bundle_cache_pt *bundle_cache);
/**
* Recreates and retrieves the list of archives for the given bundle cache.
Modified: incubator/celix/trunk/framework/private/include/bundle_cache_private.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/bundle_cache_private.h?rev=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle_cache_private.h (original)
+++ incubator/celix/trunk/framework/private/include/bundle_cache_private.h Tue Jan 14 09:21:53 2014
@@ -34,6 +34,7 @@ struct bundleCache {
properties_pt configurationMap;
char * cacheDir;
apr_pool_t *mp;
+ framework_logger_pt logger;
};
Modified: incubator/celix/trunk/framework/private/include/bundle_context_private.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/bundle_context_private.h?rev=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle_context_private.h (original)
+++ incubator/celix/trunk/framework/private/include/bundle_context_private.h Tue Jan 14 09:21:53 2014
@@ -29,11 +29,13 @@
#define BUNDLE_CONTEXT_PRIVATE_H_
#include "bundle_context.h"
+#include "celix_log.h"
struct bundleContext {
struct framework * framework;
struct bundle * bundle;
apr_pool_t *pool;
+ framework_logger_pt logger;
};
Modified: incubator/celix/trunk/framework/private/include/bundle_revision_private.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/bundle_revision_private.h?rev=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle_revision_private.h (original)
+++ incubator/celix/trunk/framework/private/include/bundle_revision_private.h Tue Jan 14 09:21:53 2014
@@ -35,6 +35,7 @@ struct bundleRevision {
char *root;
char *location;
manifest_pt manifest;
+ framework_logger_pt logger;
};
#endif /* BUNDLE_REVISION_PRIVATE_H_ */
Modified: incubator/celix/trunk/framework/private/include/framework_private.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/framework_private.h?rev=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/framework_private.h (original)
+++ incubator/celix/trunk/framework/private/include/framework_private.h Tue Jan 14 09:21:53 2014
@@ -45,6 +45,7 @@
#include "service_registration.h"
#include "bundle_context.h"
#include "bundle_cache.h"
+#include "celix_log.h"
struct framework {
struct bundle * bundle;
@@ -80,6 +81,8 @@ struct framework {
apr_thread_cond_t *dispatcher;
apr_thread_mutex_t *dispatcherLock;
apr_thread_t *dispatcherThread;
+
+ framework_logger_pt logger;
};
celix_status_t framework_start(framework_pt framework);
Modified: incubator/celix/trunk/framework/private/integration-test/test_launcher/src/launcher.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/integration-test/test_launcher/src/launcher.c?rev=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/integration-test/test_launcher/src/launcher.c (original)
+++ incubator/celix/trunk/framework/private/integration-test/test_launcher/src/launcher.c Tue Jan 14 09:21:53 2014
@@ -82,7 +82,7 @@ int main(void) {
}
if (status != CELIX_SUCCESS) {
- framework_logIfError(status, NULL, "Failed to run test");
+ printf("Problem creating framework\n");
}
apr_pool_destroy(memoryPool);
Modified: incubator/celix/trunk/framework/private/mock/bundle_archive_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/bundle_archive_mock.c?rev=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/mock/bundle_archive_mock.c (original)
+++ incubator/celix/trunk/framework/private/mock/bundle_archive_mock.c Tue Jan 14 09:21:53 2014
@@ -27,8 +27,9 @@
#include "bundle_archive.h"
-celix_status_t bundleArchive_create(char * archiveRoot, long id, char * location, char *inputFile, apr_pool_t *mp, bundle_archive_pt *bundle_archive) {
+celix_status_t bundleArchive_create(framework_logger_pt logger, char * archiveRoot, long id, char * location, char *inputFile, apr_pool_t *mp, bundle_archive_pt *bundle_archive) {
mock_c()->actualCall("bundleArchive_create")
+ ->withPointerParameters("logger", logger)
->withStringParameters("archiveRoot", archiveRoot)
->withIntParameters("id", id)
->withStringParameters("location", location)
@@ -38,9 +39,10 @@ celix_status_t bundleArchive_create(char
return mock_c()->returnValue().value.intValue;
}
-celix_status_t bundleArchive_createSystemBundleArchive(apr_pool_t *mp, bundle_archive_pt *bundle_archive) {
+celix_status_t bundleArchive_createSystemBundleArchive(apr_pool_t *mp, framework_logger_pt logger, bundle_archive_pt *bundle_archive) {
mock_c()->actualCall("bundleArchive_createSystemBundleArchive")
->withPointerParameters("pool", mp)
+ ->withPointerParameters("logger", logger)
->_andPointerOutputParameters("bundle_archive", (void **) bundle_archive);
return mock_c()->returnValue().value.intValue;
}
Modified: incubator/celix/trunk/framework/private/mock/bundle_cache_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/bundle_cache_mock.c?rev=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/mock/bundle_cache_mock.c (original)
+++ incubator/celix/trunk/framework/private/mock/bundle_cache_mock.c Tue Jan 14 09:21:53 2014
@@ -27,7 +27,7 @@
#include "bundle_cache.h"
-celix_status_t bundleCache_create(properties_pt configurationMap, apr_pool_t *mp, bundle_cache_pt *bundle_cache) {
+celix_status_t bundleCache_create(properties_pt configurationMap, apr_pool_t *mp, framework_logger_pt logger, bundle_cache_pt *bundle_cache) {
mock_c()->actualCall("bundle_getCurrentModule");
return mock_c()->returnValue().value.intValue;
}
Modified: incubator/celix/trunk/framework/private/mock/bundle_context_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/bundle_context_mock.c?rev=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/mock/bundle_context_mock.c (original)
+++ incubator/celix/trunk/framework/private/mock/bundle_context_mock.c Tue Jan 14 09:21:53 2014
@@ -27,9 +27,10 @@
#include "bundle_context.h"
-celix_status_t bundleContext_create(framework_pt framework, bundle_pt bundle, bundle_context_pt *bundle_context) {
+celix_status_t bundleContext_create(framework_pt framework, framework_logger_pt logger, bundle_pt bundle, bundle_context_pt *bundle_context) {
mock_c()->actualCall("bundleContext_create")
->withPointerParameters("framework", framework)
+ ->withPointerParameters("logger", logger)
->withPointerParameters("bundle", bundle)
->_andPointerOutputParameters("bundle_context", (void **) bundle_context);
return mock_c()->returnValue().value.intValue;
Modified: incubator/celix/trunk/framework/private/mock/bundle_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/bundle_mock.c?rev=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/mock/bundle_mock.c (original)
+++ incubator/celix/trunk/framework/private/mock/bundle_mock.c Tue Jan 14 09:21:53 2014
@@ -27,7 +27,7 @@
#include "bundle_private.h"
-celix_status_t bundle_create(bundle_pt * bundle, apr_pool_t *mp) {
+celix_status_t bundle_create(bundle_pt * bundle, framework_logger_pt logger, apr_pool_t *mp) {
return mock_c()->returnValue().value.intValue;
}
Modified: incubator/celix/trunk/framework/private/mock/bundle_revision_mock.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/mock/bundle_revision_mock.c?rev=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/mock/bundle_revision_mock.c (original)
+++ incubator/celix/trunk/framework/private/mock/bundle_revision_mock.c Tue Jan 14 09:21:53 2014
@@ -27,7 +27,7 @@
#include "bundle_revision.h"
-celix_status_t bundleRevision_create(apr_pool_t *pool, char *root, char *location, long revisionNr, char *inputFile, bundle_revision_pt *bundle_revision) {
+celix_status_t bundleRevision_create(apr_pool_t *pool, framework_logger_pt logger, char *root, char *location, long revisionNr, char *inputFile, bundle_revision_pt *bundle_revision) {
mock_c()->actualCall("bundleRevision_create");
return mock_c()->returnValue().value.intValue;
}
Modified: incubator/celix/trunk/framework/private/src/attribute.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/attribute.c?rev=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/attribute.c (original)
+++ incubator/celix/trunk/framework/private/src/attribute.c Tue Jan 14 09:21:53 2014
@@ -48,7 +48,7 @@ celix_status_t attribute_create(apr_pool
}
}
- framework_logIfError(status, error, "Could not create attribute: [key=%s;value=%s]", key, value);
+ framework_logIfError(logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle.c Tue Jan 14 09:21:53 2014
@@ -44,7 +44,7 @@
celix_status_t bundle_createModule(bundle_pt bundle, module_pt *module);
celix_status_t bundle_closeRevisions(bundle_pt bundle);
-celix_status_t bundle_create(bundle_pt * bundle, apr_pool_t *mp) {
+celix_status_t bundle_create(bundle_pt * bundle, framework_logger_pt logger, apr_pool_t *mp) {
celix_status_t status = CELIX_SUCCESS;
bundle_archive_pt archive = NULL;
@@ -52,7 +52,7 @@ celix_status_t bundle_create(bundle_pt *
if (*bundle == NULL) {
return CELIX_ENOMEM;
}
- status = bundleArchive_createSystemBundleArchive(mp, &archive);
+ status = bundleArchive_createSystemBundleArchive(mp, logger, &archive);
if (status == CELIX_SUCCESS) {
module_pt module;
apr_status_t apr_status;
@@ -81,7 +81,7 @@ celix_status_t bundle_create(bundle_pt *
}
}
- framework_logIfError(status, NULL, "Failed to create bundle");
+ framework_logIfError(logger, status, NULL, "Failed to create bundle");
return status;
}
@@ -123,7 +123,7 @@ celix_status_t bundle_createFromArchive(
status = CELIX_FILE_IO_EXCEPTION;
}
- framework_logIfError(status, NULL, "Failed to create bundle");
+ framework_logIfError(framework->logger, status, NULL, "Failed to create bundle");
return status;
}
@@ -151,7 +151,7 @@ celix_status_t bundle_getArchive(bundle_
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to get bundle archive");
+ framework_logIfError(logger, status, NULL, "Failed to get bundle archive");
return status;
}
@@ -165,7 +165,7 @@ 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");
+ framework_logIfError(logger, status, NULL, "Failed to get bundle module");
return status;
}
@@ -279,7 +279,7 @@ celix_status_t bundle_createModule(bundl
}
}
- framework_logIfError(status, NULL, "Failed to create module");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to create module");
return status;
}
@@ -302,7 +302,7 @@ celix_status_t bundle_startWithOptions(b
}
}
- framework_logIfError(status, NULL, "Failed to start bundle");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to start bundle");
return status;
}
@@ -322,7 +322,7 @@ celix_status_t bundle_update(bundle_pt b
}
}
- framework_logIfError(status, NULL, "Failed to update bundle");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to update bundle");
return status;
}
@@ -345,7 +345,7 @@ celix_status_t bundle_stopWithOptions(bu
}
}
- framework_logIfError(status, NULL, "Failed to stop bundle");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to stop bundle");
return status;
}
@@ -364,7 +364,7 @@ celix_status_t bundle_uninstall(bundle_p
}
}
- framework_logIfError(status, NULL, "Failed to uninstall bundle");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to uninstall bundle");
return status;
}
@@ -380,7 +380,7 @@ celix_status_t bundle_setPersistentState
}
}
- framework_logIfError(status, NULL, "Failed to set persistent state to inactive");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to set persistent state to inactive");
return status;
}
@@ -396,7 +396,7 @@ celix_status_t bundle_setPersistentState
}
}
- framework_logIfError(status, NULL, "Failed to set persistent state to uninstalled");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to set persistent state to uninstalled");
return status;
}
@@ -443,7 +443,7 @@ celix_status_t bundle_revise(bundle_pt b
}
}
- framework_logIfError(status, NULL, "Failed to revise bundle");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to revise bundle");
return status;
}
@@ -472,7 +472,7 @@ celix_status_t bundle_isSystemBundle(bun
}
}
- framework_logIfError(status, NULL, "Failed to check if bundle is the systembundle");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to check if bundle is the systembundle");
return status;
}
@@ -497,7 +497,7 @@ celix_status_t bundle_isLockable(bundle_
}
}
- framework_logIfError(status, NULL, "Failed to check if bundle is lockable");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to check if bundle is lockable");
return status;
}
@@ -518,7 +518,7 @@ celix_status_t bundle_getLockingThread(b
}
}
- framework_logIfError(status, NULL, "Failed to get locking thread");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to get locking thread");
return status;
}
@@ -542,7 +542,7 @@ celix_status_t bundle_lock(bundle_pt bun
apr_thread_mutex_unlock(bundle->lock);
- framework_logIfError(status, NULL, "Failed to lock bundle");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to lock bundle");
return status;
}
@@ -572,7 +572,7 @@ celix_status_t bundle_unlock(bundle_pt b
apr_thread_mutex_unlock(bundle->lock);
- framework_logIfError(status, NULL, "Failed to unlock bundle");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to unlock bundle");
return status;
}
@@ -589,7 +589,7 @@ celix_status_t bundle_close(bundle_pt bu
bundleArchive_close(archive);
}
- framework_logIfError(status, NULL, "Failed to close bundle");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to close bundle");
return status;
}
@@ -606,7 +606,7 @@ celix_status_t bundle_closeAndDelete(bun
bundleArchive_closeAndDelete(archive);
}
- framework_logIfError(status, NULL, "Failed to close and delete bundle");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to close and delete bundle");
return status;
}
@@ -647,7 +647,7 @@ celix_status_t bundle_refresh(bundle_pt
}
}
- framework_logIfError(status, NULL, "Failed to refresh bundle");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to refresh bundle");
return status;
}
@@ -660,7 +660,7 @@ celix_status_t bundle_getBundleId(bundle
status = bundleArchive_getId(archive, id);
}
- framework_logIfError(status, NULL, "Failed to get bundle id");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to get bundle id");
return status;
}
@@ -670,7 +670,7 @@ celix_status_t bundle_getRegisteredServi
status = fw_getBundleRegisteredServices(bundle->framework, pool, bundle, list);
- framework_logIfError(status, NULL, "Failed to get registered services");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to get registered services");
return status;
}
@@ -680,7 +680,7 @@ celix_status_t bundle_getServicesInUse(b
status = fw_getBundleServicesInUse(bundle->framework, bundle, list);
- framework_logIfError(status, NULL, "Failed to get in use services");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to get in use services");
return status;
}
@@ -694,7 +694,7 @@ celix_status_t bundle_getMemoryPool(bund
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to get memory pool");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to get memory pool");
return status;
}
@@ -708,7 +708,7 @@ celix_status_t bundle_setFramework(bundl
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to set framework");
+ framework_logIfError(bundle->framework->logger, status, NULL, "Failed to set framework");
return status;
}
@@ -722,7 +722,7 @@ celix_status_t bundle_getFramework(bundl
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to get framework");
+ framework_logIfError(bundle->framework->logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_archive.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_archive.c Tue Jan 14 09:21:53 2014
@@ -45,6 +45,7 @@ struct bundleArchive {
linked_list_pt revisions;
long refreshCount;
time_t lastModified;
+ framework_logger_pt logger;
bundle_state_e persistentState;
@@ -58,7 +59,7 @@ static celix_status_t bundleArchive_setR
static celix_status_t bundleArchive_initialize(bundle_archive_pt archive);
-static celix_status_t bundleArchive_deleteTree(char * directory, apr_pool_t *mp);
+static celix_status_t bundleArchive_deleteTree(bundle_archive_pt archive, char * directory, apr_pool_t *mp);
static celix_status_t bundleArchive_createRevisionFromLocation(bundle_archive_pt archive, char *location, char *inputFile, long revNr, bundle_revision_pt *bundle_revision);
static celix_status_t bundleArchive_reviseInternal(bundle_archive_pt archive, bool isReload, long revNr, char * location, char *inputFile);
@@ -66,7 +67,7 @@ static celix_status_t bundleArchive_revi
static celix_status_t bundleArchive_readLastModified(bundle_archive_pt archive, time_t *time);
static celix_status_t bundleArchive_writeLastModified(bundle_archive_pt archive);
-celix_status_t bundleArchive_createSystemBundleArchive(apr_pool_t *mp, bundle_archive_pt *bundle_archive) {
+celix_status_t bundleArchive_createSystemBundleArchive(apr_pool_t *mp, framework_logger_pt logger, bundle_archive_pt *bundle_archive) {
celix_status_t status = CELIX_SUCCESS;
char *error = NULL;
bundle_archive_pt archive;
@@ -91,6 +92,7 @@ celix_status_t bundleArchive_createSyste
archive->archiveRootDir = NULL;
archive->refreshCount = -1;
archive->persistentState = OSGI_FRAMEWORK_BUNDLE_UNKNOWN;
+ archive->logger = logger;
time(&archive->lastModified);
*bundle_archive = archive;
@@ -100,12 +102,12 @@ celix_status_t bundleArchive_createSyste
}
}
- framework_logIfError(status, error, "Could not create archive");
+ framework_logIfError(logger, status, error, "Could not create archive");
return status;
}
-celix_status_t bundleArchive_create(char * archiveRoot, long id, char * location, char *inputFile, apr_pool_t *mp, bundle_archive_pt *bundle_archive) {
+celix_status_t bundleArchive_create(framework_logger_pt logger, char * archiveRoot, long id, char * location, char *inputFile, apr_pool_t *mp, bundle_archive_pt *bundle_archive) {
celix_status_t status = CELIX_SUCCESS;
char *error = NULL;
apr_pool_t *revisions_pool;
@@ -128,6 +130,7 @@ celix_status_t bundleArchive_create(char
archive->archiveRootDir = NULL;
archive->archiveRoot = archiveRoot;
archive->refreshCount = -1;
+ archive->logger = logger;
time(&archive->lastModified);
archive->mp = mp;
@@ -143,7 +146,7 @@ celix_status_t bundleArchive_create(char
}
}
- framework_logIfError(status, error, "Could not create archive");
+ framework_logIfError(logger, status, error, "Could not create archive");
return status;
}
@@ -153,7 +156,7 @@ static apr_status_t bundleArchive_destro
bundle_archive_pt archive = archiveP;
archive = NULL;
- framework_logIfError(status, NULL, "Could not create archive");
+ framework_logIfError(archive->logger, status, NULL, "Could not create archive");
return status;
}
@@ -208,7 +211,7 @@ celix_status_t bundleArchive_recreate(ch
}
}
- framework_logIfError(status, NULL, "Could not create archive");
+ framework_logIfError(archive->logger, status, NULL, "Could not create archive");
return status;
}
@@ -246,7 +249,7 @@ celix_status_t bundleArchive_getId(bundl
*id = archive->id;
}
- framework_logIfError(status, NULL, "Could not get archive id");
+ framework_logIfError(archive->logger, status, NULL, "Could not get archive id");
return status;
}
@@ -283,7 +286,7 @@ celix_status_t bundleArchive_getLocation
*location = archive->location;
}
- framework_logIfError(status, NULL, "Could not get archive location");
+ framework_logIfError(archive->logger, status, NULL, "Could not get archive location");
return status;
}
@@ -301,7 +304,7 @@ celix_status_t bundleArchive_getCurrentR
status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
status = CELIX_DO_IF(status, bundleRevision_getNumber(revision, revisionNumber));
- framework_logIfError(status, NULL, "Could not get current revision number");
+ framework_logIfError(archive->logger, status, NULL, "Could not get current revision number");
return status;
}
@@ -358,7 +361,7 @@ celix_status_t bundleArchive_getPersiste
}
}
- framework_logIfError(status, NULL, "Could not get persistent state");
+ framework_logIfError(archive->logger, status, NULL, "Could not get persistent state");
return status;
}
@@ -405,7 +408,7 @@ celix_status_t bundleArchive_setPersiste
apr_pool_destroy(subpool);
}
- framework_logIfError(status, NULL, "Could not set persistent state");
+ framework_logIfError(archive->logger, status, NULL, "Could not set persistent state");
return status;
}
@@ -450,7 +453,7 @@ celix_status_t bundleArchive_getRefreshC
*refreshCount = archive->refreshCount;
}
- framework_logIfError(status, NULL, "Could not get refresh count");
+ framework_logIfError(archive->logger, status, NULL, "Could not get refresh count");
return status;
}
@@ -478,7 +481,7 @@ celix_status_t bundleArchive_setRefreshC
apr_pool_destroy(subpool);
}
- framework_logIfError(status, NULL, "Could not set refresh count");
+ framework_logIfError(archive->logger, status, NULL, "Could not set refresh count");
return status;
}
@@ -494,7 +497,7 @@ celix_status_t bundleArchive_getLastModi
*lastModified = archive->lastModified;
}
- framework_logIfError(status, NULL, "Could not get last modified");
+ framework_logIfError(archive->logger, status, NULL, "Could not get last modified");
return status;
}
@@ -505,7 +508,7 @@ celix_status_t bundleArchive_setLastModi
archive->lastModified = lastModifiedTime;
status = CELIX_DO_IF(status, bundleArchive_writeLastModified(archive));
- framework_logIfError(status, NULL, "Could not set last modified");
+ framework_logIfError(archive->logger, status, NULL, "Could not set last modified");
return status;
}
@@ -550,7 +553,7 @@ static celix_status_t bundleArchive_read
apr_pool_destroy(subpool);
}
- framework_logIfError(status, NULL, "Could not read last modified");
+ framework_logIfError(archive->logger, status, NULL, "Could not read last modified");
return status;
}
@@ -580,7 +583,7 @@ static celix_status_t bundleArchive_writ
apr_file_close(lastModifiedFile);
}
- framework_logIfError(status, NULL, "Could not write last modified");
+ framework_logIfError(archive->logger, status, NULL, "Could not write last modified");
return status;
}
@@ -597,7 +600,7 @@ celix_status_t bundleArchive_revise(bund
status = bundleArchive_reviseInternal(archive, false, revNr, location, inputFile);
}
- framework_logIfError(status, NULL, "Could not revise bundle archive");
+ framework_logIfError(archive->logger, status, NULL, "Could not revise bundle archive");
return status;
}
@@ -620,7 +623,7 @@ static celix_status_t bundleArchive_revi
linkedList_addElement(archive->revisions, revision);
}
- framework_logIfError(status, NULL, "Could not revise bundle archive");
+ framework_logIfError(archive->logger, status, NULL, "Could not revise bundle archive");
return status;
}
@@ -642,7 +645,7 @@ static celix_status_t bundleArchive_crea
sprintf(root, "%s/version%ld.%ld", archive->archiveRoot, refreshCount, revNr);
if (apr_pool_create(&pool, archive->mp) == APR_SUCCESS) {
- status = bundleRevision_create(pool, root, location, revNr, inputFile, &revision);
+ status = bundleRevision_create(pool, archive->logger, root, location, revNr, inputFile, &revision);
if (status != CELIX_SUCCESS) {
apr_pool_destroy(pool);
@@ -656,7 +659,7 @@ static celix_status_t bundleArchive_crea
}
}
- framework_logIfError(status, NULL, "Could not create revision [location=%s,inputFile=%s]", location, inputFile);
+ framework_logIfError(archive->logger, status, NULL, "Could not create revision [location=%s,inputFile=%s]", location, inputFile);
return status;
}
@@ -687,7 +690,7 @@ static celix_status_t bundleArchive_getR
}
- framework_logIfError(status, NULL, "Failed to get revision location");
+ framework_logIfError(archive->logger, status, NULL, "Failed to get revision location");
return status;
}
@@ -712,7 +715,7 @@ static celix_status_t bundleArchive_setR
}
}
- framework_logIfError(status, NULL, "Failed to set revision location");
+ framework_logIfError(archive->logger, status, NULL, "Failed to set revision location");
return status;
}
@@ -728,10 +731,10 @@ celix_status_t bundleArchive_closeAndDel
status = bundleArchive_close(archive);
if (status == CELIX_SUCCESS) {
- status = bundleArchive_deleteTree(archive->archiveRoot, archive->mp);
+ status = bundleArchive_deleteTree(archive, archive->archiveRoot, archive->mp);
}
- framework_logIfError(status, NULL, "Failed to close and delete archive");
+ framework_logIfError(archive->logger, status, NULL, "Failed to close and delete archive");
return status;
}
@@ -788,12 +791,12 @@ static celix_status_t bundleArchive_init
}
}
- framework_logIfError(status, NULL, "Failed to initialize archive");
+ framework_logIfError(archive->logger, status, NULL, "Failed to initialize archive");
return status;
}
-static celix_status_t bundleArchive_deleteTree(char * directory, apr_pool_t *mp) {
+static celix_status_t bundleArchive_deleteTree(bundle_archive_pt archive, char * directory, apr_pool_t *mp) {
apr_dir_t *dir;
celix_status_t status = CELIX_SUCCESS;
apr_status_t stat = apr_dir_open(&dir, directory, mp);
@@ -816,7 +819,7 @@ static celix_status_t bundleArchive_dele
strcat(subdir, dp.name);
if (dp.filetype == APR_DIR) {
- status = bundleArchive_deleteTree(subdir, mp);
+ status = bundleArchive_deleteTree(archive, subdir, mp);
} else {
if (apr_file_remove(subdir, mp) != APR_SUCCESS) {
status = CELIX_FILE_IO_EXCEPTION;
@@ -841,7 +844,7 @@ static celix_status_t bundleArchive_dele
}
}
- framework_logIfError(status, NULL, "Failed to delete tree");
+ framework_logIfError(archive->logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_cache.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_cache.c Tue Jan 14 09:21:53 2014
@@ -38,10 +38,10 @@
#include "constants.h"
#include "celix_log.h"
-static celix_status_t bundleCache_deleteTree(char * directory, apr_pool_t *mp);
+static celix_status_t bundleCache_deleteTree(bundle_cache_pt cache, char * directory, apr_pool_t *mp);
static apr_status_t bundleCache_destroy(void *cacheP);
-celix_status_t bundleCache_create(properties_pt configurationMap, apr_pool_t *mp, bundle_cache_pt *bundle_cache) {
+celix_status_t bundleCache_create(properties_pt configurationMap, apr_pool_t *mp, framework_logger_pt logger, bundle_cache_pt *bundle_cache) {
celix_status_t status;
bundle_cache_pt cache;
@@ -59,6 +59,7 @@ celix_status_t bundleCache_create(proper
}
cache->cacheDir = cacheDir;
cache->mp = mp;
+ cache->logger = logger;
*bundle_cache = cache;
status = CELIX_SUCCESS;
@@ -67,7 +68,7 @@ celix_status_t bundleCache_create(proper
}
}
- framework_logIfError(status, NULL, "Failed to create bundle cache");
+ framework_logIfError(cache->logger, status, NULL, "Failed to create bundle cache");
return status;
}
@@ -78,7 +79,7 @@ apr_status_t bundleCache_destroy(void *c
}
celix_status_t bundleCache_delete(bundle_cache_pt cache) {
- return bundleCache_deleteTree(cache->cacheDir, cache->mp);
+ return bundleCache_deleteTree(cache, cache->cacheDir, cache->mp);
}
celix_status_t bundleCache_getArchives(bundle_cache_pt cache, apr_pool_t *pool, array_list_pt *archives) {
@@ -132,7 +133,7 @@ celix_status_t bundleCache_getArchives(b
status = CELIX_FILE_IO_EXCEPTION;
}
- framework_logIfError(status, NULL, "Failed to get bundle archives");
+ framework_logIfError(cache->logger, status, NULL, "Failed to get bundle archives");
return status;
}
@@ -143,15 +144,15 @@ celix_status_t bundleCache_createArchive
if (cache && location && bundlePool) {
archiveRoot = apr_psprintf(bundlePool, "%s/bundle%ld", cache->cacheDir, id);
- status = bundleArchive_create(archiveRoot, id, location, inputFile, bundlePool, bundle_archive);
+ status = bundleArchive_create(cache->logger, archiveRoot, id, location, inputFile, bundlePool, bundle_archive);
}
- framework_logIfError(status, NULL, "Failed to create archive");
+ framework_logIfError(cache->logger, status, NULL, "Failed to create archive");
return status;
}
-static celix_status_t bundleCache_deleteTree(char * directory, apr_pool_t *mp) {
+static celix_status_t bundleCache_deleteTree(bundle_cache_pt cache, char * directory, apr_pool_t *mp) {
celix_status_t status = CELIX_SUCCESS;
apr_dir_t *dir;
@@ -166,7 +167,7 @@ static celix_status_t bundleCache_delete
strcat(subdir, dp.name);
if (dp.filetype == APR_DIR) {
- bundleCache_deleteTree(subdir, mp);
+ bundleCache_deleteTree(cache, subdir, mp);
} else {
apr_file_remove(subdir, mp);
}
@@ -181,7 +182,7 @@ static celix_status_t bundleCache_delete
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to delete tree");
+ framework_logIfError(cache->logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_context.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_context.c Tue Jan 14 09:21:53 2014
@@ -32,7 +32,7 @@
#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 bundleContext_create(framework_pt framework, framework_logger_pt logger, bundle_pt bundle, bundle_context_pt *bundle_context) {
celix_status_t status = CELIX_SUCCESS;
bundle_context_pt context = NULL;
@@ -54,6 +54,7 @@ celix_status_t bundleContext_create(fram
context->pool = contextPool;
context->framework = framework;
context->bundle = bundle;
+ context->logger = logger;
*bundle_context = context;
}
@@ -62,7 +63,7 @@ celix_status_t bundleContext_create(fram
}
- framework_logIfError(status, NULL, "Failed to create context");
+ framework_logIfError(logger, status, NULL, "Failed to create context");
return status;
}
@@ -78,7 +79,7 @@ celix_status_t bundleContext_destroy(bun
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to destroy context");
+ framework_logIfError(logger, status, NULL, "Failed to destroy context");
return status;
}
@@ -92,7 +93,7 @@ celix_status_t bundleContext_getBundle(b
*bundle = context->bundle;
}
- framework_logIfError(status, NULL, "Failed to get bundle");
+ framework_logIfError(logger, status, NULL, "Failed to get bundle");
return status;
}
@@ -106,7 +107,7 @@ celix_status_t bundleContext_getFramewor
*framework = context->framework;
}
- framework_logIfError(status, NULL, "Failed to get framework");
+ framework_logIfError(logger, status, NULL, "Failed to get framework");
return status;
}
@@ -120,7 +121,7 @@ celix_status_t bundleContext_getMemoryPo
*memory_pool = context->pool;
}
- framework_logIfError(status, NULL, "Failed to get memory pool");
+ framework_logIfError(logger, status, NULL, "Failed to get memory pool");
return status;
}
@@ -143,7 +144,7 @@ celix_status_t bundleContext_installBund
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to install bundle");
+ framework_logIfError(logger, status, NULL, "Failed to install bundle");
return status;
}
@@ -160,7 +161,7 @@ celix_status_t bundleContext_registerSer
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to register service");
+ framework_logIfError(logger, status, NULL, "Failed to register service");
return status;
}
@@ -177,7 +178,7 @@ celix_status_t bundleContext_registerSer
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to register service factory");
+ framework_logIfError(logger, status, NULL, "Failed to register service factory");
return status;
}
@@ -191,7 +192,7 @@ celix_status_t bundleContext_getServiceR
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to get service references");
+ framework_logIfError(logger, status, NULL, "Failed to get service references");
return status;
}
@@ -213,7 +214,7 @@ celix_status_t bundleContext_getServiceR
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to get service reference");
+ framework_logIfError(logger, status, NULL, "Failed to get service reference");
return status;
}
@@ -227,7 +228,7 @@ celix_status_t bundleContext_getService(
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to get service");
+ framework_logIfError(logger, status, NULL, "Failed to get service");
return status;
}
@@ -241,7 +242,7 @@ celix_status_t bundleContext_ungetServic
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to unget service");
+ framework_logIfError(logger, status, NULL, "Failed to unget service");
return status;
}
@@ -255,7 +256,7 @@ celix_status_t bundleContext_getBundles(
*bundles = framework_getBundles(context->framework);
}
- framework_logIfError(status, NULL, "Failed to get bundles");
+ framework_logIfError(logger, status, NULL, "Failed to get bundles");
return status;
}
@@ -269,7 +270,7 @@ celix_status_t bundleContext_getBundleBy
*bundle = framework_getBundleById(context->framework, id);
}
- framework_logIfError(status, NULL, "Failed to get bundle [id=%ld]", id);
+ framework_logIfError(logger, status, NULL, "Failed to get bundle [id=%ld]", id);
return status;
}
@@ -283,7 +284,7 @@ celix_status_t bundleContext_addServiceL
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to add service listener");
+ framework_logIfError(logger, status, NULL, "Failed to add service listener");
return status;
}
@@ -297,7 +298,7 @@ celix_status_t bundleContext_removeServi
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to remove service listener");
+ framework_logIfError(logger, status, NULL, "Failed to remove service listener");
return status;
}
@@ -311,7 +312,7 @@ celix_status_t bundleContext_addBundleLi
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to add bundle listener");
+ framework_logIfError(logger, status, NULL, "Failed to add bundle listener");
return status;
}
@@ -325,7 +326,7 @@ celix_status_t bundleContext_removeBundl
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to remove bundle listener");
+ framework_logIfError(logger, status, NULL, "Failed to remove bundle listener");
return status;
}
@@ -339,7 +340,7 @@ celix_status_t bundleContext_addFramewor
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to add framework listener");
+ framework_logIfError(logger, status, NULL, "Failed to add framework listener");
return status;
}
@@ -353,7 +354,7 @@ celix_status_t bundleContext_removeFrame
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to remove framework listener");
+ framework_logIfError(logger, status, NULL, "Failed to remove framework listener");
return status;
}
@@ -367,7 +368,7 @@ celix_status_t bundleContext_getProperty
fw_getProperty(context->framework, name, value);
}
- framework_logIfError(status, NULL, "Failed to get property [name=%s]", name);
+ framework_logIfError(logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_revision.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_revision.c Tue Jan 14 09:21:53 2014
@@ -35,7 +35,7 @@
static apr_status_t bundleRevision_destroy(void *revisionP);
-celix_status_t bundleRevision_create(apr_pool_t *pool, char *root, char *location, long revisionNr, char *inputFile, bundle_revision_pt *bundle_revision) {
+celix_status_t bundleRevision_create(apr_pool_t *pool, framework_logger_pt logger, char *root, char *location, long revisionNr, char *inputFile, bundle_revision_pt *bundle_revision) {
celix_status_t status = CELIX_SUCCESS;
bundle_revision_pt revision = NULL;
@@ -62,6 +62,7 @@ celix_status_t bundleRevision_create(apr
revision->revisionNr = revisionNr;
revision->root = apr_pstrdup(pool, root);
revision->location = apr_pstrdup(pool, location);
+ revision->logger = logger;
*bundle_revision = revision;
char *manifest = apr_pstrcat(pool, revision->root, "/META-INF/MANIFEST.MF", NULL);
@@ -70,7 +71,7 @@ celix_status_t bundleRevision_create(apr
}
}
- framework_logIfError(status, NULL, "Failed to create revision");
+ framework_logIfError(revision->logger, status, NULL, "Failed to create revision");
return status;
}
@@ -88,7 +89,7 @@ celix_status_t bundleRevision_getNumber(
*revisionNr = revision->revisionNr;
}
- framework_logIfError(status, NULL, "Failed to get revision number");
+ framework_logIfError(logger, status, NULL, "Failed to get revision number");
return status;
}
@@ -101,7 +102,7 @@ celix_status_t bundleRevision_getLocatio
*location = revision->location;
}
- framework_logIfError(status, NULL, "Failed to get revision location");
+ framework_logIfError(logger, status, NULL, "Failed to get revision location");
return status;
}
@@ -114,7 +115,7 @@ celix_status_t bundleRevision_getRoot(bu
*root = revision->root;
}
- framework_logIfError(status, NULL, "Failed to get revision root");
+ framework_logIfError(logger, status, NULL, "Failed to get revision root");
return status;
}
@@ -127,7 +128,7 @@ celix_status_t bundleRevision_getManifes
*manifest = revision->manifest;
}
- framework_logIfError(status, NULL, "Failed to get manifest");
+ framework_logIfError(logger, status, NULL, "Failed to get manifest");
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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/capability.c (original)
+++ incubator/celix/trunk/framework/private/src/capability.c Tue Jan 14 09:21:53 2014
@@ -61,7 +61,7 @@ celix_status_t capability_create(apr_poo
}
}
- framework_logIfError(status, NULL, "Failed to create capability");
+ framework_logIfError(logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/celix_log.c (original)
+++ incubator/celix/trunk/framework/private/src/celix_log.c Tue Jan 14 09:21:53 2014
@@ -28,12 +28,28 @@
#include "celix_errno.h"
#include "celix_log.h"
-void framework_log(framework_log_level_t level, const char *func, const char *file, int line, char *fmsg, ...) {
- char *levelStr = NULL;
+void framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, char *fmsg, ...) {
+ char msg[512];
+ va_list listPointer;
+ va_start(listPointer, fmsg);
+ vsprintf(msg, fmsg, listPointer);
+
+ logger->logFunction(level, func, file, line, msg);
+}
+
+void framework_logCode(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, celix_status_t code, char *fmsg, ...) {
+ char message[256];
+ celix_strerror(code, message, 256);
char msg[512];
va_list listPointer;
va_start(listPointer, fmsg);
vsprintf(msg, fmsg, listPointer);
+
+ framework_log(logger, level, func, file, line, "%s [%d]: %s", message, code, msg);
+}
+
+celix_status_t frameworkLogger_log(framework_log_level_t level, const char *func, const char *file, int line, char *msg) {
+ char *levelStr = NULL;
switch (level) {
case OSGI_FRAMEWORK_LOG_ERROR:
levelStr = "ERROR";
@@ -56,16 +72,5 @@ void framework_log(framework_log_level_t
printf("%s: %s\n", levelStr, msg);
}
+ return CELIX_SUCCESS;
}
-
-void framework_logCode(framework_log_level_t level, const char *func, const char *file, int line, celix_status_t code, char *fmsg, ...) {
- char message[256];
- celix_strerror(code, message, 256);
- char msg[512];
- va_list listPointer;
- va_start(listPointer, fmsg);
- vsprintf(msg, fmsg, listPointer);
-
- 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Tue Jan 14 09:21:53 2014
@@ -158,10 +158,18 @@ struct request {
typedef struct request *request_pt;
+framework_logger_pt logger;
+
celix_status_t framework_create(framework_pt *framework, apr_pool_t *memoryPool, properties_pt config) {
celix_status_t status = CELIX_SUCCESS;
char *error = NULL;
+ logger = hashMap_get(config, "logger");
+ if (logger == NULL) {
+ logger = apr_palloc(memoryPool, sizeof(*logger));
+ logger->logFunction = frameworkLogger_log;
+ }
+
*framework = (framework_pt) apr_palloc(memoryPool, sizeof(**framework));
if (*framework != NULL) {
apr_status_t apr_status = APR_SUCCESS;
@@ -190,26 +198,28 @@ celix_status_t framework_create(framewor
(*framework)->requests = NULL;
(*framework)->shutdownGate = NULL;
(*framework)->configurationMap = config;
+ (*framework)->logger = logger;
+
apr_pool_t *pool = NULL;
apr_pool_create(&pool, (*framework)->mp);
- status = CELIX_DO_IF(status, bundle_create(&(*framework)->bundle, pool));
+ status = CELIX_DO_IF(status, bundle_create(&(*framework)->bundle, (*framework)->logger, pool));
status = CELIX_DO_IF(status, arrayList_create(&(*framework)->globalLockWaitersList));
status = CELIX_DO_IF(status, bundle_setFramework((*framework)->bundle, (*framework)));
if (status == CELIX_SUCCESS) {
//
} else {
status = CELIX_FRAMEWORK_EXCEPTION;
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Could not create framework");
+ fw_logCode((*framework)->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not create framework");
}
} else {
status = CELIX_FRAMEWORK_EXCEPTION;
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Could not create framework");
+ fw_logCode((*framework)->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not create framework");
}
} else {
error = "FW exception";
status = CELIX_FRAMEWORK_EXCEPTION;
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, CELIX_ENOMEM, "Could not create framework");
+ fw_logCode((*framework)->logger, OSGI_FRAMEWORK_LOG_ERROR, CELIX_ENOMEM, "Could not create framework");
}
return status;
@@ -308,7 +318,7 @@ celix_status_t fw_init(framework_pt fram
if (status == CELIX_SUCCESS) {
if ((state == OSGI_FRAMEWORK_BUNDLE_INSTALLED) || (state == OSGI_FRAMEWORK_BUNDLE_RESOLVED)) {
bundle_state_e state;
- status = CELIX_DO_IF(status, bundleCache_create(framework->configurationMap, framework->mp, &framework->cache));
+ status = CELIX_DO_IF(status, bundleCache_create(framework->configurationMap, framework->mp, framework->logger, &framework->cache));
status = CELIX_DO_IF(status, bundle_getState(framework->bundle, &state));
if (status == CELIX_SUCCESS) {
if (state == OSGI_FRAMEWORK_BUNDLE_INSTALLED) {
@@ -344,7 +354,7 @@ celix_status_t fw_init(framework_pt fram
hashMap_destroy(wires, false, false);
} else {
status = CELIX_BUNDLE_EXCEPTION;
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Unresolved constraints in System Bundle");
+ fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Unresolved constraints in System Bundle");
}
}
@@ -381,12 +391,12 @@ celix_status_t fw_init(framework_pt fram
bundle_setHandle(framework->bundle, handle);
} else {
status = CELIX_FRAMEWORK_EXCEPTION;
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Could not get handle to framework library");
+ fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not get handle to framework library");
}
}
bundle_context_pt context = NULL;
- status = CELIX_DO_IF(status, bundleContext_create(framework, framework->bundle, &context));
+ status = CELIX_DO_IF(status, bundleContext_create(framework, framework->logger, framework->bundle, &context));
status = CELIX_DO_IF(status, bundle_setContext(framework->bundle, context));
if (status == CELIX_SUCCESS) {
activator_pt activator = NULL;
@@ -422,7 +432,7 @@ celix_status_t fw_init(framework_pt fram
}
if (status != CELIX_SUCCESS) {
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Could not init framework");
+ fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not init framework");
}
framework_releaseBundleLock(framework, framework->bundle);
@@ -456,7 +466,7 @@ celix_status_t framework_start(framework
if (status != CELIX_SUCCESS) {
status = CELIX_BUNDLE_EXCEPTION;
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Could not start framework");
+ fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not start framework");
fw_fireFrameworkEvent(framework, OSGI_FRAMEWORK_EVENT_ERROR, framework->bundle, status);
}
@@ -472,7 +482,7 @@ celix_status_t fw_getProperty(framework_
if (framework == NULL || name == NULL || *value != NULL) {
status = CELIX_ILLEGAL_ARGUMENT;
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Missing required arguments");
+ fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Missing required arguments");
} else {
if (framework->configurationMap != NULL) {
*value = properties_get(framework->configurationMap, (char *) name);
@@ -500,7 +510,7 @@ celix_status_t fw_installBundle2(framewo
status = CELIX_DO_IF(status, bundle_getState(framework->bundle, &state));
if (status == CELIX_SUCCESS) {
if (state == OSGI_FRAMEWORK_BUNDLE_STOPPING || state == OSGI_FRAMEWORK_BUNDLE_UNINSTALLED) {
- fw_log(OSGI_FRAMEWORK_LOG_INFO, "The framework is being shutdown");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_INFO, "The framework is being shutdown");
status = CELIX_DO_IF(status, framework_releaseInstallLock(framework, location));
status = CELIX_FRAMEWORK_SHUTDOWN;
}
@@ -543,7 +553,7 @@ celix_status_t fw_installBundle2(framewo
status = CELIX_DO_IF(status, framework_releaseInstallLock(framework, location));
if (status != CELIX_SUCCESS) {
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Could not install bundle");
+ fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not install bundle");
} else {
status = CELIX_DO_IF(status, fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_INSTALLED, *bundle));
}
@@ -650,7 +660,7 @@ celix_status_t fw_startBundle(framework_
}
/* no break */
case OSGI_FRAMEWORK_BUNDLE_RESOLVED:
- status = CELIX_DO_IF(status, bundleContext_create(framework, bundle, &context));
+ status = CELIX_DO_IF(status, bundleContext_create(framework, framework->logger, bundle, &context));
status = CELIX_DO_IF(status, bundle_setContext(bundle, context));
status = CELIX_DO_IF(status, bundle_getArchive(bundle, &archive));
@@ -738,9 +748,9 @@ celix_status_t fw_startBundle(framework_
module_getSymbolicName(module, &symbolicName);
bundle_getBundleId(bundle, &id);
if (error != NULL) {
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Could not start bundle: %s [%ld]; cause: %s", symbolicName, id, error);
+ fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not start bundle: %s [%ld]; cause: %s", symbolicName, id, error);
} else {
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Could not start bundle: %s [%ld]", symbolicName, id);
+ fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not start bundle: %s [%ld]", symbolicName, id);
}
}
@@ -799,9 +809,9 @@ celix_status_t framework_updateBundle(fr
module_getSymbolicName(module, &symbolicName);
bundle_getBundleId(bundle, &id);
if (error != NULL) {
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Cannot update bundle: %s [%ld]; cause: %s", symbolicName, id, error);
+ fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Cannot update bundle: %s [%ld]; cause: %s", symbolicName, id, error);
} else {
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Cannot update bundle: %s [%ld]", symbolicName, id);
+ fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Cannot update bundle: %s [%ld]", symbolicName, id);
}
}
@@ -914,9 +924,9 @@ celix_status_t fw_stopBundle(framework_p
module_getSymbolicName(module, &symbolicName);
bundle_getBundleId(bundle, &id);
if (error != NULL) {
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Cannot stop bundle: %s [%ld]; cause: %s", symbolicName, id, error);
+ fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Cannot stop bundle: %s [%ld]; cause: %s", symbolicName, id, error);
} else {
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Cannot stop bundle: %s [%ld]", symbolicName, id);
+ fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Cannot stop bundle: %s [%ld]", symbolicName, id);
}
} else {
fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_STOPPED, bundle);
@@ -960,7 +970,7 @@ celix_status_t fw_uninstallBundle(framew
if (status == CELIX_SUCCESS) {
if (target == NULL) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Could not remove bundle from installed map");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Could not remove bundle from installed map");
}
}
@@ -999,7 +1009,7 @@ celix_status_t fw_uninstallBundle(framew
// module_getSymbolicName(module, &symbolicName);
// bundle_getBundleId(bundle, &id);
- framework_logIfError(status, error, "Cannot uninstall bundle");
+ framework_logIfError(framework->logger, status, error, "Cannot uninstall bundle");
}
return status;
@@ -1069,7 +1079,7 @@ celix_status_t fw_refreshBundles(framewo
framework_releaseGlobalLock(framework);
}
- framework_logIfError(status, NULL, "Cannot refresh bundles");
+ framework_logIfError(framework->logger, status, NULL, "Cannot refresh bundles");
return status;
}
@@ -1096,7 +1106,7 @@ celix_status_t fw_refreshBundle(framewor
framework_releaseBundleLock(framework, bundle);
}
- framework_logIfError(status, NULL, "Cannot refresh bundle");
+ framework_logIfError(framework->logger, status, NULL, "Cannot refresh bundle");
return status;
}
@@ -1154,7 +1164,7 @@ celix_status_t fw_getDependentBundles(fr
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Cannot get dependent bundles");
+ framework_logIfError(framework->logger, status, NULL, "Cannot get dependent bundles");
return status;
}
@@ -1178,7 +1188,7 @@ celix_status_t fw_populateDependentGraph
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Cannot populate dependent graph");
+ framework_logIfError(framework->logger, status, NULL, "Cannot populate dependent graph");
return status;
}
@@ -1241,7 +1251,7 @@ celix_status_t fw_registerService(framew
arrayList_add(infos, info);
}
if (subs != CELIX_SUCCESS) {
- fw_logCode(OSGI_FRAMEWORK_LOG_ERROR, status, "Could not pass all listeners to the hook: %s", serviceName);
+ fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not pass all listeners to the hook: %s", serviceName);
}
}
@@ -1261,7 +1271,7 @@ celix_status_t fw_registerService(framew
}
}
- framework_logIfError(status, error, "Cannot register service: %s", serviceName);
+ framework_logIfError(framework->logger, status, error, "Cannot register service: %s", serviceName);
return status;
}
@@ -1281,7 +1291,7 @@ celix_status_t fw_registerServiceFactory
error = "Could not release bundle lock";
}
- framework_logIfError(status, error, "Cannot register service factory: %s", serviceName);
+ framework_logIfError(framework->logger, status, error, "Cannot register service factory: %s", serviceName);
return CELIX_SUCCESS;
}
@@ -1324,7 +1334,7 @@ celix_status_t fw_getServiceReferences(f
}
}
- framework_logIfError(status, NULL, "Failed to get service references");
+ framework_logIfError(framework->logger, status, NULL, "Failed to get service references");
return status;
}
@@ -1481,7 +1491,7 @@ celix_status_t fw_addBundleListener(fram
arrayList_add(framework->bundleListeners, bundleListener);
}
- framework_logIfError(status, NULL, "Failed to add bundle listener");
+ framework_logIfError(framework->logger, status, NULL, "Failed to add bundle listener");
return status;
}
@@ -1499,7 +1509,7 @@ celix_status_t fw_removeBundleListener(f
}
}
- framework_logIfError(status, NULL, "Failed to remove bundle listener");
+ framework_logIfError(framework->logger, status, NULL, "Failed to remove bundle listener");
return status;
}
@@ -1521,7 +1531,7 @@ celix_status_t fw_addFrameworkListener(f
arrayList_add(framework->frameworkListeners, frameworkListener);
}
- framework_logIfError(status, NULL, "Failed to add framework listener");
+ framework_logIfError(framework->logger, status, NULL, "Failed to add framework listener");
return status;
}
@@ -1539,7 +1549,7 @@ celix_status_t fw_removeFrameworkListene
}
}
- framework_logIfError(status, NULL, "Failed to remove framework listener");
+ framework_logIfError(framework->logger, status, NULL, "Failed to remove framework listener");
return status;
}
@@ -1720,20 +1730,20 @@ celix_status_t framework_setBundleStateA
int err = apr_thread_mutex_lock(framework->bundleLock);
if (err != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Failed to lock");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Failed to lock");
return CELIX_BUNDLE_EXCEPTION;
}
bundle_setState(bundle, state);
err = apr_thread_cond_broadcast(framework->condition);
if (err != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Failed to broadcast");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Failed to broadcast");
ret = CELIX_BUNDLE_EXCEPTION;
}
err = apr_thread_mutex_unlock(framework->bundleLock);
if (err != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Failed to unlock");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Failed to unlock");
return CELIX_BUNDLE_EXCEPTION;
}
return CELIX_SUCCESS;
@@ -1747,7 +1757,7 @@ celix_status_t framework_acquireBundleLo
int err = apr_thread_mutex_lock(framework->bundleLock);
if (err != APR_SUCCESS) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Failed to lock");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Failed to lock");
status = CELIX_BUNDLE_EXCEPTION;
} else {
bool lockable = false;
@@ -1798,7 +1808,7 @@ celix_status_t framework_acquireBundleLo
apr_thread_mutex_unlock(framework->bundleLock);
}
- framework_logIfError(status, NULL, "Failed to get bundle lock");
+ framework_logIfError(framework->logger, status, NULL, "Failed to get bundle lock");
return status;
}
@@ -1861,7 +1871,7 @@ bool framework_acquireGlobalLock(framewo
celix_status_t framework_releaseGlobalLock(framework_pt framework) {
int status = CELIX_SUCCESS;
if (apr_thread_mutex_lock(framework->bundleLock) != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Error locking framework bundle lock");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Error locking framework bundle lock");
return CELIX_FRAMEWORK_EXCEPTION;
}
@@ -1870,7 +1880,7 @@ celix_status_t framework_releaseGlobalLo
if (framework->globalLockCount == 0) {
framework->globalLockThread = 0;
if (apr_thread_cond_broadcast(framework->condition) != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Failed to broadcast global lock release.");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Failed to broadcast global lock release.");
status = CELIX_FRAMEWORK_EXCEPTION;
// still need to unlock before returning
}
@@ -1880,32 +1890,32 @@ celix_status_t framework_releaseGlobalLo
}
if (apr_thread_mutex_unlock(framework->bundleLock) != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Error unlocking framework bundle lock");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Error unlocking framework bundle lock");
return CELIX_FRAMEWORK_EXCEPTION;
}
- framework_logIfError(status, NULL, "Failed to release global lock");
+ framework_logIfError(framework->logger, status, NULL, "Failed to release global lock");
return status;
}
celix_status_t framework_waitForStop(framework_pt framework) {
if (apr_thread_mutex_lock(framework->mutex) != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Error locking the framework, shutdown gate not set.");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Error locking the framework, shutdown gate not set.");
return CELIX_FRAMEWORK_EXCEPTION;
}
while (!framework->shutdown) {
apr_status_t apr_status = apr_thread_cond_wait(framework->shutdownGate, framework->mutex);
if (apr_status != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Error waiting for shutdown gate.");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Error waiting for shutdown gate.");
return CELIX_FRAMEWORK_EXCEPTION;
}
}
if (apr_thread_mutex_unlock(framework->mutex) != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Error unlocking the framework.");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Error unlocking the framework.");
return CELIX_FRAMEWORK_EXCEPTION;
}
- fw_log(OSGI_FRAMEWORK_LOG_INFO, "FRAMEWORK: Successful shutdown");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_INFO, "FRAMEWORK: Successful shutdown");
return CELIX_SUCCESS;
}
@@ -1915,7 +1925,7 @@ static void *APR_THREAD_FUNC framework_s
hash_map_iterator_pt iterator;
int err;
- fw_log(OSGI_FRAMEWORK_LOG_INFO, "FRAMEWORK: Shutdown");
+ fw_log(fw->logger, OSGI_FRAMEWORK_LOG_INFO, "FRAMEWORK: Shutdown");
iterator = hashMapIterator_create(fw->installedBundleMap);
while (hashMapIterator_hasNext(iterator)) {
@@ -1935,17 +1945,17 @@ static void *APR_THREAD_FUNC framework_s
err = apr_thread_mutex_lock(fw->mutex);
if (err != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Error locking the framework, cannot exit clean.");
+ fw_log(fw->logger, OSGI_FRAMEWORK_LOG_ERROR, "Error locking the framework, cannot exit clean.");
apr_thread_exit(thd, APR_ENOLOCK);
return NULL;
}
fw->shutdown = true;
err = apr_thread_cond_broadcast(fw->shutdownGate);
if (err != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Error waking the shutdown gate, cannot exit clean.");
+ fw_log(fw->logger, OSGI_FRAMEWORK_LOG_ERROR, "Error waking the shutdown gate, cannot exit clean.");
err = apr_thread_mutex_unlock(fw->mutex);
if (err != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Error unlocking the framework, cannot exit clean.");
+ fw_log(fw->logger, OSGI_FRAMEWORK_LOG_ERROR, "Error unlocking the framework, cannot exit clean.");
}
apr_thread_exit(thd, APR_ENOLOCK);
@@ -1953,10 +1963,10 @@ static void *APR_THREAD_FUNC framework_s
}
err = apr_thread_mutex_unlock(fw->mutex);
if (err != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Error unlocking the framework, cannot exit clean.");
+ fw_log(fw->logger, OSGI_FRAMEWORK_LOG_ERROR, "Error unlocking the framework, cannot exit clean.");
}
- fw_log(OSGI_FRAMEWORK_LOG_INFO, "FRAMEWORK: Shutdown done\n");
+ fw_log(fw->logger, OSGI_FRAMEWORK_LOG_INFO, "FRAMEWORK: Shutdown done\n");
apr_thread_exit(thd, APR_SUCCESS);
return NULL;
@@ -1971,7 +1981,7 @@ celix_status_t framework_getFrameworkBun
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Failed to get framework bundle");
+ framework_logIfError(framework->logger, status, NULL, "Failed to get framework bundle");
return status;
}
@@ -2008,7 +2018,7 @@ celix_status_t fw_fireBundleEvent(framew
}
}
- framework_logIfError(status, NULL, "Failed to fire bundle event");
+ framework_logIfError(framework->logger, status, NULL, "Failed to fire bundle event");
return status;
}
@@ -2047,7 +2057,7 @@ celix_status_t fw_fireFrameworkEvent(fra
}
}
- framework_logIfError(status, NULL, "Failed to fire framework event");
+ framework_logIfError(framework->logger, status, NULL, "Failed to fire framework event");
return status;
}
@@ -2061,7 +2071,7 @@ static void *APR_THREAD_FUNC fw_eventDis
apr_status_t status;
if (apr_thread_mutex_lock(framework->dispatcherLock) != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Error locking the dispatcher");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Error locking the dispatcher");
return NULL;
}
@@ -2080,7 +2090,7 @@ static void *APR_THREAD_FUNC fw_eventDis
request = (request_pt) arrayList_remove(framework->requests, 0);
if ((status = apr_thread_mutex_unlock(framework->dispatcherLock)) != 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Error unlocking the dispatcher.");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Error unlocking the dispatcher.");
apr_thread_exit(thd, status);
return NULL;
}
@@ -2151,19 +2161,19 @@ celix_status_t bundleActivator_stop(void
if (bundleContext_getFramework(context, &framework) == CELIX_SUCCESS) {
- fw_log(OSGI_FRAMEWORK_LOG_INFO, "FRAMEWORK: Start shutdownthread");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_INFO, "FRAMEWORK: Start shutdownthread");
if (apr_thread_create(&shutdownThread, NULL, framework_shutdown, framework, framework->mp) == APR_SUCCESS) {
// apr_thread_join(&status, shutdownThread);
apr_thread_detach(shutdownThread);
} else {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Could not create shutdown thread, normal exit not possible.");
+ fw_log(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, "Could not create shutdown thread, normal exit not possible.");
status = CELIX_FRAMEWORK_EXCEPTION;
}
} else {
status = CELIX_FRAMEWORK_EXCEPTION;
}
- framework_logIfError(status, NULL, "Failed to stop framework activator");
+ framework_logIfError(framework->logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/manifest.c (original)
+++ incubator/celix/trunk/framework/private/src/manifest.c Tue Jan 14 09:21:53 2014
@@ -49,7 +49,7 @@ celix_status_t manifest_create(apr_pool_
(*manifest)->attributes = hashMap_create(utils_stringHash, NULL, utils_stringEquals, NULL);
}
- framework_logIfError(status, NULL, "Cannot create manifest");
+ framework_logIfError(logger, status, NULL, "Cannot create manifest");
return status;
}
@@ -74,7 +74,7 @@ celix_status_t manifest_createFromFile(a
manifest_read(*manifest, filename);
}
- framework_logIfError(status, NULL, "Cannot create manifest from file");
+ framework_logIfError(logger, status, NULL, "Cannot create manifest from file");
return status;
}
@@ -183,7 +183,7 @@ celix_status_t manifest_read(manifest_pt
status = CELIX_FILE_IO_EXCEPTION;
}
- framework_logIfError(status, NULL, "Cannot read manifest");
+ framework_logIfError(logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/manifest_parser.c (original)
+++ incubator/celix/trunk/framework/private/src/manifest_parser.c Tue Jan 14 09:21:53 2014
@@ -89,7 +89,7 @@ celix_status_t manifestParser_create(mod
status = CELIX_ENOMEM;
}
- framework_logIfError(status, NULL, "Cannot create manifest parser");
+ framework_logIfError(logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/requirement.c (original)
+++ incubator/celix/trunk/framework/private/src/requirement.c Tue Jan 14 09:21:53 2014
@@ -64,7 +64,7 @@ celix_status_t requirement_create(apr_po
}
}
- framework_logIfError(status, NULL, "Cannot create requirement");
+ framework_logIfError(logger, status, NULL, "Cannot create requirement");
return status;
}
@@ -110,7 +110,7 @@ celix_status_t requirement_isSatisfied(r
}
}
- framework_logIfError(status, NULL, "Cannot check if requirement is satisfied");
+ framework_logIfError(logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_reference.c (original)
+++ incubator/celix/trunk/framework/private/src/service_reference.c Tue Jan 14 09:21:53 2014
@@ -49,7 +49,7 @@ celix_status_t serviceReference_create(a
(*reference)->registration = registration;
}
- framework_logIfError(status, NULL, "Cannot create service reference");
+ framework_logIfError(logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registration.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registration.c Tue Jan 14 09:21:53 2014
@@ -138,7 +138,7 @@ celix_status_t serviceRegistration_unreg
serviceRegistry_unregisterService(registration->registry, registration->bundle, registration);
}
- framework_logIfError(status, NULL, "Cannot unregister service registration");
+ framework_logIfError(logger, status, NULL, "Cannot unregister service registration");
return status;
}
@@ -162,7 +162,7 @@ celix_status_t serviceRegistration_getPr
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Cannot get registration properties");
+ framework_logIfError(logger, status, NULL, "Cannot get registration properties");
return status;
}
@@ -186,7 +186,7 @@ celix_status_t serviceRegistration_getRe
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Cannot get registry");
+ framework_logIfError(logger, status, NULL, "Cannot get registry");
return status;
}
@@ -200,7 +200,7 @@ celix_status_t serviceRegistration_getSe
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Cannot get service reference");
+ framework_logIfError(logger, status, NULL, "Cannot get service reference");
return status;
}
@@ -214,7 +214,7 @@ celix_status_t serviceRegistration_getBu
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Cannot get bundle");
+ framework_logIfError(logger, status, NULL, "Cannot get bundle");
return status;
}
@@ -228,7 +228,7 @@ celix_status_t serviceRegistration_getSe
status = CELIX_ILLEGAL_ARGUMENT;
}
- framework_logIfError(status, NULL, "Cannot get service name");
+ framework_logIfError(logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registry.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registry.c Tue Jan 14 09:21:53 2014
@@ -72,7 +72,7 @@ celix_status_t serviceRegistry_create(ap
}
}
- framework_logIfError(status, NULL, "Cannot create service registry");
+ framework_logIfError(logger, status, NULL, "Cannot create service registry");
return status;
}
@@ -181,7 +181,7 @@ celix_status_t serviceRegistry_getRegist
}
}
- framework_logIfError(status, NULL, "Cannot get registered services");
+ framework_logIfError(logger, status, NULL, "Cannot get registered services");
return status;
}
@@ -330,7 +330,7 @@ celix_status_t serviceRegistry_createSer
serviceRegistration_getServiceReferences(registration, &references);
arrayList_add(references, *reference);
- framework_logIfError(status, NULL, "Cannot create service reference");
+ framework_logIfError(logger, status, NULL, "Cannot create service reference");
return status;
}
@@ -383,7 +383,7 @@ celix_status_t serviceRegistry_getServic
hashMapIterator_destroy(iterator);
hashMapValues_destroy(registrations);
- framework_logIfError(status, NULL, "Cannot get service references");
+ framework_logIfError(logger, status, NULL, "Cannot get service references");
return status;
}
@@ -573,7 +573,7 @@ celix_status_t serviceRegistry_getListen
}
}
- framework_logIfError(status, NULL, "Cannot get listener hooks");
+ framework_logIfError(logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_tracker.c (original)
+++ incubator/celix/trunk/framework/private/src/service_tracker.c Tue Jan 14 09:21:53 2014
@@ -57,7 +57,7 @@ celix_status_t serviceTracker_create(apr
}
}
- framework_logIfError(status, NULL, "Cannot create service tracker");
+ framework_logIfError(logger, status, NULL, "Cannot create service tracker");
return status;
}
@@ -82,7 +82,7 @@ celix_status_t serviceTracker_createWith
(*tracker)->listener = NULL;
}
- framework_logIfError(status, NULL, "Cannot create service tracker [filter=%s]", filter);
+ framework_logIfError(logger, status, NULL, "Cannot create service tracker [filter=%s]", filter);
return status;
}
@@ -126,7 +126,7 @@ celix_status_t serviceTracker_open(servi
}
}
- framework_logIfError(status, NULL, "Cannot open tracker");
+ framework_logIfError(logger, status, NULL, "Cannot open tracker");
return status;
}
@@ -147,7 +147,7 @@ celix_status_t serviceTracker_close(serv
arrayList_destroy(refs);
}
- framework_logIfError(status, NULL, "Cannot close tracker");
+ framework_logIfError(logger, status, NULL, "Cannot close tracker");
return status;
}
@@ -280,7 +280,7 @@ static celix_status_t serviceTracker_tra
}
}
- framework_logIfError(status, NULL, "Cannot track reference");
+ framework_logIfError(logger, status, NULL, "Cannot track reference");
return status;
}
@@ -307,7 +307,7 @@ static celix_status_t serviceTracker_ad
status = bundleContext_getService(tracker->context, reference, service);
}
- framework_logIfError(status, NULL, "Cannot handle addingService");
+ framework_logIfError(logger, status, NULL, "Cannot handle addingService");
return status;
}
@@ -346,7 +346,7 @@ static celix_status_t serviceTracker_unt
}
}
- framework_logIfError(status, NULL, "Cannot untrack reference");
+ framework_logIfError(logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_tracker_customizer.c (original)
+++ incubator/celix/trunk/framework/private/src/service_tracker_customizer.c Tue Jan 14 09:21:53 2014
@@ -53,7 +53,7 @@ celix_status_t serviceTrackerCustomizer_
}
}
- framework_logIfError(status, NULL, "Cannot create customizer");
+ framework_logIfError(logger, status, NULL, "Cannot create customizer");
return status;
}
Modified: incubator/celix/trunk/framework/private/src/version.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/version.c?rev=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/version.c (original)
+++ incubator/celix/trunk/framework/private/src/version.c Tue Jan 14 09:21:53 2014
@@ -56,15 +56,15 @@ celix_status_t version_createVersion(apr
(*version)->qualifier = apr_pstrdup(pool, qualifier);
if (major < 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Negative major");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Negative major");
status = CELIX_ILLEGAL_ARGUMENT;
}
if (minor < 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Negative minor");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Negative minor");
status = CELIX_ILLEGAL_ARGUMENT;
}
if (micro < 0) {
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Negative micro");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Negative micro");
status = CELIX_ILLEGAL_ARGUMENT;
}
@@ -82,14 +82,14 @@ celix_status_t version_createVersion(apr
if ((ch == '_') || (ch == '-')) {
continue;
}
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Invalid qualifier");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Invalid qualifier");
status = CELIX_ILLEGAL_ARGUMENT;
break;
}
}
}
- framework_logIfError(status, NULL, "Cannot create version");
+ framework_logIfError(logger, status, NULL, "Cannot create version");
return status;
}
@@ -128,7 +128,7 @@ celix_status_t version_createVersionFrom
if (('0' <= ch) && (ch <= '9')) {
continue;
}
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Invalid format");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Invalid format");
status = CELIX_ILLEGAL_ARGUMENT;
break;
}
@@ -140,7 +140,7 @@ celix_status_t version_createVersionFrom
if (('0' <= ch) && (ch <= '9')) {
continue;
}
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Invalid format");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Invalid format");
status = CELIX_ILLEGAL_ARGUMENT;
break;
}
@@ -152,7 +152,7 @@ celix_status_t version_createVersionFrom
if (('0' <= ch) && (ch <= '9')) {
continue;
}
- fw_log(OSGI_FRAMEWORK_LOG_ERROR, "Invalid format");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Invalid format");
status = CELIX_ILLEGAL_ARGUMENT;
break;
}
@@ -174,7 +174,7 @@ celix_status_t version_createVersionFrom
status = version_createVersion(pool, major, minor, micro, qualifier, version);
}
- framework_logIfError(status, NULL, "Cannot create version [versionString=%s]", versionStr);
+ framework_logIfError(logger, status, NULL, "Cannot create version [versionString=%s]", versionStr);
return status;
}
@@ -230,7 +230,7 @@ celix_status_t version_compareTo(version
}
}
- framework_logIfError(status, NULL, "Cannot compare versions");
+ framework_logIfError(logger, 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=1557991&r1=1557990&r2=1557991&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/version_range.c (original)
+++ incubator/celix/trunk/framework/private/src/version_range.c Tue Jan 14 09:21:53 2014
@@ -47,7 +47,7 @@ celix_status_t versionRange_createVersio
(*range)->isHighInclusive = isHighInclusive;
}
- framework_logIfError(status, NULL, "Cannot create version range");
+ framework_logIfError(logger, status, NULL, "Cannot create version range");
return status;
}
@@ -70,7 +70,7 @@ celix_status_t versionRange_createInfini
status = versionRange_createVersionRange(pool, version, true, NULL, true, range);
}
- framework_logIfError(status, NULL, "Cannot create infinite range");
+ framework_logIfError(logger, status, NULL, "Cannot create infinite range");
return status;
}
@@ -121,7 +121,7 @@ celix_status_t versionRange_isInRange(ve
}
}
- framework_logIfError(status, NULL, "Cannot check if version in in range");
+ framework_logIfError(logger, status, NULL, "Cannot check if version in in range");
return status;
}
@@ -180,7 +180,7 @@ celix_status_t versionRange_parse(apr_po
}
}
- framework_logIfError(status, NULL, "Cannot parse version range");
+ framework_logIfError(logger, status, NULL, "Cannot parse version range");
return status;
}