You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2015/10/13 12:21:49 UTC
[21/50] [abbrv] celix git commit: CELIX-237: Refactor
import/export_registration moved all json stuff to json_serializer.c
CELIX-237: Refactor import/export_registration moved all json stuff to json_serializer.c
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/fdade6aa
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/fdade6aa
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/fdade6aa
Branch: refs/heads/develop
Commit: fdade6aaafba00b95fa30c280e36cca29adcb938
Parents: a129b48
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Thu Aug 13 12:43:23 2015 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Thu Aug 13 12:43:23 2015 +0200
----------------------------------------------------------------------
.../remote_service_admin_dfi/CMakeLists.txt | 12 +-
.../dynamic_function_interface/dyn_function.h | 4 +-
.../dynamic_function_interface/dyn_interface.h | 7 +-
.../dynamic_function_interface/dyn_type.h | 1 -
.../json_serializer.c | 122 ++++++++++++++++---
.../json_serializer.h | 9 +-
.../remote_service_admin_dfi/rsa/CMakeLists.txt | 20 +--
.../rsa/private/src/export_registration_dfi.c | 76 +-----------
.../rsa/private/src/import_registration_dfi.c | 46 +++----
.../rsa/private/src/remote_service_admin_dfi.c | 2 +
.../rsa_tst/bundle/tst_activator.c | 2 +-
11 files changed, 154 insertions(+), 147 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/fdade6aa/remote_services/remote_service_admin_dfi/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/CMakeLists.txt b/remote_services/remote_service_admin_dfi/CMakeLists.txt
index ccd01f9..7f9404c 100644
--- a/remote_services/remote_service_admin_dfi/CMakeLists.txt
+++ b/remote_services/remote_service_admin_dfi/CMakeLists.txt
@@ -7,7 +7,7 @@ if (RSA_REMOTE_SERVICE_ADMIN_DFI)
find_package(CURL REQUIRED)
find_package(Jansson REQUIRED)
find_package(FFI REQUIRED)
- #TODO if test
+ #TODO if test check
find_package(CppUTest REQUIRED)
include_directories(
@@ -20,17 +20,15 @@ if (RSA_REMOTE_SERVICE_ADMIN_DFI)
include_directories(dynamic_function_interface/memstream)
endif()
- #TODO if test
+ #TODO if test check
include_directories(${CPPUTEST_INCLUDE_DIR})
-
add_subdirectory(dynamic_function_interface)
- #TODO if test
- add_subdirectory(dynamic_function_interface_tst)
-
add_subdirectory(rsa)
- #TODO if test
+
+ #TODO if test check
+ add_subdirectory(dynamic_function_interface_tst)
add_subdirectory(rsa_tst)
endif()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/fdade6aa/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_function.h
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_function.h b/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_function.h
index 5cbf686..e99bc7a 100644
--- a/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_function.h
+++ b/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_function.h
@@ -18,7 +18,7 @@
* e.g add(DD)D or sum({[D[D setA setB})D
*/
-//TODO maybe refactor to meta info flags (e.g context/handler, output, etc with a start/stop -> M(MetaType);
+typedef struct _dyn_function_type dyn_function_type;
#define DYN_FUNCTION_ARG_META_UNKNOWN_TYPE 0
#define DYN_FUNCTION_ARG_META_INPUT_TYPE 1
@@ -27,8 +27,6 @@
#define DYN_FUNCTION_ARG_META_HANDLE_TYPE 4
//TODO input/output types?
-typedef struct _dyn_function_type dyn_function_type;
-
DFI_SETUP_LOG_HEADER(dynFunction);
int dynFunction_parse(FILE *descriptorStream, struct types_head *refTypes, dyn_function_type **dynFunc);
http://git-wip-us.apache.org/repos/asf/celix/blob/fdade6aa/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_interface.h
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_interface.h b/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_interface.h
index f005bff..d13aa67 100644
--- a/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_interface.h
+++ b/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_interface.h
@@ -22,14 +22,9 @@ DFI_SETUP_LOG_HEADER(dynInterface);
* ':methods\n' [MethodIdValue]
*
*/
-
-//struct namvals_head in dyn_common.h
-TAILQ_HEAD(methods_head, method_entry);
-//struct reference_types_head in dyn_type.h
-
typedef struct _dyn_interface_type dyn_interface_type;
-
+TAILQ_HEAD(methods_head, method_entry);
struct method_entry {
int index;
char *id;
http://git-wip-us.apache.org/repos/asf/celix/blob/fdade6aa/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.h
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.h b/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.h
index a409ff5..2058c41 100644
--- a/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.h
+++ b/remote_services/remote_service_admin_dfi/dynamic_function_interface/dyn_type.h
@@ -83,7 +83,6 @@
typedef struct _dyn_type dyn_type;
-//TODO rename
TAILQ_HEAD(types_head, type_entry);
struct type_entry {
dyn_type *type;
http://git-wip-us.apache.org/repos/asf/celix/blob/fdade6aa/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c b/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c
index a2cc34e..a689483 100644
--- a/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c
+++ b/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.c
@@ -3,6 +3,7 @@
*/
#include "json_serializer.h"
#include "dyn_type.h"
+#include "dyn_interface.h"
#include <jansson.h>
#include <assert.h>
@@ -26,6 +27,13 @@ static int ERROR = 1;
DFI_SETUP_LOG(jsonSerializer);
+typedef void (*gen_func_type)(void);
+
+struct generic_service_layout {
+ void *handle;
+ gen_func_type methods[];
+};
+
int jsonSerializer_deserialize(dyn_type *type, const char *input, void **result) {
assert(dynType_type(type) == DYN_TYPE_COMPLEX);
int status = 0;
@@ -416,13 +424,60 @@ static int jsonSerializer_writeComplex(dyn_type *type, void *input, json_t **out
return status;
}
-int jsonSerializer_call(dyn_function_type *func, void *handle, void (*fp)(void), json_t *arguments, json_t **out) {
+int jsonSerializer_call(dyn_interface_type *intf, void *service, const char *request, char **out) {
int status = OK;
- int nrOfArgs = dynFunction_nrOfArguments(func);
- void *args[nrOfArgs];
+ LOG_DEBUG("Parsing data: %s\n", request);
+ json_error_t error;
+ json_t *js_request = json_loads(request, 0, &error);
+ json_t *arguments = NULL;
+ const char *sig;
+ if (js_request) {
+ if (json_unpack(js_request, "{s:s}", "m", &sig) != 0) {
+ LOG_ERROR("Got json error '%s'\n", error.text);
+ } else {
+ arguments = json_object_get(js_request, "a");
+ }
+ } else {
+ LOG_ERROR("Got json error '%s' for '%s'\n", error.text, request);
+ return 0;
+ }
+ LOG_DEBUG("Looking for method %s\n", sig);
+ struct methods_head *methods = NULL;
+ dynInterface_methods(intf, &methods);
+ struct method_entry *entry = NULL;
+ struct method_entry *method = NULL;
+ TAILQ_FOREACH(entry, methods, entries) {
+ if (strcmp(sig, entry->id) == 0) {
+ method = entry;
+ break;
+ }
+ }
+
+ if (method == NULL) {
+ status = ERROR;
+ LOG_ERROR("Cannot find method with sig '%s'", sig);
+ } else {
+ LOG_DEBUG("RSA: found method '%s'\n", entry->id);
+ }
+ void (*fp)(void) = NULL;
+ void *handle = NULL;
+ if (status == OK) {
+ struct generic_service_layout *serv = service;
+ handle = serv->handle;
+ fp = serv->methods[method->index];
+ }
+
+ dyn_function_type *func = NULL;
+ int nrOfArgs = 0;
+ if (status == OK) {
+ nrOfArgs = dynFunction_nrOfArguments(entry->dynFunc);
+ func = entry->dynFunc;
+ }
+
+ void *args[nrOfArgs];
json_t *value = NULL;
@@ -451,6 +506,7 @@ int jsonSerializer_call(dyn_function_type *func, void *handle, void (*fp)(void),
break;
}
}
+ json_decref(js_request);
//TODO assert return type is native int
@@ -460,12 +516,14 @@ int jsonSerializer_call(dyn_function_type *func, void *handle, void (*fp)(void),
double **r = args[2];
printf("result ptrptr is %p, result ptr %p, result is %f\n", r, *r, **r);
+
+ json_t *jsonResult = NULL;
for (i = 0; i < nrOfArgs; i += 1) {
int metaInfo = dynFunction_argumentMetaInfoForIndex(func, i);
dyn_type *argType = dynFunction_argumentTypeForIndex(func, i);
if (metaInfo == DYN_FUNCTION_ARG_META_PRE_ALLOCATED_OUTPUT_TYPE) {
if (status == OK) {
- status = jsonSerializer_serializeJson(argType, args[i], out);
+ status = jsonSerializer_serializeJson(argType, args[i], &jsonResult);
}
} else if (metaInfo == DYN_FUNCTION_ARG_META_OUTPUT_TYPE) {
printf("TODO\n");
@@ -477,17 +535,41 @@ int jsonSerializer_call(dyn_function_type *func, void *handle, void (*fp)(void),
}
}
+ char *response = NULL;
+ if (status == OK) {
+ LOG_DEBUG("creating payload\n");
+ json_t *payload = json_object();
+ json_object_set_new(payload, "r", jsonResult);
+ response = json_dumps(payload, JSON_DECODE_ANY);
+ json_decref(payload);
+ LOG_DEBUG("status ptr is %p. response if '%s'\n", status, response);
+ }
+
+ if (status == OK) {
+ *out = response;
+ } else {
+ if (response != NULL) {
+ free(response);
+ }
+ }
+
//TODO free args (created by jsonSerializer and dynType_alloc) (dynType_free)
return status;
}
-int jsonSerializer_prepareArguments(dyn_function_type *func, void *args[], json_t **out) {
+int jsonSerializer_prepareInvokeRequest(dyn_function_type *func, const char *id, void *args[], char **out) {
int status = OK;
+
+
+ LOG_DEBUG("Calling remote function '%s'\n", id);
+ json_t *invoke = json_object();
+ json_object_set(invoke, "m", json_string(id));
+
json_t *arguments = json_array();
+ json_object_set_new(invoke, "a", arguments);
int i;
int nrOfArgs = dynFunction_nrOfArguments(func);
-
for (i = 0; i < nrOfArgs; i +=1) {
if (dynFunction_argumentMetaInfoForIndex(func, i) == DYN_FUNCTION_ARG_META_INPUT_TYPE) {
json_t *val = NULL;
@@ -504,34 +586,46 @@ int jsonSerializer_prepareArguments(dyn_function_type *func, void *args[], json_
}
}
+ char *invokeStr = json_dumps(invoke, JSON_DECODE_ANY);
+ json_decref(invoke);
+
if (status == OK) {
- *out = arguments;
+ *out = invokeStr;
}
return status;
}
-int jsonSerializer_handleReply(dyn_function_type *func, void *handle, json_t *reply, void *args[]) {
+int jsonSerializer_handleReply(dyn_function_type *func, const char *reply, void *args[]) {
int status = 0;
+ json_t *replyJson = json_loads(reply, JSON_DECODE_ANY, NULL); //TODO check
+ json_t *result = json_object_get(replyJson, "r"); //TODO check
+
+ LOG_DEBUG("replyJson ptr is %p and result ptr is %p\n", replyJson, result);
+
int nrOfArgs = dynFunction_nrOfArguments(func);
int i;
for (i = 0; i < nrOfArgs; i += 1) {
dyn_type *argType = dynFunction_argumentTypeForIndex(func, i);
int metaInf = dynFunction_argumentMetaInfoForIndex(func, i);
if (metaInf == DYN_FUNCTION_ARG_META_PRE_ALLOCATED_OUTPUT_TYPE) {
- void **tmp = NULL;
+ dyn_type *subType = NULL;
+ dynType_typedPointer_getTypedType(argType, &subType);
+ void *tmp = NULL;
+ size_t size = dynType_size(subType);
+ status = jsonSerializer_deserializeJson(subType, result, &tmp);
void **out = (void **)args[i];
- size_t size = dynType_size(argType);
- status = jsonSerializer_deserializeJson(argType, reply, (void **)&tmp);
- memcpy(*out, *tmp, size);
- dynType_free(argType, tmp);
+ memcpy(*out, tmp, size);
+ dynType_free(subType, tmp);
} else if (metaInf == DYN_FUNCTION_ARG_META_OUTPUT_TYPE) {
assert(false); //TODO
} else {
- //skipt handle and input types
+ //skip handle and input types
}
}
+ json_decref(replyJson);
+
return status;
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/celix/blob/fdade6aa/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.h
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.h b/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.h
index 0853114..6e7ee7d 100644
--- a/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.h
+++ b/remote_services/remote_service_admin_dfi/dynamic_function_interface/json_serializer.h
@@ -8,6 +8,7 @@
#include "dfi_log_util.h"
#include "dyn_type.h"
#include "dyn_function.h"
+#include "dyn_interface.h"
//logging
DFI_SETUP_LOG_HEADER(jsonSerializer);
@@ -18,10 +19,8 @@ int jsonSerializer_deserializeJson(dyn_type *type, json_t *input, void **result)
int jsonSerializer_serialize(dyn_type *type, void *input, char **output);
int jsonSerializer_serializeJson(dyn_type *type, void *input, json_t **out);
-//input should be a json array with with the std args
-int jsonSerializer_call(dyn_function_type *func, void *handle, void (*fp)(void), json_t *arguments, json_t **result);
-
-int jsonSerializer_prepareArguments(dyn_function_type *func, void *args[], json_t **arguments);
-int jsonSerializer_handleReply(dyn_function_type *func, void *handle, json_t *reply, void *args[]);
+int jsonSerializer_call(dyn_interface_type *intf, void *service, const char *request, char **out);
+int jsonSerializer_prepareInvokeRequest(dyn_function_type *func, const char *id, void *args[], char **out);
+int jsonSerializer_handleReply(dyn_function_type *func, const char *reply, void *args[]);
#endif
http://git-wip-us.apache.org/repos/asf/celix/blob/fdade6aa/remote_services/remote_service_admin_dfi/rsa/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/CMakeLists.txt b/remote_services/remote_service_admin_dfi/rsa/CMakeLists.txt
index 79c9220..2c8ef5d 100644
--- a/remote_services/remote_service_admin_dfi/rsa/CMakeLists.txt
+++ b/remote_services/remote_service_admin_dfi/rsa/CMakeLists.txt
@@ -15,15 +15,17 @@
# specific language governing permissions and limitations
# under the License.
-include_directories(private/include)
-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/remote_service_admin/public/include")
-include_directories("${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin_http/private/include")
-include_directories("${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin_dfi/dynamic_function_interface")
-include_directories("${PROJECT_SOURCE_DIR}/remote_services/examples/calculator_service/public/include")
-include_directories("../dynamic_function_interface")
+include_directories(
+ private/include
+ ${PROJECT_SOURCE_DIR}/utils/public/include
+ ${PROJECT_SOURCE_DIR}/log_service/public/include
+ ${PROJECT_SOURCE_DIR}/remote_services/utils/private/include
+ ${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin/public/include
+ ${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin_http/private/include
+ ${PROJECT_SOURCE_DIR}/remote_services/remote_service_admin_dfi/dynamic_function_interface
+ ${PROJECT_SOURCE_DIR}/remote_services/examples/calculator_service/public/include
+ ../dynamic_function_interface
+)
SET_HEADER(BUNDLE_SYMBOLICNAME "apache_celix_remote_service_admin_dfi")
SET(BUNDLE_VERSION "0.0.1")
http://git-wip-us.apache.org/repos/asf/celix/blob/fdade6aa/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 cc181b3..85ecb43 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
@@ -5,7 +5,6 @@
#include <dyn_interface.h>
#include <json_serializer.h>
#include <remote_constants.h>
-#include <assert.h>
#include "export_registration.h"
#include "export_registration_dfi.h"
@@ -24,13 +23,6 @@ struct export_registration {
bool closed;
};
-typedef void (*gen_func_type)(void);
-
-struct generic_service_layout {
- void *handle;
- gen_func_type methods[];
-};
-
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;
@@ -94,72 +86,12 @@ celix_status_t exportRegistration_create(log_helper_pt helper, service_reference
celix_status_t exportRegistration_call(export_registration_pt export, char *data, int datalength, char **responseOut, int *responseLength) {
int status = CELIX_SUCCESS;
- //TODO lock/sema export
-
- printf("Parsing data: %s\n", data);
- json_error_t error;
- json_t *js_request = json_loads(data, 0, &error);
- json_t *arguments = NULL;
- const char *sig;
- if (js_request) {
- if (json_unpack(js_request, "{s:s}", "m", &sig) != 0) {
- printf("RSA: Got error '%s'\n", error.text);
- } else {
- arguments = json_object_get(js_request, "a");
- }
- } else {
- printf("RSA: got error '%s' for '%s'\n", error.text, data);
- return 0;
- }
-
- printf("RSA: Looking for method %s\n", sig);
- struct methods_head *methods = NULL;
- dynInterface_methods(export->intf, &methods);
- struct method_entry *entry = NULL;
- struct method_entry *method = NULL;
- TAILQ_FOREACH(entry, methods, entries) {
- if (strcmp(sig, entry->id) == 0) {
- method = entry;
- break;
- }
- }
- if (method == NULL) {
- status = CELIX_ILLEGAL_STATE;
- } else {
- printf("RSA: found method '%s'\n", entry->id);
- }
-
- if (method != NULL) {
-
- struct generic_service_layout *serv = export->service;
- void *handle = serv->handle;
- void (*fp)(void) = serv->methods[method->index];
-
- json_t *result = NULL;
- status = jsonSerializer_call(method->dynFunc, handle, fp, arguments, &result);
-
- json_decref(js_request);
-
- if (status == CELIX_SUCCESS) {
- printf("creating payload\n");
- json_t *payload = json_object();
- json_object_set_new(payload, "r", result);
-
- char *response = json_dumps(payload, JSON_DECODE_ANY);
- printf("status ptr is %p. response if '%s'\n", status, response);
-
- *responseOut = response;
- *responseLength = -1;
-
- json_decref(payload);
- }
-
- ///TODO add more status checks
- }
+ *responseLength = -1;
+ //TODO lock service
+ status = jsonSerializer_call(export->intf, export->service, data, responseOut);
+ //TODO unlock service
- //TODO unlock/sema export
- printf("done export reg call\n");
return status;
}
http://git-wip-us.apache.org/repos/asf/celix/blob/fdade6aa/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c b/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
index 20ff61d..09ad25b 100644
--- a/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
+++ b/remote_services/remote_service_admin_dfi/rsa/private/src/import_registration_dfi.c
@@ -216,47 +216,35 @@ static void importRegistration_proxyFunc(void *userData, void *args[], void *ret
struct method_entry *entry = userData;
import_registration_pt import = *((void **)args[0]);
- printf("Calling remote function '%s'\n", entry->id);
- json_t *invoke = json_object();
- json_object_set(invoke, "m", json_string(entry->id));
+ if (import == NULL || import->send == NULL) {
+ status = CELIX_ILLEGAL_ARGUMENT;
+ }
- json_t *arguments = NULL;
- status = jsonSerializer_prepareArguments(entry->dynFunc, args, &arguments);
+ char *invokeRequest = NULL;
if (status == CELIX_SUCCESS) {
- json_object_set_new(invoke, "a", arguments);
+ status = jsonSerializer_prepareInvokeRequest(entry->dynFunc, entry->id, args, &invokeRequest);
+ printf("Need to send following json '%s'\n", invokeRequest);
}
- char *output = json_dumps(invoke, JSON_DECODE_ANY);
- json_decref(invoke);
-
- printf("Need to send following json '%s'\n", output);
-
- if (import != NULL && import->send != NULL) {
+ if (status == CELIX_SUCCESS) {
char *reply = NULL;
int rc = 0;
printf("sending request\n");
- import->send(import->sendHandle, import->endpoint, output, &reply, &rc);
- printf("request sended. got reply '%s'\n", reply);
-
- json_t *replyJson = json_loads(reply, JSON_DECODE_ANY, NULL); //TODO check
- json_t *result = json_object_get(replyJson, "r"); //TODO check
- status = jsonSerializer_handleReply(entry->dynFunc, NULL, result, args);
- json_decref(result);
+ import->send(import->sendHandle, import->endpoint, invokeRequest, &reply, &rc);
+ printf("request sended. got reply '%s' with status %i\n", reply, rc);
-
-
-
- if (status == 0) {
- printf("done with proxy func\n");
+ if (rc == 0) {
+ printf("handling reply\n");
+ status = jsonSerializer_handleReply(entry->dynFunc, reply, args);
}
- } else {
- printf("Error import of import->send is NULL\n");
+
+ *(int *) returnVal = rc;
}
- //TODO assert double check if return type is native int
- int *rVal = returnVal;
- *rVal = status;
+ if (status != CELIX_SUCCESS) {
+ //TODO log error
+ }
}
celix_status_t importRegistration_ungetService(import_registration_pt import, bundle_pt bundle, service_registration_pt registration, void **out) {
http://git-wip-us.apache.org/repos/asf/celix/blob/fdade6aa/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 c78cc19..a092a63 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
@@ -34,6 +34,7 @@
#include <curl/curl.h>
#include <jansson.h>
+#include <json_serializer.h>
#include "import_registration_dfi.h"
#include "export_registration_dfi.h"
@@ -127,6 +128,7 @@ celix_status_t remoteServiceAdmin_create(bundle_context_pt context, remote_servi
dynType_logSetup((void *)remoteServiceAdmin_log, *admin, 4);
dynFunction_logSetup((void *)remoteServiceAdmin_log, *admin, 4);
dynInterface_logSetup((void *)remoteServiceAdmin_log, *admin, 4);
+ jsonSerializer_logSetup((void *)remoteServiceAdmin_log, *admin, 4);
}
bundleContext_getProperty(context, "RSA_PORT", &port);
http://git-wip-us.apache.org/repos/asf/celix/blob/fdade6aa/remote_services/remote_service_admin_dfi/rsa_tst/bundle/tst_activator.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_dfi/rsa_tst/bundle/tst_activator.c b/remote_services/remote_service_admin_dfi/rsa_tst/bundle/tst_activator.c
index 728030e..1f72db1 100644
--- a/remote_services/remote_service_admin_dfi/rsa_tst/bundle/tst_activator.c
+++ b/remote_services/remote_service_admin_dfi/rsa_tst/bundle/tst_activator.c
@@ -120,7 +120,7 @@ static int test(void *handle) {
int status = 0;
struct activator *act = handle;
- double result = 0.0;
+ double result = -1.0;
int rc;
if (act->calc != NULL) {