Author: bpetri
Date: Sat Nov 22 10:38:12 2014
New Revision: 1641042
URL: http://svn.apache.org/r1641042
Log:
CELIX-182: replaced rsa fw_log calls w/ loghelper
Modified:
celix/trunk/remote_services/remote_service_admin/private/include/export_registration_impl.h
celix/trunk/remote_services/remote_service_admin/private/include/import_registration_impl.h
celix/trunk/remote_services/remote_service_admin_http/CMakeLists.txt
celix/trunk/remote_services/remote_service_admin_http/private/include/remote_service_admin_http_impl.h
celix/trunk/remote_services/remote_service_admin_http/private/src/export_registration_impl.c
celix/trunk/remote_services/remote_service_admin_http/private/src/import_registration_impl.c
celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
celix/trunk/remote_services/remote_service_admin_shm/CMakeLists.txt
Modified: celix/trunk/remote_services/remote_service_admin/private/include/export_registration_impl.h
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin/private/include/export_registration_impl.h?rev=1641042&r1=1641041&r2=1641042&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin/private/include/export_registration_impl.h
(original)
+++ celix/trunk/remote_services/remote_service_admin/private/include/export_registration_impl.h
Sat Nov 22 10:38:12 2014
@@ -30,6 +30,7 @@
#include "remote_service_admin.h"
#include "remote_endpoint.h"
#include "service_tracker.h"
+#include "log_helper.h"
struct export_registration {
apr_pool_t *pool;
@@ -37,6 +38,7 @@ struct export_registration {
remote_service_admin_pt rsa;
endpoint_description_pt endpointDescription;
service_reference_pt reference;
+ log_helper_pt loghelper;
service_tracker_pt tracker;
service_tracker_pt endpointTracker;
Modified: celix/trunk/remote_services/remote_service_admin/private/include/import_registration_impl.h
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin/private/include/import_registration_impl.h?rev=1641042&r1=1641041&r2=1641042&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin/private/include/import_registration_impl.h
(original)
+++ celix/trunk/remote_services/remote_service_admin/private/include/import_registration_impl.h
Sat Nov 22 10:38:12 2014
@@ -30,6 +30,7 @@
#include "remote_service_admin.h"
#include "remote_proxy.h"
#include "service_tracker.h"
+#include "log_helper.h"
struct import_registration {
apr_pool_t *pool;
@@ -51,6 +52,7 @@ struct import_registration_factory
{
apr_pool_t *pool;
char* serviceName;
+ log_helper_pt loghelper;
remote_proxy_factory_service_pt trackedFactory;
service_tracker_pt proxyFactoryTracker;
bundle_context_pt context;
Modified: celix/trunk/remote_services/remote_service_admin_http/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin_http/CMakeLists.txt?rev=1641042&r1=1641041&r2=1641042&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin_http/CMakeLists.txt (original)
+++ celix/trunk/remote_services/remote_service_admin_http/CMakeLists.txt Sat Nov 22 10:38:12
2014
@@ -20,6 +20,7 @@ find_package(CURL REQUIRED)
include_directories(${CURL_INCLUDE_DIRS})
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
include_directories("${PROJECT_SOURCE_DIR}/remote_services/utils/private/include")
include_directories("${PROJECT_SOURCE_DIR}/remote_services/utils/public/include")
include_directories("${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/public/include")
@@ -37,6 +38,7 @@ bundle(remote_service_admin_http SOURCES
private/src/import_registration_impl
private/src/remote_service_admin_activator
${PROJECT_SOURCE_DIR}/remote_services/utils/private/src/civetweb.c
+ ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
)
install_bundle(remote_service_admin_http)
Modified: celix/trunk/remote_services/remote_service_admin_http/private/include/remote_service_admin_http_impl.h
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin_http/private/include/remote_service_admin_http_impl.h?rev=1641042&r1=1641041&r2=1641042&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin_http/private/include/remote_service_admin_http_impl.h
(original)
+++ celix/trunk/remote_services/remote_service_admin_http/private/include/remote_service_admin_http_impl.h
Sat Nov 22 10:38:12 2014
@@ -28,11 +28,13 @@
#define REMOTE_SERVICE_ADMIN_HTTP_IMPL_H_
#include "remote_service_admin_impl.h"
+#include "log_helper.h"
#include "civetweb.h"
struct remote_service_admin {
apr_pool_t *pool;
bundle_context_pt context;
+ log_helper_pt loghelper;
hash_map_pt exportedServices;
hash_map_pt importedServices;
Modified: celix/trunk/remote_services/remote_service_admin_http/private/src/export_registration_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin_http/private/src/export_registration_impl.c?rev=1641042&r1=1641041&r2=1641042&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin_http/private/src/export_registration_impl.c
(original)
+++ celix/trunk/remote_services/remote_service_admin_http/private/src/export_registration_impl.c
Sat Nov 22 10:38:12 2014
@@ -36,7 +36,7 @@
#include "service_tracker.h"
#include "bundle_context.h"
#include "bundle.h"
-#include "celix_log.h"
+#include "log_helper.h"
celix_status_t exportRegistration_endpointAdding(void * handle, service_reference_pt reference,
void **service);
celix_status_t exportRegistration_endpointAdded(void * handle, service_reference_pt reference,
void *service);
@@ -65,11 +65,13 @@ celix_status_t exportRegistration_create
(*registration)->endpointTracker = NULL;
(*registration)->exportReference = NULL;
(*registration)->bundle = NULL;
+ (*registration)->loghelper = NULL;
}
return status;
}
+
celix_status_t exportRegistration_startTracking(export_registration_pt registration) {
celix_status_t status = CELIX_SUCCESS;
@@ -89,13 +91,13 @@ celix_status_t exportRegistration_stopTr
if (registration->endpointTracker != NULL) {
status = serviceTracker_close(registration->endpointTracker);
if (status != CELIX_SUCCESS) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "EXPORT_REGISTRATION: Could not close endpoint
tracker");
+ logHelper_log(registration->loghelper, OSGI_FRAMEWORK_LOG_ERROR, "EXPORT_REGISTRATION:
Could not close endpoint tracker");
}
}
if (registration->tracker != NULL) {
status = serviceTracker_close(registration->tracker);
if (status != CELIX_SUCCESS) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "EXPORT_REGISTRATION: Could not close service
tracker");
+ logHelper_log(registration->loghelper, OSGI_FRAMEWORK_LOG_ERROR, "EXPORT_REGISTRATION:
Could not close service tracker");
}
}
@@ -165,9 +167,14 @@ celix_status_t exportRegistration_endpoi
celix_status_t exportRegistration_open(export_registration_pt registration) {
celix_status_t status = CELIX_SUCCESS;
-
char *bundleStore = NULL;
+
+ if(logHelper_create(registration->context, ®istration->loghelper) == CELIX_SUCCESS)
{
+ logHelper_start(registration->loghelper);
+ }
+
bundleContext_getProperty(registration->context, BUNDLE_STORE_PROPERTY_NAME, &bundleStore);
+
if (bundleStore == NULL) {
bundleStore = DEFAULT_BUNDLE_STORE;
}
@@ -190,6 +197,9 @@ celix_status_t exportRegistration_close(
bundle_uninstall(registration->bundle);
remoteServiceAdmin_removeExportedService(registration);
+ logHelper_stop(registration->loghelper);
+ logHelper_destroy(®istration->loghelper);
+
return status;
}
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=1641042&r1=1641041&r2=1641042&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
Sat Nov 22 10:38:12 2014
@@ -86,7 +86,12 @@ celix_status_t importRegistrationFactory
(*registration_factory)->pool = mypool;
(*registration_factory)->context = context;
(*registration_factory)->bundle = NULL;
+
arrayList_create(&(*registration_factory)->registrations);
+
+ if (logHelper_create(context, &(*registration_factory)->loghelper) == CELIX_SUCCESS)
{
+ logHelper_start((*registration_factory)->loghelper);
+ }
}
return status;
@@ -97,6 +102,9 @@ celix_status_t importRegistrationFactory
celix_status_t importRegistrationFactory_destroy(import_registration_factory_pt* registration_factory)
{
celix_status_t status = CELIX_SUCCESS;
+ logHelper_stop((*registration_factory)->loghelper);
+ logHelper_destroy(&(*registration_factory)->loghelper);
+
if (*registration_factory != NULL)
{
free((*registration_factory)->serviceName);
@@ -127,12 +135,11 @@ celix_status_t importRegistrationFactory
if (status == CELIX_SUCCESS) {
status = bundle_start(registration_factory->bundle);
if (status == CELIX_SUCCESS) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "%s successfully started.", name);
+ logHelper_log(registration_factory->loghelper, OSGI_FRAMEWORK_LOG_INFO, "%s successfully
started.", name);
}
}
- else
- {
- fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "%s could not be installed.", name);
+ else {
+ logHelper_log(registration_factory->loghelper, OSGI_FRAMEWORK_LOG_ERROR, "%s could not
be installed.", name);
}
return status;
@@ -212,26 +219,21 @@ celix_status_t importRegistration_proxyF
celix_status_t importRegistrationFactory_install(apr_pool_t *pool, char* serviceName, bundle_context_pt
context, import_registration_factory_pt *registration_factory)
{
- celix_status_t status = CELIX_SUCCESS;
+ celix_status_t status = CELIX_BUNDLE_EXCEPTION;
- if ( (status = importRegistrationFactory_create(pool, serviceName, context, registration_factory))
!= CELIX_SUCCESS)
- {
- fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "remoteServiceAdmin_importService: error while
creating importRegistrationFactory.");
- }
- else
- {
+ if ( (status = importRegistrationFactory_create(pool, serviceName, context, registration_factory))
== CELIX_SUCCESS) {
// starting the proxy tracker first allows us to pick up already available proxy factories
importRegistration_createProxyFactoryTracker(*registration_factory, &((*registration_factory)->proxyFactoryTracker));
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "remoteServiceAdmin_importService: new registration_factory
added for %s at %p", serviceName, (*registration_factory)->proxyFactoryTracker);
+ logHelper_log((*registration_factory)->loghelper, OSGI_FRAMEWORK_LOG_INFO, "remoteServiceAdmin_importService:
new registration_factory added for %s at %p", serviceName, (*registration_factory)->proxyFactoryTracker);
// check whether factory is available
- if (((*registration_factory)->trackedFactory == NULL) && ((status = importRegistrationFactory_open(*registration_factory))
!= CELIX_SUCCESS))
- {
- fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "remoteServiceAdmin_importService: cannot open
registration_factory for %s.", serviceName);
+ if (((*registration_factory)->trackedFactory == NULL) && ((status = importRegistrationFactory_open(*registration_factory))
!= CELIX_SUCCESS)) {
+ logHelper_log((*registration_factory)->loghelper, OSGI_FRAMEWORK_LOG_ERROR, "remoteServiceAdmin_importService:
cannot open registration_factory for %s.", serviceName);
importRegistrationFactory_destroy(registration_factory);
serviceTracker_close((*registration_factory)->proxyFactoryTracker);
}
}
+
return status;
}
Modified: celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c?rev=1641042&r1=1641041&r2=1641042&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
(original)
+++ celix/trunk/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
Sat Nov 22 10:38:12 2014
@@ -109,6 +109,10 @@ celix_status_t remoteServiceAdmin_create
(*admin)->exportedServices = hashMap_create(NULL, NULL, NULL, NULL);
(*admin)->importedServices = hashMap_create(NULL, NULL, NULL, NULL);
+ if (logHelper_create(context, &(*admin)->loghelper) == CELIX_SUCCESS) {
+ logHelper_start((*admin)->loghelper);
+ }
+
bundleContext_getProperty(context, "RSA_PORT", &port);
if (port == NULL) {
port = (char *)DEFAULT_PORT;
@@ -120,7 +124,7 @@ celix_status_t remoteServiceAdmin_create
bundleContext_getProperty(context, "RSA_INTERFACE", &interface);
if ((interface != NULL) && (remoteServiceAdmin_getIpAdress(interface, &ip)
!= CELIX_SUCCESS)) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "RSA: Could not retrieve IP adress for interface
%s", interface);
+ logHelper_log((*admin)->loghelper, OSGI_FRAMEWORK_LOG_WARNING, "RSA: Could not retrieve
IP adress for interface %s", interface);
}
if (ip == NULL) {
@@ -129,11 +133,11 @@ celix_status_t remoteServiceAdmin_create
}
if (ip != NULL) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "RSA: Using %s for service annunciation", ip);
+ logHelper_log((*admin)->loghelper, OSGI_FRAMEWORK_LOG_INFO, "RSA: Using %s for service
annunciation", ip);
(*admin)->ip = apr_pstrdup(pool, ip);
}
else {
- fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "RSA: No IP address for service annunciation
set. Using %s", DEFAULT_IP);
+ logHelper_log((*admin)->loghelper, OSGI_FRAMEWORK_LOG_WARNING, "RSA: No IP address
for service annunciation set. Using %s", DEFAULT_IP);
(*admin)->ip = (char*) DEFAULT_IP;
}
@@ -148,7 +152,7 @@ celix_status_t remoteServiceAdmin_create
(*admin)->ctx = mg_start(&callbacks, (*admin), options);
if ((*admin)->ctx != NULL) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "RSA: Start webserver: %s", port);
+ logHelper_log((*admin)->loghelper, OSGI_FRAMEWORK_LOG_INFO, "RSA: Start webserver:
%s", port);
(*admin)->port = port;
}
else {
@@ -164,7 +168,7 @@ celix_status_t remoteServiceAdmin_create
port_counter++;
snprintf(newPort, 6, "%d", (currentPort+1));
- fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error while starting rsa server on port %s
- retrying on port %s...", port, newPort);
+ logHelper_log((*admin)->loghelper, OSGI_FRAMEWORK_LOG_ERROR, "Error while starting
rsa server on port %s - retrying on port %s...", port, newPort);
port = newPort;
}
} while(((*admin)->ctx == NULL) && (port_counter < MAX_NUMBER_OF_RESTARTS));
@@ -206,11 +210,14 @@ celix_status_t remoteServiceAdmin_stop(r
hashMapIterator_destroy(iter);
if (admin->ctx != NULL) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "RSA: Stopping webserver...");
+ logHelper_log(admin->loghelper, OSGI_FRAMEWORK_LOG_INFO, "RSA: Stopping webserver...");
mg_stop(admin->ctx);
admin->ctx = NULL;
}
+ logHelper_stop(admin->loghelper);
+ logHelper_destroy(&admin->loghelper);
+
return status;
}
@@ -316,7 +323,7 @@ celix_status_t remoteServiceAdmin_export
}
if (reference == NULL) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "ERROR: expected a reference for service id %s.",
serviceId);
+ logHelper_log(admin->loghelper, OSGI_FRAMEWORK_LOG_ERROR, "ERROR: expected a reference
for service id %s.", serviceId);
return CELIX_ILLEGAL_STATE;
}
@@ -326,9 +333,9 @@ celix_status_t remoteServiceAdmin_export
serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_OBJECTCLASS, &provided);
if (exports == NULL || provided == NULL) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "RSA: No Services to export.");
+ logHelper_log(admin->loghelper, OSGI_FRAMEWORK_LOG_WARNING, "RSA: No Services to export.");
} else {
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "RSA: Export services (%s)", exports);
+ logHelper_log(admin->loghelper, OSGI_FRAMEWORK_LOG_INFO, "RSA: Export services (%s)",
exports);
array_list_pt interfaces = NULL;
arrayList_create(&interfaces);
if (strcmp(utils_stringTrim(exports), "*") == 0) {
@@ -499,7 +506,7 @@ celix_status_t remoteServiceAdmin_getImp
celix_status_t remoteServiceAdmin_importService(remote_service_admin_pt admin, endpoint_description_pt
endpointDescription, import_registration_pt *registration) {
celix_status_t status = CELIX_SUCCESS;
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "RSA: Import service %s", endpointDescription->service);
+ logHelper_log(admin->loghelper, OSGI_FRAMEWORK_LOG_INFO, "RSA: Import service %s", endpointDescription->service);
import_registration_factory_pt registration_factory = (import_registration_factory_pt)
hashMap_get(admin->importedServices, endpointDescription->service);
@@ -515,7 +522,7 @@ celix_status_t remoteServiceAdmin_import
// factory available
if (status != CELIX_SUCCESS || (registration_factory->trackedFactory == NULL))
{
- fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "RSA: no proxyFactory available.");
+ logHelper_log(admin->loghelper, OSGI_FRAMEWORK_LOG_WARNING, "RSA: no proxyFactory available.");
}
else
{
@@ -538,7 +545,7 @@ celix_status_t remoteServiceAdmin_remove
// factory available
if ((registration_factory == NULL) || (registration_factory->trackedFactory == NULL))
{
- fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "RSA: Error while retrieving registration factory
for imported service %s", endpointDescription->service);
+ logHelper_log(admin->loghelper, OSGI_FRAMEWORK_LOG_ERROR, "RSA: Error while retrieving
registration factory for imported service %s", endpointDescription->service);
}
else
{
@@ -548,7 +555,7 @@ celix_status_t remoteServiceAdmin_remove
if (arrayList_isEmpty(registration_factory->registrations))
{
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "RSA: closing proxy");
+ logHelper_log(admin->loghelper, OSGI_FRAMEWORK_LOG_INFO, "RSA: closing proxy.");
serviceTracker_close(registration_factory->proxyFactoryTracker);
importRegistrationFactory_close(registration_factory);
@@ -620,7 +627,7 @@ static size_t remoteServiceAdmin_write(v
mem->writeptr = realloc(mem->writeptr, mem->size + realsize + 1);
if (mem->writeptr == NULL) {
/* out of memory! */
- fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "not enough memory (realloc returned NULL)");
+ printf("not enough memory (realloc returned NULL)");
exit(EXIT_FAILURE);
}
Modified: celix/trunk/remote_services/remote_service_admin_shm/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/trunk/remote_services/remote_service_admin_shm/CMakeLists.txt?rev=1641042&r1=1641041&r2=1641042&view=diff
==============================================================================
--- celix/trunk/remote_services/remote_service_admin_shm/CMakeLists.txt (original)
+++ celix/trunk/remote_services/remote_service_admin_shm/CMakeLists.txt Sat Nov 22 10:38:12
2014
@@ -19,6 +19,7 @@ if (RSA_BUNDLES_REMOTE_SERVICE_ADMIN_SHM
link_directories("/opt/local/lib")
include_directories("/opt/local/include")
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+ include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
include_directories("${PROJECT_SOURCE_DIR}/framework/private/include")
include_directories("${PROJECT_SOURCE_DIR}/remote_services/utils/public/include")
@@ -37,6 +38,7 @@ if (RSA_BUNDLES_REMOTE_SERVICE_ADMIN_SHM
private/src/export_registration_impl
private/src/import_registration_impl
private/src/remote_service_admin_activator
+ ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
)
install_bundle(remote_service_admin_shm
|