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 2014/12/17 09:23:44 UTC
svn commit: r1646169 - in /celix/trunk: ./ dependency_manager_2/
dependency_manager_2/private/include/ dependency_manager_2/private/src/
dependency_manager_2/public/ dependency_manager_2/public/include/
Author: abroekhuis
Date: Wed Dec 17 08:23:43 2014
New Revision: 1646169
URL: http://svn.apache.org/r1646169
Log:
Added initial files for DM.
Added:
celix/trunk/dependency_manager_2/private/include/dm_component_impl.h
celix/trunk/dependency_manager_2/private/include/dm_service_dependency_impl.h
- copied, changed from r1646168, celix/trunk/dependency_manager_2/private/include/dm_dependency_manager.h
celix/trunk/dependency_manager_2/private/src/
celix/trunk/dependency_manager_2/private/src/dm_component_impl.c
celix/trunk/dependency_manager_2/private/src/dm_service_dependency.c
- copied, changed from r1646168, celix/trunk/dependency_manager_2/private/include/dm_component.h
celix/trunk/dependency_manager_2/public/
celix/trunk/dependency_manager_2/public/include/
celix/trunk/dependency_manager_2/public/include/dm_component.h
- copied, changed from r1646168, celix/trunk/dependency_manager_2/private/include/dm_component.h
celix/trunk/dependency_manager_2/public/include/dm_dependency_manager.h
- copied, changed from r1646168, celix/trunk/dependency_manager_2/private/include/dm_dependency_manager.h
celix/trunk/dependency_manager_2/public/include/dm_event.h
- copied, changed from r1646168, celix/trunk/dependency_manager_2/private/include/dm_dependency_manager.h
celix/trunk/dependency_manager_2/public/include/dm_service_dependency.h
Removed:
celix/trunk/dependency_manager_2/private/include/dm_component.h
celix/trunk/dependency_manager_2/private/include/dm_dependency_manager.h
Modified:
celix/trunk/CMakeLists.txt
celix/trunk/dependency_manager_2/CMakeLists.txt
Modified: celix/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/trunk/CMakeLists.txt?rev=1646169&r1=1646168&r2=1646169&view=diff
==============================================================================
--- celix/trunk/CMakeLists.txt (original)
+++ celix/trunk/CMakeLists.txt Wed Dec 17 08:23:43 2014
@@ -66,6 +66,7 @@ add_subdirectory(log_service)
add_subdirectory(event_admin)
add_subdirectory(dependency_manager)
+add_subdirectory(dependency_manager_2)
add_subdirectory(launcher)
add_subdirectory(framework)
Modified: celix/trunk/dependency_manager_2/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/trunk/dependency_manager_2/CMakeLists.txt?rev=1646169&r1=1646168&r2=1646169&view=diff
==============================================================================
--- celix/trunk/dependency_manager_2/CMakeLists.txt (original)
+++ celix/trunk/dependency_manager_2/CMakeLists.txt Wed Dec 17 08:23:43 2014
@@ -15,8 +15,8 @@
# specific language governing permissions and limitations
# under the License.
-celix_subproject(DEPENDENCY_MANAGER "Option to build the dependency manager static library" "OFF" DEPS framework)
-if (DEPENDENCY_MANAGER)
+celix_subproject(DEPENDENCY_MANAGER2 "Option to build the dependency manager static library" "OFF" DEPS framework)
+if (DEPENDENCY_MANAGER2)
# Add -fPIC for x86_64 Unix platforms; this lib will be linked to a shared lib
if(UNIX AND NOT WIN32)
find_program(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin )
@@ -29,20 +29,18 @@ if (DEPENDENCY_MANAGER)
endif(CMAKE_UNAME)
endif(UNIX AND NOT WIN32)
- CELIX_ADD_COMPONENT(dependency_manager
+ CELIX_ADD_COMPONENT(dependency_manager2
DISPLAY_NAME Dependency Manager
DESCRIPTION "The Apache Celix dependency manager (static) library"
GROUP all
)
- add_library(dependency_manager STATIC
- private/src/dependency_manager
- private/src/dependency_activator_base
- private/src/service_component
- private/src/service_dependency)
+ add_library(dependency_manager2 STATIC
+ private/src/dm_component_impl)
include_directories("public/include")
+ include_directories("private/include")
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
- target_link_libraries(dependency_manager celix_framework)
+ target_link_libraries(dependency_manager2 celix_framework)
install(
FILES
@@ -54,7 +52,7 @@ if (DEPENDENCY_MANAGER)
DESTINATION
include/celix/dependency_manager
COMPONENT
- dependency_manager
+ dependency_manager2
)
- install(TARGETS dependency_manager DESTINATION lib COMPONENT dependency_manager)
-endif (DEPENDENCY_MANAGER)
+ install(TARGETS dependency_manager2 DESTINATION lib COMPONENT dependency_manager)
+endif (DEPENDENCY_MANAGER2)
Added: celix/trunk/dependency_manager_2/private/include/dm_component_impl.h
URL: http://svn.apache.org/viewvc/celix/trunk/dependency_manager_2/private/include/dm_component_impl.h?rev=1646169&view=auto
==============================================================================
--- celix/trunk/dependency_manager_2/private/include/dm_component_impl.h (added)
+++ celix/trunk/dependency_manager_2/private/include/dm_component_impl.h Wed Dec 17 08:23:43 2014
@@ -0,0 +1,86 @@
+/**
+ *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.
+ */
+/*
+ * component.h
+ *
+ * \date 22 Feb 2014
+ * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef COMPONENT_IMPL_H_
+#define COMPONENT_IMPL_H_
+
+#include <bundle_context.h>
+
+#include "dm_component.h"
+#include "dm_dependency_manager.h"
+
+#include "dm_service_dependency.h"
+
+#include "dm_event.h"
+
+typedef enum dm_component_state {
+ DM_CMP_STATE_INACTIVE = 1,
+ DM_CMP_STATE_WAITING_FOR_REQUIRED,
+ DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED,
+ DM_CMP_STATE_TRACKING_OPTIONAL,
+} dm_component_state_pt;
+
+typedef struct dm_executor * dm_executor_pt;
+
+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);
+
+struct dm_component {
+ bundle_context_pt context;
+ dm_dependency_manager_pt manager;
+
+ char *serviceName;
+ void *implementation;
+ properties_pt properties;
+ service_registration_pt registration;
+
+ init_fpt callbackInit;
+ start_fpt callbackStart;
+ stop_fpt callbackStop;
+ destroy_fpt callbackDestroy;
+
+ array_list_pt dependencies;
+ pthread_mutex_t mutex;
+
+ dm_component_state_pt state;
+ bool isStarted;
+ bool active;
+
+ hash_map_pt dependencyEvents;
+
+ dm_executor_pt executor;
+};
+
+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_setImplementation(dm_component_pt component, void *implementation);
+
+celix_status_t component_addServiceDependency(dm_component_pt component, ...);
+
+#endif /* COMPONENT_IMPL_H_ */
Copied: celix/trunk/dependency_manager_2/private/include/dm_service_dependency_impl.h (from r1646168, celix/trunk/dependency_manager_2/private/include/dm_dependency_manager.h)
URL: http://svn.apache.org/viewvc/celix/trunk/dependency_manager_2/private/include/dm_service_dependency_impl.h?p2=celix/trunk/dependency_manager_2/private/include/dm_service_dependency_impl.h&p1=celix/trunk/dependency_manager_2/private/include/dm_dependency_manager.h&r1=1646168&r2=1646169&rev=1646169&view=diff
==============================================================================
--- celix/trunk/dependency_manager_2/private/include/dm_dependency_manager.h (original)
+++ celix/trunk/dependency_manager_2/private/include/dm_service_dependency_impl.h Wed Dec 17 08:23:43 2014
@@ -17,18 +17,29 @@
*under the License.
*/
/*
- * dm_dependency_manager.h
+ * dm_service_dependency.h
*
- * \date 22 Feb 2014
+ * \date 8 Oct 2014
* \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
-#ifndef DM_DEPENDENCY_MANAGER_H_
-#define DM_DEPENDENCY_MANAGER_H_
+#ifndef DM_SERVICE_DEPENDENCY_IMPL_H_
+#define DM_SERVICE_DEPENDENCY_IMPL_H_
+#include "dm_service_dependency.h"
+struct dm_service_dependency {
+};
+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,
+ void (*added)(void *handle, service_reference_pt reference, void *service),
+ void (*changed)(void *handle, service_reference_pt reference, void *service),
+ void (*removed)(void *handle, service_reference_pt reference, void *service));
+celix_status_t serviceDependency_setAutoConfigure(dm_service_dependency_pt dependency, void **field);
-#endif /* DM_DEPENDENCY_MANAGER_H_ */
+
+#endif /* DM_SERVICE_DEPENDENCY_IMPL_H_ */
Added: celix/trunk/dependency_manager_2/private/src/dm_component_impl.c
URL: http://svn.apache.org/viewvc/celix/trunk/dependency_manager_2/private/src/dm_component_impl.c?rev=1646169&view=auto
==============================================================================
--- celix/trunk/dependency_manager_2/private/src/dm_component_impl.c (added)
+++ celix/trunk/dependency_manager_2/private/src/dm_component_impl.c Wed Dec 17 08:23:43 2014
@@ -0,0 +1,878 @@
+/**
+ *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_impl.c
+ *
+ * \date 9 Oct 2014
+ * \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#include <stdarg.h>
+#include <stdlib.h>
+
+#include "dm_component_impl.h"
+
+struct dm_executor {
+ pthread_t runningThread;
+ linked_list_pt workQueue;
+
+ pthread_mutex_t mutex;
+};
+
+struct dm_executor_task {
+ dm_component_pt component;
+ void (*command)(void *command, void *data);
+ void *data;
+};
+
+static celix_status_t executor_runTasks(dm_executor_pt executor, pthread_t currentThread);
+static celix_status_t executor_execute(dm_executor_pt executor);
+static celix_status_t executor_executeTask(dm_executor_pt executor, dm_component_pt component, void (*command), void *data);
+static celix_status_t executor_schedule(dm_executor_pt executor, dm_component_pt component, void (*command), void *data);
+static celix_status_t executor_create(dm_component_pt component, dm_executor_pt *executor);
+
+static celix_status_t component_destroyComponent(dm_component_pt component);
+static celix_status_t component_invokeRemoveRequiredDependencies(dm_component_pt component);
+static celix_status_t component_invokeRemoveInstanceBoundDependencies(dm_component_pt component);
+static celix_status_t component_invokeRemoveOptionalDependencies(dm_component_pt component);
+static celix_status_t component_registerService(dm_component_pt component);
+static celix_status_t component_unregisterService(dm_component_pt component);
+static celix_status_t component_invokeAddOptionalDependencies(dm_component_pt component);
+static celix_status_t component_invokeAddRequiredInstanceBoundDependencies(dm_component_pt component);
+static celix_status_t component_invokeAddRequiredDependencies(dm_component_pt component);
+static celix_status_t component_allInstanceBoundAvailable(dm_component_pt component, bool *available);
+static celix_status_t component_allRequiredAvailable(dm_component_pt component, bool *available);
+static celix_status_t component_performTransition(dm_component_pt component, dm_component_state_pt oldState, dm_component_state_pt newState, bool *transition);
+static celix_status_t component_calculateNewState(dm_component_pt component, dm_component_state_pt currentState, dm_component_state_pt *newState);
+static celix_status_t component_handleChange(dm_component_pt component);
+static celix_status_t component_startDependencies(dm_component_pt component, array_list_pt dependencies);
+
+static celix_status_t component_addTask(dm_component_pt component, array_list_pt dependencies);
+static celix_status_t component_startTask(dm_component_pt component, dm_service_dependency_pt dependency);
+static celix_status_t component_stopTask(dm_component_pt component, dm_service_dependency_pt dependency);
+static celix_status_t component_removeTask(dm_component_pt component, dm_service_dependency_pt dependency);
+
+celix_status_t component_create(bundle_context_pt context, dm_dependency_manager_pt manager, dm_component_pt *component) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ *component = malloc(sizeof(**component));
+ if (!*component) {
+ status = CELIX_ENOMEM;
+ } else {
+ (*component)->context = context;
+ (*component)->manager = manager;
+
+ (*component)->callbackInit = NULL;
+ (*component)->callbackStart = NULL;
+ (*component)->callbackStop = NULL;
+ (*component)->callbackDestroy = NULL;
+
+ (*component)->implementation = NULL;
+
+ arrayList_create(&(*component)->dependencies);
+
+ pthread_mutex_init(&(*component)->mutex, NULL);
+
+ (*component)->isStarted = false;
+ (*component)->dependencyEvents = hashMap_create(NULL, NULL, NULL, NULL);
+
+ (*component)->executor = NULL;
+ executor_create(*component, &(*component)->executor);
+ }
+
+ return status;
+}
+
+celix_status_t component_addServiceDependency(dm_component_pt component, ...) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ array_list_pt dependenciesList = NULL;
+ arrayList_create(&dependenciesList);
+
+ va_list dependencies;
+ va_start(dependencies, component);
+ dm_service_dependency_pt dependency = va_arg(dependencies, dm_service_dependency_pt);
+ while (dependency != NULL) {
+ arrayList_add(dependenciesList, dependency);
+
+ executor_executeTask(component->executor, component, component_addTask, dependenciesList);
+
+ dependency = va_arg(dependencies, dm_service_dependency_pt);
+ }
+
+ va_end(dependencies);
+
+ return status;
+}
+
+
+celix_status_t component_addTask(dm_component_pt component, array_list_pt dependencies) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ array_list_pt bounds = NULL;
+ arrayList_create(&bounds);
+ for (int i = 0; i < arrayList_size(dependencies); i++) {
+ dm_service_dependency_pt dependency = arrayList_get(dependencies, i);
+
+ pthread_mutex_lock(&component->mutex);
+ arrayList_add(component->dependencies, dependency);
+ pthread_mutex_unlock(&component->mutex);
+
+ serviceDependency_add(dependency, component);
+ if (!(component->state == DM_CMP_STATE_INACTIVE)) {
+ serviceDependency_setInstanceBound(dependency, true);
+ arrayList_add(bounds, dependency);
+ }
+ component_startDependencies(component, bounds);
+ component_handleChange(component);
+ }
+
+ return status;
+}
+
+celix_status_t component_removeServiceDependency(dm_component_pt component, dm_service_dependency_pt dependency) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ executor_executeTask(component->executor, component, component_removeTask, dependency);
+
+ return status;
+}
+
+celix_status_t component_removeTask(dm_component_pt component, dm_service_dependency_pt dependency) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ pthread_mutex_lock(&component->mutex);
+ arrayList_removeElement(component->dependencies, dependency);
+ pthread_mutex_unlock(&component->mutex);
+
+ if (!(component->state == DM_CMP_STATE_INACTIVE)) {
+ serviceDependency_stop(dependency);
+ }
+ serviceDependency_remove(dependency, component);
+ component_handleChange(component);
+
+ return status;
+}
+
+celix_status_t component_start(dm_component_pt component, dm_service_dependency_pt dependency) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ executor_executeTask(component->executor, component, component_startTask, dependency);
+
+ return status;
+}
+
+celix_status_t component_startTask(dm_component_pt component, dm_service_dependency_pt dependency) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ component->isStarted = true;
+ component_handleChange(component);
+
+ return status;
+}
+
+celix_status_t component_stop(dm_component_pt component, dm_service_dependency_pt dependency) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ executor_executeTask(component->executor, component, component_stopTask, dependency);
+
+ return status;
+}
+
+celix_status_t component_stopTask(dm_component_pt component, dm_service_dependency_pt dependency) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ component->isStarted = false;
+ component_handleChange(component);
+ component->active = false;
+
+ return status;
+}
+
+celix_status_t component_setInterface(dm_component_pt component, char *serviceName, properties_pt properties) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ if (component->active) {
+ return CELIX_ILLEGAL_STATE;
+ } else {
+ component->serviceName = serviceName;
+ component->properties = properties;
+ }
+
+ return status;
+}
+
+celix_status_t component_handleAdded(dm_component_pt component, dm_service_dependency_pt dependency, dm_event_pt event) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ array_list_pt events = hashMap_get(component->dependencyEvents, dependency);
+ arrayList_add(events, event);
+ serviceDependency_setAvailable(dependency, true);
+
+ switch (component->state) {
+ case DM_CMP_STATE_WAITING_FOR_REQUIRED: {
+ bool required = false;
+ serviceDependency_isRequired(dependency, &required);
+ if (required) {
+ component_handleChange(component);
+ }
+ break;
+ }
+ case DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED: {
+ bool instanceBound = false;
+ serviceDependency_isInstanceBound(dependency, &instanceBound);
+ if (!instanceBound) {
+ bool required = false;
+ serviceDependency_isRequired(dependency, &required);
+ if (required) {
+ serviceDependency_invokeAdd(dependency, event);
+ }
+ // updateInstance
+ } else {
+ bool required = false;
+ serviceDependency_isRequired(dependency, &required);
+ if (required) {
+ component_handleChange(component);
+ }
+ }
+ break;
+ }
+ case DM_CMP_STATE_TRACKING_OPTIONAL:
+ serviceDependency_invokeAdd(dependency, event);
+ // updateInstance
+ break;
+ default:
+ break;
+ }
+
+ return status;
+}
+
+celix_status_t component_handleChanged(dm_component_pt component, dm_service_dependency_pt dependency, dm_event_pt event) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ array_list_pt events = hashMap_get(component->dependencyEvents, dependency);
+ arrayList_removeElement(events, event);
+ arrayList_add(events, event);
+
+ switch (component->state) {
+ case DM_CMP_STATE_TRACKING_OPTIONAL:
+ serviceDependency_invokeChange(dependency, event);
+ // updateInstance
+ break;
+ case DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED: {
+ bool instanceBound = false;
+ serviceDependency_isInstanceBound(dependency, &instanceBound);
+ if (!instanceBound) {
+ serviceDependency_invokeChange(dependency, event);
+ // updateInstance
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ return status;
+}
+
+celix_status_t component_handleRemoved(dm_component_pt component, dm_service_dependency_pt dependency, dm_event_pt event) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ array_list_pt events = hashMap_get(component->dependencyEvents, dependency);
+ int size = arrayList_size(events);
+ if (arrayList_contains(events, event)) {
+ size--;
+ }
+ serviceDependency_setAvailable(dependency, size > 0);
+ component_handleChange(component);
+
+ arrayList_removeElement(events, event);
+
+ switch (component->state) {
+ case DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED: {
+ bool instanceBound = false;
+ serviceDependency_isInstanceBound(dependency, &instanceBound);
+ if (!instanceBound) {
+ bool required = false;
+ serviceDependency_isRequired(dependency, &required);
+ if (required) {
+ serviceDependency_invokeRemove(dependency, event);
+ }
+ // updateInstance
+ }
+ break;
+ }
+ case DM_CMP_STATE_TRACKING_OPTIONAL:
+ serviceDependency_invokeRemove(dependency, event);
+ // updateInstance
+ break;
+ default:
+ break;
+ }
+
+ return status;
+}
+
+celix_status_t component_handleSwapped(dm_component_pt component, dm_service_dependency_pt dependency, dm_event_pt event, dm_event_pt newEvent) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ array_list_pt events = hashMap_get(component->dependencyEvents, dependency);
+ arrayList_removeElement(events, event);
+ arrayList_add(events, newEvent);
+
+ switch (component->state) {
+ case DM_CMP_STATE_WAITING_FOR_REQUIRED:
+ break;
+ case DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED:
+ {
+ bool instanceBound = false;
+ serviceDependency_isInstanceBound(dependency, &instanceBound);
+ if (!instanceBound) {
+ bool required = false;
+ serviceDependency_isRequired(dependency, &required);
+ if (required) {
+ serviceDependency_invokeSwap(dependency, event, newEvent);
+ }
+ }
+ break;
+ }
+ case DM_CMP_STATE_TRACKING_OPTIONAL:
+ serviceDependency_invokeSwap(dependency, event, newEvent);
+ break;
+ default:
+ break;
+ }
+
+ return status;
+}
+
+celix_status_t component_startDependencies(dm_component_pt component, array_list_pt dependencies) {
+ celix_status_t status = CELIX_SUCCESS;
+ array_list_pt requiredDeps = NULL;
+ arrayList_create(&requiredDeps);
+
+ for (int i = 0; i < arrayList_size(dependencies); i++) {
+ dm_service_dependency_pt dependency = arrayList_get(dependencies, i);
+ bool required = false;
+ serviceDependency_isRequired(dependency, &required);
+ if (required) {
+ arrayList_add(requiredDeps, dependency);
+ continue;
+ }
+
+ serviceDependency_start(dependency);
+ }
+
+ for (int i = 0; i < arrayList_size(requiredDeps); i++) {
+ dm_service_dependency_pt dependency = arrayList_get(requiredDeps, i);
+ serviceDependency_start(dependency);
+ }
+ return status;
+}
+
+celix_status_t component_stopDependencies(dm_component_pt component) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ for (int i = 0; i < arrayList_size(component->dependencies); i++) {
+ dm_service_dependency_pt dependency = arrayList_get(component->dependencies, i);
+ serviceDependency_stop(dependency);
+ }
+
+ return status;
+}
+
+celix_status_t component_handleChange(dm_component_pt component) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ dm_component_state_pt oldState;
+ dm_component_state_pt newState;
+
+ bool cont = false;
+ do {
+ oldState = component->state;
+ component_calculateNewState(component, oldState, &newState);
+ component->state = newState;
+ component_performTransition(component, oldState, newState, &cont);
+ } while (cont);
+
+ return status;
+}
+
+celix_status_t component_calculateNewState(dm_component_pt component, dm_component_state_pt currentState, dm_component_state_pt *newState) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ if (currentState == DM_CMP_STATE_INACTIVE) {
+ if (component->isStarted) {
+ *newState = DM_CMP_STATE_WAITING_FOR_REQUIRED;
+ return status;
+ }
+ }
+ if (currentState == DM_CMP_STATE_WAITING_FOR_REQUIRED) {
+ if (!component->isStarted) {
+ *newState = DM_CMP_STATE_INACTIVE;
+ return status;
+ }
+
+ bool available = false;
+ component_allRequiredAvailable(component, &available);
+
+ if (available) {
+ *newState = DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED;
+ return status;
+ }
+ }
+ if (currentState == DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED) {
+ bool available = false;
+ component_allRequiredAvailable(component, &available);
+
+ if (component->isStarted && available) {
+ bool instanceBoundAvailable = false;
+ component_allInstanceBoundAvailable(component, &instanceBoundAvailable);
+
+ if (instanceBoundAvailable) {
+ *newState = DM_CMP_STATE_TRACKING_OPTIONAL;
+ return status;
+ }
+
+ *newState = currentState;
+ return status;
+ }
+ *newState = DM_CMP_STATE_WAITING_FOR_REQUIRED;
+ return status;
+ }
+ if (currentState == DM_CMP_STATE_TRACKING_OPTIONAL) {
+ bool instanceBoundAvailable = false;
+ bool available = false;
+
+ component_allInstanceBoundAvailable(component, &instanceBoundAvailable);
+ component_allRequiredAvailable(component, &available);
+
+ if (component->isStarted && available && instanceBoundAvailable) {
+ *newState = currentState;
+ return status;
+ }
+
+ *newState = DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED;
+ return status;
+ }
+
+ return status;
+}
+
+celix_status_t component_performTransition(dm_component_pt component, dm_component_state_pt oldState, dm_component_state_pt newState, bool *transition) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ if (oldState == DM_CMP_STATE_INACTIVE && newState == DM_CMP_STATE_WAITING_FOR_REQUIRED) {
+ component_startDependencies(component, component->dependencies);
+// #TODO Add listener support
+// notifyListeners(newState);
+ *transition = true;
+ return status;
+ }
+
+ if (oldState == DM_CMP_STATE_WAITING_FOR_REQUIRED && newState == DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED) {
+ // #TODO Remove
+// component_instantiateComponent(component);
+ component_invokeAddRequiredDependencies(component);
+// component_invokeAutoConfigDependencies(component);
+ dm_component_state_pt stateBeforeCallingInit = component->state;
+ component->callbackInit(component->implementation);
+ if (stateBeforeCallingInit == component->state) {
+// #TODO Add listener support
+// notifyListeners(newState); // init did not change current state, we can notify about this new state
+ }
+ *transition = true;
+ return status;
+ }
+
+ if (oldState == DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED && newState == DM_CMP_STATE_TRACKING_OPTIONAL) {
+ component_invokeAddRequiredInstanceBoundDependencies(component);
+// component_invokeAutoConfigInstanceBoundDependencies(component);
+ component->callbackStart(component->implementation);
+ component_invokeAddOptionalDependencies(component);
+ component_registerService(component);
+// #TODO Add listener support
+// notifyListeners(newState);
+ return true;
+ }
+
+ if (oldState == DM_CMP_STATE_TRACKING_OPTIONAL && newState == DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED) {
+ component_unregisterService(component);
+ component_invokeRemoveOptionalDependencies(component);
+ component->callbackStop(component->implementation);
+ component_invokeRemoveInstanceBoundDependencies(component);
+// #TODO Add listener support
+// notifyListeners(newState);
+ *transition = true;
+ return status;
+ }
+
+ if (oldState == DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED && newState == DM_CMP_STATE_WAITING_FOR_REQUIRED) {
+ component->callbackDestroy(component->implementation);
+ component_invokeRemoveRequiredDependencies(component);
+// #TODO Add listener support
+// notifyListeners(newState);
+ bool needInstance = false;
+// component_someDependenciesNeedInstance(component, &needInstance);
+ if (!needInstance) {
+ component_destroyComponent(component);
+ }
+ *transition = true;
+ return status;
+ }
+
+ if (oldState == DM_CMP_STATE_WAITING_FOR_REQUIRED && newState == DM_CMP_STATE_INACTIVE) {
+ component_stopDependencies(component);
+ component_destroyComponent(component);
+// #TODO Add listener support
+// notifyListeners(newState);
+ *transition = true;
+ return status;
+ }
+
+ *transition = false;
+ return status;
+}
+
+celix_status_t component_allRequiredAvailable(dm_component_pt component, bool *available) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ *available = true;
+ for (int i = 0; i < arrayList_size(component->dependencies); i++) {
+ dm_service_dependency_pt dependency = arrayList_get(component->dependencies, i);
+ bool required = false;
+ bool instanceBound = false;
+
+ serviceDependency_isRequired(dependency, &required);
+ serviceDependency_isInstanceBound(dependency, &instanceBound);
+
+ if (required && !instanceBound) {
+ bool isAvailable = false;
+ serviceDependency_isAvailable(dependency, &isAvailable);
+ if (!isAvailable) {
+ *available = false;
+ break;
+ }
+ }
+ }
+
+ return status;
+}
+
+celix_status_t component_allInstanceBoundAvailable(dm_component_pt component, bool *available) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ *available = true;
+ for (int i = 0; i < arrayList_size(component->dependencies); i++) {
+ dm_service_dependency_pt dependency = arrayList_get(component->dependencies, i);
+ bool required = false;
+ bool instanceBound = false;
+
+ serviceDependency_isRequired(dependency, &required);
+ serviceDependency_isInstanceBound(dependency, &instanceBound);
+
+ if (required && instanceBound) {
+ bool isAvailable = false;
+ serviceDependency_isAvailable(dependency, &isAvailable);
+ if (!isAvailable) {
+ *available = false;
+ break;
+ }
+ }
+ }
+
+ return status;
+}
+
+celix_status_t component_invokeAddRequiredDependencies(dm_component_pt component) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ for (int i = 0; i < arrayList_size(component->dependencies); i++) {
+ dm_service_dependency_pt dependency = arrayList_get(component->dependencies, i);
+
+ bool required = false;
+ bool instanceBound = false;
+
+ serviceDependency_isRequired(dependency, &required);
+ serviceDependency_isInstanceBound(dependency, &instanceBound);
+
+ if (required && !instanceBound) {
+ array_list_pt events = hashMap_get(component->dependencyEvents, dependency);
+ for (int i = 0; i < arrayList_size(events); i++) {
+ dm_event_pt event = arrayList_get(events, i);
+ serviceDependency_invokeAdd(dependency, event);
+ }
+ }
+ }
+
+ return status;
+}
+
+celix_status_t component_invokeAddRequiredInstanceBoundDependencies(dm_component_pt component) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ for (int i = 0; i < arrayList_size(component->dependencies); i++) {
+ dm_service_dependency_pt dependency = arrayList_get(component->dependencies, i);
+
+ bool required = false;
+ bool instanceBound = false;
+
+ serviceDependency_isRequired(dependency, &required);
+ serviceDependency_isInstanceBound(dependency, &instanceBound);
+
+ if (instanceBound && required) {
+ array_list_pt events = hashMap_get(component->dependencyEvents, dependency);
+ for (int i = 0; i < arrayList_size(events); i++) {
+ dm_event_pt event = arrayList_get(events, i);
+ serviceDependency_invokeAdd(dependency, event);
+ }
+ }
+ }
+
+ return status;
+}
+
+celix_status_t component_invokeAddOptionalDependencies(dm_component_pt component) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ for (int i = 0; i < arrayList_size(component->dependencies); i++) {
+ dm_service_dependency_pt dependency = arrayList_get(component->dependencies, i);
+
+ bool required = false;
+
+ serviceDependency_isRequired(dependency, &required);
+
+ if (!required) {
+ array_list_pt events = hashMap_get(component->dependencyEvents, dependency);
+ for (int i = 0; i < arrayList_size(events); i++) {
+ dm_event_pt event = arrayList_get(events, i);
+ serviceDependency_invokeAdd(dependency, event);
+ }
+ }
+ }
+
+ return status;
+}
+
+celix_status_t component_invokeRemoveOptionalDependencies(dm_component_pt component) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ for (int i = 0; i < arrayList_size(component->dependencies); i++) {
+ dm_service_dependency_pt dependency = arrayList_get(component->dependencies, i);
+
+ bool required = false;
+
+ serviceDependency_isRequired(dependency, &required);
+
+ if (!required) {
+ array_list_pt events = hashMap_get(component->dependencyEvents, dependency);
+ for (int i = 0; i < arrayList_size(events); i++) {
+ dm_event_pt event = arrayList_get(events, i);
+ serviceDependency_invokeRemove(dependency, event);
+ }
+ }
+ }
+
+ return status;
+}
+
+celix_status_t component_invokeRemoveInstanceBoundDependencies(dm_component_pt component) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ for (int i = 0; i < arrayList_size(component->dependencies); i++) {
+ dm_service_dependency_pt dependency = arrayList_get(component->dependencies, i);
+
+ bool instanceBound = false;
+
+ serviceDependency_isInstanceBound(dependency, &instanceBound);
+
+ if (instanceBound) {
+ array_list_pt events = hashMap_get(component->dependencyEvents, dependency);
+ for (int i = 0; i < arrayList_size(events); i++) {
+ dm_event_pt event = arrayList_get(events, i);
+ serviceDependency_invokeRemove(dependency, event);
+ }
+ }
+ }
+
+ return status;
+}
+
+celix_status_t component_invokeRemoveRequiredDependencies(dm_component_pt component) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ for (int i = 0; i < arrayList_size(component->dependencies); i++) {
+ dm_service_dependency_pt dependency = arrayList_get(component->dependencies, i);
+
+ bool required = false;
+ bool instanceBound = false;
+
+ serviceDependency_isRequired(dependency, &required);
+ serviceDependency_isInstanceBound(dependency, &instanceBound);
+
+ if (!instanceBound && required) {
+ array_list_pt events = hashMap_get(component->dependencyEvents, dependency);
+ for (int i = 0; i < arrayList_size(events); i++) {
+ dm_event_pt event = arrayList_get(events, i);
+ serviceDependency_invokeRemove(dependency, event);
+ }
+ }
+ }
+
+ return status;
+}
+
+celix_status_t component_destroyComponent(dm_component_pt component) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ component->implementation = NULL;
+
+ return status;
+}
+
+celix_status_t component_registerService(dm_component_pt component) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ if (component->context && component->serviceName) {
+ bundleContext_registerService(component->context, component->serviceName, component->implementation, component->properties, &component->registration);
+ }
+
+ return status;
+}
+
+celix_status_t component_unregisterService(dm_component_pt component) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ if (component->registration && component->serviceName) {
+ serviceRegistration_unregister(component->registration);
+ component->registration = NULL;
+ }
+
+ return status;
+}
+
+celix_status_t component_isAvailable(dm_component_pt component, bool *available) {
+ *available = component->state == DM_CMP_STATE_TRACKING_OPTIONAL;
+ return CELIX_SUCCESS;
+}
+
+celix_status_t component_setImplementation(dm_component_pt component, void *implementation) {
+ component->implementation = implementation;
+ return CELIX_SUCCESS;
+}
+
+
+
+celix_status_t executor_create(dm_component_pt component, dm_executor_pt *executor) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ *executor = malloc(sizeof(**executor));
+ if (!*executor) {
+ status = CELIX_ENOMEM;
+ } else {
+ linkedList_create(&(*executor)->workQueue);
+ pthread_mutex_init(&(*executor)->mutex, NULL);
+ }
+
+ return status;
+}
+
+celix_status_t executor_schedule(dm_executor_pt executor, dm_component_pt component, void (*command), void *data) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ struct dm_executor_task *task = NULL;
+ task = malloc(sizeof(*task));
+ if (!task) {
+ status = CELIX_ENOMEM;
+ } else {
+ task->component = component;
+ task->command = command;
+ task->data = data;
+
+ pthread_mutex_lock(&executor->mutex);
+ linkedList_addLast(executor->workQueue, task);
+ pthread_mutex_unlock(&executor->mutex);
+ }
+
+ return status;
+}
+
+celix_status_t executor_executeTask(dm_executor_pt executor, dm_component_pt component, void (*command), void *data) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ // Check thread and executor thread, if the same, execute immediately.
+ bool execute = false;
+ pthread_mutex_lock(&executor->mutex);
+ pthread_t currentThread = pthread_self();
+ if (pthread_equal(executor->runningThread, currentThread)) {
+ execute = true;
+ }
+ pthread_mutex_unlock(&executor->mutex);
+ // For now, just schedule.
+
+ executor_schedule(executor, component, command, data);
+
+ return status;
+}
+
+celix_status_t executor_execute(dm_executor_pt executor) {
+ celix_status_t status = CELIX_SUCCESS;
+ pthread_t currentThread = pthread_self();
+
+ pthread_mutex_lock(&executor->mutex);
+ bool execute = false;
+ if (executor->runningThread == NULL) {
+ executor->runningThread = currentThread;
+ execute = true;
+ }
+ pthread_mutex_unlock(&executor->mutex);
+ if (execute) {
+ executor_runTasks(executor, currentThread);
+ }
+
+ return status;
+}
+
+celix_status_t executor_runTasks(dm_executor_pt executor, pthread_t currentThread) {
+ celix_status_t status = CELIX_SUCCESS;
+ bool execute = false;
+
+ do {
+ struct dm_executor_task *entry = NULL;
+ pthread_mutex_lock(&executor->mutex);
+ while ((entry = linkedList_removeFirst(executor->workQueue)) != NULL) {
+ pthread_mutex_unlock(&executor->mutex);
+
+ entry->command(entry->component, entry->data);
+ }
+ executor->runningThread = NULL;
+ pthread_mutex_unlock(&executor->mutex);
+
+ pthread_mutex_lock(&executor->mutex);
+ if (executor->runningThread == NULL) {
+ executor->runningThread = currentThread;
+ execute = true;
+ }
+ pthread_mutex_unlock(&executor->mutex);
+ } while (!linkedList_isEmpty(executor->workQueue) && execute);
+
+ return status;
+}
Copied: celix/trunk/dependency_manager_2/private/src/dm_service_dependency.c (from r1646168, celix/trunk/dependency_manager_2/private/include/dm_component.h)
URL: http://svn.apache.org/viewvc/celix/trunk/dependency_manager_2/private/src/dm_service_dependency.c?p2=celix/trunk/dependency_manager_2/private/src/dm_service_dependency.c&p1=celix/trunk/dependency_manager_2/private/include/dm_component.h&r1=1646168&r2=1646169&rev=1646169&view=diff
==============================================================================
--- celix/trunk/dependency_manager_2/private/include/dm_component.h (original)
+++ celix/trunk/dependency_manager_2/private/src/dm_service_dependency.c Wed Dec 17 08:23:43 2014
@@ -17,18 +17,15 @@
*under the License.
*/
/*
- * component.h
+ * dm_service_dependency.c
*
- * \date 22 Feb 2014
+ * \date 17 Oct 2014
* \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
-#ifndef COMPONENT_H_
-#define COMPONENT_H_
+#include "dm_service_dependency.h"
-typedef struct dm_component *dm_component_pt;
+celix_status_t serviceDependency_start(dm_service_dependency_pt dependency) {
-
-
-#endif /* COMPONENT_H_ */
+}
Copied: celix/trunk/dependency_manager_2/public/include/dm_component.h (from r1646168, celix/trunk/dependency_manager_2/private/include/dm_component.h)
URL: http://svn.apache.org/viewvc/celix/trunk/dependency_manager_2/public/include/dm_component.h?p2=celix/trunk/dependency_manager_2/public/include/dm_component.h&p1=celix/trunk/dependency_manager_2/private/include/dm_component.h&r1=1646168&r2=1646169&rev=1646169&view=diff
==============================================================================
--- celix/trunk/dependency_manager_2/private/include/dm_component.h (original)
+++ celix/trunk/dependency_manager_2/public/include/dm_component.h Wed Dec 17 08:23:43 2014
@@ -19,7 +19,7 @@
/*
* component.h
*
- * \date 22 Feb 2014
+ * \date 8 Oct 2014
* \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
Copied: celix/trunk/dependency_manager_2/public/include/dm_dependency_manager.h (from r1646168, celix/trunk/dependency_manager_2/private/include/dm_dependency_manager.h)
URL: http://svn.apache.org/viewvc/celix/trunk/dependency_manager_2/public/include/dm_dependency_manager.h?p2=celix/trunk/dependency_manager_2/public/include/dm_dependency_manager.h&p1=celix/trunk/dependency_manager_2/private/include/dm_dependency_manager.h&r1=1646168&r2=1646169&rev=1646169&view=diff
==============================================================================
--- celix/trunk/dependency_manager_2/private/include/dm_dependency_manager.h (original)
+++ celix/trunk/dependency_manager_2/public/include/dm_dependency_manager.h Wed Dec 17 08:23:43 2014
@@ -27,7 +27,7 @@
#ifndef DM_DEPENDENCY_MANAGER_H_
#define DM_DEPENDENCY_MANAGER_H_
-
+typedef struct dm_dependency_manager *dm_dependency_manager_pt;
Copied: celix/trunk/dependency_manager_2/public/include/dm_event.h (from r1646168, celix/trunk/dependency_manager_2/private/include/dm_dependency_manager.h)
URL: http://svn.apache.org/viewvc/celix/trunk/dependency_manager_2/public/include/dm_event.h?p2=celix/trunk/dependency_manager_2/public/include/dm_event.h&p1=celix/trunk/dependency_manager_2/private/include/dm_dependency_manager.h&r1=1646168&r2=1646169&rev=1646169&view=diff
==============================================================================
--- celix/trunk/dependency_manager_2/private/include/dm_dependency_manager.h (original)
+++ celix/trunk/dependency_manager_2/public/include/dm_event.h Wed Dec 17 08:23:43 2014
@@ -17,18 +17,22 @@
*under the License.
*/
/*
- * dm_dependency_manager.h
+ * dm_event.h
*
- * \date 22 Feb 2014
+ * \date 17 Oct 2014
* \author <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
* \copyright Apache License, Version 2.0
*/
-#ifndef DM_DEPENDENCY_MANAGER_H_
-#define DM_DEPENDENCY_MANAGER_H_
+#ifndef DM_EVENT_H_
+#define DM_EVENT_H_
+struct dm_event {
+};
+typedef struct dm_event *dm_event_pt;
-#endif /* DM_DEPENDENCY_MANAGER_H_ */
+
+#endif /* DM_EVENT_H_ */
Added: celix/trunk/dependency_manager_2/public/include/dm_service_dependency.h
URL: http://svn.apache.org/viewvc/celix/trunk/dependency_manager_2/public/include/dm_service_dependency.h?rev=1646169&view=auto
==============================================================================
--- celix/trunk/dependency_manager_2/public/include/dm_service_dependency.h (added)
+++ celix/trunk/dependency_manager_2/public/include/dm_service_dependency.h Wed Dec 17 08:23:43 2014
@@ -0,0 +1,52 @@
+/**
+ *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:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
+ * \copyright Apache License, Version 2.0
+ */
+
+#ifndef DM_SERVICE_DEPENDENCY_H_
+#define DM_SERVICE_DEPENDENCY_H_
+
+#include "dm_event.h"
+
+typedef struct dm_service_dependency *dm_service_dependency_pt;
+
+celix_status_t serviceDependency_start(dm_service_dependency_pt dependency);
+celix_status_t serviceDependency_stop(dm_service_dependency_pt dependency);
+
+celix_status_t serviceDependency_add(dm_service_dependency_pt dependency, dm_component_pt component);
+celix_status_t serviceDependency_remove(dm_service_dependency_pt dependency, dm_component_pt component);
+celix_status_t serviceDependency_setInstanceBound(dm_service_dependency_pt dependency, bool instanceBound);
+celix_status_t serviceDependency_setAvailable(dm_service_dependency_pt dependency, bool available);
+
+celix_status_t serviceDependency_invokeAdd(dm_service_dependency_pt dependency, dm_event_pt event);
+celix_status_t serviceDependency_invokeChange(dm_service_dependency_pt dependency, dm_event_pt event);
+celix_status_t serviceDependency_invokeRemove(dm_service_dependency_pt dependency, dm_event_pt event);
+celix_status_t serviceDependency_invokeSwap(dm_service_dependency_pt dependency, dm_event_pt event, dm_event_pt newEvent);
+celix_status_t serviceDependency_isAvailable(dm_service_dependency_pt dependency, bool *available);
+celix_status_t serviceDependency_isRequired(dm_service_dependency_pt dependency, bool *required);
+celix_status_t serviceDependency_isInstanceBound(dm_service_dependency_pt dependency, bool *instanceBound);
+
+
+
+#endif /* DM_SERVICE_DEPENDENCY_H_ */