You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by ab...@apache.org on 2011/12/15 11:12:06 UTC
svn commit: r1214685 [4/4] - in /incubator/celix/trunk: ./ cmake/
dependency_manager/ deployment_admin/private/src/
examples/osgi-in-action/chapter04-paint-example/paint/private/src/
examples/whiteboard/publisherA/ examples/whiteboard/publisherB/ frame...
Modified: incubator/celix/trunk/log_writer/log_writer.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/log_writer/log_writer.h?rev=1214685&r1=1214684&r2=1214685&view=diff
==============================================================================
--- incubator/celix/trunk/log_writer/log_writer.h (original)
+++ incubator/celix/trunk/log_writer/log_writer.h Thu Dec 15 10:12:04 2011
@@ -28,11 +28,13 @@
#include "headers.h"
#include "service_component.h"
+#include "service_dependency.h"
#include "log_reader_service.h"
struct log_writer {
log_reader_service_t logReader;
SERVICE service;
+ SERVICE_DEPENDENCY dep;
log_listener_t logListener;
};
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=1214685&r1=1214684&r2=1214685&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/discovery/private/src/discovery.c (original)
+++ incubator/celix/trunk/remote_services/discovery/private/src/discovery.c Thu Dec 15 10:12:04 2011
@@ -16,6 +16,7 @@
#include "utils.h"
#include "celix_errno.h"
#include "filter.h"
+#include "service_reference.h"
#include "discovery.h"
@@ -152,7 +153,10 @@ celix_status_t discovery_addService(disc
SERVICE_REFERENCE reference = hashMapEntry_getKey(entry);
endpoint_listener_t listener = NULL;
- char *scope = properties_get(reference->registration->properties, (char *) ENDPOINT_LISTENER_SCOPE);
+ SERVICE_REGISTRATION registration = NULL;
+ serviceReference_getServiceRegistration(reference, ®istration);
+ PROPERTIES serviceProperties = registration->properties;
+ char *scope = properties_get(serviceProperties, (char *) ENDPOINT_LISTENER_SCOPE);
FILTER filter = filter_create(scope, discovery->pool);
if (filter_match(filter, endpoint->properties)) {
printf("DISCOVERY: Add service (%s)\n", endpoint->service);
@@ -296,7 +300,11 @@ celix_status_t discovery_endpointListene
celix_status_t discovery_endpointListenerAdded(void * handle, SERVICE_REFERENCE reference, void * service) {
celix_status_t status = CELIX_SUCCESS;
discovery_t discovery = handle;
- char *discoveryListener = properties_get(reference->registration->properties, "DISCOVERY");
+
+ SERVICE_REGISTRATION registration = NULL;
+ serviceReference_getServiceRegistration(reference, ®istration);
+ PROPERTIES serviceProperties = registration->properties;
+ char *discoveryListener = properties_get(serviceProperties, "DISCOVERY");
if (discoveryListener != NULL && strcmp(discoveryListener, "true") == 0) {
printf("DISCOVERY: EndpointListener Ignored - Discovery listener\n");
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=1214685&r1=1214684&r2=1214685&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 Dec 15 10:12:04 2011
@@ -19,6 +19,7 @@
#include "utils.h"
#include "bundle_context.h"
#include "bundle.h"
+#include "service_reference.h"
static const char *ajax_reply_start =
"HTTP/1.1 200 OK\r\n"
@@ -136,9 +137,11 @@ celix_status_t remoteServiceAdmin_export
celix_status_t status = CELIX_SUCCESS;
arrayList_create(admin->pool, registrations);
-
- char *exports = properties_get(reference->registration->properties, (char *) SERVICE_EXPORTED_INTERFACES);
- char *provided = properties_get(reference->registration->properties, (char *) OBJECTCLASS);
+ SERVICE_REGISTRATION registration = NULL;
+ serviceReference_getServiceRegistration(reference, ®istration);
+ PROPERTIES serviceProperties = registration->properties;
+ char *exports = properties_get(serviceProperties, (char *) SERVICE_EXPORTED_INTERFACES);
+ char *provided = properties_get(serviceProperties, (char *) OBJECTCLASS);
if (exports == NULL || provided == NULL) {
printf("RSA: No Services to export.\n");
@@ -194,7 +197,10 @@ celix_status_t remoteServiceAdmin_instal
celix_status_t status = CELIX_SUCCESS;
PROPERTIES endpointProperties = properties_create();
- HASH_MAP_ITERATOR iter = hashMapIterator_create(reference->registration->properties);
+ SERVICE_REGISTRATION sRegistration = NULL;
+ serviceReference_getServiceRegistration(reference, &sRegistration);
+
+ HASH_MAP_ITERATOR iter = hashMapIterator_create(sRegistration->properties);
while (hashMapIterator_hasNext(iter)) {
HASH_MAP_ENTRY entry = hashMapIterator_nextEntry(iter);
char *key = (char *) hashMapEntry_getKey(entry);
@@ -212,7 +218,7 @@ celix_status_t remoteServiceAdmin_instal
properties_set(endpointProperties, (char *) SERVICE_LOCATION, apr_pstrdup(admin->pool, service));
endpoint_description_t endpointDescription = NULL;
- remoteServiceAdmin_createEndpointDescription(admin, reference->registration->properties, endpointProperties, interface, &endpointDescription);
+ remoteServiceAdmin_createEndpointDescription(admin, sRegistration->properties, endpointProperties, interface, &endpointDescription);
exportRegistration_setEndpointDescription(registration, endpointDescription);
return status;
Modified: incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c?rev=1214685&r1=1214684&r2=1214685&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c (original)
+++ incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c Thu Dec 15 10:12:04 2011
@@ -91,11 +91,13 @@ celix_status_t bundleActivator_createRSA
celix_status_t bundleActivator_createServiceListener(struct activator *activator, SERVICE_LISTENER *listener) {
celix_status_t status = CELIX_SUCCESS;
-
- *listener = apr_palloc(activator->pool, sizeof(*listener));
+ apr_pool_t *pool;
+ apr_pool_create(&pool, activator->pool);
+ *listener = apr_palloc(pool, sizeof(*listener));
if (!*listener) {
status = CELIX_ENOMEM;
} else {
+ (*listener)->pool = pool;
(*listener)->handle = activator->manager;
(*listener)->serviceChanged = topologyManager_serviceChanged;
}
Modified: incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c?rev=1214685&r1=1214684&r2=1214685&view=diff
==============================================================================
--- incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c (original)
+++ incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c Thu Dec 15 10:12:04 2011
@@ -21,6 +21,7 @@
#include "filter.h"
#include "listener_hook_service.h"
#include "utils.h"
+#include "service_reference.h"
struct topology_manager {
apr_pool_t *pool;
@@ -101,7 +102,9 @@ celix_status_t topologyManager_serviceCh
celix_status_t status = CELIX_SUCCESS;
SERVICE_LISTENER listen = listener;
topology_manager_t manager = listen->handle;
- PROPERTIES props = event->reference->registration->properties;
+ SERVICE_REGISTRATION registration = NULL;
+ serviceReference_getServiceRegistration(event->reference, ®istration);
+ PROPERTIES props = registration->properties;
char *name = properties_get(props, (char *) OBJECTCLASS);
char *export = properties_get(props, (char *) SERVICE_EXPORTED_INTERFACES);
@@ -159,7 +162,9 @@ celix_status_t topologyManager_exportSer
if (arrayList_size(manager->rsaList) == 0) {
char *symbolicName = NULL;
MODULE module = NULL;
- status = bundle_getCurrentModule(reference->bundle, &module);
+ BUNDLE bundle = NULL;
+ serviceReference_getBundle(reference, &bundle);
+ status = bundle_getCurrentModule(bundle, &module);
if (status == CELIX_SUCCESS) {
status = module_getSymbolicName(module, &symbolicName);
if (status == CELIX_SUCCESS) {
@@ -194,7 +199,10 @@ celix_status_t topologyManager_notifyLis
int eplIt;
for (eplIt = 0; eplIt < arrayList_size(endpointListeners); eplIt++) {
SERVICE_REFERENCE eplRef = arrayList_get(endpointListeners, eplIt);
- char *scope = properties_get(eplRef->registration->properties, (char *) ENDPOINT_LISTENER_SCOPE);
+ SERVICE_REGISTRATION registration = NULL;
+ serviceReference_getServiceRegistration(eplRef, ®istration);
+ PROPERTIES props = registration->properties;
+ char *scope = properties_get(props, (char *) ENDPOINT_LISTENER_SCOPE);
FILTER filter = filter_create(scope, manager->pool);
endpoint_listener_t epl = NULL;
status = bundleContext_getService(manager->context, eplRef, (void **) &epl);
@@ -249,7 +257,11 @@ celix_status_t topologyManager_importSer
celix_status_t topologyManager_removeService(topology_manager_t manager, SERVICE_REFERENCE reference) {
celix_status_t status = CELIX_SUCCESS;
- char *name = properties_get(reference->registration->properties, (char *) OBJECTCLASS);
+
+ SERVICE_REGISTRATION registration = NULL;
+ serviceReference_getServiceRegistration(reference, ®istration);
+ PROPERTIES props = registration->properties;
+ char *name = properties_get(props, (char *) OBJECTCLASS);
printf("TOPOLOGY_MANAGER: Remove Service: %s.\n", name);
Modified: incubator/celix/trunk/shell/inspect_command.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/inspect_command.c?rev=1214685&r1=1214684&r2=1214685&view=diff
==============================================================================
--- incubator/celix/trunk/shell/inspect_command.c (original)
+++ incubator/celix/trunk/shell/inspect_command.c Thu Dec 15 10:12:04 2011
@@ -16,6 +16,7 @@
#include "module.h"
#include "constants.h"
#include "service_registration.h"
+#include "service_reference.h"
#define SERVICE_TYPE "service"
#define CAPABILITY "capability"
@@ -112,8 +113,10 @@ celix_status_t inspectCommand_printExpor
}
if (bundle != NULL) {
+ apr_pool_t *pool;
+ bundleContext_getMemoryPool(command->bundleContext, &pool);
ARRAY_LIST refs = NULL;
- if (bundle_getRegisteredServices(bundle, &refs) == CELIX_SUCCESS) {
+ if (bundle_getRegisteredServices(bundle, pool, &refs) == CELIX_SUCCESS) {
char line[256];
MODULE module = NULL;
char * name = NULL;
@@ -131,8 +134,10 @@ celix_status_t inspectCommand_printExpor
int j = 0;
for (j = 0; j < arrayList_size(refs); j++) {
SERVICE_REFERENCE ref = arrayList_get(refs, j);
+ SERVICE_REGISTRATION reg = NULL;
+ serviceReference_getServiceRegistration(ref, ®);
char line[256];
- char *objectClass = properties_get(ref->registration->properties, (char *) OBJECTCLASS);
+ char *objectClass = properties_get(reg->properties, (char *) OBJECTCLASS);
sprintf(line, "ObjectClass = %s\n", objectClass);
out(line);
if ((j + 1) < arrayList_size(refs)) {
Modified: incubator/celix/trunk/shell/shell.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell/shell.c?rev=1214685&r1=1214684&r2=1214685&view=diff
==============================================================================
--- incubator/celix/trunk/shell/shell.c (original)
+++ incubator/celix/trunk/shell/shell.c Thu Dec 15 10:12:04 2011
@@ -199,9 +199,12 @@ celix_status_t bundleActivator_start(voi
status = bundleContext_registerService(context, (char *) SHELL_SERVICE_NAME, activator->shellService, NULL, &activator->registration);
+ apr_pool_t *pool = NULL;
+ bundleContext_getMemoryPool(context, &pool);
if (status == CELIX_SUCCESS) {
SERVICE_LISTENER listener = (SERVICE_LISTENER) malloc(sizeof(*listener));
activator->listener = listener;
+ listener->pool = pool;
listener->handle = activator->shell;
listener->serviceChanged = (void *) shell_serviceChanged;
status = bundleContext_addServiceListener(context, listener, "(objectClass=commandService)");
Modified: incubator/celix/trunk/shell_tui/shell_tui.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell_tui/shell_tui.c?rev=1214685&r1=1214684&r2=1214685&view=diff
==============================================================================
--- incubator/celix/trunk/shell_tui/shell_tui.c (original)
+++ incubator/celix/trunk/shell_tui/shell_tui.c Thu Dec 15 10:12:04 2011
@@ -116,8 +116,12 @@ celix_status_t bundleActivator_start(voi
act->context = context;
act->running = true;
+ apr_pool_t *pool = NULL;
+ bundleContext_getMemoryPool(context, &pool);
+
SERVICE_LISTENER listener = (SERVICE_LISTENER) malloc(sizeof(*listener));
act->listener = listener;
+ act->listener->pool = pool;
act->listener->handle = act;
act->listener->serviceChanged = (void *) shellTui_serviceChanged;
status = bundleContext_addServiceListener(context, act->listener, "(objectClass=shellService)");
Modified: incubator/celix/trunk/target.cmake
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/target.cmake?rev=1214685&r1=1214684&r2=1214685&view=diff
==============================================================================
--- incubator/celix/trunk/target.cmake (original)
+++ incubator/celix/trunk/target.cmake Thu Dec 15 10:12:04 2011
@@ -17,8 +17,8 @@
#deploy("name" BUNDLES receiver receiver-2.0 sender shell shell_tui)
#deploy("shell test" BUNDLES shell)
-#deploy("hello_world" BUNDLES shell shell_tui hello_world celix.mongoose log_service log_writer)
+deploy("hello_world" BUNDLES shell shell_tui hello_world log_service log_writer)
#deploy("deployer" BUNDLES shell shell_tui deployer)
#deploy("wb" BUNDLES tracker publisherA publisherB shell shell_tui log_service log_writer)
deploy("wb_dp" BUNDLES tracker_depman publisherA publisherB shell shell_tui log_service log_writer)
-#deploy("echo" BUNDLES echo_server echo_client shell shell_tui)
\ No newline at end of file
+#deploy("echo" BUNDLES echo_server echo_client shell shell_tui)
Modified: incubator/celix/trunk/utils/private/src/array_list.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/src/array_list.c?rev=1214685&r1=1214684&r2=1214685&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/src/array_list.c (original)
+++ incubator/celix/trunk/utils/private/src/array_list.c Thu Dec 15 10:12:04 2011
@@ -30,6 +30,9 @@
#include "array_list_private.h"
celix_status_t arrayList_create(apr_pool_t *pool, ARRAY_LIST *list) {
+ apr_pool_t *mypool;
+ apr_pool_create(&mypool, pool);
+// *list = (ARRAY_LIST) apr_palloc(mypool, sizeof(**list));
*list = (ARRAY_LIST) malloc(sizeof(**list));
(*list)->size = 0;
Modified: incubator/celix/trunk/utils/private/src/linkedlist.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/utils/private/src/linkedlist.c?rev=1214685&r1=1214684&r2=1214685&view=diff
==============================================================================
--- incubator/celix/trunk/utils/private/src/linkedlist.c (original)
+++ incubator/celix/trunk/utils/private/src/linkedlist.c Thu Dec 15 10:12:04 2011
@@ -50,6 +50,19 @@ celix_status_t linkedList_create(apr_poo
return CELIX_ENOMEM;
}
+celix_status_t linkedList_clone(LINKED_LIST list, apr_pool_t *pool, LINKED_LIST *clone) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ status = linkedList_create(pool, clone);
+ if (status == CELIX_SUCCESS) {
+ for (struct linkedListEntry *e = list->header->next; e != list->header; e = e->next) {
+ linkedList_addElement(*clone, e->element);
+ }
+ }
+
+ return status;
+}
+
void * linkedList_getFirst(LINKED_LIST list) {
if (list->size == 0) {
return NULL;
Modified: incubator/celix/trunk/utils/public/include/linkedlist.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/utils/public/include/linkedlist.h?rev=1214685&r1=1214684&r2=1214685&view=diff
==============================================================================
--- incubator/celix/trunk/utils/public/include/linkedlist.h (original)
+++ incubator/celix/trunk/utils/public/include/linkedlist.h Thu Dec 15 10:12:04 2011
@@ -36,6 +36,7 @@ typedef struct linkedListEntry * LINKED_
typedef struct linkedList * LINKED_LIST;
UTILS_EXPORT celix_status_t linkedList_create(apr_pool_t *pool, LINKED_LIST *list);
+celix_status_t linkedList_clone(LINKED_LIST list, apr_pool_t *pool, LINKED_LIST *clone);
UTILS_EXPORT void * linkedList_getFirst(LINKED_LIST list);
UTILS_EXPORT void * linkedList_getLast(LINKED_LIST list);
UTILS_EXPORT void * linkedList_removeFirst(LINKED_LIST list);