Return-Path: X-Original-To: apmail-incubator-celix-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-celix-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B183A7A14 for ; Thu, 17 Nov 2011 12:46:23 +0000 (UTC) Received: (qmail 31746 invoked by uid 500); 17 Nov 2011 12:46:23 -0000 Delivered-To: apmail-incubator-celix-commits-archive@incubator.apache.org Received: (qmail 31728 invoked by uid 500); 17 Nov 2011 12:46:23 -0000 Mailing-List: contact celix-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: celix-dev@incubator.apache.org Delivered-To: mailing list celix-commits@incubator.apache.org Received: (qmail 31721 invoked by uid 99); 17 Nov 2011 12:46:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Nov 2011 12:46:23 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Nov 2011 12:46:19 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B8CCD23888CC; Thu, 17 Nov 2011 12:45:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1203171 - in /incubator/celix/trunk: ./ examples/hello_world/ remote_services/calc_shell/private/src/ remote_services/discovery/private/src/ remote_services/example_endpoint/private/src/ remote_services/example_proxy/private/src/ remote_se... Date: Thu, 17 Nov 2011 12:45:57 -0000 To: celix-commits@incubator.apache.org From: abroekhuis@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111117124557.B8CCD23888CC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: abroekhuis Date: Thu Nov 17 12:45:56 2011 New Revision: 1203171 URL: http://svn.apache.org/viewvc?rev=1203171&view=rev Log: Remote Services updates Modified: incubator/celix/trunk/Remote Services.launch incubator/celix/trunk/examples/hello_world/activator.c incubator/celix/trunk/remote_services/calc_shell/private/src/add_command.c incubator/celix/trunk/remote_services/calc_shell/private/src/sqrt_command.c incubator/celix/trunk/remote_services/calc_shell/private/src/sub_command.c incubator/celix/trunk/remote_services/discovery/private/src/discovery.c incubator/celix/trunk/remote_services/example_endpoint/private/src/example_endpoint_impl.c incubator/celix/trunk/remote_services/example_proxy/private/src/example_proxy_impl.c incubator/celix/trunk/remote_services/example_service/private/src/example_impl.c incubator/celix/trunk/remote_services/remote_service_admin/private/src/remote_service_admin_impl.c Modified: incubator/celix/trunk/Remote Services.launch URL: http://svn.apache.org/viewvc/incubator/celix/trunk/Remote%20Services.launch?rev=1203171&r1=1203170&r2=1203171&view=diff ============================================================================== --- incubator/celix/trunk/Remote Services.launch (original) +++ incubator/celix/trunk/Remote Services.launch Thu Nov 17 12:45:56 2011 @@ -29,7 +29,7 @@ - + Modified: incubator/celix/trunk/examples/hello_world/activator.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/hello_world/activator.c?rev=1203171&r1=1203170&r2=1203171&view=diff ============================================================================== --- incubator/celix/trunk/examples/hello_world/activator.c (original) +++ incubator/celix/trunk/examples/hello_world/activator.c Thu Nov 17 12:45:56 2011 @@ -48,7 +48,6 @@ celix_status_t bundleActivator_create(BU celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) { struct userData * data = (struct userData *) userData; printf("Hello %s\n", data->word); - return CELIX_SUCCESS; } Modified: incubator/celix/trunk/remote_services/calc_shell/private/src/add_command.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/calc_shell/private/src/add_command.c?rev=1203171&r1=1203170&r2=1203171&view=diff ============================================================================== --- incubator/celix/trunk/remote_services/calc_shell/private/src/add_command.c (original) +++ incubator/celix/trunk/remote_services/calc_shell/private/src/add_command.c Thu Nov 17 12:45:56 2011 @@ -62,7 +62,7 @@ void addCommand_execute(COMMAND command, status = example->add(example->example, a, b, &result); if (status == CELIX_SUCCESS) { char line[256]; - sprintf(line, "ADD: %f + %f = %f\n", a, b, result); + sprintf(line, "CALCULATOR_SHELL: Add: %f + %f = %f\n", a, b, result); out(line); } else { out("ADD: Unexpected exception in Calc service\n"); Modified: incubator/celix/trunk/remote_services/calc_shell/private/src/sqrt_command.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/calc_shell/private/src/sqrt_command.c?rev=1203171&r1=1203170&r2=1203171&view=diff ============================================================================== --- incubator/celix/trunk/remote_services/calc_shell/private/src/sqrt_command.c (original) +++ incubator/celix/trunk/remote_services/calc_shell/private/src/sqrt_command.c Thu Nov 17 12:45:56 2011 @@ -60,7 +60,7 @@ void sqrtCommand_execute(COMMAND command status = example->sqrt(example->example, a, &result); if (status == CELIX_SUCCESS) { char line[256]; - sprintf(line, "SQRT: sqrt %f = %f\n", a, result); + sprintf(line, "CALCULATOR_SHELL: Sqrt: %f = %f\n", a, result); out(line); } else { out("SQRT: Unexpected exception in Calc service\n"); Modified: incubator/celix/trunk/remote_services/calc_shell/private/src/sub_command.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/calc_shell/private/src/sub_command.c?rev=1203171&r1=1203170&r2=1203171&view=diff ============================================================================== --- incubator/celix/trunk/remote_services/calc_shell/private/src/sub_command.c (original) +++ incubator/celix/trunk/remote_services/calc_shell/private/src/sub_command.c Thu Nov 17 12:45:56 2011 @@ -64,7 +64,7 @@ void subCommand_execute(COMMAND command, status = example->sub(example->example, a, b, &result); if (status == CELIX_SUCCESS) { char line[256]; - sprintf(line, "SUB: %f - %f = %f\n", a, b, result); + sprintf(line, "CALCULATOR_SHELL: Sub: %f - %f = %f\n", a, b, result); out(line); } else { out("SUB: Unexpected exception in Calc service\n"); Modified: incubator/celix/trunk/remote_services/discovery/private/src/discovery.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/discovery/private/src/discovery.c?rev=1203171&r1=1203170&r2=1203171&view=diff ============================================================================== --- incubator/celix/trunk/remote_services/discovery/private/src/discovery.c (original) +++ incubator/celix/trunk/remote_services/discovery/private/src/discovery.c Thu Nov 17 12:45:56 2011 @@ -69,6 +69,9 @@ celix_status_t discovery_create(apr_pool (*discovery)->slpServices = hashMap_create(string_hash, NULL, string_equals, NULL); (*discovery)->running = true; (*discovery)->rsaPort = getenv("RSA_PORT"); + if ((*discovery)->rsaPort == NULL) { + printf("No RemoteServiceAdmin port set, set it using RSA_PORT!\n"); + } (*discovery)->handled = NULL; arrayList_create(pool, &(*discovery)->handled); (*discovery)->registered = NULL; @@ -268,6 +271,13 @@ celix_status_t discovery_endpointRemoved status = discovery_constructServiceUrl(discovery, endpoint, &serviceUrl); if (status == CELIX_SUCCESS) { status = discovery_deregisterEndpoint(discovery, serviceUrl); + int i; + for (i = 0; i < arrayList_size(discovery->registered); i++) { + char *url = arrayList_get(discovery->registered, i); + if (strcmp(url, serviceUrl) == 0) { + arrayList_remove(discovery->registered, i); + } + } } } Modified: incubator/celix/trunk/remote_services/example_endpoint/private/src/example_endpoint_impl.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/example_endpoint/private/src/example_endpoint_impl.c?rev=1203171&r1=1203170&r2=1203171&view=diff ============================================================================== --- incubator/celix/trunk/remote_services/example_endpoint/private/src/example_endpoint_impl.c (original) +++ incubator/celix/trunk/remote_services/example_endpoint/private/src/example_endpoint_impl.c Thu Nov 17 12:45:56 2011 @@ -37,6 +37,7 @@ celix_status_t exampleEndpoint_setServic celix_status_t exampleEndpoint_handleRequest(remote_endpoint_t ep, char *request, char *data, char **reply) { celix_status_t status = CELIX_SUCCESS; + printf("EXAMPLE ENDPOINT: Handle request \"%s\" with data \"%s\"\n", request, data); if (strcmp(request, "add") == 0) { exampleEndpoint_add(ep, data, reply); } else if (strcmp(request, "sub") == 0) { Modified: incubator/celix/trunk/remote_services/example_proxy/private/src/example_proxy_impl.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/example_proxy/private/src/example_proxy_impl.c?rev=1203171&r1=1203170&r2=1203171&view=diff ============================================================================== --- incubator/celix/trunk/remote_services/example_proxy/private/src/example_proxy_impl.c (original) +++ incubator/celix/trunk/remote_services/example_proxy/private/src/example_proxy_impl.c Thu Nov 17 12:45:56 2011 @@ -46,7 +46,7 @@ celix_status_t exampleProxy_add(example_ celix_status_t status = CELIX_SUCCESS; if (example->endpoint != NULL) { - printf("PROXY: URL: %s\n", example->endpoint->id); + printf("CALCULATOR_PROXY: URL: %s\n", example->endpoint->id); char *url = apr_pstrcat(example->pool, example->endpoint->id, "/add", NULL); json_t *root; @@ -68,7 +68,7 @@ celix_status_t exampleProxy_add(example_ json_unpack(reply, "{s:f}", "result", result); } } else { - printf("PROXY: No endpoint information available"); + printf("CALCULATOR_PROXY: No endpoint information available"); } return status; @@ -77,7 +77,7 @@ celix_status_t exampleProxy_add(example_ celix_status_t exampleProxy_sub(example_t example, double a, double b, double *result) { celix_status_t status = CELIX_SUCCESS; if (example->endpoint != NULL) { - printf("PROXY: URL: %s\n", example->endpoint->id); + printf("CALCULATOR_PROXY: URL: %s\n", example->endpoint->id); char *url = apr_pstrcat(example->pool, example->endpoint->id, "/sub", NULL); json_t *root; @@ -99,7 +99,7 @@ celix_status_t exampleProxy_sub(example_ json_unpack(reply, "{s:f}", "result", result); } } else { - printf("PROXY: No endpoint information available"); + printf("CALCULATOR_PROXY: No endpoint information available"); } return status; @@ -108,7 +108,7 @@ celix_status_t exampleProxy_sub(example_ celix_status_t exampleProxy_sqrt(example_t example, double a, double *result) { celix_status_t status = CELIX_SUCCESS; if (example->endpoint != NULL) { - printf("PROXY: URL: %s\n", example->endpoint->id); + printf("CALCULATOR_PROXY: URL: %s\n", example->endpoint->id); char *url = apr_pstrcat(example->pool, example->endpoint->id, "/sqrt", NULL); json_t *root; @@ -130,7 +130,7 @@ celix_status_t exampleProxy_sqrt(example json_unpack(reply, "{s:f}", "result", result); } } else { - printf("PROXY: No endpoint information available"); + printf("CALCULATOR_PROXY: No endpoint information available"); } return status; @@ -155,7 +155,7 @@ celix_status_t exampleProxy_postRequest( res = curl_easy_perform(curl); curl_easy_cleanup(curl); - printf("Data read: %s\n", get->writeptr); + printf("CALCULATOR_PROXY: Data read: \"%s\"\n", get->writeptr); } return status; Modified: incubator/celix/trunk/remote_services/example_service/private/src/example_impl.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/example_service/private/src/example_impl.c?rev=1203171&r1=1203170&r2=1203171&view=diff ============================================================================== --- incubator/celix/trunk/remote_services/example_service/private/src/example_impl.c (original) +++ incubator/celix/trunk/remote_services/example_service/private/src/example_impl.c Thu Nov 17 12:45:56 2011 @@ -26,6 +26,7 @@ celix_status_t example_add(example_t exa celix_status_t status = CELIX_SUCCESS; *result = a + b; + printf("CALCULATOR: Add: %f + %f = %f\n", a, b, *result); return status; } @@ -34,6 +35,7 @@ celix_status_t example_sub(example_t exa celix_status_t status = CELIX_SUCCESS; *result = a - b; + printf("CALCULATOR: Sub: %f + %f = %f\n", a, b, *result); return status; } @@ -43,7 +45,9 @@ celix_status_t example_sqrt(example_t ex if (a > 0) { *result = sqrt(a); + printf("CALCULATOR: Sqrt: %f = %f\n", a, *result); } else { + printf("CALCULATOR: Sqrt: %f = ERR\n", a); status = CELIX_ILLEGAL_ARGUMENT; } Modified: incubator/celix/trunk/remote_services/remote_service_admin/private/src/remote_service_admin_impl.c URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/remote_service_admin/private/src/remote_service_admin_impl.c?rev=1203171&r1=1203170&r2=1203171&view=diff ============================================================================== --- incubator/celix/trunk/remote_services/remote_service_admin/private/src/remote_service_admin_impl.c (original) +++ incubator/celix/trunk/remote_services/remote_service_admin/private/src/remote_service_admin_impl.c Thu Nov 17 12:45:56 2011 @@ -45,6 +45,9 @@ celix_status_t remoteServiceAdmin_create // Start webserver const char *port = getenv("RSA_PORT"); + if (port == NULL) { + printf("No RemoteServiceAdmin port set, set it using RSA_PORT!\n"); + } const char *options[] = {"listening_ports", port, NULL}; (*admin)->ctx = mg_start(remoteServiceAdmin_callback, (*admin), options); } @@ -82,7 +85,7 @@ celix_status_t remoteServiceAdmin_stop(r */ void *remoteServiceAdmin_callback(enum mg_event event, struct mg_connection *conn, const struct mg_request_info *request_info) { if (request_info->uri != NULL) { - printf("RSA Handle request: %s\n", request_info->uri); + printf("REMOTE_SERVICE_ADMIN: Handle request: %s\n", request_info->uri); remote_service_admin_t rsa = request_info->user_data; if (strncmp(request_info->uri, "/services/", 10) == 0) { @@ -96,11 +99,9 @@ void *remoteServiceAdmin_callback(enum m char service[pos+1]; strncpy(service, rest, pos); service[pos] = '\0'; - printf("RSA Find Handler for Service: %s\n", service); char request[length - pos]; strncpy(request, rest + pos + 1, length - pos); - printf("RSA Send Request: %s\n", request); const char *lengthStr = mg_get_header(conn, (const char *) "Content-Length"); int datalength = apr_atoi64(lengthStr); @@ -116,7 +117,6 @@ void *remoteServiceAdmin_callback(enum m for (expIt = 0; expIt < arrayList_size(exports); expIt++) { export_registration_t export = arrayList_get(exports, expIt); if (strcmp(service, export->endpointDescription->service) == 0) { - printf("RSA Sending Request: %s\n", request); char *reply = NULL; export->endpoint->handleRequest(export->endpoint->endpoint, request, data, &reply); if (reply != NULL) {