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/11/03 12:09:39 UTC
[02/21] celix git commit: CELIX-210: renamed dep man 2 -> dep man 2.
Fixed whiteboard dep man example
http://git-wip-us.apache.org/repos/asf/celix/blob/cc6fd432/dependency_manager_2/private/src/dm_service_dependency.c
----------------------------------------------------------------------
diff --git a/dependency_manager_2/private/src/dm_service_dependency.c b/dependency_manager_2/private/src/dm_service_dependency.c
deleted file mode 100644
index 8f65ddb..0000000
--- a/dependency_manager_2/private/src/dm_service_dependency.c
+++ /dev/null
@@ -1,564 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements. See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership. The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * dm_service_dependency.c
- *
- * \date 17 Oct 2014
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "constants.h"
-
-#include "dm_service_dependency_impl.h"
-#include "dm_component_impl.h"
-
-static celix_status_t serviceDependency_addedService(void *_ptr, service_reference_pt reference, void *service);
-static celix_status_t serviceDependency_modifiedService(void *_ptr, service_reference_pt reference, void *service);
-static celix_status_t serviceDependency_removedService(void *_ptr, service_reference_pt reference, void *service);
-
-celix_status_t serviceDependency_create(dm_service_dependency_pt *dependency_ptr) {
- celix_status_t status = CELIX_SUCCESS;
-
- *dependency_ptr = calloc(1, sizeof(**dependency_ptr));
- if (!*dependency_ptr) {
- status = CELIX_ENOMEM;
- } else {
- (*dependency_ptr)->component = NULL;
- (*dependency_ptr)->available = false;
- (*dependency_ptr)->instanceBound = false;
- (*dependency_ptr)->required = false;
-
- (*dependency_ptr)->add = NULL;
- (*dependency_ptr)->change = NULL;
- (*dependency_ptr)->remove = NULL;
- (*dependency_ptr)->swap = NULL;
-
- (*dependency_ptr)->add_with_ref = NULL;
- (*dependency_ptr)->change_with_ref = NULL;
- (*dependency_ptr)->remove_with_ref = NULL;
- (*dependency_ptr)->swap_with_ref = NULL;
-
- (*dependency_ptr)->autoConfigure = NULL;
-
- (*dependency_ptr)->isStarted = false;
-
- (*dependency_ptr)->tracked_service_name = NULL;
- (*dependency_ptr)->tracked_filter_unmodified = NULL;
- (*dependency_ptr)->tracked_filter = NULL;
-
- (*dependency_ptr)->tracker = NULL;
- (*dependency_ptr)->tracker_customizer = NULL;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_destroy(dm_service_dependency_pt *dependency_ptr) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!*dependency_ptr) {
- status = CELIX_ENOMEM;
- }
-
- if (status == CELIX_SUCCESS) {
- free((*dependency_ptr)->tracked_service_name);
- free((*dependency_ptr)->tracked_filter);
- free((*dependency_ptr)->tracked_filter_unmodified);
- free(*dependency_ptr);
- *dependency_ptr = NULL;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_lock(dm_service_dependency_pt dependency) {
- celixThreadMutex_lock(&dependency->lock);
- return CELIX_SUCCESS;
-}
-
-celix_status_t serviceDependency_unlock(dm_service_dependency_pt dependency) {
- celixThreadMutex_unlock(&dependency->lock);
- return CELIX_SUCCESS;
-}
-
-celix_status_t serviceDependency_setRequired(dm_service_dependency_pt dependency, bool required) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- dependency->required = required;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency, char *serviceName, char *filter) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- if (serviceName != NULL) {
- dependency->tracked_service_name = strdup(serviceName);
- }
- if (filter != NULL) {
- dependency->tracked_filter_unmodified = strdup(filter);
- if (serviceName == NULL) {
- dependency->tracked_filter = strdup(filter);
- } else {
- size_t len = strlen(serviceName) + strlen(OSGI_FRAMEWORK_OBJECTCLASS) + strlen(filter) + 7;
- char new_filter[len];
- snprintf(new_filter, len, "(&(%s=%s)%s)", OSGI_FRAMEWORK_OBJECTCLASS, serviceName, filter);
- dependency->tracked_filter = strdup(new_filter);
- }
- } else {
- dependency->tracked_filter_unmodified = NULL;
- dependency->tracked_filter = NULL;
- }
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_setCallbacks(dm_service_dependency_pt dependency, service_add_fpt add, service_change_fpt change, service_remove_fpt remove, service_swap_fpt swap) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- dependency->add = add;
- dependency->change = change;
- dependency->remove = remove;
- dependency->swap = swap;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_setCallbacksWithServiceReference(dm_service_dependency_pt dependency, service_add_with_ref_fpt add, service_change_with_ref_fpt change, service_remove_with_ref_fpt remove, service_swap_with_ref_fpt swap) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- dependency->add_with_ref = add;
- dependency->change_with_ref = change;
- dependency->remove_with_ref = remove;
- dependency->swap_with_ref = swap;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_setAutoConfigure(dm_service_dependency_pt dependency, celix_thread_mutex_t *service_lock, void **field) {
- celix_status_t status = CELIX_SUCCESS;
-
- celix_thread_mutex_t lock;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- dependency->autoConfigure = field;
- celixThreadMutex_create(&lock, NULL);
- *service_lock = lock;
- dependency->lock = lock;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_setComponent(dm_service_dependency_pt dependency, dm_component_pt component) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- dependency->component = component;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_start(dm_service_dependency_pt dependency) {
- celix_status_t status = CELIX_SUCCESS;
- bundle_context_pt context = NULL;
-
- if (!dependency || !dependency->component || (!dependency->tracked_service_name && !dependency->tracked_filter)) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- status = component_getBundleContext(dependency->component, &context);
- if (!context) {
- status = CELIX_BUNDLE_EXCEPTION;
- }
- }
-
- if (status == CELIX_SUCCESS) {
- dependency->tracker_customizer = NULL;
- status = serviceTrackerCustomizer_create(dependency, NULL, serviceDependency_addedService, serviceDependency_modifiedService,
- serviceDependency_removedService, &dependency->tracker_customizer);
- }
-
- if (status == CELIX_SUCCESS) {
- if (dependency->tracked_filter) {
- status = serviceTracker_createWithFilter(context, dependency->tracked_filter, dependency->tracker_customizer, &dependency->tracker);
- } else if (dependency->tracked_service_name) {
- status = serviceTracker_create(context, dependency->tracked_service_name, dependency->tracker_customizer, &dependency->tracker);
- }
- }
-
- if (status == CELIX_SUCCESS) {
- status = serviceTracker_open(dependency->tracker);
- }
-
- if (status == CELIX_SUCCESS) {
- dependency->isStarted = true;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_stop(dm_service_dependency_pt dependency) {
- celix_status_t status = CELIX_SUCCESS;
- celix_status_t tmp_status;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- if (dependency->tracker) {
- tmp_status = serviceTracker_close(dependency->tracker);
- if (tmp_status != CELIX_SUCCESS) {
- status = tmp_status;
- }
- tmp_status = serviceTracker_destroy(dependency->tracker);
- if (tmp_status != CELIX_SUCCESS && status == CELIX_SUCCESS) {
- status = tmp_status;
- }
- }
- }
-
- if (status == CELIX_SUCCESS) {
- dependency->isStarted = false;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_setInstanceBound(dm_service_dependency_pt dependency, bool instanceBound) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- dependency->instanceBound = instanceBound;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_setAvailable(dm_service_dependency_pt dependency, bool available) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- dependency->available = available;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_invokeAdd(dm_service_dependency_pt dependency, dm_event_pt event) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- if (dependency->add) {
- dependency->add(dependency->component->implementation, event->service);
- }
- if (dependency->add_with_ref) {
- dependency->add_with_ref(dependency->component->implementation, event->reference, event->service);
- }
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_invokeChange(dm_service_dependency_pt dependency, dm_event_pt event) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- if (dependency->change) {
- dependency->change(dependency->component->implementation, event->service);
- }
- if (dependency->change_with_ref) {
- dependency->change_with_ref(dependency->component->implementation, event->reference, event->service);
- }
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_invokeRemove(dm_service_dependency_pt dependency, dm_event_pt event) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- if (dependency->remove) {
- dependency->remove(dependency->component->implementation, event->service);
- }
- if (dependency->remove_with_ref) {
- dependency->remove_with_ref(dependency->component->implementation, event->reference, event->service);
- }
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_invokeSwap(dm_service_dependency_pt dependency, dm_event_pt event, dm_event_pt newEvent) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- if (dependency->swap) {
- dependency->swap(dependency->component->implementation, event->service, newEvent->service);
- }
- if (dependency->swap_with_ref) {
- dependency->swap_with_ref(dependency->component->implementation, event->reference, event->service, newEvent->reference, newEvent->service);
- }
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_isAvailable(dm_service_dependency_pt dependency, bool *available) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- *available = dependency->available;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_isRequired(dm_service_dependency_pt dependency, bool *required) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- *required = dependency->required;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_isInstanceBound(dm_service_dependency_pt dependency, bool *instanceBound) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- *instanceBound = dependency->instanceBound;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_isAutoConfig(dm_service_dependency_pt dependency, bool *autoConfig) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- *autoConfig = dependency->autoConfigure != NULL;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_getAutoConfig(dm_service_dependency_pt dependency, void ***autoConfigure) {
- celix_status_t status = CELIX_SUCCESS;
-
- if (!dependency) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- *autoConfigure = dependency->autoConfigure;
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_addedService(void *_ptr, service_reference_pt reference, void *service) {
- celix_status_t status = CELIX_SUCCESS;
- bundle_context_pt context = NULL;
- bundle_pt bundle = NULL;
- dm_event_pt event = NULL;
- dm_service_dependency_pt dependency = _ptr;
-
- if (!dependency || !reference || !service) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- status = component_getBundleContext(dependency->component, &context);
- if (!context) {
- status = CELIX_BUNDLE_EXCEPTION;
- }
- }
-
- if (status == CELIX_SUCCESS) {
- status = bundleContext_getBundle(context, &bundle);
- if (!bundle) {
- status = CELIX_BUNDLE_EXCEPTION;
- }
- }
-
- if (status == CELIX_SUCCESS) {
- status = event_create(DM_EVENT_ADDED, bundle, context, reference, service, &event);
- }
-
- if (status == CELIX_SUCCESS) {
- component_handleEvent(dependency->component, dependency, event);
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_modifiedService(void *_ptr, service_reference_pt reference, void *service) {
- celix_status_t status = CELIX_SUCCESS;
- bundle_context_pt context = NULL;
- bundle_pt bundle = NULL;
- dm_event_pt event = NULL;
- dm_service_dependency_pt dependency = _ptr;
-
- if (!dependency || !reference || !service) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- status = component_getBundleContext(dependency->component, &context);
- if (!context) {
- status = CELIX_BUNDLE_EXCEPTION;
- }
- }
-
- if (status == CELIX_SUCCESS) {
- status = bundleContext_getBundle(context, &bundle);
- if (!bundle) {
- status = CELIX_BUNDLE_EXCEPTION;
- }
- }
-
- if (status == CELIX_SUCCESS) {
- status = event_create(DM_EVENT_CHANGED, bundle, context, reference, service, &event);
- }
-
- if (status == CELIX_SUCCESS) {
- component_handleEvent(dependency->component, dependency, event);
- }
-
- return status;
-}
-
-celix_status_t serviceDependency_removedService(void *_ptr, service_reference_pt reference, void *service) {
- celix_status_t status = CELIX_SUCCESS;
- bundle_context_pt context = NULL;
- bundle_pt bundle = NULL;
- dm_event_pt event = NULL;
- dm_service_dependency_pt dependency = _ptr;
-
- if (!dependency || !reference || !service) {
- status = CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (status == CELIX_SUCCESS) {
- status = component_getBundleContext(dependency->component, &context);
- if (!context) {
- status = CELIX_BUNDLE_EXCEPTION;
- }
- }
-
- if (status == CELIX_SUCCESS) {
- status = bundleContext_getBundle(context, &bundle);
- if (!bundle) {
- status = CELIX_BUNDLE_EXCEPTION;
- }
- }
-
- if (status == CELIX_SUCCESS) {
- status = event_create(DM_EVENT_REMOVED, bundle, context, reference, service, &event);
- }
-
- if (status == CELIX_SUCCESS) {
- component_handleEvent(dependency->component, dependency, event);
- }
-
- return status;
-}
http://git-wip-us.apache.org/repos/asf/celix/blob/cc6fd432/dependency_manager_2/public/include/dm_activator_base.h
----------------------------------------------------------------------
diff --git a/dependency_manager_2/public/include/dm_activator_base.h b/dependency_manager_2/public/include/dm_activator_base.h
deleted file mode 100644
index 80196e2..0000000
--- a/dependency_manager_2/public/include/dm_activator_base.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/*
- * dm_activator_base.h
- *
- * \date 26 Jul 2014
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-
-#ifndef DM_ACTIVATOR_BASE_H_
-#define DM_ACTIVATOR_BASE_H_
-
-#include "bundle_context.h"
-#include "celix_errno.h"
-#include "dm_dependency_manager.h"
-
-celix_status_t dm_create(bundle_context_pt context, void ** userData);
-celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager);
-celix_status_t dm_deinit(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager);
-celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager);
-
-#endif /* DM_ACTIVATOR_BASE_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cc6fd432/dependency_manager_2/public/include/dm_component.h
----------------------------------------------------------------------
diff --git a/dependency_manager_2/public/include/dm_component.h b/dependency_manager_2/public/include/dm_component.h
deleted file mode 100644
index f98c3bb..0000000
--- a/dependency_manager_2/public/include/dm_component.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements. See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership. The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * dm_component.h
- *
- * \date 8 Oct 2014
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef COMPONENT_H_
-#define COMPONENT_H_
-
-#include <bundle_context.h>
-#include <celix_errno.h>
-
-typedef struct dm_component *dm_component_pt;
-
-#include "dm_dependency_manager.h"
-#include "dm_service_dependency.h"
-
-typedef celix_status_t (*init_fpt)(void *userData);
-typedef celix_status_t (*start_fpt)(void *userData);
-typedef celix_status_t (*stop_fpt)(void *userData);
-typedef celix_status_t (*destroy_fpt)(void *userData);
-
-celix_status_t component_create(bundle_context_pt context, dm_dependency_manager_pt manager, dm_component_pt *component);
-celix_status_t component_destroy(dm_component_pt *component);
-
-celix_status_t component_addInterface(dm_component_pt component, char *serviceName, void *service, properties_pt properties);
-celix_status_t component_setImplementation(dm_component_pt component, void *implementation);
-
-celix_status_t component_addServiceDependency(dm_component_pt component, ...);
-celix_status_t component_removeServiceDependency(dm_component_pt component, dm_service_dependency_pt dependency);
-
-celix_status_t component_setCallbacks(dm_component_pt component, init_fpt init, start_fpt start, stop_fpt, destroy_fpt);
-
-#endif /* COMPONENT_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cc6fd432/dependency_manager_2/public/include/dm_dependency_manager.h
----------------------------------------------------------------------
diff --git a/dependency_manager_2/public/include/dm_dependency_manager.h b/dependency_manager_2/public/include/dm_dependency_manager.h
deleted file mode 100644
index 4311d3a..0000000
--- a/dependency_manager_2/public/include/dm_dependency_manager.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements. See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership. The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * dm_dependency_manager.h
- *
- * \date 22 Feb 2014
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef DM_DEPENDENCY_MANAGER_H_
-#define DM_DEPENDENCY_MANAGER_H_
-
-#include "bundle_context.h"
-#include "celix_errno.h"
-#include "array_list.h"
-
-typedef struct dm_dependency_manager *dm_dependency_manager_pt;
-
-#include "dm_component.h"
-
-celix_status_t dependencyManager_create(bundle_context_pt context, dm_dependency_manager_pt *manager);
-celix_status_t dependencyManager_destroy(dm_dependency_manager_pt *manager);
-
-celix_status_t dependencyManager_add(dm_dependency_manager_pt manager, dm_component_pt component);
-celix_status_t dependencyManager_remove(dm_dependency_manager_pt manager, dm_component_pt component);
-celix_status_t dependencyManager_getComponents(dm_dependency_manager_pt manager, array_list_pt* components);
-
-#endif /* DM_DEPENDENCY_MANAGER_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cc6fd432/dependency_manager_2/public/include/dm_service_dependency.h
----------------------------------------------------------------------
diff --git a/dependency_manager_2/public/include/dm_service_dependency.h b/dependency_manager_2/public/include/dm_service_dependency.h
deleted file mode 100644
index e9a5513..0000000
--- a/dependency_manager_2/public/include/dm_service_dependency.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- *Licensed to the Apache Software Foundation (ASF) under one
- *or more contributor license agreements. See the NOTICE file
- *distributed with this work for additional information
- *regarding copyright ownership. The ASF licenses this file
- *to you under the Apache License, Version 2.0 (the
- *"License"); you may not use this file except in compliance
- *with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- *Unless required by applicable law or agreed to in writing,
- *software distributed under the License is distributed on an
- *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- *specific language governing permissions and limitations
- *under the License.
- */
-/*
- * dm_service_dependency.h
- *
- * \date 8 Oct 2014
- * \author <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- * \copyright Apache License, Version 2.0
- */
-
-#ifndef DM_SERVICE_DEPENDENCY_H_
-#define DM_SERVICE_DEPENDENCY_H_
-
-#include "celix_errno.h"
-
-typedef struct dm_service_dependency *dm_service_dependency_pt;
-
-#include "dm_component.h"
-
-typedef celix_status_t (*service_add_fpt)(void *handle, void *service);
-typedef celix_status_t (*service_change_fpt)(void *handle, void *service);
-typedef celix_status_t (*service_remove_fpt)(void *handle, void *service);
-typedef celix_status_t (*service_swap_fpt)(void *handle, void *oldService, void *newService);
-
-typedef celix_status_t (*service_add_with_ref_fpt)(void *handle, service_reference_pt reference, void *service);
-typedef celix_status_t (*service_change_with_ref_fpt)(void *handle, service_reference_pt reference, void *service);
-typedef celix_status_t (*service_remove_with_ref_fpt)(void *handle, service_reference_pt reference, void *service);
-typedef celix_status_t (*service_swap_with_ref_fpt)(void *handle, service_reference_pt oldReference, void *oldService, service_reference_pt newReference, void *newService);
-
-celix_status_t serviceDependency_create(dm_service_dependency_pt *dependency_ptr);
-celix_status_t serviceDependency_destroy(dm_service_dependency_pt *dependency_ptr);
-
-celix_status_t serviceDependency_setRequired(dm_service_dependency_pt dependency, bool required);
-celix_status_t serviceDependency_setService(dm_service_dependency_pt dependency, char *serviceName, char *filter);
-celix_status_t serviceDependency_setCallbacks(dm_service_dependency_pt dependency, service_add_fpt add, service_change_fpt change, service_remove_fpt remove, service_swap_fpt swap);
-celix_status_t serviceDependency_setCallbacksWithServiceReference(dm_service_dependency_pt dependency, service_add_with_ref_fpt add, service_change_with_ref_fpt change, service_remove_with_ref_fpt remove, service_swap_with_ref_fpt swap);
-celix_status_t serviceDependency_setAutoConfigure(dm_service_dependency_pt dependency, celix_thread_mutex_t *service_lock, void **field);
-
-#endif /* DM_SERVICE_DEPENDENCY_H_ */
http://git-wip-us.apache.org/repos/asf/celix/blob/cc6fd432/examples/whiteboard/tracker_depman/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker_depman/CMakeLists.txt b/examples/whiteboard/tracker_depman/CMakeLists.txt
index a9c3654..9cc1b07 100644
--- a/examples/whiteboard/tracker_depman/CMakeLists.txt
+++ b/examples/whiteboard/tracker_depman/CMakeLists.txt
@@ -25,15 +25,15 @@ bundle(tracker_depman SOURCES
private/include/tracker.h
)
include_directories("private/include")
-include_directories("${PROJECT_SOURCE_DIR}/dependency_manager_2/public/include")
-#include_directories("${PROJECT_SOURCE_DIR}/dependency_manager_2/private/include")
+include_directories("${PROJECT_SOURCE_DIR}/dependency_manager/public/include")
+#include_directories("${PROJECT_SOURCE_DIR}/dependency_manager/private/include")
include_directories("../publisherService/public/include")
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
# Use some magic to include all symbols of the static library
IF(APPLE)
-target_link_libraries(tracker_depman celix_framework -Wl,-all_load dependency_manager2)
+target_link_libraries(tracker_depman celix_framework -Wl,-all_load dependency_manager)
else()
-target_link_libraries(tracker_depman -Wl,--whole-archive dependency_manager2 -Wl,--no-whole-archive celix_framework)
+target_link_libraries(tracker_depman -Wl,--whole-archive dependency_manager -Wl,--no-whole-archive celix_framework)
ENDIF()
http://git-wip-us.apache.org/repos/asf/celix/blob/cc6fd432/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker_depman/private/src/dependency_activator.c b/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
index 1340751..84194f8 100644
--- a/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
+++ b/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
@@ -61,13 +61,13 @@ celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency
serviceDependency_create(&dep);
serviceDependency_setRequired(dep, false);
serviceDependency_setService(dep, PUBLISHER_NAME, "(|(id=A)(id=B))");
- serviceDependency_setCallbacks(dep, tracker_addedServ, tracker_modifiedServ, tracker_removedServ, NULL);
+ serviceDependency_setCallbacksWithServiceReference(dep, tracker_addedServ, tracker_modifiedServ, tracker_removedServ, NULL);
component_addServiceDependency(service, dep, NULL);
serviceDependency_create(&dep2);
serviceDependency_setRequired(dep2, false);
serviceDependency_setService(dep2, (char *) OSGI_LOGSERVICE_NAME, NULL);
-// serviceDependency_setCallbacks(dep2, tracker_addLog, tracker_modifiedLog, tracker_removeLog, NULL);
+ serviceDependency_setCallbacksWithServiceReference(dep2, tracker_addLog, tracker_modifiedLog, tracker_removeLog, NULL);
serviceDependency_setAutoConfigure(dep2, &data->logger_lock, (void **) &data->logger);
component_addServiceDependency(service, dep2, NULL);
@@ -122,4 +122,4 @@ celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_depende
// } else {
// pthread_mutex_unlock(&lock);
// }
-//}
\ No newline at end of file
+//}
http://git-wip-us.apache.org/repos/asf/celix/blob/cc6fd432/examples/whiteboard/tracker_depman/private/src/tracker.c
----------------------------------------------------------------------
diff --git a/examples/whiteboard/tracker_depman/private/src/tracker.c b/examples/whiteboard/tracker_depman/private/src/tracker.c
index 0d26ad8..2605609 100644
--- a/examples/whiteboard/tracker_depman/private/src/tracker.c
+++ b/examples/whiteboard/tracker_depman/private/src/tracker.c
@@ -97,25 +97,25 @@ celix_status_t tracker_removedServ(void * handle, service_reference_pt ref, void
return CELIX_SUCCESS;
}
-//celix_status_t tracker_addLog(void *handle, service_reference_pt ref, void *service) {
-// struct data * data = (struct data *) handle;
-// printf("Add log\n");
-// data->logger = service;
-// ((log_service_pt) service)->log(((log_service_pt) service)->logger, OSGI_LOGSERVICE_DEBUG, "test");
-// return CELIX_SUCCESS;
-//}
-//
-//celix_status_t tracker_modifiedLog(void *handle, service_reference_pt ref, void *service) {
-// struct data * data = (struct data *) handle;
-// printf("Modify log\n");
-// data->logger = service;
-// ((log_service_pt) service)->log(((log_service_pt) service)->logger, OSGI_LOGSERVICE_DEBUG, "test");
-// return CELIX_SUCCESS;
-//}
-//
-//celix_status_t tracker_removeLog(void *handle, service_reference_pt ref, void *service) {
-// struct data * data = (struct data *) handle;
-// data->logger = NULL;
-// printf("Remove log\n");
-// return CELIX_SUCCESS;
-//}
+celix_status_t tracker_addLog(void *handle, service_reference_pt ref, void *service) {
+ struct data * data = (struct data *) handle;
+ printf("Add log\n");
+ data->logger = service;
+ ((log_service_pt) service)->log(((log_service_pt) service)->logger, OSGI_LOGSERVICE_DEBUG, "test");
+ return CELIX_SUCCESS;
+}
+
+celix_status_t tracker_modifiedLog(void *handle, service_reference_pt ref, void *service) {
+ struct data * data = (struct data *) handle;
+ printf("Modify log\n");
+ data->logger = service;
+ ((log_service_pt) service)->log(((log_service_pt) service)->logger, OSGI_LOGSERVICE_DEBUG, "test");
+ return CELIX_SUCCESS;
+}
+
+celix_status_t tracker_removeLog(void *handle, service_reference_pt ref, void *service) {
+ struct data * data = (struct data *) handle;
+ data->logger = NULL;
+ printf("Remove log\n");
+ return CELIX_SUCCESS;
+}