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 2015/01/19 13:26:55 UTC
svn commit: r1652984 [1/5] - in /celix/branches/celix_config_admin: ./
cmake/cmake_celix/ dependency_manager_2/ deployment_admin/private/include/
deployment_admin/private/src/ device_access/device_access/
device_access/device_access/private/src/ event_...
Author: abroekhuis
Date: Mon Jan 19 12:26:54 2015
New Revision: 1652984
URL: http://svn.apache.org/r1652984
Log:
Merged trunk into branch
Added:
celix/branches/celix_config_admin/dependency_manager_2/
- copied from r1652982, celix/trunk/dependency_manager_2/
celix/branches/celix_config_admin/log_service/public/include/log_helper.h
- copied unchanged from r1652982, celix/trunk/log_service/public/include/log_helper.h
celix/branches/celix_config_admin/log_service/public/src/
- copied from r1652982, celix/trunk/log_service/public/src/
celix/branches/celix_config_admin/remote_services/calculator_proxy2/
- copied from r1652982, celix/trunk/remote_services/calculator_proxy2/
celix/branches/celix_config_admin/remote_services/remote_service_admin/private/src/export_registration_impl.c
- copied unchanged from r1652982, celix/trunk/remote_services/remote_service_admin/private/src/export_registration_impl.c
celix/branches/celix_config_admin/remote_services/remote_service_admin/private/src/import_registration_impl.c
- copied unchanged from r1652982, celix/trunk/remote_services/remote_service_admin/private/src/import_registration_impl.c
celix/branches/celix_config_admin/remote_services/remote_service_admin/private/src/remote_proxy_factory_impl.c
- copied unchanged from r1652982, celix/trunk/remote_services/remote_service_admin/private/src/remote_proxy_factory_impl.c
celix/branches/celix_config_admin/shell/private/src/activator.c
- copied unchanged from r1652982, celix/trunk/shell/private/src/activator.c
Removed:
celix/branches/celix_config_admin/remote_services/remote_service_admin_http/private/src/export_registration_impl.c
celix/branches/celix_config_admin/remote_services/remote_service_admin_http/private/src/import_registration_impl.c
celix/branches/celix_config_admin/remote_services/remote_service_admin_shm/private/src/export_registration_impl.c
celix/branches/celix_config_admin/remote_services/remote_service_admin_shm/private/src/import_registration_impl.c
Modified:
celix/branches/celix_config_admin/ (props changed)
celix/branches/celix_config_admin/CMakeLists.txt
celix/branches/celix_config_admin/cmake/cmake_celix/CodeCoverage.cmake
celix/branches/celix_config_admin/cmake/cmake_celix/Packaging.cmake
celix/branches/celix_config_admin/deployment_admin/private/include/deployment_admin.h
celix/branches/celix_config_admin/deployment_admin/private/include/deployment_package.h
celix/branches/celix_config_admin/deployment_admin/private/src/deployment_admin.c
celix/branches/celix_config_admin/deployment_admin/private/src/deployment_admin_activator.c
celix/branches/celix_config_admin/deployment_admin/private/src/deployment_package.c
celix/branches/celix_config_admin/device_access/device_access/CMakeLists.txt
celix/branches/celix_config_admin/device_access/device_access/private/src/activator.c
celix/branches/celix_config_admin/device_access/device_access/private/src/device_manager.c
celix/branches/celix_config_admin/device_access/device_access/private/src/driver_matcher.c
celix/branches/celix_config_admin/event_admin/event_admin/CMakeLists.txt
celix/branches/celix_config_admin/event_admin/event_admin/private/include/event_admin_impl.h
celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_admin_activator.c
celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_admin_impl.c
celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_impl.c
celix/branches/celix_config_admin/event_admin/event_handler/CMakeLists.txt
celix/branches/celix_config_admin/event_admin/event_handler/private/src/event_handler_activator.c
celix/branches/celix_config_admin/event_admin/event_handler/private/src/event_handler_impl.c
celix/branches/celix_config_admin/event_admin/event_publisher/CMakeLists.txt
celix/branches/celix_config_admin/event_admin/event_publisher/private/include/event_publisher_impl.h
celix/branches/celix_config_admin/event_admin/event_publisher/private/src/event_publisher_activator.c
celix/branches/celix_config_admin/event_admin/event_publisher/private/src/event_publisher_impl.c
celix/branches/celix_config_admin/examples/CMakeLists.txt
celix/branches/celix_config_admin/examples/deploy.cmake
celix/branches/celix_config_admin/examples/echo_service/client/private/src/echo_client_activator.c
celix/branches/celix_config_admin/examples/whiteboard/publisherA/CMakeLists.txt
celix/branches/celix_config_admin/examples/whiteboard/publisherB/CMakeLists.txt
celix/branches/celix_config_admin/examples/whiteboard/tracker/CMakeLists.txt
celix/branches/celix_config_admin/examples/whiteboard/tracker/private/src/activator.c
celix/branches/celix_config_admin/examples/whiteboard/tracker_depman/CMakeLists.txt
celix/branches/celix_config_admin/examples/whiteboard/tracker_depman/private/include/tracker.h
celix/branches/celix_config_admin/examples/whiteboard/tracker_depman/private/src/dependency_activator.c
celix/branches/celix_config_admin/examples/whiteboard/tracker_depman/private/src/tracker.c
celix/branches/celix_config_admin/framework/CMakeLists.txt
celix/branches/celix_config_admin/framework/private/include/bundle_cache.h
celix/branches/celix_config_admin/framework/private/include/service_reference_private.h
celix/branches/celix_config_admin/framework/private/include/service_registration_private.h
celix/branches/celix_config_admin/framework/private/mock/service_reference_mock.c
celix/branches/celix_config_admin/framework/private/mock/service_registry_mock.c
celix/branches/celix_config_admin/framework/private/mock/service_tracker_customizer_mock.c
celix/branches/celix_config_admin/framework/private/src/bundle.c
celix/branches/celix_config_admin/framework/private/src/bundle_cache.c
celix/branches/celix_config_admin/framework/private/src/bundle_revision.c
celix/branches/celix_config_admin/framework/private/src/filter.c
celix/branches/celix_config_admin/framework/private/src/framework.c
celix/branches/celix_config_admin/framework/private/src/module.c
celix/branches/celix_config_admin/framework/private/src/service_reference.c
celix/branches/celix_config_admin/framework/private/src/service_registration.c
celix/branches/celix_config_admin/framework/private/src/service_registry.c
celix/branches/celix_config_admin/framework/private/src/service_tracker.c
celix/branches/celix_config_admin/framework/private/src/service_tracker_customizer.c
celix/branches/celix_config_admin/framework/private/test/service_registration_test.cpp
celix/branches/celix_config_admin/framework/private/test/service_registry_test.cpp
celix/branches/celix_config_admin/framework/private/test/version_test.cpp
celix/branches/celix_config_admin/framework/public/include/service_factory.h
celix/branches/celix_config_admin/log_service/CMakeLists.txt
celix/branches/celix_config_admin/log_service/private/include/log.h
celix/branches/celix_config_admin/log_service/private/include/log_factory.h
celix/branches/celix_config_admin/log_service/private/include/log_reader_service_impl.h
celix/branches/celix_config_admin/log_service/private/include/log_service_impl.h
celix/branches/celix_config_admin/log_service/private/src/log.c
celix/branches/celix_config_admin/log_service/private/src/log_entry.c
celix/branches/celix_config_admin/log_service/private/src/log_factory.c
celix/branches/celix_config_admin/log_service/private/src/log_reader_service_impl.c
celix/branches/celix_config_admin/log_service/private/src/log_service_activator.c
celix/branches/celix_config_admin/log_service/private/src/log_service_impl.c
celix/branches/celix_config_admin/log_service/public/include/log_entry.h
celix/branches/celix_config_admin/log_service/public/include/log_reader_service.h
celix/branches/celix_config_admin/log_writer/log_writer/private/include/log_writer.h
celix/branches/celix_config_admin/log_writer/log_writer/private/src/log_writer.c
celix/branches/celix_config_admin/log_writer/log_writer/private/src/log_writer_activator.c
celix/branches/celix_config_admin/log_writer/log_writer_stdout/private/src/log_writer_stdout.c
celix/branches/celix_config_admin/log_writer/log_writer_syslog/private/src/log_writer_syslog.c
celix/branches/celix_config_admin/remote_services/CMakeLists.txt
celix/branches/celix_config_admin/remote_services/calculator_endpoint/private/include/calculator_endpoint_impl.h
celix/branches/celix_config_admin/remote_services/calculator_endpoint/private/src/calculator_endpoint_activator.c
celix/branches/celix_config_admin/remote_services/calculator_endpoint/private/src/calculator_endpoint_impl.c
celix/branches/celix_config_admin/remote_services/calculator_endpoint2/CMakeLists.txt
celix/branches/celix_config_admin/remote_services/calculator_proxy/CMakeLists.txt
celix/branches/celix_config_admin/remote_services/calculator_proxy/private/include/calculator_proxy_impl.h
celix/branches/celix_config_admin/remote_services/calculator_proxy/private/src/calculator_proxy_activator.c
celix/branches/celix_config_admin/remote_services/calculator_proxy/private/src/calculator_proxy_impl.c
celix/branches/celix_config_admin/remote_services/deploy.cmake
celix/branches/celix_config_admin/remote_services/discovery/private/include/endpoint_descriptor_reader.h
celix/branches/celix_config_admin/remote_services/discovery/private/include/endpoint_discovery_poller.h
celix/branches/celix_config_admin/remote_services/discovery/private/src/discovery.c
celix/branches/celix_config_admin/remote_services/discovery/private/src/discovery_activator.c
celix/branches/celix_config_admin/remote_services/discovery/private/src/endpoint_descriptor_reader.c
celix/branches/celix_config_admin/remote_services/discovery/private/src/endpoint_discovery_poller.c
celix/branches/celix_config_admin/remote_services/discovery/private/src/endpoint_discovery_server.c
celix/branches/celix_config_admin/remote_services/discovery_bonjour/CMakeLists.txt
celix/branches/celix_config_admin/remote_services/discovery_configured/CMakeLists.txt
celix/branches/celix_config_admin/remote_services/discovery_configured/private/include/discovery_impl.h
celix/branches/celix_config_admin/remote_services/discovery_configured/private/src/discovery_impl.c
celix/branches/celix_config_admin/remote_services/discovery_etcd/CMakeLists.txt
celix/branches/celix_config_admin/remote_services/discovery_etcd/private/include/discovery_impl.h
celix/branches/celix_config_admin/remote_services/discovery_etcd/private/src/etcd.c
celix/branches/celix_config_admin/remote_services/discovery_etcd/private/src/etcd_watcher.c
celix/branches/celix_config_admin/remote_services/discovery_shm/CMakeLists.txt
celix/branches/celix_config_admin/remote_services/discovery_slp/CMakeLists.txt
celix/branches/celix_config_admin/remote_services/remote_service_admin/CMakeLists.txt
celix/branches/celix_config_admin/remote_services/remote_service_admin/private/include/export_registration_impl.h
celix/branches/celix_config_admin/remote_services/remote_service_admin/private/include/import_registration_impl.h
celix/branches/celix_config_admin/remote_services/remote_service_admin/private/include/remote_service_admin_impl.h
celix/branches/celix_config_admin/remote_services/remote_service_admin/public/include/remote_endpoint_impl.h
celix/branches/celix_config_admin/remote_services/remote_service_admin/public/include/remote_proxy.h
celix/branches/celix_config_admin/remote_services/remote_service_admin/public/include/remote_service_admin.h
celix/branches/celix_config_admin/remote_services/remote_service_admin_http/CMakeLists.txt
celix/branches/celix_config_admin/remote_services/remote_service_admin_http/private/include/remote_service_admin_http_impl.h
celix/branches/celix_config_admin/remote_services/remote_service_admin_http/private/src/remote_service_admin_activator.c
celix/branches/celix_config_admin/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
celix/branches/celix_config_admin/remote_services/remote_service_admin_shm/CMakeLists.txt
celix/branches/celix_config_admin/remote_services/remote_service_admin_shm/private/src/remote_service_admin_activator.c
celix/branches/celix_config_admin/remote_services/remote_service_admin_shm/private/src/remote_service_admin_impl.c
celix/branches/celix_config_admin/remote_services/topology_manager/CMakeLists.txt
celix/branches/celix_config_admin/remote_services/topology_manager/private/include/topology_manager.h
celix/branches/celix_config_admin/remote_services/topology_manager/private/src/activator.c
celix/branches/celix_config_admin/remote_services/topology_manager/private/src/topology_manager.c
celix/branches/celix_config_admin/remote_shell/CMakeLists.txt
celix/branches/celix_config_admin/remote_shell/private/include/connection_listener.h
celix/branches/celix_config_admin/remote_shell/private/include/remote_shell.h
celix/branches/celix_config_admin/remote_shell/private/include/shell_mediator.h
celix/branches/celix_config_admin/remote_shell/private/src/activator.c
celix/branches/celix_config_admin/remote_shell/private/src/connection_listener.c
celix/branches/celix_config_admin/remote_shell/private/src/remote_shell.c
celix/branches/celix_config_admin/remote_shell/private/src/shell_mediator.c
celix/branches/celix_config_admin/shell/CMakeLists.txt
celix/branches/celix_config_admin/shell/private/include/shell_private.h
celix/branches/celix_config_admin/shell/private/src/install_command.c
celix/branches/celix_config_admin/shell/private/src/log_command.c
celix/branches/celix_config_admin/shell/private/src/shell.c
celix/branches/celix_config_admin/shell_bonjour/CMakeLists.txt
celix/branches/celix_config_admin/shell_tui/private/src/shell_tui.c
celix/branches/celix_config_admin/utils/CMakeLists.txt
celix/branches/celix_config_admin/utils/private/src/celix_threads.c
celix/branches/celix_config_admin/utils/public/include/celix_threads.h
Propchange: celix/branches/celix_config_admin/
------------------------------------------------------------------------------
svn:mergeinfo = /celix/trunk:1633669-1652982
Modified: celix/branches/celix_config_admin/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/CMakeLists.txt?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/CMakeLists.txt (original)
+++ celix/branches/celix_config_admin/CMakeLists.txt Mon Jan 19 12:26:54 2015
@@ -67,6 +67,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/branches/celix_config_admin/cmake/cmake_celix/CodeCoverage.cmake
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/cmake/cmake_celix/CodeCoverage.cmake?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/cmake/cmake_celix/CodeCoverage.cmake (original)
+++ celix/branches/celix_config_admin/cmake/cmake_celix/CodeCoverage.cmake Mon Jan 19 12:26:54 2015
@@ -44,41 +44,49 @@
# 6. Removed unneeded Cobertura function
#
-# Check prereqs
-FIND_PROGRAM( GCOV_PATH gcov )
-FIND_PROGRAM( LCOV_PATH lcov )
-FIND_PROGRAM( GENHTML_PATH genhtml )
-FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests)
+# Option to enable/disable coverage
+option(ENABLE_CODE_COVERAGE "Enables code coverage" FALSE)
-IF(NOT GCOV_PATH)
- MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
-ENDIF() # NOT GCOV_PATH
+# Check if coverage is enabled
+IF(ENABLE_CODE_COVERAGE)
-#IF(NOT CMAKE_COMPILER_IS_GNUCXX)
-# MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
-#ENDIF() # NOT CMAKE_COMPILER_IS_GNUCXX
-
-IF ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
- MESSAGE( WARNING "Code coverage results with an optimised (non-Debug) build may be misleading" )
-ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
-
-# Setup compiler options
-ADD_DEFINITIONS(--coverage)
-set(CMAKE_SHARED_LINKER_FLAGS "--coverage")
-set(CMAKE_EXE_LINKER_FLAGS "--coverage")
-
-IF(NOT TARGET coverage)
- add_custom_target(coverage
- COMMAND ${CMAKE_COMMAND} -E make_directory coverage_results
- COMMAND ${GENHTML_PATH} -o coverage_results coverage/*.info.cleaned
- COMMAND ${CMAKE_COMMAND} -E remove_directory coverage
-
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- COMMENT "Generating report.\nOpen ./${_outputname}/index.html in your browser to view the coverage report."
- )
-
- SET_TARGET_PROPERTIES(coverage PROPERTIES COVERAGE_TARGET_ADDED "")
-ENDIF()
+ # Check prereqs
+ FIND_PROGRAM( GCOV_PATH gcov )
+ FIND_PROGRAM( LCOV_PATH lcov )
+ FIND_PROGRAM( GENHTML_PATH genhtml )
+ FIND_PROGRAM( GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/tests)
+
+ IF(NOT GCOV_PATH)
+ MESSAGE(FATAL_ERROR "gcov not found! Aborting...")
+ ENDIF() # NOT GCOV_PATH
+
+ #IF(NOT CMAKE_COMPILER_IS_GNUCXX)
+ # MESSAGE(FATAL_ERROR "Compiler is not GNU gcc! Aborting...")
+ #ENDIF() # NOT CMAKE_COMPILER_IS_GNUCXX
+
+ IF ( NOT CMAKE_BUILD_TYPE STREQUAL "Debug" )
+ MESSAGE( WARNING "Code coverage results with an optimised (non-Debug) build may be misleading" )
+ ENDIF() # NOT CMAKE_BUILD_TYPE STREQUAL "Debug"
+
+ # Setup compiler options
+ ADD_DEFINITIONS(--coverage)
+ set(CMAKE_SHARED_LINKER_FLAGS "--coverage")
+ set(CMAKE_EXE_LINKER_FLAGS "--coverage")
+
+ IF(NOT TARGET coverage)
+ add_custom_target(coverage
+ COMMAND ${CMAKE_COMMAND} -E make_directory coverage_results
+ COMMAND ${GENHTML_PATH} -o coverage_results coverage/*.info.cleaned
+ COMMAND ${CMAKE_COMMAND} -E remove_directory coverage
+
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ COMMENT "Generating report.\nOpen ./${_outputname}/index.html in your browser to view the coverage report."
+ )
+
+ SET_TARGET_PROPERTIES(coverage PROPERTIES COVERAGE_TARGET_ADDED "")
+ ENDIF()
+
+ENDIF(ENABLE_CODE_COVERAGE)
# Param _targetname The name of new the custom make target
# Param _testrunner The name of the target which runs the tests
@@ -87,31 +95,32 @@ ENDIF()
# Optional fourth parameter is passed as arguments to _testrunner
# Pass them in list form, e.g.: "-j;2" for -j 2
FUNCTION(SETUP_TARGET_FOR_COVERAGE _targetname _testrunner _outputname)
-
- IF(NOT LCOV_PATH)
- MESSAGE(FATAL_ERROR "lcov not found! Aborting...")
- ENDIF() # NOT LCOV_PATH
-
- IF(NOT GENHTML_PATH)
- MESSAGE(FATAL_ERROR "genhtml not found! Aborting...")
- ENDIF() # NOT GENHTML_PATH
-
- # Setup target
- ADD_CUSTOM_TARGET(${_targetname}
-
- # Cleanup lcov
- ${LCOV_PATH} --directory . --zerocounters
-
- # Run tests
- COMMAND ${_testrunner} ${ARGV3}
-
- # Capturing lcov counters and generating report
- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/coverage
- COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info
- COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'mock/*' 'test/*' '/usr/*' --output-file ${_outputname}.info.cleaned
-
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
- )
- ADD_DEPENDENCIES(coverage ${_targetname})
+ IF(ENABLE_CODE_COVERAGE)
+ IF(NOT LCOV_PATH)
+ MESSAGE(FATAL_ERROR "lcov not found! Aborting...")
+ ENDIF() # NOT LCOV_PATH
+
+ IF(NOT GENHTML_PATH)
+ MESSAGE(FATAL_ERROR "genhtml not found! Aborting...")
+ ENDIF() # NOT GENHTML_PATH
+
+ # Setup target
+ ADD_CUSTOM_TARGET(${_targetname}
+
+ # Cleanup lcov
+ ${LCOV_PATH} --directory . --zerocounters
+
+ # Run tests
+ COMMAND ${_testrunner} ${ARGV3}
+
+ # Capturing lcov counters and generating report
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/coverage
+ COMMAND ${LCOV_PATH} --directory . --capture --output-file ${_outputname}.info
+ COMMAND ${LCOV_PATH} --remove ${_outputname}.info 'mock/*' 'test/*' '/usr/*' --output-file ${_outputname}.info.cleaned
+
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Resetting code coverage counters to zero.\nProcessing code coverage counters and generating report."
+ )
+ ADD_DEPENDENCIES(coverage ${_targetname})
+ ENDIF(ENABLE_CODE_COVERAGE)
ENDFUNCTION() # SETUP_TARGET_FOR_COVERAGE
\ No newline at end of file
Modified: celix/branches/celix_config_admin/cmake/cmake_celix/Packaging.cmake
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/cmake/cmake_celix/Packaging.cmake?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/cmake/cmake_celix/Packaging.cmake (original)
+++ celix/branches/celix_config_admin/cmake/cmake_celix/Packaging.cmake Mon Jan 19 12:26:54 2015
@@ -160,7 +160,7 @@ ENDMACRO()
MACRO(bundle)
- PARSE_ARGUMENTS(_BUNDLE "SOURCES;EXPORT_VERSION;ACTIVATOR;PRIVATE_LIBRARIES;EXPORT_LIBRARIES;IMPORT_LIBRARIES;FILES;DIRECTORIES;INSTALL_FILES" "PRIVATE;EXPORT;INSTALL" ${ARGN})
+ PARSE_ARGUMENTS(_BUNDLE "SOURCES;LINK_LIBRARIES;EXPORT_VERSION;ACTIVATOR;PRIVATE_LIBRARIES;EXPORT_LIBRARIES;IMPORT_LIBRARIES;FILES;DIRECTORIES;INSTALL_FILES" "PRIVATE;EXPORT;INSTALL" ${ARGN})
LIST(GET _BUNDLE_DEFAULT_ARGS 0 _BUNDLE_NAME)
CHECK_HEADERS()
@@ -176,6 +176,7 @@ MACRO(bundle)
if(_BUNDLE_SOURCES)
add_library(${_BUNDLE_NAME} SHARED ${_BUNDLE_SOURCES})
+ target_link_libraries(${_BUNDLE_NAME} ${_BUNDLE_LINK_LIBRARIES})
SET_HEADERS("Bundle-Activator: ${_BUNDLE_NAME}")
else(_BUNDLE_SOURCES)
add_custom_target(${_BUNDLE_NAME})
Modified: celix/branches/celix_config_admin/deployment_admin/private/include/deployment_admin.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/deployment_admin/private/include/deployment_admin.h?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/deployment_admin/private/include/deployment_admin.h (original)
+++ celix/branches/celix_config_admin/deployment_admin/private/include/deployment_admin.h Mon Jan 19 12:26:54 2015
@@ -53,5 +53,6 @@ typedef enum {
} DEPLOYMENT_ADMIN_AUDIT_EVENT;
celix_status_t deploymentAdmin_create(apr_pool_t *pool, bundle_context_pt context, deployment_admin_pt *admin);
+celix_status_t deploymentAdmin_destroy(deployment_admin_pt admin);
#endif /* DEPLOYMENT_ADMIN_H_ */
Modified: celix/branches/celix_config_admin/deployment_admin/private/include/deployment_package.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/deployment_admin/private/include/deployment_package.h?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/deployment_admin/private/include/deployment_package.h (original)
+++ celix/branches/celix_config_admin/deployment_admin/private/include/deployment_package.h Mon Jan 19 12:26:54 2015
@@ -67,6 +67,7 @@ struct deployment_package {
typedef struct deployment_package *deployment_package_pt;
celix_status_t deploymentPackage_create(apr_pool_t *pool, bundle_context_pt context, manifest_pt manifest, deployment_package_pt *package);
+celix_status_t deploymentPackage_destroy(deployment_package_pt package);
celix_status_t deploymentPackage_getName(deployment_package_pt package, char **name);
celix_status_t deploymentPackage_getBundleInfos(deployment_package_pt package, array_list_pt *infos);
celix_status_t deploymentPackage_getBundleInfoByName(deployment_package_pt package, char *name, bundle_info_pt *info);
Modified: celix/branches/celix_config_admin/deployment_admin/private/src/deployment_admin.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/deployment_admin/private/src/deployment_admin.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/deployment_admin/private/src/deployment_admin.c (original)
+++ celix/branches/celix_config_admin/deployment_admin/private/src/deployment_admin.c Mon Jan 19 12:26:54 2015
@@ -129,6 +129,29 @@ celix_status_t deploymentAdmin_create(ap
return status;
}
+
+
+celix_status_t deploymentAdmin_destroy(deployment_admin_pt admin) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ hash_map_iterator_pt iter = hashMapIterator_create(admin->packages);
+
+ while (hashMapIterator_hasNext(iter)) {
+ deployment_package_pt target = (deployment_package_pt) hashMapIterator_nextValue(iter);
+ deploymentPackage_destroy(target);
+ }
+
+ hashMapIterator_destroy(iter);
+
+ hashMap_destroy(admin->packages, false, false);
+
+ if (admin->current != NULL) {
+ free(admin->current);
+ }
+
+ return status;
+}
+
static celix_status_t deploymentAdmin_updateAuditPool(deployment_admin_pt admin, DEPLOYMENT_ADMIN_AUDIT_EVENT auditEvent) {
celix_status_t status = CELIX_SUCCESS;
@@ -190,10 +213,8 @@ static void * APR_THREAD_FUNC deployment
request = apr_pstrcat(admin->pool, admin->pollUrl, "/", last, NULL);
}
- char inputFile[256];
- inputFile[0] = '\0';
- char *test = inputFile;
- celix_status_t status = deploymentAdmin_download(request, &test);
+ char *inputFilename = NULL;
+ celix_status_t status = deploymentAdmin_download(request, &inputFilename);
if (status == CELIX_SUCCESS) {
bundle_pt bundle = NULL;
bundleContext_getBundle(admin->context, &bundle);
@@ -210,7 +231,7 @@ static void * APR_THREAD_FUNC deployment
apr_dir_make(tmpDir, APR_UREAD|APR_UWRITE|APR_UEXECUTE, admin->pool);
// TODO: update to use bundle cache DataFile instead of module entries.
- unzip_extractDeploymentPackage(test, tmpDir);
+ unzip_extractDeploymentPackage(inputFilename, tmpDir);
char *manifest = apr_pstrcat(admin->pool, tmpDir, "/META-INF/MANIFEST.MF", NULL);
manifest_pt mf = NULL;
manifest_createFromFile(manifest, &mf);
@@ -243,10 +264,13 @@ static void * APR_THREAD_FUNC deployment
deploymentAdmin_deleteTree(repoCache, admin->pool);
deploymentAdmin_deleteTree(tmpDir, admin->pool);
- remove(test);
+ remove(inputFilename);
admin->current = strdup(last);
hashMap_put(admin->packages, name, source);
}
+ if (inputFilename != NULL) {
+ free(inputFilename);
+ }
}
}
sleep(5);
@@ -320,7 +344,7 @@ celix_status_t deploymentAdmin_download(
CURLcode res = 0;
curl = curl_easy_init();
if (curl) {
- *inputFile = "updateXXXXXX";
+ *inputFile = strdup("updateXXXXXX");
int fd = mkstemp(*inputFile);
if (fd) {
FILE *fp = fopen(*inputFile, "wb+");
Modified: celix/branches/celix_config_admin/deployment_admin/private/src/deployment_admin_activator.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/deployment_admin/private/src/deployment_admin_activator.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/deployment_admin/private/src/deployment_admin_activator.c (original)
+++ celix/branches/celix_config_admin/deployment_admin/private/src/deployment_admin_activator.c Mon Jan 19 12:26:54 2015
@@ -28,17 +28,19 @@
#include "bundle_activator.h"
#include "deployment_admin.h"
-struct activator {
+struct bundle_activator {
apr_pool_t *pool;
deployment_admin_pt admin;
};
+typedef struct bundle_activator* bundle_activator_pt;
+
celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
celix_status_t status = CELIX_SUCCESS;
apr_pool_t *parentPool = NULL;
apr_pool_t *pool = NULL;
- struct activator *activator;
+ bundle_activator_pt activator = NULL;
status = bundleContext_getMemoryPool(context, &parentPool);
if (status == CELIX_SUCCESS) {
@@ -75,6 +77,11 @@ celix_status_t bundleActivator_stop(void
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
celix_status_t status = CELIX_SUCCESS;
+
+ bundle_activator_pt activator = (bundle_activator_pt) userData;
+
+ status = deploymentAdmin_destroy(activator->admin);
+
return status;
}
Modified: celix/branches/celix_config_admin/deployment_admin/private/src/deployment_package.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/deployment_admin/private/src/deployment_package.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/deployment_admin/private/src/deployment_package.c (original)
+++ celix/branches/celix_config_admin/deployment_admin/private/src/deployment_package.c Mon Jan 19 12:26:54 2015
@@ -78,6 +78,18 @@ celix_status_t deploymentPackage_create(
return status;
}
+celix_status_t deploymentPackage_destroy(deployment_package_pt package) {
+ celix_status_t status = CELIX_SUCCESS;
+
+ hashMap_destroy(package->nameToBundleInfo, false, false);
+ hashMap_destroy(package->pathToEntry, false, false);
+
+ arrayList_destroy(package->bundleInfos);
+ arrayList_destroy(package->resourceInfos);
+
+ return status;
+}
+
celix_status_t deploymentPackage_getName(deployment_package_pt package, char **name) {
*name = manifest_getValue(package->manifest, "DeploymentPackage-SymbolicName");
return CELIX_SUCCESS;
Modified: celix/branches/celix_config_admin/device_access/device_access/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/device_access/device_access/CMakeLists.txt?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/device_access/device_access/CMakeLists.txt (original)
+++ celix/branches/celix_config_admin/device_access/device_access/CMakeLists.txt Mon Jan 19 12:26:54 2015
@@ -28,6 +28,8 @@ bundle(device_manager SOURCES
private/src/driver_loader
private/src/driver_matcher
+ ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
+
private/include/device_manager.h
private/include/driver_attributes.h
private/include/driver_loader.h
@@ -45,6 +47,7 @@ install_bundle(device_manager
include_directories("${PROJECT_SOURCE_DIR}/framework/public/include")
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
include_directories("public/include")
include_directories("private/include")
Modified: celix/branches/celix_config_admin/device_access/device_access/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/device_access/device_access/private/src/activator.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/device_access/device_access/private/src/activator.c (original)
+++ celix/branches/celix_config_admin/device_access/device_access/private/src/activator.c Mon Jan 19 12:26:54 2015
@@ -33,8 +33,11 @@
#include "driver_locator.h"
#include "device_manager.h"
+#include "log_service.h"
+#include "log_helper.h"
struct device_manager_bundle_instance {
+ log_helper_pt loghelper;
bundle_context_pt context;
apr_pool_t *pool;
device_manager_pt deviceManager;
@@ -72,6 +75,9 @@ celix_status_t bundleActivator_create(bu
(*userData) = bi;
bi->context = context;
bi->pool = pool;
+
+ logHelper_create(context, &bi->loghelper);
+
status = deviceManager_create(pool, context, &bi->deviceManager);
}
}
@@ -82,6 +88,9 @@ celix_status_t bundleActivator_start(voi
celix_status_t status = CELIX_SUCCESS;
device_manager_bundle_instance_pt bundleData = userData;
apr_pool_t *pool;
+
+ logHelper_start(bundleData->loghelper);
+
status = bundleContext_getMemoryPool(context, &pool);
if (status == CELIX_SUCCESS) {
status = deviceManagerBundle_createDriverLocatorTracker(bundleData);
@@ -103,10 +112,11 @@ celix_status_t bundleActivator_start(voi
}
if (status != CELIX_SUCCESS) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "DEVICE_MANAGER: Error while starting bundle got error num %d", status);
+ logHelper_log(bundleData->loghelper, OSGI_LOGSERVICE_ERROR, "DEVICE_MANAGER: Error while starting bundle got error num %d", status);
}
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DEVICE_MANAGER: Started");
+ logHelper_log(bundleData->loghelper, OSGI_LOGSERVICE_INFO, "DEVICE_MANAGER: Started");
+
return status;
}
@@ -180,6 +190,9 @@ celix_status_t bundleActivator_stop(void
status = serviceTracker_close(bundleData->deviceTracker);
}
}
+
+ logHelper_stop(bundleData->loghelper);
+
return status;
}
@@ -187,5 +200,8 @@ celix_status_t bundleActivator_destroy(v
celix_status_t status = CELIX_SUCCESS;
device_manager_bundle_instance_pt bundleData = userData;
status = deviceManager_destroy(bundleData->deviceManager);
+
+ logHelper_destroy(&bundleData->loghelper);
+
return status;
}
Modified: celix/branches/celix_config_admin/device_access/device_access/private/src/device_manager.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/device_access/device_access/private/src/device_manager.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/device_access/device_access/private/src/device_manager.c (original)
+++ celix/branches/celix_config_admin/device_access/device_access/private/src/device_manager.c Mon Jan 19 12:26:54 2015
@@ -34,6 +34,9 @@
#include "driver_loader.h"
#include "driver.h"
#include "device.h"
+#include "log_helper.h"
+#include "log_service.h"
+
#include <bundle.h>
#include <module.h>
@@ -48,6 +51,7 @@ struct device_manager {
hash_map_pt drivers;
array_list_pt locators;
driver_selector_service_pt selector;
+ log_helper_pt loghelper;
};
static celix_status_t deviceManager_attachAlgorithm(device_manager_pt manager, service_reference_pt ref, void *service);
@@ -70,17 +74,25 @@ celix_status_t deviceManager_create(apr_
(*manager)->devices = hashMap_create(serviceReference_hashCode, NULL, serviceReference_equals2, NULL);
(*manager)->drivers = hashMap_create(serviceReference_hashCode, NULL, serviceReference_equals2, NULL);
+
status = arrayList_create(&(*manager)->locators);
+
+ if(logHelper_create(context, &(*manager)->loghelper) == CELIX_SUCCESS) {
+ logHelper_start((*manager)->loghelper);
+ }
}
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Initialized");
+ logHelper_log((*manager)->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Initialized");
return status;
}
celix_status_t deviceManager_destroy(device_manager_pt manager) {
celix_status_t status = CELIX_SUCCESS;
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DEVICE_MANAGER: Stop");
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "DEVICE_MANAGER: Stop");
+
+ logHelper_stop(manager->loghelper);
+ logHelper_destroy(&manager->loghelper);
hashMap_destroy(manager->devices, false, false);
hashMap_destroy(manager->drivers, false, false);
arrayList_destroy(manager->locators);
@@ -89,48 +101,50 @@ celix_status_t deviceManager_destroy(dev
}
celix_status_t deviceManager_selectorAdded(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Add selector");
device_manager_pt manager = handle;
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Add selector");
+
manager->selector = (driver_selector_service_pt) service;
return CELIX_SUCCESS;
}
celix_status_t deviceManager_selectorModified(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Modify selector");
+ device_manager_pt manager = handle;
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Modify selector");
return CELIX_SUCCESS;
}
celix_status_t deviceManager_selectorRemoved(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Remove selector");
device_manager_pt manager = handle;
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Remove selector");
manager->selector = NULL;
return CELIX_SUCCESS;
}
celix_status_t deviceManager_locatorAdded(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Add locator");
device_manager_pt manager = handle;
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Add locator");
arrayList_add(manager->locators, service);
return CELIX_SUCCESS;
}
celix_status_t deviceManager_locatorModified(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Modify locator");
+ device_manager_pt manager = handle;
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Modify locator");
return CELIX_SUCCESS;
}
celix_status_t deviceManager_locatorRemoved(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Remove locator");
device_manager_pt manager = handle;
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Remove locator");
arrayList_removeElement(manager->locators, service);
return CELIX_SUCCESS;
}
celix_status_t deviceManager_deviceAdded(void * handle, service_reference_pt ref, void * service) {
celix_status_t status = CELIX_SUCCESS;
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Add device");
device_manager_pt manager = handle;
-
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Add device");
status = deviceManager_attachAlgorithm(manager, ref, service);
return status;
@@ -226,7 +240,7 @@ celix_status_t deviceManager_matchAttach
for (i = 0; i < arrayList_size(driverIds); i++) {
char *id = arrayList_get(driverIds, i);
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DEVICE_MANAGER: Driver found: %s", id);
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "DEVICE_MANAGER: Driver found: %s", id);
}
status = driverLoader_loadDrivers(loader, attachPool, manager->locators, driverIds, &references);
@@ -248,7 +262,7 @@ celix_status_t deviceManager_matchAttach
int match = 0;
celix_status_t substatus = driverAttributes_match(attributes, reference, &match);
if (substatus == CELIX_SUCCESS) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "DEVICE_MANAGER: Found match: %d", match);
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "DEVICE_MANAGER: Found match: %d", match);
if (match <= OSGI_DEVICEACCESS_DEVICE_MATCH_NONE) {
continue;
}
@@ -308,16 +322,16 @@ celix_status_t deviceManager_noDriverFou
}
celix_status_t deviceManager_deviceModified(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Modify device");
+ device_manager_pt manager = handle;
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Modify device");
// #TODO the device properties could be changed
- //device_manager_pt manager = handle;
//hashMap_put(manager->devices, ref, service);
return CELIX_SUCCESS;
}
celix_status_t deviceManager_deviceRemoved(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Remove device");
device_manager_pt manager = handle;
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Remove device");
hashMap_remove(manager->devices, ref);
return CELIX_SUCCESS;
}
@@ -325,8 +339,8 @@ celix_status_t deviceManager_deviceRemov
celix_status_t deviceManager_driverAdded(void * handle, service_reference_pt ref, void * service) {
celix_status_t status = CELIX_SUCCESS;
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Add driver");
device_manager_pt manager = handle;
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Add driver");
apr_pool_t *pool = NULL;
driver_attributes_pt attributes = NULL;
@@ -341,7 +355,8 @@ celix_status_t deviceManager_driverAdded
}
celix_status_t deviceManager_driverModified(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Modify driver");
+ device_manager_pt manager = handle;
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Modify driver");
// #TODO the driver properties could be changed?
return CELIX_SUCCESS;
}
@@ -349,8 +364,9 @@ celix_status_t deviceManager_driverModif
celix_status_t deviceManager_driverRemoved(void * handle, service_reference_pt ref, void * service) {
celix_status_t status = CELIX_SUCCESS;
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Remove driver");
device_manager_pt manager = handle;
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Remove driver");
+
hashMap_remove(manager->drivers, ref);
apr_pool_t *idleCheckPool;
@@ -374,7 +390,7 @@ celix_status_t deviceManager_driverRemov
if (forStatus == CELIX_SUCCESS) {
forStatus = module_getSymbolicName(module, &bsn);
if (forStatus == CELIX_SUCCESS) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: IDLE: %s", bsn);
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: IDLE: %s", bsn);
// #TODO attachDriver (idle device)
// #TODO this can result in a loop?
// Locate and install a driver
@@ -429,7 +445,7 @@ celix_status_t deviceManager_getIdleDevi
if (substatus == CELIX_SUCCESS) {
substatus = module_getSymbolicName(module, &bsn);
if (substatus == CELIX_SUCCESS) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Check idle device: %s", bsn);
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Check idle device: %s", bsn);
array_list_pt bundles = NULL;
substatus = serviceReference_getUsingBundles(ref, &bundles);
if (substatus == CELIX_SUCCESS) {
@@ -446,7 +462,7 @@ celix_status_t deviceManager_getIdleDevi
bundle_getCurrentModule(bundle, &module);
module_getSymbolicName(module, &bsn);
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Not idle, used by driver: %s", bsn);
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Not idle, used by driver: %s", bsn);
inUse = true;
break;
@@ -493,7 +509,7 @@ celix_status_t deviceManager_getIdleDevi
substatus = DO_IF_SUCCESS(substatus, serviceReference_getUsingBundles(ref, &bundles));
if (substatus == CELIX_SUCCESS) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Check idle device: %s", bsn);
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Check idle device: %s", bsn);
bool inUse = false;
int i;
for (i = 0; i < arrayList_size(bundles); i++) {
@@ -507,7 +523,7 @@ celix_status_t deviceManager_getIdleDevi
bundle_getCurrentModule(bundle, &module);
module_getSymbolicName(module, &bsn);
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DEVICE_MANAGER: Not idle, used by driver: %s", bsn);
+ logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Not idle, used by driver: %s", bsn);
inUse = true;
break;
Modified: celix/branches/celix_config_admin/device_access/device_access/private/src/driver_matcher.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/device_access/device_access/private/src/driver_matcher.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/device_access/device_access/private/src/driver_matcher.c (original)
+++ celix/branches/celix_config_admin/device_access/device_access/private/src/driver_matcher.c Mon Jan 19 12:26:54 2015
@@ -29,18 +29,22 @@
#include "constants.h"
#include "driver_matcher.h"
+#include "log_helper.h"
+#include "log_service.h"
+
struct driver_matcher {
apr_pool_t *pool;
hash_map_pt attributes;
- array_list_pt matches;
+ array_list_pt matches;
+ log_helper_pt loghelper;
- bundle_context_pt context;
+ bundle_context_pt context;
};
typedef struct match_key {
int matchValue;
-} *match_key_t;
+}*match_key_t;
static apr_status_t driverMatcher_destroy(void *matcherP);
static celix_status_t driverMatcher_get(driver_matcher_pt matcher, int key, array_list_pt *attributesV);
@@ -71,6 +75,11 @@ celix_status_t driverMatcher_create(apr_
(*matcher)->attributes = hashMap_create(driverMatcher_matchKeyHash, NULL, driverMatcher_matchKeyEquals, NULL);
arrayList_create(&(*matcher)->matches);
+
+ if(logHelper_create(context, &(*matcher)->loghelper) == CELIX_SUCCESS) {
+ logHelper_start((*matcher)->loghelper);
+ }
+
}
return status;
@@ -88,6 +97,10 @@ apr_status_t driverMatcher_destroy(void
}
hashMapIterator_destroy(iter);
hashMap_destroy(matcher->attributes, false, false);
+
+ logHelper_stop(matcher->loghelper);
+ logHelper_destroy(&matcher->loghelper);
+
return APR_SUCCESS;
}
@@ -196,37 +209,42 @@ celix_status_t driverMatcher_getBestMatc
celix_status_t substatus = driverAttributes_getReference(attributes, &reference);
if (substatus == CELIX_SUCCESS) {
if (best != NULL) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DRIVER_MATCHER: Compare ranking");
char *rank1Str, *rank2Str;
int rank1, rank2;
- rank1Str = "0";
- rank2Str = "0";
- serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_RANKING, &rank1Str);
- serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_RANKING, &rank2Str);
-
- rank1 = atoi(rank1Str);
- rank2 = atoi(rank2Str);
-
- if (rank1 != rank2) {
- if (rank1 > rank2) {
- best = reference;
- }
- } else {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "DRIVER_MATCHER: Compare id's");
- char *id1Str, *id2Str;
- long id1, id2;
-
- id1Str = NULL;
- id2Str = NULL;
- serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_ID, &id1Str);
- serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_ID, &id2Str);
-
- id1 = atol(id1Str);
- id2 = atol(id2Str);
-
- if (id1 < id2) {
- best = reference;
- }
+
+ rank1Str = "0";
+ rank2Str = "0";
+
+ logHelper_log(matcher->loghelper, OSGI_LOGSERVICE_DEBUG, "DRIVER_MATCHER: Compare ranking");
+
+ serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_RANKING, &rank1Str);
+ serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_RANKING, &rank2Str);
+
+ rank1 = atoi(rank1Str);
+ rank2 = atoi(rank2Str);
+
+ if (rank1 != rank2) {
+ if (rank1 > rank2) {
+ best = reference;
+ }
+ } else {
+ char *id1Str, *id2Str;
+ long id1, id2;
+
+ id1Str = NULL;
+ id2Str = NULL;
+
+ logHelper_log(matcher->loghelper, OSGI_LOGSERVICE_DEBUG, "DRIVER_MATCHER: Compare id's");
+
+ serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_ID, &id1Str);
+ serviceReference_getProperty(reference, (char *) OSGI_FRAMEWORK_SERVICE_ID, &id2Str);
+
+ id1 = atol(id1Str);
+ id2 = atol(id2Str);
+
+ if (id1 < id2) {
+ best = reference;
+ }
}
} else {
best = reference;
Modified: celix/branches/celix_config_admin/event_admin/event_admin/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/event_admin/event_admin/CMakeLists.txt?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/event_admin/event_admin/CMakeLists.txt (original)
+++ celix/branches/celix_config_admin/event_admin/event_admin/CMakeLists.txt Mon Jan 19 12:26:54 2015
@@ -17,10 +17,10 @@
find_package(APR REQUIRED)
-include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
include_directories(public/include)
include_directories(private/include)
-#include_directories(../utils/public/include)
+include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
SET_HEADER(BUNDLE_SYMBOLICNAME "eventadmin")
SET(BUNDLE_VERSION "0.0.1")
@@ -35,6 +35,7 @@ bundle(event_admin
public/include/event_admin.h
public/include/event_handler.h
private/include/event_admin_impl.h
+ ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
)
install_bundle(event_admin
Modified: celix/branches/celix_config_admin/event_admin/event_admin/private/include/event_admin_impl.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/event_admin/event_admin/private/include/event_admin_impl.h?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/event_admin/event_admin/private/include/event_admin_impl.h (original)
+++ celix/branches/celix_config_admin/event_admin/event_admin/private/include/event_admin_impl.h Mon Jan 19 12:26:54 2015
@@ -42,12 +42,14 @@
#include "service_registration.h"
#include "listener_hook_service.h"
#include "event_admin.h"
+#include "log_helper.h"
struct event_admin {
apr_pool_t *pool;
hash_map_pt channels;
array_list_pt event_handlers;
bundle_context_pt context;
+ log_helper_pt *loghelper;
};
typedef struct channel *channel_t;
struct channel {
@@ -98,7 +100,7 @@ celix_status_t eventAdmin_removedService
* @param char *topic, the topic string.
* @param array_list_pt event_handlers. The array list to contain the interested handlers.
*/
-celix_status_t eventAdmin_findHandlersByTopic(hash_map_pt channels, char *topic , array_list_pt event_handlers);
+celix_status_t eventAdmin_findHandlersByTopic(event_admin_pt event_admin, char *topic , array_list_pt event_handlers);
/**
* @desc create the needed event channels for an event handler.
* @desc apr_pool_t *pool. a memory pool pointer.
Modified: celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_admin_activator.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_admin_activator.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_admin_activator.c (original)
+++ celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_admin_activator.c Mon Jan 19 12:26:54 2015
@@ -27,6 +27,8 @@
#include <stdlib.h>
#include "event_admin_impl.h"
+#include "log_helper.h"
+#include "log_service.h"
struct activator {
apr_pool_t *pool;
@@ -35,6 +37,7 @@ struct activator {
service_registration_pt registration;
service_tracker_pt tracker;
bundle_context_pt context;
+ log_helper_pt loghelper;
};
celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
@@ -50,11 +53,12 @@ celix_status_t bundleActivator_create(bu
activator = apr_palloc(pool,sizeof(*activator));
activator->pool = pool;
activator->registration = NULL;
+ logHelper_create(context, &activator->loghelper);
+
*userData = activator;
event_admin_pt event_admin = NULL;
event_admin_service_pt event_admin_service = NULL;
status = eventAdmin_create(activator->pool,context, &event_admin);
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "event admin activator pointer: %p ",event_admin);
if(status == CELIX_SUCCESS){
activator->event_admin = event_admin;
event_admin_service = apr_palloc(activator->pool, sizeof(event_admin_service));
@@ -62,6 +66,7 @@ celix_status_t bundleActivator_create(bu
status = CELIX_ENOMEM;
} else {
event_admin->context = context;
+ event_admin->loghelper = &activator->loghelper;
event_admin_service->eventAdmin = event_admin;
event_admin_service->postEvent = eventAdmin_postEvent;
event_admin_service->sendEvent = eventAdmin_sendEvent;
@@ -78,7 +83,6 @@ celix_status_t bundleActivator_create(bu
}
}
activator->event_admin_service = event_admin_service;
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "event admin service pointer: %p ",event_admin_service);
}
}
@@ -108,7 +112,7 @@ celix_status_t bundleActivator_start(voi
event_admin_service = activator->event_admin_service;
//printf("pointer of event admin service %p\n",event_admin_service);
bundleContext_registerService(context, (char *) EVENT_ADMIN_NAME, event_admin_service, properties, &activator->registration);
-
+ logHelper_start(activator->loghelper);
}
return status;
}
@@ -116,13 +120,19 @@ celix_status_t bundleActivator_start(voi
celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
celix_status_t status = CELIX_SUCCESS;
struct activator * data = userData;
- serviceTracker_close(data->tracker);
+
+ serviceTracker_close(data->tracker);
+ status = logHelper_stop(data->loghelper);
+
return status;
}
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
celix_status_t status = CELIX_SUCCESS;
+ struct activator * data = userData;
+
+ status = logHelper_destroy(&data->loghelper);
return status;
}
Modified: celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_admin_impl.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_admin_impl.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_admin_impl.c (original)
+++ celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_admin_impl.c Mon Jan 19 12:26:54 2015
@@ -56,17 +56,18 @@ celix_status_t eventAdmin_postEvent(even
celix_status_t status = CELIX_SUCCESS;
char *topic;
+
eventAdmin_getTopic(&event, &topic);
array_list_pt event_handlers;
arrayList_create(&event_handlers);
eventAdmin_lockHandlersList(event_admin, topic);
- eventAdmin_findHandlersByTopic(event_admin->channels, topic, event_handlers);
+ eventAdmin_findHandlersByTopic(event_admin, topic, event_handlers);
// TODO make this async!
array_list_iterator_pt handlers_iterator = arrayListIterator_create(event_handlers);
while (arrayListIterator_hasNext(handlers_iterator)) {
event_handler_service_pt event_handler_service = (event_handler_service_pt) arrayListIterator_next(handlers_iterator);
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "handler found (POST EVENT) for %s", topic);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "handler found (POST EVENT) for %s", topic);
event_handler_service->handle_event(&event_handler_service->event_handler, event);
}
eventAdmin_releaseHandersList(event_admin, topic);
@@ -82,22 +83,23 @@ celix_status_t eventAdmin_sendEvent(even
array_list_pt event_handlers;
arrayList_create(&event_handlers);
eventAdmin_lockHandlersList(event_admin, topic);
- eventAdmin_findHandlersByTopic(event_admin->channels, topic, event_handlers);
+ eventAdmin_findHandlersByTopic(event_admin, topic, event_handlers);
array_list_iterator_pt handlers_iterator = arrayListIterator_create(event_handlers);
while (arrayListIterator_hasNext(handlers_iterator)) {
event_handler_service_pt event_handler_service = (event_handler_service_pt) arrayListIterator_next(handlers_iterator);
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "handler found (SEND EVENT) for %s", topic);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "handler found (SEND EVENT) for %s", topic);
event_handler_service->handle_event(&event_handler_service->event_handler, event);
}
eventAdmin_releaseHandersList(event_admin, topic);
return status;
}
-celix_status_t eventAdmin_findHandlersByTopic(hash_map_pt channels, char *topic, array_list_pt event_handlers) {
+celix_status_t eventAdmin_findHandlersByTopic(event_admin_pt event_admin, char *topic, array_list_pt event_handlers) {
celix_status_t status = CELIX_SUCCESS;
+ hash_map_pt channels = event_admin->channels;
channel_t channel = hashMap_get(channels, topic);
if (channel != NULL) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "found channel: %s", topic);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "found channel: %s", topic);
if (channel->eventHandlers != NULL && !hashMap_isEmpty(channel->eventHandlers)) {
// iterate throught the handlers and add them to the array list for result.
hash_map_iterator_pt hashmap_iterator = hashMapIterator_create(channel->eventHandlers);
@@ -106,7 +108,7 @@ celix_status_t eventAdmin_findHandlersBy
}
}
} else {
- fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "no such channel: %s", topic);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_WARNING, "no such channel: %s", topic);
}
return status;
}
@@ -116,7 +118,7 @@ celix_status_t eventAdmin_createEventCha
channel_t channel = hashMap_get((*event_admin)->channels, topic);
if (channel == NULL) {
//create channel
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "Creating channel: %s", topic);
+ logHelper_log(*(*event_admin)->loghelper, OSGI_LOGSERVICE_INFO, "Creating channel: %s", topic);
apr_pool_t *subPool = NULL;
apr_pool_create(&subPool, (*event_admin)->pool);
@@ -184,7 +186,7 @@ celix_status_t eventAdmin_lockHandlersLi
do {
status = apr_thread_mutex_trylock(channel->channelLock);
} while (status != 0 && !APR_STATUS_IS_EBUSY(status));
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "LOCK: %s!", topic);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "LOCK: %s!", topic);
}
return status;
}
@@ -195,7 +197,7 @@ celix_status_t eventAdmin_releaseHanders
if (channel != NULL) {
// TODO check the result value...
apr_thread_mutex_unlock(channel->channelLock);
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "UNLOCK: %s!", topic);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "UNLOCK: %s!", topic);
}
return status;
}
@@ -214,17 +216,19 @@ celix_status_t eventAdmin_addedService(v
event_handler_service = (event_handler_service_pt) service;
char *topic = NULL;
serviceReference_getProperty(ref, (char*)EVENT_TOPIC, &topic);
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "Original TOPIC: %s", topic);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "Original TOPIC: %s", topic);
eventAdmin_createEventChannels(&event_admin,topic,event_handler_service);
return status;
}
celix_status_t eventAdmin_modifiedService(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "Event admin Modified");
+ event_admin_pt event_admin = (event_admin_pt) handle;
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "Event admin Modified");
return CELIX_SUCCESS;
}
celix_status_t eventAdmin_removedService(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "Event admin Removed %p", service);
+ event_admin_pt event_admin = (event_admin_pt) handle;
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "Event admin Removed %p", service);
return CELIX_SUCCESS;
}
Modified: celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_impl.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_impl.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_impl.c (original)
+++ celix/branches/celix_config_admin/event_admin/event_admin/private/src/event_impl.c Mon Jan 19 12:26:54 2015
@@ -33,6 +33,7 @@
#include "stddef.h"
#include <apr.h>
#include <apr_pools.h>
+
struct event {
char *topic;
properties_pt properties;
@@ -41,15 +42,15 @@ struct event {
celix_status_t eventAdmin_createEvent(event_admin_pt event_admin, char *topic, properties_pt properties, event_pt *event){
celix_status_t status = CELIX_SUCCESS;
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "create event event admin pointer: %p",event_admin);
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "pool create event: %p",event_admin->pool);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "create event event admin pointer: %p",event_admin);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_DEBUG, "pool create event: %p",event_admin->pool);
*event = apr_palloc(event_admin->pool,sizeof(**event));
if(!*event){
status = CELIX_ENOMEM;
- fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "No MEM");
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_ERROR, "No MEM");
}else {
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "Event created : %s", topic);
+ logHelper_log(*event_admin->loghelper, OSGI_LOGSERVICE_INFO, "Event created : %s", topic);
(*event)->topic = topic;
(*event)->properties = properties;
properties_set((*event)->properties, (char *)EVENT_TOPIC, topic);
Modified: celix/branches/celix_config_admin/event_admin/event_handler/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/event_admin/event_handler/CMakeLists.txt?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/event_admin/event_handler/CMakeLists.txt (original)
+++ celix/branches/celix_config_admin/event_admin/event_handler/CMakeLists.txt Mon Jan 19 12:26:54 2015
@@ -20,6 +20,7 @@ find_package(APR REQUIRED)
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
include_directories(private/include)
include_directories(${PROJECT_SOURCE_DIR}/event_admin/event_admin/public/include)
+include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
SET_HEADER(BUNDLE_SYMBOLICNAME "eventhandler")
SET(BUNDLE_VERSION "0.0.1")
@@ -30,6 +31,7 @@ bundle(event_handler
SOURCES
private/src/event_handler_activator.c
private/src/event_handler_impl.c
+ ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
)
install_bundle(event_handler)
Modified: celix/branches/celix_config_admin/event_admin/event_handler/private/src/event_handler_activator.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/event_admin/event_handler/private/src/event_handler_activator.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/event_admin/event_handler/private/src/event_handler_activator.c (original)
+++ celix/branches/celix_config_admin/event_admin/event_handler/private/src/event_handler_activator.c Mon Jan 19 12:26:54 2015
@@ -93,8 +93,6 @@ celix_status_t bundleActivator_start(voi
serviceTracker_create(context, (char *) EVENT_ADMIN_NAME, customizer, &tracker);
activator->eventAdminTracker = tracker;
serviceTracker_open(tracker);
- properties_pt properties = NULL;
- properties = properties_create();
}
return status;
}
Modified: celix/branches/celix_config_admin/event_admin/event_handler/private/src/event_handler_impl.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/event_admin/event_handler/private/src/event_handler_impl.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/event_admin/event_handler/private/src/event_handler_impl.c (original)
+++ celix/branches/celix_config_admin/event_admin/event_handler/private/src/event_handler_impl.c Mon Jan 19 12:26:54 2015
@@ -24,11 +24,15 @@
* \copyright Apache License, Version 2.0
*/
#include "event_handler.h"
+#include "log_helper.h"
+#include "log_service.h"
struct event_handler {
apr_pool_t *pool;
event_admin_service_pt event_admin_service;
bundle_context_pt context;
+ log_helper_pt loghelper;
+
};
celix_status_t eventHandlerCreate(apr_pool_t *pool, bundle_context_pt context, event_handler_pt *event_handler){
@@ -40,6 +44,10 @@ celix_status_t eventHandlerCreate(apr_po
(*event_handler)->pool = pool;
(*event_handler)->event_admin_service = NULL;
(*event_handler)->context = context;
+
+ if (logHelper_create(context, &(*event_handler)->loghelper) == CELIX_SUCCESS) {
+ logHelper_start((*event_handler)->loghelper);
+ }
}
return status;
}
@@ -49,7 +57,7 @@ celix_status_t eventHandlerHandleEvent(e
if (event != NULL) {
char *topic = NULL;
status = (*event_handler)->event_admin_service->getTopic(&event, &topic);
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "[SUB] topic of event: %s.", topic);
+ logHelper_log((*event_handler)->loghelper, OSGI_LOGSERVICE_INFO, "[SUB] topic of event: %s.", topic);
array_list_pt propertyNames;
arrayList_create(&propertyNames);
@@ -61,7 +69,7 @@ celix_status_t eventHandlerHandleEvent(e
char *value = NULL;
(*event_handler)->event_admin_service->getProperty(&event,key,&value);
- fw_log(logger, OSGI_FRAMEWORK_LOG_INFO, "[SUB] Key: %s value: %s.", key, value);
+ logHelper_log((*event_handler)->loghelper, OSGI_LOGSERVICE_INFO, "[SUB] Key: %s value: %s.", key, value);
}
}
return status;
@@ -76,20 +84,21 @@ celix_status_t eventHandlerAddingService
}
celix_status_t eventHandlerAddedService(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "[SUB] Event admin added.");
- event_handler_pt data = handle;
+ event_handler_pt data = (event_handler_pt) handle;
+ logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[SUB] Event admin added.");
data->event_admin_service = (event_admin_service_pt) service;
return CELIX_SUCCESS;
}
celix_status_t eventHandlerModifiedService(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "[SUB] Event admin modified.");
+ event_handler_pt data = (event_handler_pt) handle;
+ logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[SUB] Event admin modified.");
return CELIX_SUCCESS;
}
celix_status_t eventHandlerRemovedService(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "[SUB] Event admin removed.");
- event_handler_pt data = handle;
+ event_handler_pt data = (event_handler_pt) handle;
+logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[SUB] Event admin removed.");
data->event_admin_service = NULL;
return CELIX_SUCCESS;
}
Modified: celix/branches/celix_config_admin/event_admin/event_publisher/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/event_admin/event_publisher/CMakeLists.txt?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/event_admin/event_publisher/CMakeLists.txt (original)
+++ celix/branches/celix_config_admin/event_admin/event_publisher/CMakeLists.txt Mon Jan 19 12:26:54 2015
@@ -20,6 +20,7 @@ find_package(APR REQUIRED)
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
include_directories(private/include)
include_directories(${PROJECT_SOURCE_DIR}/event_admin/event_admin/public/include)
+include_directories(${PROJECT_SOURCE_DIR}/log_service/public/include)
SET_HEADER(BUNDLE_SYMBOLICNAME "event_publisher")
SET(BUNDLE_VERSION "0.0.1")
@@ -29,6 +30,7 @@ SET_HEADERS("Bundle-Name: Event Publishe
bundle(event_publisher SOURCES
private/src/event_publisher_activator.c
private/src/event_publisher_impl.c
+ ${PROJECT_SOURCE_DIR}/log_service/public/src/log_helper.c
)
install_bundle(event_publisher)
Modified: celix/branches/celix_config_admin/event_admin/event_publisher/private/include/event_publisher_impl.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/event_admin/event_publisher/private/include/event_publisher_impl.h?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/event_admin/event_publisher/private/include/event_publisher_impl.h (original)
+++ celix/branches/celix_config_admin/event_admin/event_publisher/private/include/event_publisher_impl.h Mon Jan 19 12:26:54 2015
@@ -37,6 +37,9 @@
#include "service_listener.h"
#include "service_registration.h"
#include "event_constants.h"
+#include "log_helper.h"
+#include "log_service.h"
+
#include <apr.h>
#include <apr_pools.h>
#include <apr_thread_proc.h>
@@ -49,6 +52,7 @@ struct event_publisher {
bool eventAdminAdded;
apr_thread_t *sender;
bundle_context_pt context;
+ log_helper_pt loghelper;
};
/**
* @desc create the event publisher
Modified: celix/branches/celix_config_admin/event_admin/event_publisher/private/src/event_publisher_activator.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/event_admin/event_publisher/private/src/event_publisher_activator.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/event_admin/event_publisher/private/src/event_publisher_activator.c (original)
+++ celix/branches/celix_config_admin/event_admin/event_publisher/private/src/event_publisher_activator.c Mon Jan 19 12:26:54 2015
@@ -75,8 +75,6 @@ celix_status_t bundleActivator_start(voi
data->tracker = tracker;
serviceTracker_open(tracker);
- properties_pt properties = NULL;
- properties = properties_create();
}
eventPublisherStart(&data->event_publisher);
return status;
Modified: celix/branches/celix_config_admin/event_admin/event_publisher/private/src/event_publisher_impl.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/event_admin/event_publisher/private/src/event_publisher_impl.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/event_admin/event_publisher/private/src/event_publisher_impl.c (original)
+++ celix/branches/celix_config_admin/event_admin/event_publisher/private/src/event_publisher_impl.c Mon Jan 19 12:26:54 2015
@@ -40,12 +40,15 @@ celix_status_t eventPublisherCreate(apr_
(*event_publisher)->running = false;
(*event_publisher)->pool = pool;
(*event_publisher)->context = context;
+
+ logHelper_create(context, &(*event_publisher)->loghelper);
}
return status;
}
celix_status_t eventPublisherStart(event_publisher_pt *event_publisher) {
(*event_publisher)->running = true;
+ logHelper_start((*event_publisher)->loghelper);
apr_thread_create(&(*event_publisher)->sender, NULL, eventPublisherSendEventThread, event_publisher, (*event_publisher)->pool);
return CELIX_SUCCESS;
}
@@ -54,6 +57,8 @@ celix_status_t eventPublisherStop(event_
(*event_publisher)->running = false;
apr_status_t status;
apr_thread_join(&status,(*event_publisher)->sender);
+ logHelper_stop((*event_publisher)->loghelper);
+ logHelper_destroy(&(*event_publisher)->loghelper);
return CELIX_SUCCESS;
}
@@ -86,21 +91,24 @@ celix_status_t eventPublisherAddingServi
}
celix_status_t eventPublisherAddedService(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "[PUB] Event admin added.");
- event_publisher_pt data = handle;
+ event_publisher_pt data = (event_publisher_pt) handle;
+ logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[PUB] Event admin added.");
+
data->event_admin_service = (event_admin_service_pt) service;
data->eventAdminAdded = true;
return CELIX_SUCCESS;
}
celix_status_t eventPublisherModifiedService(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "[PUB] Event admin modified.");
+ event_publisher_pt data = (event_publisher_pt) handle;
+ logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[PUB] Event admin modified.");
return CELIX_SUCCESS;
}
celix_status_t eventPublisherRemovedService(void * handle, service_reference_pt ref, void * service) {
- fw_log(logger, OSGI_FRAMEWORK_LOG_DEBUG, "[PUB] Event admin removed.");
- event_publisher_pt data = handle;
+ event_publisher_pt data = (event_publisher_pt) handle;
+ logHelper_log(data->loghelper, OSGI_LOGSERVICE_DEBUG, "[PUB] Event admin removed.");
+
data->event_admin_service = NULL;
data->eventAdminAdded = false;
return CELIX_SUCCESS;
Modified: celix/branches/celix_config_admin/examples/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/examples/CMakeLists.txt?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/examples/CMakeLists.txt (original)
+++ celix/branches/celix_config_admin/examples/CMakeLists.txt Mon Jan 19 12:26:54 2015
@@ -20,7 +20,7 @@ if (EXAMPLES)
add_subdirectory(hello_world_test)
#add_subdirectory(mongoose)
- #add_subdirectory(whiteboard)
+ add_subdirectory(whiteboard)
add_subdirectory(echo_service)
add_subdirectory(osgi-in-action/chapter04-correct-lookup)
Modified: celix/branches/celix_config_admin/examples/deploy.cmake
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/examples/deploy.cmake?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/examples/deploy.cmake (original)
+++ celix/branches/celix_config_admin/examples/deploy.cmake Mon Jan 19 12:26:54 2015
@@ -20,7 +20,7 @@ if (EXAMPLES)
deploy(chapter04-correct-listener BUNDLES shell shell_tui log_service chapter04-correct-listener)
deploy("hello_world" BUNDLES shell shell_tui apache_celix_examples_hello_world hello_world_test log_service)
- #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("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)
endif (EXAMPLES)
\ No newline at end of file
Modified: celix/branches/celix_config_admin/examples/echo_service/client/private/src/echo_client_activator.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/examples/echo_service/client/private/src/echo_client_activator.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/examples/echo_service/client/private/src/echo_client_activator.c (original)
+++ celix/branches/celix_config_admin/examples/echo_service/client/private/src/echo_client_activator.c Mon Jan 19 12:26:54 2015
@@ -75,7 +75,10 @@ celix_status_t bundleActivator_stop(void
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
struct echoActivator * act = (struct echoActivator *) userData;
+ serviceTracker_destroy(act->tracker);
echoClient_destroy(act->client);
+ free(act);
+
return CELIX_SUCCESS;
}
Modified: celix/branches/celix_config_admin/examples/whiteboard/publisherA/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/examples/whiteboard/publisherA/CMakeLists.txt?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/examples/whiteboard/publisherA/CMakeLists.txt (original)
+++ celix/branches/celix_config_admin/examples/whiteboard/publisherA/CMakeLists.txt Mon Jan 19 12:26:54 2015
@@ -15,10 +15,11 @@
# specific language governing permissions and limitations
# under the License.
+SET(BUNDLE_SYMBOLICNAME "apache_celix_examples_publisher_a")
+SET(BUNDLE_VERSION "0.0.1")
+
bundle(publisherA SOURCES private/src/activator private/src/publisher)
include_directories("../publisherService/public/include")
include_directories("../publisherService/private/include")
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
target_link_libraries(publisherA celix_framework)
-
-package(publisherA FILES ../publisherService/public/include/publisher.h)
\ No newline at end of file
Modified: celix/branches/celix_config_admin/examples/whiteboard/publisherB/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/examples/whiteboard/publisherB/CMakeLists.txt?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/examples/whiteboard/publisherB/CMakeLists.txt (original)
+++ celix/branches/celix_config_admin/examples/whiteboard/publisherB/CMakeLists.txt Mon Jan 19 12:26:54 2015
@@ -15,10 +15,11 @@
# specific language governing permissions and limitations
# under the License.
+SET(BUNDLE_SYMBOLICNAME "apache_celix_examples_publisher_b")
+SET(BUNDLE_VERSION "0.0.1")
+
bundle(publisherB SOURCES private/src/activator private/src/publisher)
include_directories("../publisherService/public/include")
include_directories("../publisherService/private/include")
target_link_libraries(publisherB celix_framework)
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-
-package(publisherB FILES ../publisherService/public/include/publisher.h)
\ No newline at end of file
Modified: celix/branches/celix_config_admin/examples/whiteboard/tracker/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/examples/whiteboard/tracker/CMakeLists.txt?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/examples/whiteboard/tracker/CMakeLists.txt (original)
+++ celix/branches/celix_config_admin/examples/whiteboard/tracker/CMakeLists.txt Mon Jan 19 12:26:54 2015
@@ -15,6 +15,9 @@
# specific language governing permissions and limitations
# under the License.
+SET(BUNDLE_SYMBOLICNAME "apache_celix_examples_tracker")
+SET(BUNDLE_VERSION "0.0.1")
+
bundle(tracker SOURCES private/src/activator)
include_directories("../publisherService/public/include")
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
Modified: celix/branches/celix_config_admin/examples/whiteboard/tracker/private/src/activator.c
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/examples/whiteboard/tracker/private/src/activator.c?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/examples/whiteboard/tracker/private/src/activator.c (original)
+++ celix/branches/celix_config_admin/examples/whiteboard/tracker/private/src/activator.c Mon Jan 19 12:26:54 2015
@@ -24,6 +24,8 @@
* \copyright Apache License, Version 2.0
*/
#include <stdlib.h>
+#include <unistd.h>
+
#include "celixbool.h"
#include "bundle_activator.h"
@@ -35,11 +37,11 @@ struct data {
bundle_context_pt context;
service_tracker_pt tracker;
array_list_pt publishers;
- apr_thread_t *sender;
+ pthread_t sender;
bool running;
};
-static void *APR_THREAD_FUNC trk_send(apr_thread_t *thd, void *handle) {
+static void *trk_send(void *handle) {
struct data * data = (struct data *) handle;
while (data->running) {
int i;
@@ -47,9 +49,9 @@ static void *APR_THREAD_FUNC trk_send(ap
publisher_service_pt pub = arrayList_get(data->publishers, i);
pub->invoke(pub->publisher, "test");
}
- apr_sleep(1000000);
+ usleep(1000000);
}
- apr_thread_exit(thd, APR_SUCCESS);
+ pthread_exit(NULL);
return NULL;
}
@@ -70,7 +72,6 @@ celix_status_t addedServ(void * handle,
}
celix_status_t modifiedServ(void * handle, service_reference_pt ref, void * service) {
- struct data * data = (struct data *) handle;
printf("Modified\n");
return CELIX_SUCCESS;
}
@@ -83,10 +84,9 @@ celix_status_t removedServ(void * handle
}
celix_status_t bundleActivator_create(bundle_context_pt context, void **userData) {
- apr_pool_t *pool;
- celix_status_t status = bundleContext_getMemoryPool(context, &pool);
+ celix_status_t status = CELIX_SUCCESS;
if (status == CELIX_SUCCESS) {
- *userData = apr_palloc(pool, sizeof(struct data));
+ *userData = calloc(1, sizeof(struct data));
((struct data *) (*userData))->publishers = NULL;
arrayList_create(&((struct data *) (*userData))->publishers);
} else {
@@ -97,8 +97,6 @@ celix_status_t bundleActivator_create(bu
celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
celix_status_t status = CELIX_SUCCESS;
- apr_pool_t *pool;
- status = bundleContext_getMemoryPool(context, &pool);
if (status == CELIX_SUCCESS) {
struct data * data = (struct data *) userData;
service_tracker_customizer_pt cust = NULL;
@@ -106,15 +104,15 @@ celix_status_t bundleActivator_start(voi
data->context = context;
- serviceTrackerCustomizer_create(pool, data, addingServ, addedServ, modifiedServ, removedServ, &cust);
- serviceTracker_create(pool, context, (char *) PUBLISHER_NAME, cust, &tracker);
+ serviceTrackerCustomizer_create(data, addingServ, addedServ, modifiedServ, removedServ, &cust);
+ serviceTracker_create(context, (char *) PUBLISHER_NAME, cust, &tracker);
data->tracker = tracker;
serviceTracker_open(tracker);
data->running = true;
- apr_thread_create(&data->sender, NULL, trk_send, data, pool);
+ pthread_create(&data->sender, NULL, trk_send, data);
} else {
status = CELIX_START_ERROR;
}
@@ -124,12 +122,11 @@ celix_status_t bundleActivator_start(voi
celix_status_t bundleActivator_stop(void * userData, bundle_context_pt context) {
celix_status_t status = CELIX_SUCCESS;
struct data * data = (struct data *) userData;
- apr_status_t stat;
printf("Stop\n");
serviceTracker_close(data->tracker);
data->running = false;
- apr_thread_join(&stat, data->sender);
+ pthread_join(data->sender, NULL);
return status;
}
Modified: celix/branches/celix_config_admin/examples/whiteboard/tracker_depman/CMakeLists.txt
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/examples/whiteboard/tracker_depman/CMakeLists.txt?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/examples/whiteboard/tracker_depman/CMakeLists.txt (original)
+++ celix/branches/celix_config_admin/examples/whiteboard/tracker_depman/CMakeLists.txt Mon Jan 19 12:26:54 2015
@@ -15,6 +15,9 @@
# specific language governing permissions and limitations
# under the License.
+SET(BUNDLE_SYMBOLICNAME "apache_celix_examples_tracker_dm")
+SET(BUNDLE_VERSION "0.0.1")
+
bundle(tracker_depman SOURCES
private/src/dependency_activator
private/src/tracker
@@ -22,8 +25,15 @@ bundle(tracker_depman SOURCES
private/include/tracker.h
)
include_directories("private/include")
-include_directories("${PROJECT_SOURCE_DIR}/dependency_manager/public/include")
+include_directories("${PROJECT_SOURCE_DIR}/dependency_manager_2/public/include")
+#include_directories("${PROJECT_SOURCE_DIR}/dependency_manager_2/private/include")
include_directories("../publisherService/public/include")
include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
include_directories("${PROJECT_SOURCE_DIR}/log_service/public/include")
-target_link_libraries(tracker_depman celix_framework dependency_manager)
+
+# 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)
+else()
+target_link_libraries(tracker_depman -Wl,--whole-archive dependency_manager2 -Wl,--no-whole-archive celix_framework)
+ENDIF()
Modified: celix/branches/celix_config_admin/examples/whiteboard/tracker_depman/private/include/tracker.h
URL: http://svn.apache.org/viewvc/celix/branches/celix_config_admin/examples/whiteboard/tracker_depman/private/include/tracker.h?rev=1652984&r1=1652983&r2=1652984&view=diff
==============================================================================
--- celix/branches/celix_config_admin/examples/whiteboard/tracker_depman/private/include/tracker.h (original)
+++ celix/branches/celix_config_admin/examples/whiteboard/tracker_depman/private/include/tracker.h Mon Jan 19 12:26:54 2015
@@ -27,25 +27,32 @@
#ifndef TRACKER_H_
#define TRACKER_H_
-#include "service_component.h"
+#include "dm_component.h"
#include "log_service.h"
struct data {
- service_pt service;
+ dm_component_pt service;
+ dm_service_dependency_pt dep;
+ dm_service_dependency_pt dep2;
bundle_context_pt context;
array_list_pt publishers;
- apr_thread_t *sender;
+ pthread_t sender;
bool running;
log_service_pt logger;
};
-void tracker_addedServ(void * handle, service_reference_pt ref, void * service);
-void tracker_modifiedServ(void * handle, service_reference_pt ref, void * service);
-void tracker_removedServ(void * handle, service_reference_pt ref, void * service);
-
-void tracker_addLog(void * handle, service_reference_pt ref, void * service);
-void tracker_modifiedLog(void * handle, service_reference_pt ref, void * service);
-void tracker_removeLog(void * handle, service_reference_pt ref, void * service);
+celix_status_t tracker_addedServ(void * handle, service_reference_pt ref, void * service);
+celix_status_t tracker_modifiedServ(void * handle, service_reference_pt ref, void * service);
+celix_status_t tracker_removedServ(void * handle, service_reference_pt ref, void * service);
+
+celix_status_t tracker_addLog(void * handle, service_reference_pt ref, void * service);
+celix_status_t tracker_modifiedLog(void * handle, service_reference_pt ref, void * service);
+celix_status_t tracker_removeLog(void * handle, service_reference_pt ref, void * service);
+
+celix_status_t service_init(void * userData);
+celix_status_t service_start(void * userData);
+celix_status_t service_stop(void * userData);
+celix_status_t service_destroy(void * userData);
#endif /* TRACKER_H_ */