You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by bp...@apache.org on 2014/09/01 07:46:08 UTC
svn commit: r1621677 [1/2] - in /celix/trunk: deployment_admin/private/src/
device_access/device_access/private/src/
event_admin/event_admin/private/src/ event_admin/event_handler/private/src/
event_admin/event_publisher/private/src/ framework/private/...
Author: bpetri
Date: Mon Sep 1 05:46:07 2014
New Revision: 1621677
URL: http://svn.apache.org/r1621677
Log:
CELIX-146
+ replaced printf's w/ fw_log calls
+ added JSON_DECODE_ANY define to allow use of jansson 2.2.1
Modified:
celix/trunk/deployment_admin/private/src/deployment_admin.c
celix/trunk/deployment_admin/private/src/log_sync.c
celix/trunk/device_access/device_access/private/src/activator.c
celix/trunk/device_access/device_access/private/src/device_manager.c
celix/trunk/device_access/device_access/private/src/driver_matcher.c
celix/trunk/event_admin/event_admin/private/src/event_admin_activator.c
celix/trunk/event_admin/event_admin/private/src/event_admin_impl.c
celix/trunk/event_admin/event_admin/private/src/event_impl.c
celix/trunk/event_admin/event_handler/private/src/event_handler_impl.c
celix/trunk/event_admin/event_publisher/private/src/event_publisher_impl.c
celix/trunk/framework/private/src/filter.c
celix/trunk/remote_services/calculator_proxy/private/src/calculator_proxy_impl.c
celix/trunk/remote_services/discovery_bonjour/private/src/discovery.c
celix/trunk/remote_services/discovery_configured/private/src/discovery.c
celix/trunk/remote_services/discovery_configured/private/src/discovery_activator.c
celix/trunk/remote_services/discovery_configured/private/src/endpoint_descriptor_reader.c
celix/trunk/remote_services/discovery_configured/private/src/endpoint_discovery_poller.c
celix/trunk/remote_services/discovery_configured/private/src/endpoint_discovery_server.c
celix/trunk/remote_services/discovery_shm/private/src/discovery.c
celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c
celix/trunk/remote_services/discovery_slp/private/src/discovery.c
celix/trunk/remote_services/remote_service_admin/private/src/endpoint_description.c
celix/trunk/remote_services/remote_service_admin_http/private/src/import_registration_impl.c
celix/trunk/remote_services/remote_service_admin_shm/private/src/import_registration_impl.c
celix/trunk/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c
celix/trunk/remote_services/topology_manager/private/src/activator.c
celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
celix/trunk/remote_shell/private/src/connection_listener.c
celix/trunk/remote_shell/private/src/remote_shell.c
celix/trunk/shell/private/src/inspect_command.c
Modified: celix/trunk/deployment_admin/private/src/deployment_admin.c
URL: http://svn.apache.org/viewvc/celix/trunk/deployment_admin/private/src/deployment_admin.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/deployment_admin/private/src/deployment_admin.c (original)
+++ celix/trunk/deployment_admin/private/src/deployment_admin.c Mon Sep 1 05:46:07 2014
@@ -99,13 +99,13 @@ celix_status_t deploymentAdmin_create(ap
(*admin)->aditlogSeqNr = 0;
if ((*admin)->targetIdentification == NULL ) {
- printf("Target name must be set using \"deployment_admin_identification\"\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Target name must be set using \"deployment_admin_identification\"");
status = CELIX_ILLEGAL_ARGUMENT;
} else {
char *url = NULL;
bundleContext_getProperty(context, DISCOVERY_URL, &url);
if (url == NULL) {
- printf("URL must be set using \"deployment_admin_url\"\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "URL must be set using \"deployment_admin_url\"\n");
status = CELIX_ILLEGAL_ARGUMENT;
} else {
(*admin)->pollUrl = apr_pstrcat(subpool, url, "/deployment/", (*admin)->targetIdentification, VERSIONS, NULL);
@@ -139,7 +139,8 @@ static celix_status_t deploymentAdmin_up
if (!curl) {
status = CELIX_BUNDLE_EXCEPTION;
- printf("Error initializing curl\n");
+
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error initializing curl.");
}
char url[strlen(admin->auditlogUrl)+6];
@@ -148,7 +149,7 @@ static celix_status_t deploymentAdmin_up
int entrySize = snprintf(entry, 512, "%s,%i,%i,0,%i\n", admin->targetIdentification, admin->auditlogId, admin->aditlogSeqNr++, auditEvent);
if (entrySize >= 512) {
status = CELIX_BUNDLE_EXCEPTION;
- printf("Error, entry buffer is too small\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error, entry buffer is too small");
}
if (status == CELIX_SUCCESS) {
@@ -158,7 +159,7 @@ static celix_status_t deploymentAdmin_up
if (res != CURLE_OK ) {
status = CELIX_BUNDLE_EXCEPTION;
- printf("Error sending auditlog, got curl error code %i\n", res);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error sending auditlog, got curl error code %d", res);
}
}
@@ -224,7 +225,7 @@ static void * APR_THREAD_FUNC deployment
deploymentAdmin_deleteTree(repoCache, admin->pool);
apr_status_t stat = apr_file_rename(tmpDir, repoCache, admin->pool);
if (stat != APR_SUCCESS) {
- printf("No success\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "No success");
}
deployment_package_pt target = hashMap_get(admin->packages, name);
@@ -266,9 +267,9 @@ size_t deploymentAdmin_parseVersions(voi
mem->memory = realloc(mem->memory, mem->size + realsize + 1);
if (mem->memory == NULL) {
- /* out of memory! */
- printf("not enough memory (realloc returned NULL)\n");
- exit(EXIT_FAILURE);
+ /* out of memory! */
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "not enough memory (realloc returned NULL)");
+ exit(EXIT_FAILURE);
}
memcpy(&(mem->memory[mem->size]), contents, realsize);
@@ -396,7 +397,7 @@ celix_status_t deploymentAdmin_stopDeplo
if (bundle != NULL) {
bundle_stop(bundle);
} else {
- printf("DEPLOYMENT_ADMIN: Bundle %s not found\n", info->symbolicName);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DEPLOYMENT_ADMIN: Bundle %s not found", info->symbolicName);
}
}
}
@@ -622,7 +623,7 @@ celix_status_t deploymentAdmin_startDepl
if (bundle != NULL) {
bundle_start(bundle);
} else {
- printf("DEPLOYMENT_ADMIN: Could not start bundle %s\n", info->symbolicName);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DEPLOYMENT_ADMIN: Could not start bundle %s", info->symbolicName);
}
}
}
Modified: celix/trunk/deployment_admin/private/src/log_sync.c
URL: http://svn.apache.org/viewvc/celix/trunk/deployment_admin/private/src/log_sync.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/deployment_admin/private/src/log_sync.c (original)
+++ celix/trunk/deployment_admin/private/src/log_sync.c Mon Sep 1 05:46:07 2014
@@ -36,6 +36,7 @@
#include <curl/easy.h>
#include "celix_errno.h"
+#include "celix_log.h"
#include "celixbool.h"
#include "log_sync.h"
@@ -86,7 +87,7 @@ celix_status_t logSync_create(apr_pool_t
celix_status_t logSync_parseLogDescriptor(log_sync_pt logSync, char *descriptorString, log_descriptor_pt *descriptor) {
celix_status_t status = CELIX_SUCCESS;
- printf("Descriptor: %s\n", descriptorString);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "Descriptor: %s", descriptorString);
char *last = NULL;
char *targetId = apr_strtok(descriptorString, ",", &last);
char *logIdStr = apr_strtok(NULL, ",", &last);
@@ -95,7 +96,7 @@ celix_status_t logSync_parseLogDescripto
logId = atol(logIdStr);
}
char *range = apr_strtok(NULL, ",", &last);
- printf("Range: %s\n", range);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "Range: %s", range);
long low = 0;
long high = 0;
@@ -183,7 +184,7 @@ celix_status_t logSync_queryLog(log_sync
if (res != CURLE_OK) {
status = CELIX_BUNDLE_EXCEPTION;
}
- printf("Error: %d\n", res);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: %d", res);
/* always cleanup */
curl_easy_cleanup(curl);
@@ -199,9 +200,9 @@ static size_t logSync_readQeury(void *co
mem->memory = realloc(mem->memory, mem->size + realsize + 1);
if (mem->memory == NULL) {
- /* out of memory! */
- printf("not enough memory (realloc returned NULL)\n");
- exit(EXIT_FAILURE);
+ /* out of memory! */
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "not enough memory (realloc returned NULL)");
+ exit(EXIT_FAILURE);
}
memcpy(&(mem->memory[mem->size]), contents, realsize);
Modified: celix/trunk/device_access/device_access/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/device_access/device_access/private/src/activator.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/device_access/device_access/private/src/activator.c (original)
+++ celix/trunk/device_access/device_access/private/src/activator.c Mon Sep 1 05:46:07 2014
@@ -103,10 +103,10 @@ celix_status_t bundleActivator_start(voi
}
if (status != CELIX_SUCCESS) {
- printf("DEVICE_MANAGER: Error while starting bundle got error num %i\n", status);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DEVICE_MANAGER: Error while starting bundle got error num %d", status);
}
- printf("DEVICE_MANAGER: Started\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DEVICE_MANAGER: Started");
return status;
}
Modified: celix/trunk/device_access/device_access/private/src/device_manager.c
URL: http://svn.apache.org/viewvc/celix/trunk/device_access/device_access/private/src/device_manager.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/device_access/device_access/private/src/device_manager.c (original)
+++ celix/trunk/device_access/device_access/private/src/device_manager.c Mon Sep 1 05:46:07 2014
@@ -73,14 +73,14 @@ celix_status_t deviceManager_create(apr_
status = arrayList_create(&(*manager)->locators);
}
- printf("DEVICE_MANAGER: Initialized\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Initialized");
return status;
}
celix_status_t deviceManager_destroy(device_manager_pt manager) {
celix_status_t status = CELIX_SUCCESS;
- printf("DEVICE_MANAGER: Stop\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DEVICE_MANAGER: Stop");
hashMap_destroy(manager->devices, false, false);
hashMap_destroy(manager->drivers, false, false);
arrayList_destroy(manager->locators);
@@ -89,38 +89,38 @@ celix_status_t deviceManager_destroy(dev
}
celix_status_t deviceManager_selectorAdded(void * handle, service_reference_pt ref, void * service) {
- printf("DEVICE_MANAGER: Add selector\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Add selector");
device_manager_pt manager = handle;
manager->selector = (driver_selector_service_pt) service;
return CELIX_SUCCESS;
}
celix_status_t deviceManager_selectorModified(void * handle, service_reference_pt ref, void * service) {
- printf("DEVICE_MANAGER: Modify selector\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Modify selector");
return CELIX_SUCCESS;
}
celix_status_t deviceManager_selectorRemoved(void * handle, service_reference_pt ref, void * service) {
- printf("DEVICE_MANAGER: Remove selector\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Remove selector");
device_manager_pt manager = handle;
manager->selector = NULL;
return CELIX_SUCCESS;
}
celix_status_t deviceManager_locatorAdded(void * handle, service_reference_pt ref, void * service) {
- printf("DEVICE_MANAGER: Add locator\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Add locator");
device_manager_pt manager = handle;
arrayList_add(manager->locators, service);
return CELIX_SUCCESS;
}
celix_status_t deviceManager_locatorModified(void * handle, service_reference_pt ref, void * service) {
- printf("DEVICE_MANAGER: Modify locator\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Modify locator");
return CELIX_SUCCESS;
}
celix_status_t deviceManager_locatorRemoved(void * handle, service_reference_pt ref, void * service) {
- printf("DEVICE_MANAGER: Remove locator\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Remove locator");
device_manager_pt manager = handle;
arrayList_removeElement(manager->locators, service);
return CELIX_SUCCESS;
@@ -128,7 +128,7 @@ celix_status_t deviceManager_locatorRemo
celix_status_t deviceManager_deviceAdded(void * handle, service_reference_pt ref, void * service) {
celix_status_t status = CELIX_SUCCESS;
- printf("DEVICE_MANAGER: Add device\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Add device");
device_manager_pt manager = handle;
status = deviceManager_attachAlgorithm(manager, ref, service);
@@ -220,7 +220,7 @@ celix_status_t deviceManager_matchAttach
for (i = 0; i < arrayList_size(driverIds); i++) {
char *id = arrayList_get(driverIds, i);
- printf("DEVICE_MANAGER: Driver found: %s\n", id);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DEVICE_MANAGER: Driver found: %s", id);
}
status = driverLoader_loadDrivers(loader, attachPool, manager->locators, driverIds, &references);
@@ -242,7 +242,7 @@ celix_status_t deviceManager_matchAttach
int match = 0;
celix_status_t substatus = driverAttributes_match(attributes, reference, &match);
if (substatus == CELIX_SUCCESS) {
- printf("DEVICE_MANAGER: Found match: %d\n", match);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DEVICE_MANAGER: Found match: %d", match);
if (match <= OSGI_DEVICEACCESS_DEVICE_MATCH_NONE) {
continue;
}
@@ -318,7 +318,7 @@ celix_status_t deviceManager_noDriverFou
}
celix_status_t deviceManager_deviceModified(void * handle, service_reference_pt ref, void * service) {
- printf("DEVICE_MANAGER: Modify device\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Modify device");
// #TODO the device properties could be changed
//device_manager_pt manager = handle;
//hashMap_put(manager->devices, ref, service);
@@ -326,7 +326,7 @@ celix_status_t deviceManager_deviceModif
}
celix_status_t deviceManager_deviceRemoved(void * handle, service_reference_pt ref, void * service) {
- printf("DEVICE_MANAGER: Remove device\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Remove device");
device_manager_pt manager = handle;
hashMap_remove(manager->devices, ref);
return CELIX_SUCCESS;
@@ -335,7 +335,7 @@ celix_status_t deviceManager_deviceRemov
celix_status_t deviceManager_driverAdded(void * handle, service_reference_pt ref, void * service) {
celix_status_t status = CELIX_SUCCESS;
- printf("DEVICE_MANAGER: Add driver\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Add driver");
device_manager_pt manager = handle;
apr_pool_t *pool = NULL;
driver_attributes_pt attributes = NULL;
@@ -351,7 +351,7 @@ celix_status_t deviceManager_driverAdded
}
celix_status_t deviceManager_driverModified(void * handle, service_reference_pt ref, void * service) {
- printf("DEVICE_MANAGER: Modify driver\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Modify driver");
// #TODO the driver properties could be changed?
return CELIX_SUCCESS;
}
@@ -359,7 +359,7 @@ celix_status_t deviceManager_driverModif
celix_status_t deviceManager_driverRemoved(void * handle, service_reference_pt ref, void * service) {
celix_status_t status = CELIX_SUCCESS;
- printf("DEVICE_MANAGER: Remove driver\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Remove driver");
device_manager_pt manager = handle;
hashMap_remove(manager->drivers, ref);
@@ -384,7 +384,7 @@ celix_status_t deviceManager_driverRemov
if (forStatus == CELIX_SUCCESS) {
forStatus = module_getSymbolicName(module, &bsn);
if (forStatus == CELIX_SUCCESS) {
- printf("DEVICE_MANAGER: IDLE: %s\n", bsn);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: IDLE: %s", bsn);
// #TODO attachDriver (idle device)
// #TODO this can result in a loop?
// Locate and install a driver
@@ -439,7 +439,7 @@ celix_status_t deviceManager_getIdleDevi
if (substatus == CELIX_SUCCESS) {
substatus = module_getSymbolicName(module, &bsn);
if (substatus == CELIX_SUCCESS) {
- printf("DEVICE_MANAGER: Check idle device: %s\n", bsn);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Check idle device: %s", bsn);
array_list_pt bundles = NULL;
substatus = serviceReference_getUsingBundles(ref, &bundles);
if (substatus == CELIX_SUCCESS) {
@@ -456,7 +456,7 @@ celix_status_t deviceManager_getIdleDevi
bundle_getCurrentModule(bundle, &module);
module_getSymbolicName(module, &bsn);
- printf("DEVICE_MANAGER: Not idle, used by driver: %s\n", bsn);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Not idle, used by driver: %s", bsn);
inUse = true;
break;
@@ -503,7 +503,7 @@ celix_status_t deviceManager_getIdleDevi
substatus = DO_IF_SUCCESS(substatus, serviceReference_getUsingBundles(ref, &bundles));
if (substatus == CELIX_SUCCESS) {
- printf("DEVICE_MANAGER: Check idle device: %s\n", bsn);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Check idle device: %s", bsn);
bool inUse = false;
int i;
for (i = 0; i < arrayList_size(bundles); i++) {
@@ -517,7 +517,7 @@ celix_status_t deviceManager_getIdleDevi
bundle_getCurrentModule(bundle, &module);
module_getSymbolicName(module, &bsn);
- printf("DEVICE_MANAGER: Not idle, used by driver: %s\n", bsn);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Not idle, used by driver: %s", bsn);
inUse = true;
break;
Modified: celix/trunk/device_access/device_access/private/src/driver_matcher.c
URL: http://svn.apache.org/viewvc/celix/trunk/device_access/device_access/private/src/driver_matcher.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/device_access/device_access/private/src/driver_matcher.c (original)
+++ celix/trunk/device_access/device_access/private/src/driver_matcher.c Mon Sep 1 05:46:07 2014
@@ -196,7 +196,7 @@ celix_status_t driverMatcher_getBestMatc
celix_status_t substatus = driverAttributes_getReference(attributes, &reference);
if (substatus == CELIX_SUCCESS) {
if (best != NULL) {
- printf("DRIVER_MATCHER: Compare ranking\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DRIVER_MATCHER: Compare ranking");
char *rank1Str, *rank2Str;
int rank1, rank2;
service_registration_pt registration = NULL;
@@ -217,7 +217,7 @@ celix_status_t driverMatcher_getBestMatc
best = reference;
}
} else {
- printf("DRIVER_MATCHER: Compare id's\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DRIVER_MATCHER: Compare id's");
char *id1Str, *id2Str;
long id1, id2;
Modified: celix/trunk/event_admin/event_admin/private/src/event_admin_activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/event_admin/event_admin/private/src/event_admin_activator.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/event_admin/event_admin/private/src/event_admin_activator.c (original)
+++ celix/trunk/event_admin/event_admin/private/src/event_admin_activator.c Mon Sep 1 05:46:07 2014
@@ -54,7 +54,7 @@ celix_status_t bundleActivator_create(bu
event_admin_pt event_admin = NULL;
event_admin_service_pt event_admin_service = NULL;
status = eventAdmin_create(activator->pool,context, &event_admin);
- printf("event admin activator pointer: %p\n",event_admin);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "event admin activator pointer: %p ",event_admin);
if(status == CELIX_SUCCESS){
activator->event_admin = event_admin;
event_admin_service = apr_palloc(activator->pool, sizeof(event_admin_service));
@@ -78,7 +78,7 @@ celix_status_t bundleActivator_create(bu
}
}
activator->event_admin_service = event_admin_service;
- printf("event admin service pointer: %p\n",event_admin_service);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "event admin service pointer: %p ",event_admin_service);
}
}
Modified: celix/trunk/event_admin/event_admin/private/src/event_admin_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/event_admin/event_admin/private/src/event_admin_impl.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/event_admin/event_admin/private/src/event_admin_impl.c (original)
+++ celix/trunk/event_admin/event_admin/private/src/event_admin_impl.c Mon Sep 1 05:46:07 2014
@@ -30,6 +30,7 @@
#include "event_handler.h"
#include "hash_map.h"
#include "utils.h"
+#include "celix_log.h"
celix_status_t eventAdmin_create(apr_pool_t *pool, bundle_context_pt context, event_admin_pt *event_admin){
@@ -65,7 +66,7 @@ celix_status_t eventAdmin_postEvent(even
array_list_iterator_pt handlers_iterator = arrayListIterator_create(event_handlers);
while (arrayListIterator_hasNext(handlers_iterator)) {
event_handler_service_pt event_handler_service = (event_handler_service_pt) arrayListIterator_next(handlers_iterator);
- printf("handler found (POST EVENT) for %s\n", topic);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "handler found (POST EVENT) for %s", topic);
event_handler_service->handle_event(&event_handler_service->event_handler, event);
}
eventAdmin_releaseHandersList(event_admin, topic);
@@ -85,7 +86,7 @@ celix_status_t eventAdmin_sendEvent(even
array_list_iterator_pt handlers_iterator = arrayListIterator_create(event_handlers);
while (arrayListIterator_hasNext(handlers_iterator)) {
event_handler_service_pt event_handler_service = (event_handler_service_pt) arrayListIterator_next(handlers_iterator);
- printf("handler found (SEND EVENT) for %s\n", topic);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "handler found (SEND EVENT) for %s", topic);
event_handler_service->handle_event(&event_handler_service->event_handler, event);
}
eventAdmin_releaseHandersList(event_admin, topic);
@@ -96,7 +97,7 @@ celix_status_t eventAdmin_findHandlersBy
celix_status_t status = CELIX_SUCCESS;
channel_t channel = hashMap_get(channels, topic);
if (channel != NULL) {
- printf("found channel: %s\n", topic);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "found channel: %s", topic);
if (channel->eventHandlers != NULL && !hashMap_isEmpty(channel->eventHandlers)) {
// iterate throught the handlers and add them to the array list for result.
hash_map_iterator_pt hashmap_iterator = hashMapIterator_create(channel->eventHandlers);
@@ -105,7 +106,7 @@ celix_status_t eventAdmin_findHandlersBy
}
}
} else {
- printf("no such channel: %s\n", topic);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "no such channel: %s", topic);
}
return status;
}
@@ -115,7 +116,7 @@ celix_status_t eventAdmin_createEventCha
channel_t channel = hashMap_get((*event_admin)->channels, topic);
if (channel == NULL) {
//create channel
- printf("Creating channel: %s\n", topic);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "Creating channel: %s", topic);
apr_pool_t *subPool = NULL;
apr_pool_create(&subPool, (*event_admin)->pool);
@@ -183,7 +184,7 @@ celix_status_t eventAdmin_lockHandlersLi
do {
status = apr_thread_mutex_trylock(channel->channelLock);
} while (status != 0 && !APR_STATUS_IS_EBUSY(status));
- printf("LOCK: %s!\n", topic);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "LOCK: %s!", topic);
}
return status;
}
@@ -194,7 +195,7 @@ celix_status_t eventAdmin_releaseHanders
if (channel != NULL) {
// TODO check the result value...
apr_status_t status = apr_thread_mutex_unlock(channel->channelLock);
- printf("UNLOCK: %s!\n", topic);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "UNLOCK: %s!", topic);
}
return status;
}
@@ -216,19 +217,19 @@ celix_status_t eventAdmin_addedService(v
properties_pt props = NULL;
serviceRegistration_getProperties(registration, &props);
char *topic = properties_get(props, (char*)EVENT_TOPIC);
- printf("Original TOPIC: %s\n", topic);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "Original TOPIC: %s", topic);
eventAdmin_createEventChannels(&event_admin,topic,event_handler_service);
return status;
}
celix_status_t eventAdmin_modifiedService(void * handle, service_reference_pt ref, void * service) {
struct data * data = (struct data *) handle;
- printf("Event admin Modified\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "Event admin Modified");
return CELIX_SUCCESS;
}
celix_status_t eventAdmin_removedService(void * handle, service_reference_pt ref, void * service) {
struct data * data = (struct data *) handle;
- printf("Event admin Removed %p\n", service);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "Event admin Removed %p", service);
return CELIX_SUCCESS;
}
Modified: celix/trunk/event_admin/event_admin/private/src/event_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/event_admin/event_admin/private/src/event_impl.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/event_admin/event_admin/private/src/event_impl.c (original)
+++ celix/trunk/event_admin/event_admin/private/src/event_impl.c Mon Sep 1 05:46:07 2014
@@ -41,15 +41,15 @@ struct event {
celix_status_t eventAdmin_createEvent(event_admin_pt *event_admin, char *topic, properties_pt properties, event_pt *event){
celix_status_t status = CELIX_SUCCESS;
- printf("create event event admin pointer: %p\n",(*event_admin));
- printf("pool create event: %p\n",(*event_admin)->pool);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "create event event admin pointer: %p",(*event_admin));
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "pool create event: %p",(*event_admin)->pool);
*event = apr_palloc((*event_admin)->pool,sizeof(**event));
if(!*event){
status = CELIX_ENOMEM;
- printf("No MEM\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "No MEM");
}else {
- printf("Event created : %s \n",topic);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "Event created : %s", topic);
(*event)->topic = topic;
(*event)->properties = properties;
properties_set((*event)->properties, (char *)EVENT_TOPIC, topic);
Modified: celix/trunk/event_admin/event_handler/private/src/event_handler_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/event_admin/event_handler/private/src/event_handler_impl.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/event_admin/event_handler/private/src/event_handler_impl.c (original)
+++ celix/trunk/event_admin/event_handler/private/src/event_handler_impl.c Mon Sep 1 05:46:07 2014
@@ -49,7 +49,7 @@ celix_status_t eventHandlerHandleEvent(e
if (event != NULL) {
char *topic = NULL;
status = (*event_handler)->event_admin_service->getTopic(&event, &topic);
- printf("[SUB] topic of event: %s\n", topic);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "[SUB] topic of event: %s.", topic);
array_list_pt propertyNames;
arrayList_create(&propertyNames);
@@ -61,7 +61,7 @@ celix_status_t eventHandlerHandleEvent(e
char *value = NULL;
(*event_handler)->event_admin_service->getProperty(&event,key,&value);
- printf("[SUB] Key: %s value: %s\n",key,value);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "[SUB] Key: %s value: %s.", key, value);
}
}
return status;
@@ -76,19 +76,19 @@ celix_status_t eventHandlerAddingService
}
celix_status_t eventHandlerAddedService(void * handle, service_reference_pt ref, void * service) {
- printf("[SUB] Event admin added...\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "[SUB] Event admin added.");
event_handler_pt data = handle;
data->event_admin_service = (event_admin_service_pt) service;
return CELIX_SUCCESS;
}
celix_status_t eventHandlerModifiedService(void * handle, service_reference_pt ref, void * service) {
- printf("[SUB] Event admin modified...\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG,"" [SUB] Event admin modified.");
return CELIX_SUCCESS;
}
celix_status_t eventHandlerRemovedService(void * handle, service_reference_pt ref, void * service) {
- printf("[SUB] Event admin removed...\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "[SUB] Event admin removed.");
event_handler_pt data = handle;
data->event_admin_service = NULL;
return CELIX_SUCCESS;
Modified: celix/trunk/event_admin/event_publisher/private/src/event_publisher_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/event_admin/event_publisher/private/src/event_publisher_impl.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/event_admin/event_publisher/private/src/event_publisher_impl.c (original)
+++ celix/trunk/event_admin/event_publisher/private/src/event_publisher_impl.c Mon Sep 1 05:46:07 2014
@@ -84,7 +84,7 @@ celix_status_t eventPublisherAddingServi
}
celix_status_t eventPublisherAddedService(void * handle, service_reference_pt ref, void * service) {
- printf("[PUB] Event admin added...\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "[PUB] Event admin added.");
event_publisher_pt data = handle;
data->event_admin_service = (event_admin_service_pt) service;
data->eventAdminAdded = true;
@@ -92,12 +92,12 @@ celix_status_t eventPublisherAddedServic
}
celix_status_t eventPublisherModifiedService(void * handle, service_reference_pt ref, void * service) {
- printf("[PUB] Event admin modified...\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "[PUB] Event admin modified.");
return CELIX_SUCCESS;
}
celix_status_t eventPublisherRemovedService(void * handle, service_reference_pt ref, void * service) {
- printf("[PUB] Event admin removed...\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "[PUB] Event admin removed.");
event_publisher_pt data = handle;
data->event_admin_service = NULL;
data->eventAdminAdded = false;
Modified: celix/trunk/framework/private/src/filter.c
URL: http://svn.apache.org/viewvc/celix/trunk/framework/private/src/filter.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/framework/private/src/filter.c (original)
+++ celix/trunk/framework/private/src/filter.c Mon Sep 1 05:46:07 2014
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <ctype.h>
+#include "celix_log.h"
#include "filter_private.h"
#include "array_list.h"
@@ -57,7 +58,7 @@ filter_pt filter_create(char * filterStr
int pos = 0;
filter = filter_parseFilter(filterString, &pos);
if (pos != strlen(filterString)) {
- printf("Error: Extraneous trailing characters\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Extraneous trailing characters.");
return NULL;
}
filter->filterStr = filterString;
@@ -94,7 +95,7 @@ filter_pt filter_parseFilter(char * filt
filter_pt filter;
filter_skipWhiteSpace(filterString, pos);
if (filterString[*pos] != '(') {
- printf("Error: Missing '('\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing '('.");
return NULL;
}
(*pos)++;
@@ -104,7 +105,7 @@ filter_pt filter_parseFilter(char * filt
filter_skipWhiteSpace(filterString, pos);
if (filterString[*pos] != ')') {
- printf("Error: Missing ')'\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing ')'.");
return NULL;
}
(*pos)++;
@@ -143,7 +144,7 @@ filter_pt filter_parseAnd(char * filterS
filter_skipWhiteSpace(filterString, pos);
if (filterString[*pos] != '(') {
- printf("Error: Missing '('\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing '('.");
return NULL;
}
@@ -166,7 +167,7 @@ filter_pt filter_parseOr(char * filterSt
filter_skipWhiteSpace(filterString, pos);
if (filterString[*pos] != '(') {
- printf("Error: Missing '('\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing '('.");
return NULL;
}
@@ -188,7 +189,7 @@ filter_pt filter_parseNot(char * filterS
filter_skipWhiteSpace(filterString, pos);
if (filterString[*pos] != '(') {
- printf("Error: Missing '('\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error: Missing '('.");
return NULL;
}
@@ -276,7 +277,7 @@ filter_pt filter_parseItem(char * filter
return filter;
}
}
- printf("Invalid operator\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Invalid operator.");
return NULL;
}
@@ -302,7 +303,7 @@ char * filter_parseAttr(char * filterStr
length = end - begin;
if (length == 0) {
- printf("Missing attr");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Missing attr.");
return NULL;
} else {
char * attr = (char *) malloc(length+1);
@@ -325,7 +326,7 @@ char * filter_parseValue(char * filterSt
break;
}
case '(': {
- printf("Invalid value");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Invalid value.");
return NULL;
}
case '\\': {
@@ -345,7 +346,7 @@ char * filter_parseValue(char * filterSt
}
if (strlen(value) == 0) {
- printf("Missing value");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Missing value.");
return NULL;
}
return value;
@@ -372,7 +373,7 @@ array_list_pt filter_parseSubstring(char
break;
}
case '(': {
- printf("Invalid value");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Invalid value.");
return NULL;
}
case '*': {
@@ -403,7 +404,7 @@ array_list_pt filter_parseSubstring(char
size = arrayList_size(operands);
if (size == 0) {
- printf("Missing value");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Missing value.");
return NULL;
}
Modified: celix/trunk/remote_services/calculator_proxy/private/src/calculator_proxy_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/calculator_proxy/private/src/calculator_proxy_impl.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/remote_services/calculator_proxy/private/src/calculator_proxy_impl.c (original)
+++ celix/trunk/remote_services/calculator_proxy/private/src/calculator_proxy_impl.c Mon Sep 1 05:46:07 2014
@@ -34,6 +34,11 @@
#include "array_list.h"
#include "calculator_proxy_impl.h"
+/* Allows the use of Jansson < 2.3 */
+#ifndef JSON_DECODE_ANY
+#define JSON_DECODE_ANY 0
+#endif
+
celix_status_t calculatorProxy_setEndpointDescription(void *proxy, endpoint_description_pt endpoint);
celix_status_t calculatorProxy_setHandler(void *proxy, void *handler);
celix_status_t calculatorProxy_setCallback(void *proxy, sendToHandle callback);
Modified: celix/trunk/remote_services/discovery_bonjour/private/src/discovery.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_bonjour/private/src/discovery.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_bonjour/private/src/discovery.c (original)
+++ celix/trunk/remote_services/discovery_bonjour/private/src/discovery.c Mon Sep 1 05:46:07 2014
@@ -201,7 +201,7 @@ celix_status_t discovery_endpointAdded(v
celix_status_t status = CELIX_SUCCESS;
discovery_pt discovery = handle;
- printf("DISCOVERY: Endpoint for %s, with filter \"%s\" added\n", endpoint->service, machtedFilter);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: Endpoint for %s, with filter \"%s\" added.", endpoint->service, machtedFilter);
disclosed_endpoint_entry_pt entry = NULL;
apr_pool_t *childPool = NULL;
status = apr_pool_create(&childPool, discovery->pool);
@@ -314,9 +314,9 @@ celix_status_t discovery_endpointListene
char *discoveryListener = properties_get(serviceProperties, "DISCOVERY");
if (discoveryListener != NULL && strcmp(discoveryListener, "true") == 0) {
- printf("DISCOVERY: EndpointListener Ignored - Discovery listener\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: EndpointListener Ignored - Discovery listener.");
} else {
- printf("DISCOVERY: EndpointListener Added - Add Scope\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: EndpointListener Added - Add Scope.");
apr_thread_mutex_lock(discovery->discoveredServicesMutex);
if (discovery->discoveredServices != NULL) {
@@ -363,7 +363,7 @@ celix_status_t discovery_endpointListene
celix_status_t status = CELIX_SUCCESS;
discovery_pt discovery = handle;
- printf("DISCOVERY: EndpointListener Removed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: EndpointListener Removed");
apr_thread_mutex_lock(discovery->listenerReferencesMutex);
if (discovery->listenerReferences != NULL) {
hashMap_remove(discovery->listenerReferences, reference);
@@ -390,20 +390,20 @@ static void discovery_browseCallback(DNS
void *context) {
discovery_pt discovery = context;
if (flags & kDNSServiceFlagsAdd) {
- printf("Added service with %s %s %s\n", serviceName, regtype,
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "Added service with %s %s %s.", serviceName, regtype,
replyDomain);
DNSServiceRef resolveRef = NULL;
DNSServiceErrorType resolveError = DNSServiceResolve(&resolveRef, 0, 0,
serviceName, regtype, replyDomain, discovery_resolveAddCallback,
context);
- printf("Resolve return with error %i\n", resolveError);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Resolve return with error %d.", resolveError);
if (resolveError == kDNSServiceErr_NoError) {
DNSServiceProcessResult(resolveRef);
} else {
//TODO print error / handle error?
}
} else {
- printf("Removed service with %s %s %s\n", serviceName, regtype,
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "Removed service with %s %s %s.", serviceName, regtype,
replyDomain);
DNSServiceRef resolveRef = NULL;
DNSServiceErrorType resolveError = DNSServiceResolve(&resolveRef, 0, 0,
@@ -459,14 +459,14 @@ static void discovery_resolveAddCallback
&value);
memcpy(valueBuf, value, valueSize);
valueBuf[valueSize] = '\0';
- printf("Found key=value %s=%s\n", key, valueBuf);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "Found key=value %s=%s.", key, valueBuf);
properties_set(props, key, valueBuf);
}
char *endpointFrameworkUuid = properties_get(props, (char *)OSGI_RSA_ENDPOINT_FRAMEWORK_UUID);
if (endpointFrameworkUuid == NULL) {
- printf("DISCOVERY: Cannot process endpoint, no %s property\n", OSGI_RSA_ENDPOINT_FRAMEWORK_UUID);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "DISCOVERY: Cannot process endpoint, no %s property.", OSGI_RSA_ENDPOINT_FRAMEWORK_UUID);
} else if (strcmp(endpointFrameworkUuid, discovery->frameworkUuid) != 0) {
apr_pool_t *childPool = NULL;
apr_pool_create(&childPool, discovery->pool);
@@ -492,7 +492,7 @@ static void discovery_resolveAddCallback
discovery_informEndpointListeners(discovery, endpoint, true);
} else {
//ignore self disclosed endpoints!
- printf("DISCOVERY: Ignoring own endpoint, with service %s!\n", properties_get(props, "service"));
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY: Ignoring own endpoint, with service %s!", properties_get(props, "service"));
properties_destroy(props);
}
}
@@ -519,7 +519,7 @@ static celix_status_t discovery_informEn
bool matchResult = false;
filter_match(filter, endpoint->properties, &matchResult);
if (matchResult) {
- printf("DISCOVERY: Add service (%s)\n", endpoint->service);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: Add service (%s)", endpoint->service);
bundleContext_getService(discovery->context, reference,
(void**) &listener);
if (endpointAdded) {
Modified: celix/trunk/remote_services/discovery_configured/private/src/discovery.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_configured/private/src/discovery.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_configured/private/src/discovery.c (original)
+++ celix/trunk/remote_services/discovery_configured/private/src/discovery.c Mon Sep 1 05:46:07 2014
@@ -163,7 +163,7 @@ celix_status_t discovery_endpointAdded(v
celix_status_t status = CELIX_SUCCESS;
discovery_pt discovery = handle;
- printf("DISCOVERY_CONFIGURED: Endpoint for %s, with filter \"%s\" added...\n", endpoint->service, matchedFilter);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY_CONFIGURED: Endpoint for %s, with filter \"%s\" added.", endpoint->service, matchedFilter);
status = endpointDiscoveryServer_addEndpoint(discovery->server, endpoint);
@@ -174,7 +174,7 @@ celix_status_t discovery_endpointRemoved
celix_status_t status = CELIX_SUCCESS;
discovery_pt discovery = handle;
- printf("DISCOVERY_CONFIGURED: Endpoint for %s, with filter \"%s\" removed...\n", endpoint->service, matchedFilter);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY_CONFIGURED: Endpoint for %s, with filter \"%s\" removed.", endpoint->service, matchedFilter);
status = endpointDiscoveryServer_removeEndpoint(discovery->server, endpoint);
@@ -205,7 +205,7 @@ celix_status_t discovery_endpointListene
filter_pt filter = filter_create(scope);
if (discoveryListener != NULL && strcmp(discoveryListener, "true") == 0) {
- printf("DISCOVERY: EndpointListener Ignored - Discovery listener\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: EndpointListener Ignored - Discovery listener.");
} else {
celixThreadMutex_lock(&discovery->discoveredServicesMutex);
@@ -218,7 +218,7 @@ celix_status_t discovery_endpointListene
if (matchResult) {
endpoint_listener_pt listener = service;
- printf("DISCOVERY: EndpointListener Added - Add Scope\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: EndpointListener Added - Add Scope.");
listener->endpointAdded(listener, endpoint, NULL);
}
@@ -257,7 +257,7 @@ celix_status_t discovery_endpointListene
if (discovery->listenerReferences != NULL) {
if (hashMap_remove(discovery->listenerReferences, reference)) {
- printf("DISCOVERY: EndpointListener Removed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: EndpointListener Removed.");
}
}
Modified: celix/trunk/remote_services/discovery_configured/private/src/discovery_activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_configured/private/src/discovery_activator.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_configured/private/src/discovery_activator.c (original)
+++ celix/trunk/remote_services/discovery_configured/private/src/discovery_activator.c Mon Sep 1 05:46:07 2014
@@ -91,7 +91,7 @@ celix_status_t bundleActivator_start(voi
char *uuid = NULL;
status = bundleContext_getProperty(context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
if (!uuid) {
- printf("DISCOVERY_CONFIGURED: no framework UUID defined?!\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY_CONFIGURED: no framework UUID defined?!");
return CELIX_ILLEGAL_STATE;
}
@@ -103,7 +103,7 @@ celix_status_t bundleActivator_start(voi
snprintf(scope, len, "(&(%s=*)(%s=%s))", OSGI_FRAMEWORK_OBJECTCLASS, OSGI_RSA_ENDPOINT_FRAMEWORK_UUID, uuid);
- printf("DISCOVERY_CONFIGURED: using scope %s.\n", scope);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY_CONFIGURED: using scope %s.", scope);
endpoint_listener_pt endpointListener = malloc(sizeof(struct endpoint_listener));
if (!endpointListener) {
Modified: celix/trunk/remote_services/discovery_configured/private/src/endpoint_descriptor_reader.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_configured/private/src/endpoint_descriptor_reader.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_configured/private/src/endpoint_descriptor_reader.c (original)
+++ celix/trunk/remote_services/discovery_configured/private/src/endpoint_descriptor_reader.c Mon Sep 1 05:46:07 2014
@@ -28,6 +28,7 @@
#include <string.h>
#include <libxml/xmlreader.h>
+#include "celix_log.h"
#include "constants.h"
#include "remote_constants.h"
@@ -159,7 +160,7 @@ celix_status_t endpointDescriptorReader_
if (propertyValue != NULL) {
if (propertyType != VALUE_TYPE_STRING && strcmp(OSGI_RSA_ENDPOINT_SERVICE_ID, (char*) propertyName)) {
- printf("ENDPOINT_DESCRIPTOR_READER: Only single-valued string supported for %s\n", propertyName);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "ENDPOINT_DESCRIPTOR_READER: Only single-valued string supported for %s", propertyName);
}
endpointDescriptorReader_addSingleValuedProperty(endpointProperties, propertyName, propertyValue);
}
@@ -203,7 +204,7 @@ celix_status_t endpointDescriptorReader_
}
else if (propertyValue != NULL) {
if (propertyType != VALUE_TYPE_STRING) {
- printf("ENDPOINT_DESCRIPTOR_READER: Only string support for %s\n", propertyName);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "ENDPOINT_DESCRIPTOR_READER: Only string support for %s", propertyName);
}
endpointDescriptorReader_addSingleValuedProperty(endpointProperties, propertyName, propertyValue);
Modified: celix/trunk/remote_services/discovery_configured/private/src/endpoint_discovery_poller.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_configured/private/src/endpoint_discovery_poller.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_configured/private/src/endpoint_discovery_poller.c (original)
+++ celix/trunk/remote_services/discovery_configured/private/src/endpoint_discovery_poller.c Mon Sep 1 05:46:07 2014
@@ -206,7 +206,7 @@ static void *endpointDiscoveryPoller_pol
celix_status_t status = celixThreadMutex_lock(&poller->pollerLock);
if (status != CELIX_SUCCESS) {
- printf("ENDPOINT_POLLER: failed to obtain lock; retrying...\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "ENDPOINT_POLLER: failed to obtain lock; retrying..");
continue;
}
@@ -248,7 +248,7 @@ static void *endpointDiscoveryPoller_pol
status = celixThreadMutex_unlock(&poller->pollerLock);
if (status != CELIX_SUCCESS) {
- printf("ENDPOINT_POLLER: failed to release lock; retrying...\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "ENDPOINT_POLLER: failed to release lock; retrying.");
}
}
@@ -266,7 +266,7 @@ static size_t endpointDiscoveryPoller_wr
mem->memory = realloc(mem->memory, mem->size + realsize + 1);
if(mem->memory == NULL) {
- printf("ENDPOINT_POLLER: not enough memory (realloc returned NULL)!\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "ENDPOINT_POLLER: not enough memory (realloc returned NULL)!");
return 0;
}
@@ -312,7 +312,7 @@ static celix_status_t endpointDiscoveryP
endpointDescriptorReader_destroy(reader);
}
} else {
- printf("ENDPOINT_POLLER: unable to read endpoints, reason: %s\n", curl_easy_strerror(res));
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "ENDPOINT_POLLER: unable to read endpoints, reason: %s", curl_easy_strerror(res));
}
// clean up endpoints file
Modified: celix/trunk/remote_services/discovery_configured/private/src/endpoint_discovery_server.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_configured/private/src/endpoint_discovery_server.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_configured/private/src/endpoint_discovery_server.c (original)
+++ celix/trunk/remote_services/discovery_configured/private/src/endpoint_discovery_server.c Mon Sep 1 05:46:07 2014
@@ -23,7 +23,9 @@
* \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
+
#include <stdlib.h>
+#include <stdint.h>
#include "civetweb.h"
#include "celix_errno.h"
@@ -106,7 +108,7 @@ celix_status_t endpointDiscoveryServer_c
(*server)->ctx = mg_start(&callbacks, (*server), options);
- printf("CONFIGURED_DISCOVERY: Starting discovery server on port %s...\n", port);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "CONFIGURED_DISCOVERY: Starting discovery server on port %s.", port);
return status;
}
@@ -143,7 +145,7 @@ celix_status_t endpointDiscoveryServer_a
char* endpointId = strdup(endpoint->id);
endpoint_description_pt cur_value = hashMap_get(server->entries, endpointId);
if (!cur_value) {
- printf("CONFIGURED_DISCOVERY: exposing new endpoint \"%s\"...\n", endpointId);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "CONFIGURED_DISCOVERY: exposing new endpoint \"%s\".", endpointId);
hashMap_put(server->entries, endpointId, endpoint);
}
@@ -168,7 +170,7 @@ celix_status_t endpointDiscoveryServer_r
if (entry) {
char* key = hashMapEntry_getKey(entry);
- printf("CONFIGURED_DISCOVERY: removing endpoint \"%s\"...\n", key);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "CONFIGURED_DISCOVERY: removing endpoint \"%s\".", key);
hashMap_remove(server->entries, key);
Modified: celix/trunk/remote_services/discovery_shm/private/src/discovery.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_shm/private/src/discovery.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_shm/private/src/discovery.c (original)
+++ celix/trunk/remote_services/discovery_shm/private/src/discovery.c Mon Sep 1 05:46:07 2014
@@ -40,6 +40,7 @@
#include "array_list.h"
#include "utils.h"
#include "celix_errno.h"
+#include "celix_log.h"
#include "filter.h"
#include "service_reference.h"
#include "service_registration.h"
@@ -70,7 +71,7 @@ celix_status_t discovery_stopOrDetachShm
celix_status_t discovery_create(apr_pool_t *pool, bundle_context_pt context, discovery_pt *discovery) {
celix_status_t status = CELIX_SUCCESS;
- printf("DISCOVERY started.\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY_SHM started.");
*discovery = apr_palloc(pool, sizeof(**discovery));
if (!*discovery) {
@@ -90,7 +91,7 @@ celix_status_t discovery_create(apr_pool
if ((status = discovery_createOrAttachShm(*discovery)) != CELIX_SUCCESS)
{
- printf("DISCOVERY: Shared Memory initialization failed.");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY_SHM: Shared Memory initialization failed.");
}
else
{
@@ -126,17 +127,17 @@ celix_status_t discovery_stop(discovery_
if (stat != APR_SUCCESS && tstat != APR_SUCCESS)
{
- printf("DISCOVERY: An error occured while stopping the SHM polling thread.\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY_SHM: An error occured while stopping the SHM polling thread.");
status = CELIX_BUNDLE_EXCEPTION;
}
else
{
- printf("DISCOVERY: SHM polling thread sucessfully stopped.\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: SHM polling thread sucessfully stopped.");
int i;
for (i = 0; i < arrayList_size(discovery->registered); i++) {
endpoint_description_pt endpoint = (endpoint_description_pt) arrayList_get(discovery->registered, i);
- printf("DISCOVERY: deregistering service %s.\n", endpoint->service);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY_SHM: deregistering service %s.", endpoint->service);
status = discovery_deregisterSHMService(discovery, endpoint);
}
@@ -150,7 +151,7 @@ celix_status_t discovery_stop(discovery_
celix_status_t discovery_removeService(discovery_pt discovery, endpoint_description_pt endpoint) {
celix_status_t status = CELIX_SUCCESS;
- printf("DISCOVERY: Remove service (%s)\n", endpoint->service);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY_SHM: Remove service (%s).", endpoint->service);
// Inform listeners of new endpoint
hash_map_iterator_pt iter = hashMapIterator_create(discovery->listenerReferences);
@@ -172,7 +173,7 @@ celix_status_t discovery_addService(disc
// Inform listeners of new endpoint
hash_map_iterator_pt iter = hashMapIterator_create(discovery->listenerReferences);
- printf("DISCOVERY: Add service (%s)\n", endpoint->service);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY_SHM: Add service (%s).", endpoint->service);
while (hashMapIterator_hasNext(iter)) {
hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
@@ -188,7 +189,7 @@ celix_status_t discovery_addService(disc
bool matchResult = false;
filter_match(filter, endpoint->properties, &matchResult);
if (matchResult) {
- printf("DISCOVERY: Add service (%s)\n", endpoint->service);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY_SHM: Add service (%s).", endpoint->service);
bundleContext_getService(discovery->context, reference, (void**) &listener);
discovery_informListener(discovery, listener, endpoint);
}
@@ -287,7 +288,7 @@ celix_status_t discovery_decShmMapServic
if ((status = netstring_decodeToHashMap(discovery->pool, encServiceMap, outShmMap)) != CELIX_SUCCESS)
{
- printf("DISCOVERY: discovery_decShmMapService : decoding service data to hashmap failed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: discovery_decShmMapService : decoding service data to hashmap failed.");
}
else
{
@@ -297,7 +298,7 @@ celix_status_t discovery_decShmMapServic
if ((status = netstring_decodeToHashMap(discovery->pool, encServiceProps, props)) != CELIX_SUCCESS)
{
- printf("DISCOVERY: discovery_decShmMapService : Decoding of endpointProperties failed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: discovery_decShmMapService : Decoding of endpointProperties failed.");
}
hashMap_put(outShmMap, DISCOVERY_SHM_SRVC_PROPERTIES, props);
@@ -316,7 +317,7 @@ celix_status_t discovery_encShmMapServic
if ((status = netstring_encodeFromHashMap(discovery->pool, props, &encServiceProps)) != CELIX_SUCCESS)
{
- printf("DISCOVERY: discovery_encShmMapService : encoding of endpointProperties failed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: discovery_encShmMapService : encoding of endpointProperties failed.");
}
else
{
@@ -324,7 +325,7 @@ celix_status_t discovery_encShmMapServic
if ((status = netstring_encodeFromHashMap(discovery->pool, inShmMap, outEncServiceMap)) != CELIX_SUCCESS)
{
- printf("DISCOVERY: discovery_encShmMapService : encoding service data to hashmap failed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: discovery_encShmMapService : encoding service data to hashmap failed.");
}
}
@@ -340,7 +341,7 @@ celix_status_t discovery_decShmMapDiscov
if ((status = netstring_decodeToHashMap(discovery->pool, encDiscInstance, outRegServices)) != CELIX_SUCCESS)
{
- printf("DISCOVERY: discovery_decShmMapDiscoveryInstance : decoding data to properties failed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: discovery_decShmMapDiscoveryInstance : decoding data to properties failed.");
}
else {
@@ -349,7 +350,7 @@ celix_status_t discovery_decShmMapDiscov
if ((status = netstring_decodeToHashMap(discovery->pool, encServices, fwServices)) != CELIX_SUCCESS)
{
- printf("DISCOVERY: discovery_decShmMapDiscoveryInstance : decoding services failed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: discovery_decShmMapDiscoveryInstance : decoding services failed");
}
else
{
@@ -410,7 +411,7 @@ celix_status_t discovery_encShmMapDiscov
if ((status = netstring_encodeFromHashMap(discovery->pool, inRegServices, &outEncServices)) != CELIX_SUCCESS)
{
- printf("DISCOVERY: discovery_encShmMapDiscoveryInstance : encode services failed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: discovery_encShmMapDiscoveryInstance : encode services failed.");
}
else
{
@@ -418,7 +419,7 @@ celix_status_t discovery_encShmMapDiscov
if ((status = netstring_encodeFromHashMap(discovery->pool, inFwAttr, outEncDiscoveryInstance)) != CELIX_SUCCESS)
{
- printf("DISCOVERY: discovery_encShmMapDiscoveryInstance : encode discovery instances failed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: discovery_encShmMapDiscoveryInstance : encode discovery instances failed.");
}
}
@@ -435,7 +436,7 @@ celix_status_t discovery_decShmMap(disco
if ((status = netstring_decodeToHashMap(discovery->pool, encMap, outRegDiscInstances)) != CELIX_SUCCESS)
{
- printf("DISCOVERY: discovery_updateLocalSHMServices : decoding data to properties failed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: discovery_updateLocalSHMServices : decoding data to properties failed.");
}
else
{
@@ -488,7 +489,7 @@ celix_status_t discovery_encShmMap(disco
if ((status == CELIX_SUCCESS) && ((status = netstring_encodeFromHashMap(discovery->pool, inRegDiscInstances, outEncMap)) != CELIX_SUCCESS))
{
- printf("DISCOVERY: discovery_encShmMapDiscoveryInstance : encode shm map failed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: discovery_encShmMapDiscoveryInstance : encode shm map failed.");
}
return status;
@@ -530,7 +531,7 @@ celix_status_t discovery_updateSHMServic
if ((discovery->shmId < 0) || (discovery->shmBaseAdress == NULL))
{
- printf("DISCOVERY : shared memory not initialized.\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY : shared memory not initialized.");
status = CELIX_BUNDLE_EXCEPTION;
}
else
@@ -543,7 +544,7 @@ celix_status_t discovery_updateSHMServic
if ((status = discovery_decShmMap(discovery, &(shmData->data[0]), regDiscoveryInstances)) != CELIX_SUCCESS)
{
- printf("DISCOVERY : discovery_registerSHMService : decoding data to Properties failed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY : discovery_registerSHMService : decoding data failed.");
}
else
{
@@ -589,7 +590,7 @@ celix_status_t discovery_updateSHMServic
}
else
{
- printf("remove Services %s\n", endpoint->service);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "remove Services %s.", endpoint->service);
hashMap_remove(ownServices, endpoint->service);
@@ -598,7 +599,7 @@ celix_status_t discovery_updateSHMServic
// the structure but the process with the pid does not live anymore)
if (hashMap_size(ownServices) == 0)
{
- printf("removing framework w/ uuid %s\n", uuid);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "removing framework w/ uuid %s.", uuid);
hashMap_remove(ownFramework, DISCOVERY_SHM_FW_SERVICES);
hashMap_remove(regDiscoveryInstances, uuid);
@@ -615,7 +616,7 @@ celix_status_t discovery_updateSHMServic
}
else
{
- printf("DISCOVERY : discovery_registerSHMService : encoding data from HashMap failed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY : discovery_registerSHMService : encoding data from HashMap failed.");
}
}
@@ -640,14 +641,14 @@ celix_status_t discovery_deregisterSHMSe
celix_status_t discovery_endpointAdded(void *handle, endpoint_description_pt endpoint, char *machtedFilter) {
celix_status_t status = CELIX_SUCCESS;
- printf("DISCOVERY: Endpoint for %s, with filter \"%s\" added\n", endpoint->service, machtedFilter);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY_SHM: Endpoint for %s, with filter \"%s\" added.", endpoint->service, machtedFilter);
discovery_pt discovery = handle;
if (status == CELIX_SUCCESS) {
if ((status = discovery_registerSHMService(discovery, endpoint)) != CELIX_SUCCESS)
{
- printf("DISCOVERY: Error registering service (%s) within shared memory \n", endpoint->service);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY_SHM: Error registering service (%s) within shared memory.", endpoint->service);
}
arrayList_add(discovery->registered, endpoint);
@@ -658,7 +659,7 @@ celix_status_t discovery_endpointAdded(v
celix_status_t discovery_endpointRemoved(void *handle, endpoint_description_pt endpoint, char *machtedFilter) {
celix_status_t status = CELIX_SUCCESS;
- printf("DISCOVERY: Endpoint for %s, with filter \"%s\" removed\n", endpoint->service, machtedFilter);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY_SHM: Endpoint for %s, with filter \"%s\" removed", endpoint->service, machtedFilter);
discovery_pt discovery = handle;
@@ -697,7 +698,7 @@ celix_status_t discovery_endpointListene
char *discoveryListener = properties_get(serviceProperties, "DISCOVERY");
if (discoveryListener != NULL && strcmp(discoveryListener, "true") == 0) {
- printf("DISCOVERY: EndpointListener Ignored - Discovery listener\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: EndpointListener Ignored - Discovery listener.");
} else {
discovery_updateEndpointListener(discovery, reference, (endpoint_listener_pt) service);
}
@@ -753,7 +754,7 @@ celix_status_t discovery_endpointListene
celix_status_t status = CELIX_SUCCESS;
discovery_pt discovery = handle;
- printf("DISCOVERY: EndpointListener Removed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: EndpointListener Removed");
hashMap_remove(discovery->listenerReferences, reference);
return status;
@@ -766,18 +767,18 @@ celix_status_t discovery_createOrAttachS
key_t shmKey = ftok(DISCOVERY_SHM_FILENAME, DISCOVERY_SHM_FTOK_ID);
if ((discovery->shmId = shmget(shmKey, DISCOVERY_SHM_MEMSIZE, 0666)) < 0)
- {
- printf("DISCOVERY : Could not attach to shared memory. Trying to create shared memory segment. \n");
+ {
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY : Could not attach to shared memory. Trying to create shared memory segment.");
// trying to create shared memory
if ((discovery->shmId = shmget(shmKey, DISCOVERY_SHM_MEMSIZE, IPC_CREAT | 0666)) < 0)
- {
- printf("DISCOVERY : Creation of shared memory segment failed\n");
+ {
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY : Creation of shared memory segment failed.");
status = CELIX_BUNDLE_EXCEPTION;
}
else if ((discovery->shmBaseAdress = shmat(discovery->shmId, 0, 0)) == (char*) -1)
- {
- printf("DISCOVERY : Attaching of shared memory segment failed\n");
+ {
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY : Attaching of shared memory segment failed.");
status = CELIX_BUNDLE_EXCEPTION;
}
else
@@ -785,40 +786,39 @@ celix_status_t discovery_createOrAttachS
int semId = -1;
key_t semKey = -1;
ipc_shmData_pt shmData = NULL;
- printf("DISCOVERY : Shared memory segment successfully created at %p\n", discovery->shmBaseAdress);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY : Shared memory segment successfully created at %p", discovery->shmBaseAdress);
// create structure
shmData = calloc(1, sizeof(*shmData));
semKey = ftok(DISCOVERY_SEM_FILENAME, DISCOVERY_SEM_FTOK_ID);
if ((semId = semget(semKey, 2, 0666 | IPC_CREAT)) == -1)
- {
- printf("DISCOVERY : Creation of semaphores failed %i\n", semId);
+ {
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY : Creation of semaphores failed %d.", semId);
}
else
{
// set
if (semctl(semId, 0, SETVAL, (int) 1) < 0)
- {
- printf(" DISCOVERY : error while initializing semaphore 0 \n");
+ {
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY : error while initializing semaphore 0.");
}
else
{
- printf(" DISCOVERY : semaphore 0 initialized w/ %d\n", semctl(semId, 0, GETVAL, 0));
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, " DISCOVERY : semaphore 0 initialized w/ %d", semctl(semId, 0, GETVAL, 0));
}
if (semctl(semId, 1, SETVAL, (int) 0) < 0)
- {
- printf(" DISCOVERY : error while initializing semaphore 1\n");
+ {
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY : error while initializing semaphore 1.");
}
else
{
- printf(" DISCOVERY : semaphore 1 initialized w/ %d\n", semctl(semId, 1, GETVAL, 0));
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, " DISCOVERY : semaphore 1 initialized w/ %d.", semctl(semId, 1, GETVAL, 0));
}
shmData->semId = semId;
shmData->numListeners = 1;
- printf(" numListeners is initalized: %d \n", shmData->numListeners);
memcpy(discovery->shmBaseAdress, shmData, sizeof(*shmData));
}
@@ -828,7 +828,7 @@ celix_status_t discovery_createOrAttachS
}
else if ((discovery->shmBaseAdress = shmat(discovery->shmId, 0, 0)) < 0)
{
- printf("DISCOVERY : Attaching of shared memory segment failed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY : Attaching of shared memory segment failed.");
status = CELIX_BUNDLE_EXCEPTION;
}
else
@@ -850,7 +850,7 @@ celix_status_t discovery_stopOrDetachShm
if ((discovery->shmId < 0) || (discovery->shmBaseAdress == NULL))
{
- printf("DISCOVERY : discovery_addNewEntry : shared memory not initialized.\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY : discovery_addNewEntry : shared memory not initialized.");
status = CELIX_BUNDLE_EXCEPTION;
}
else
@@ -860,22 +860,22 @@ celix_status_t discovery_stopOrDetachShm
discovery_lock(shmData->semId, 0);
shmData->numListeners--;
- printf(" numListeners decreased: %d \n", shmData->numListeners);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: numListeners decreased: %d", shmData->numListeners);
discovery_unlock(shmData->semId, 0);
if (shmData->numListeners > 0)
- {
- printf("DISCOVERY: Detaching from Shared memory\n");
+ {
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: Detaching from Shared memory\n");
shmdt(discovery->shmBaseAdress);
}
else
{
- printf("DISCOVERY: Removing semaphore w/ id \n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: Removing semaphore w/ id.");
ipc_shmData_pt shmData = (ipc_shmData_pt) discovery->shmBaseAdress;
semctl(shmData->semId, 0, IPC_RMID);
- printf("DISCOVERY: Detaching from Shared memory\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: Detaching from Shared memory.");
shmdt(discovery->shmBaseAdress);
- printf("DISCOVERY: Destroying Shared memory\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY_SHM: Destroying Shared memory.");
shmctl(discovery->shmId, IPC_RMID, 0);
}
}
@@ -890,7 +890,7 @@ celix_status_t discovery_updateLocalSHMS
if ((status = discovery_lock(shmData->semId, 0)) != CELIX_SUCCESS)
{
- printf("cannot acquire semaphore");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY_SHM: cannot acquire semaphore");
}
else
{
@@ -928,7 +928,7 @@ celix_status_t discovery_updateLocalSHMS
if (hashMap_get(fwServices, srvcName) != NULL)
{
- printf("DISCOVERY : discovery_updateLocalSHMServices : service with url %s from %s already registered", srvcName, uuid);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY : discovery_updateLocalSHMServices : service with url %s from %s already registered", srvcName, uuid);
}
else
{
@@ -958,7 +958,7 @@ celix_status_t discovery_updateLocalSHMS
if (hashMap_get(services, fwurl) == NULL)
{
- printf("DISCOVERY: service with url %s from %s already unregistered", fwurl, uuid);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY_SHM: service with url %s from %s already unregistered", fwurl, uuid);
endpoint_description_pt endpoint = hashMap_get(fwServices, fwurl);
discovery_removeService(discovery, endpoint);
hashMap_remove(fwServices, fwurl);
@@ -984,7 +984,7 @@ celix_status_t discovery_updateLocalSHMS
if ((lclFwServices = (hash_map_pt) hashMapEntry_getValue(lclFwEntry)) == NULL)
{
- printf("UUID %s does not have any services, but a structure\n", fwUUID);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "UUID %s does not have any services, but a structure?", fwUUID);
}
else
{
@@ -1022,7 +1022,7 @@ static void *APR_THREAD_FUNC discovery_p
if ((discovery->shmId < 0) || (discovery->shmBaseAdress == NULL))
{
- printf( "DISCOVERY: shared memory not initialized.");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY_SHM: shared memory not initialized.");
status = CELIX_BUNDLE_EXCEPTION;
}
else
@@ -1033,7 +1033,7 @@ static void *APR_THREAD_FUNC discovery_p
{
if(((status = discovery_lock(shmData->semId, 1)) != CELIX_SUCCESS) && (discovery->running == true))
{
- printf( "DISCOVERY: cannot acquire semaphore. Breaking main poll cycle.");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY_SHM: cannot acquire semaphore. Breaking main poll cycle.");
break;
}
else
Modified: celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c (original)
+++ celix/trunk/remote_services/discovery_shm/private/src/discovery_activator.c Mon Sep 1 05:46:07 2014
@@ -111,7 +111,7 @@ celix_status_t bundleActivator_start(voi
char *uuid = NULL;
bundleContext_getProperty(context, OSGI_FRAMEWORK_FRAMEWORK_UUID, &uuid);
char *scope = apr_pstrcat(activator->pool, "(&(", OSGI_FRAMEWORK_OBJECTCLASS, "=*)(", OSGI_RSA_ENDPOINT_FRAMEWORK_UUID, "=", uuid, "))", NULL);
- printf("DISCOVERY SCOPE IS: %s\n", scope);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY SCOPE IS: %s.", scope);
properties_set(props, (char *) OSGI_ENDPOINT_LISTENER_SCOPE, scope);
status = bundleContext_registerService(context, (char *) OSGI_ENDPOINT_LISTENER_SERVICE, endpointListener, props, &activator->endpointListenerService);
Modified: celix/trunk/remote_services/discovery_slp/private/src/discovery.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/discovery_slp/private/src/discovery.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/remote_services/discovery_slp/private/src/discovery.c (original)
+++ celix/trunk/remote_services/discovery_slp/private/src/discovery.c Mon Sep 1 05:46:07 2014
@@ -94,7 +94,7 @@ celix_status_t discovery_create(apr_pool
(*discovery)->running = true;
(*discovery)->discoveryPort = getenv("RSA_PORT");
if ((*discovery)->discoveryPort == NULL) {
- printf("No RemoteServiceAdmin port set, set it using RSA_PORT!\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "No RemoteServiceAdmin port set, set it using RSA_PORT!");
}
(*discovery)->handled = NULL;
arrayList_create(&(*discovery)->handled);
@@ -109,7 +109,7 @@ celix_status_t discovery_create(apr_pool
celix_status_t discovery_deregisterEndpoint(discovery_pt discovery, const char *serviceUrl) {
celix_status_t status = CELIX_SUCCESS;
- printf("DISCOVERY: Remove endpoint: %s\n", serviceUrl);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: Remove endpoint: %s.", serviceUrl);
SLPError err;
SLPError callbackerr;
@@ -121,7 +121,7 @@ celix_status_t discovery_deregisterEndpo
} else {
err = SLPDereg(slp, serviceUrl, discovery_deregistrationReport, &callbackerr);
if ((err != SLP_OK) || (callbackerr != SLP_OK)) {
- printf("DISCOVERY: Error deregistering service (%s) with slp %i\n", serviceUrl, err);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: Error deregistering service (%s) with slp %d.", serviceUrl, err);
status = CELIX_BUNDLE_EXCEPTION;
}
SLPClose(slp);
@@ -151,7 +151,7 @@ celix_status_t discovery_stop(discovery_
celix_status_t discovery_removeService(discovery_pt discovery, endpoint_description_pt endpoint) {
celix_status_t status = CELIX_SUCCESS;
- printf("DISCOVERY: Remove service (%s)\n", endpoint->service);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: Remove service (%s).", endpoint->service);
// Inform listeners of new endpoint
hash_map_iterator_pt iter = hashMapIterator_create(discovery->listenerReferences);
@@ -186,7 +186,7 @@ celix_status_t discovery_addService(disc
bool matchResult = false;
filter_match(filter, endpoint->properties, &matchResult);
if (matchResult) {
- printf("DISCOVERY: Add service (%s)\n", endpoint->service);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: Add service (%s)", endpoint->service);
bundleContext_getService(discovery->context, reference, (void**)&listener);
discovery_informListener(discovery, listener, endpoint);
}
@@ -245,7 +245,7 @@ void discovery_registrationReport(SLPHan
celix_status_t discovery_endpointAdded(void *handle, endpoint_description_pt endpoint, char *machtedFilter) {
celix_status_t status = CELIX_SUCCESS;
- printf("DISCOVERY: Endpoint for %s, with filter \"%s\" added\n", endpoint->service, machtedFilter);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: Endpoint for %s, with filter \"%s\" added.", endpoint->service, machtedFilter);
discovery_pt discovery = handle;
SLPError err;
SLPError callbackerr;
@@ -275,7 +275,7 @@ celix_status_t discovery_endpointAdded(v
err = SLPReg(slp, serviceUrl, SLP_LIFETIME_MAXIMUM, 0, attributes, SLP_TRUE, discovery_registrationReport, &callbackerr);
if ((err != SLP_OK) || (callbackerr != SLP_OK)) {
status = CELIX_ILLEGAL_STATE;
- printf("DISCOVERY: Error registering service (%s) with slp %i\n", serviceUrl, err);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DISCOVERY: Error registering service (%s) with slp %d", serviceUrl, err);
}
arrayList_add(discovery->registered, serviceUrl);
@@ -292,7 +292,7 @@ void discovery_deregistrationReport(SLPH
celix_status_t discovery_endpointRemoved(void *handle, endpoint_description_pt endpoint, char *machtedFilter) {
celix_status_t status = CELIX_SUCCESS;
- printf("DISCOVERY: Endpoint for %s, with filter \"%s\" removed\n", endpoint->service, machtedFilter);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DISCOVERY: Endpoint for %s, with filter \"%s\" removed.", endpoint->service, machtedFilter);
discovery_pt discovery = handle;
SLPError err;
@@ -340,9 +340,9 @@ celix_status_t discovery_endpointListene
char *discoveryListener = properties_get(serviceProperties, "DISCOVERY");
if (discoveryListener != NULL && strcmp(discoveryListener, "true") == 0) {
- printf("DISCOVERY: EndpointListener Ignored - Discovery listener\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY: EndpointListener Ignored - Discovery listener.");
} else {
- printf("DISCOVERY: EndpointListener Added - Add Scope\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY: EndpointListener Added - Add Scope.");
discovery_updateEndpointListener(discovery, reference, (endpoint_listener_pt) service);
}
@@ -353,7 +353,7 @@ celix_status_t discovery_endpointListene
celix_status_t status = CELIX_SUCCESS;
discovery_pt discovery = handle;
- printf("DISCOVERY: EndpointListener Modified - Update Scope\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY: EndpointListener Modified - Update Scope");
discovery_updateEndpointListener(discovery, reference, (endpoint_listener_pt) service);
return status;
@@ -390,7 +390,7 @@ celix_status_t discovery_endpointListene
celix_status_t status = CELIX_SUCCESS;
discovery_pt discovery = handle;
- printf("DISCOVERY: EndpointListener Removed\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DISCOVERY: EndpointListener Removed.");
hashMap_remove(discovery->listenerReferences, reference);
return status;
Modified: celix/trunk/remote_services/remote_service_admin/private/src/endpoint_description.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin/private/src/endpoint_description.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin/private/src/endpoint_description.c (original)
+++ celix/trunk/remote_services/remote_service_admin/private/src/endpoint_description.c Mon Sep 1 05:46:07 2014
@@ -27,6 +27,7 @@
#include <stdio.h>
#include "celix_errno.h"
+#include "celix_log.h"
#include "endpoint_description.h"
#include "remote_constants.h"
@@ -52,7 +53,7 @@ celix_status_t endpointDescription_creat
(*endpointDescription)->serviceId = serviceId;
if (!(*endpointDescription)->frameworkUUID || !(*endpointDescription)->id || !(*endpointDescription)->service) {
- printf("ENDPOINT_DESCRIPTION: incomplete description!\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "ENDPOINT_DESCRIPTION: incomplete description!.");
status = CELIX_BUNDLE_EXCEPTION;
}
Modified: celix/trunk/remote_services/remote_service_admin_http/private/src/import_registration_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin_http/private/src/import_registration_impl.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin_http/private/src/import_registration_impl.c (original)
+++ celix/trunk/remote_services/remote_service_admin_http/private/src/import_registration_impl.c Mon Sep 1 05:46:07 2014
@@ -127,13 +127,12 @@ celix_status_t importRegistrationFactory
if (status == CELIX_SUCCESS) {
status = bundle_start(registration_factory->bundle);
if (status == CELIX_SUCCESS) {
- printf("%s successfully started\n", name);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "%s successfully started.", name);
}
}
else
{
-
- printf("%s could not be installed.\n", name);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "%s could not be installed.", name);
}
return status;
@@ -215,17 +214,17 @@ celix_status_t importRegistrationFactory
if ( (status = importRegistrationFactory_create(pool, serviceName, context, registration_factory)) != CELIX_SUCCESS)
{
- printf("remoteServiceAdmin_importService: error while creating importRegistrationFactory\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "remoteServiceAdmin_importService: error while creating importRegistrationFactory.");
}
else if ((status = importRegistrationFactory_open(*registration_factory)) != CELIX_SUCCESS)
{
- printf("remoteServiceAdmin_importService: cannot open registration_factory for %s \n", serviceName);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "remoteServiceAdmin_importService: cannot open registration_factory for %s.", serviceName);
importRegistrationFactory_destroy(registration_factory);
}
else
{
importRegistration_createProxyFactoryTracker(*registration_factory, &((*registration_factory)->proxyFactoryTracker));
- printf("remoteServiceAdmin_importService: new registration_factory added for %s at %p\n", serviceName, (*registration_factory)->proxyFactoryTracker);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "remoteServiceAdmin_importService: new registration_factory added for %s at %p", serviceName, (*registration_factory)->proxyFactoryTracker);
}
return status;
Modified: celix/trunk/remote_services/remote_service_admin_shm/private/src/import_registration_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin_shm/private/src/import_registration_impl.c?rev=1621677&r1=1621676&r2=1621677&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin_shm/private/src/import_registration_impl.c (original)
+++ celix/trunk/remote_services/remote_service_admin_shm/private/src/import_registration_impl.c Mon Sep 1 05:46:07 2014
@@ -126,13 +126,13 @@ celix_status_t importRegistrationFactory
if (status == CELIX_SUCCESS) {
status = bundle_start(registration_factory->bundle);
if (status == CELIX_SUCCESS) {
- printf("%s sucessfully started\n", name);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "%s sucessfully started.", name);
}
}
else
{
- printf("%s could not be installed.\n", name);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "%s could not be installed.", name);
}
return status;
@@ -213,17 +213,17 @@ celix_status_t importRegistrationFactory
if ( (status = importRegistrationFactory_create(pool, serviceName, context, registration_factory)) != CELIX_SUCCESS)
{
- printf("remoteServiceAdmin_importService: error while creating importRegistrationFactory\n");
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "remoteServiceAdmin_importService: error while creating importRegistrationFactory.");
}
else if ((status = importRegistrationFactory_open(*registration_factory)) != CELIX_SUCCESS)
{
- printf("remoteServiceAdmin_importService: cannot open registration_factory for %s \n ", serviceName);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "remoteServiceAdmin_importService: cannot open registration_factory for %s.", serviceName);
importRegistrationFactory_destroy(registration_factory);
}
else
{
importRegistration_createProxyFactoryTracker(*registration_factory, &((*registration_factory)->proxyFactoryTracker));
- printf("remoteServiceAdmin_importService: new registration_factory added for %s at %p\n ", serviceName, (*registration_factory)->proxyFactoryTracker);
+ fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "remoteServiceAdmin_importService: new registration_factory added for %s at %p.", serviceName, (*registration_factory)->proxyFactoryTracker);
}
return status;