celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [2/2] celix git commit: CELIX-237: Forwarded and implemented remove export service to export_registration_dfi
Date Wed, 16 Sep 2015 11:03:31 GMT
CELIX-237: Forwarded and implemented remove export service to export_registration_dfi


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/e4d3ea6e
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/e4d3ea6e
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/e4d3ea6e

Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: e4d3ea6e81e5b6d700cff0a6752f0b83dfbc0892
Parents: a477ab9
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Wed Sep 16 13:02:38 2015 +0200
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Wed Sep 16 13:02:38 2015 +0200

----------------------------------------------------------------------
 .../private/include/export_registration_dfi.h   |  2 +-
 .../rsa/private/src/export_registration_dfi.c   |  7 +----
 .../rsa/private/src/remote_service_admin_dfi.c  | 33 ++++++++++++++------
 3 files changed, 26 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/e4d3ea6e/remote_services/remote_service_admin_dfi/rsa/private/include/export_registration_dfi.h
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/include/export_registration_dfi.h
b/remote_services/remote_service_admin_dfi/rsa/private/include/export_registration_dfi.h
index 100294c..4356646 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/include/export_registration_dfi.h
+++ b/remote_services/remote_service_admin_dfi/rsa/private/include/export_registration_dfi.h
@@ -9,7 +9,7 @@
 #include "log_helper.h"
 #include "endpoint_description.h"
 
-celix_status_t exportRegistration_create(log_helper_pt helper, void (*closedCallback)(void
*handle, export_registration_pt reg), void *handle, service_reference_pt reference, endpoint_description_pt
endpoint, bundle_context_pt context, export_registration_pt *registration);
+celix_status_t exportRegistration_create(log_helper_pt helper, service_reference_pt reference,
endpoint_description_pt endpoint, bundle_context_pt context, export_registration_pt *registration);
 void exportRegistration_destroy(export_registration_pt registration);
 
 celix_status_t exportRegistration_start(export_registration_pt registration);

http://git-wip-us.apache.org/repos/asf/celix/blob/e4d3ea6e/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c
b/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c
index 9bc5b08..edc085e 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c
+++ b/remote_services/remote_service_admin_dfi/rsa/private/src/export_registration_dfi.c
@@ -18,8 +18,6 @@ struct export_reference {
 
 struct export_registration {
     bundle_context_pt  context;
-    void (*rsaCloseExportCallback)(void *handle, export_registration_pt reg);
-    void *handle;
     struct export_reference exportReference;
     char *servId;
     dyn_interface_type *intf; //owner
@@ -35,7 +33,7 @@ struct export_registration {
 static void exportRegistration_addServ(export_registration_pt reg, service_reference_pt ref,
void *service);
 static void exportRegistration_removeServ(export_registration_pt reg, service_reference_pt
ref, void *service);
 
-celix_status_t exportRegistration_create(log_helper_pt helper, void (*closedCallback)(void
*handle, export_registration_pt reg), void *handle, service_reference_pt reference, endpoint_description_pt
endpoint, bundle_context_pt context, export_registration_pt *out) {
+celix_status_t exportRegistration_create(log_helper_pt helper, service_reference_pt reference,
endpoint_description_pt endpoint, bundle_context_pt context, export_registration_pt *out)
{
     celix_status_t status = CELIX_SUCCESS;
 
     char *servId = NULL;
@@ -55,8 +53,6 @@ celix_status_t exportRegistration_create(log_helper_pt helper, void (*closedCall
 
     if (status == CELIX_SUCCESS) {
         reg->context = context;
-        reg->rsaCloseExportCallback = closedCallback;
-        reg->handle = handle;
         reg->exportReference.endpoint = endpoint;
         reg->exportReference.reference = reference;
         reg->closed = false;
@@ -183,7 +179,6 @@ celix_status_t exportRegistration_stop(export_registration_pt reg) {
 celix_status_t exportRegistration_close(export_registration_pt reg) {
     celix_status_t status = CELIX_SUCCESS;
     exportRegistration_stop(reg);
-    reg->rsaCloseExportCallback(reg->handle, reg);
     return status;
 }
 

http://git-wip-us.apache.org/repos/asf/celix/blob/e4d3ea6e/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c
b/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c
index c12d0aa..54d08d3 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c
+++ b/remote_services/remote_service_admin_dfi/rsa/private/src/remote_service_admin_dfi.c
@@ -49,6 +49,16 @@
 // defines how often the webserver is restarted (with an increased port number)
 #define MAX_NUMBER_OF_RESTARTS 	5
 
+
+#define LOG_ERROR(admin, msg, ...) \
+    logHelper_log((admin)->loghelper, OSGI_LOGSERVICE_ERROR, (msg),  ##__VA_ARGS__)
+
+#define LOG_WARNING(admin, msg, ...) \
+    logHelper_log((admin)->loghelper, OSGI_LOGSERVICE_ERROR, (msg),  ##__VA_ARGS__)
+
+#define LOG_DEBUG(admin, msg, ...) \
+    logHelper_log((admin)->loghelper, OSGI_LOGSERVICE_ERROR, (msg),  ##__VA_ARGS__)
+
 struct remote_service_admin {
     bundle_context_pt context;
     log_helper_pt loghelper;
@@ -413,7 +423,7 @@ celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt
admin, c
         remoteServiceAdmin_createEndpointDescription(admin, reference, interface, &endpoint);
         printf("RSA: Creating export registration with endpoint pointer %p\n", endpoint);
         //TOOD precheck if descriptor exists
-        status = exportRegistration_create(admin->loghelper, remoteServiceAdmin_removeExportedService,
admin, reference, endpoint, admin->context, &registration);
+        status = exportRegistration_create(admin->loghelper, reference, endpoint, admin->context,
&registration);
         if (status == CELIX_SUCCESS) {
             status = exportRegistration_start(registration);
             if (status == CELIX_SUCCESS) {
@@ -434,17 +444,22 @@ celix_status_t remoteServiceAdmin_exportService(remote_service_admin_pt
admin, c
 
 celix_status_t remoteServiceAdmin_removeExportedService(remote_service_admin_pt admin, export_registration_pt
registration) {
     celix_status_t status = CELIX_SUCCESS;
-    //TODO
-    /*
-    remote_service_admin_pt admin = registration->rsa;
 
-    celixThreadMutex_lock(&admin->exportedServicesLock);
+    service_reference_pt  ref = NULL;
+    status = exportRegistration_getExportReference(registration, &ref);
+
+    if (status == CELIX_SUCCESS) {
+        celixThreadMutex_lock(&admin->exportedServicesLock);
+        exportRegistration_close(registration);
+        //exportRegistration_destroy(registration); TODO test
+        hashMap_remove(admin->exportedServices, ref);
+        celixThreadMutex_unlock(&admin->exportedServicesLock);
+    } else {
+        LOG_ERROR(admin, "Cannot find reference for registration");
+    }
+
 
-    hashMap_remove(admin->exportedServices, registration->reference);
-    //TODO stop ?
 
-    celixThreadMutex_unlock(&admin->exportedServicesLock);
-    */
     return status;
 }
 


Mime
View raw message