incubator-celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1595803 - in /incubator/celix/trunk: cmake/ examples/ examples/hello_world/ examples/hello_world/private/src/ examples/hello_world/public/ examples/hello_world/public/include/ examples/hello_world_test/ examples/hello_world_test/private/ e...
Date Mon, 19 May 2014 09:45:46 GMT
Author: abroekhuis
Date: Mon May 19 09:45:45 2014
New Revision: 1595803

URL: http://svn.apache.org/r1595803
Log:
CELIX-111, CELIX-112: Multilib and code sharing support. Code sharing works using version, although version ranges are not yet fully supported. Ranges are resolved, but the actual used dependant library has to be the same as with which initially was linked.

Added:
    incubator/celix/trunk/examples/hello_world/private/src/test.c
      - copied, changed from r1595802, incubator/celix/trunk/framework/private/include/bundle_revision_private.h
    incubator/celix/trunk/examples/hello_world/public/
    incubator/celix/trunk/examples/hello_world/public/include/
    incubator/celix/trunk/examples/hello_world/public/include/test.h
      - copied, changed from r1595802, incubator/celix/trunk/framework/private/include/bundle_revision_private.h
    incubator/celix/trunk/examples/hello_world_test/
    incubator/celix/trunk/examples/hello_world_test/CMakeLists.txt
      - copied, changed from r1595802, incubator/celix/trunk/examples/hello_world/CMakeLists.txt
    incubator/celix/trunk/examples/hello_world_test/private/
    incubator/celix/trunk/examples/hello_world_test/private/src/
    incubator/celix/trunk/examples/hello_world_test/private/src/activator.c
      - copied, changed from r1595802, incubator/celix/trunk/examples/hello_world/private/src/activator.c
Modified:
    incubator/celix/trunk/cmake/CPackConfig.in
    incubator/celix/trunk/cmake/Packaging.cmake
    incubator/celix/trunk/cmake/manifest.in
    incubator/celix/trunk/examples/CMakeLists.txt
    incubator/celix/trunk/examples/deploy.cmake
    incubator/celix/trunk/examples/hello_world/CMakeLists.txt
    incubator/celix/trunk/examples/hello_world/private/src/activator.c
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/deploy.cmake
    incubator/celix/trunk/framework/private/include/bundle_revision_private.h
    incubator/celix/trunk/framework/private/include/framework_private.h
    incubator/celix/trunk/framework/private/include/resolver.h
    incubator/celix/trunk/framework/private/src/bundle_revision.c
    incubator/celix/trunk/framework/private/src/framework.c
    incubator/celix/trunk/framework/private/src/manifest_parser.c
    incubator/celix/trunk/framework/private/src/resolver.c
    incubator/celix/trunk/framework/private/src/version_range.c
    incubator/celix/trunk/framework/public/include/bundle_revision.h
    incubator/celix/trunk/framework/public/include/celix_log.h
    incubator/celix/trunk/framework/public/include/constants.h

Modified: incubator/celix/trunk/cmake/CPackConfig.in
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/CPackConfig.in?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/cmake/CPackConfig.in (original)
+++ incubator/celix/trunk/cmake/CPackConfig.in Mon May 19 09:45:45 2014
@@ -17,9 +17,9 @@
 
 SET(CPACK_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
 SET(CPACK_GENERATOR "@CPACK_GENERATOR@")
-SET(CPACK_INSTALL_CMAKE_PROJECTS "@BUNDLE_BIN_DIR@;@INT_BUNDLE_NAME@;@INT_BUNDLE_NAME_INSTALL@;/")
+SET(CPACK_INSTALL_CMAKE_PROJECTS "@BUNDLE_BIN_DIR@;@_BUNDLE_NAME@;@_BUNDLE_NAME_INSTALL@;/")
 SET(CPACK_PACKAGE_DESCRIPTION "@BUNDLE_DESCRIPTION@")
-SET(CPACK_PACKAGE_FILE_NAME "@INT_BUNDLE_NAME@")
-SET(CPACK_PACKAGE_NAME "@INT_BUNDLE_NAME@")
+SET(CPACK_PACKAGE_FILE_NAME "@_BUNDLE_NAME@")
+SET(CPACK_PACKAGE_NAME "@_BUNDLE_NAME@")
 SET(CPACK_PACKAGE_VERSION "@BUNDLE_VERSION@")
 SET(CPACK_INCLUDE_TOPLEVEL_DIRECTORY "0")

Modified: incubator/celix/trunk/cmake/Packaging.cmake
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/Packaging.cmake?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/cmake/Packaging.cmake (original)
+++ incubator/celix/trunk/cmake/Packaging.cmake Mon May 19 09:45:45 2014
@@ -78,85 +78,197 @@ SET(CPACK_GENERATOR "ZIP")
 celix_add_component_group(all)
 celix_add_component_group(bundles PARENT_GROUP all)
 
+add_custom_target(bundles ALL)
+
+MACRO(CHECK_HEADERS)
+    if (NOT BUNDLE_SYMBOLICNAME)
+        MESSAGE(FATAL_ERROR "Bundle Symbolic Name not set, please set it using \"SET(BUNDLE_SYMBOLIC_NAME \"bundle_symbolic_name\")\".")
+    endif (NOT BUNDLE_SYMBOLICNAME)
+    
+    if (NOT BUNDLE_VERSION)
+        MESSAGE(WARNING "Bundle version not set, using default \"0.0.0\" version.")
+        SET(BUNDLE_VERSION "0.0.0")
+    endif (NOT BUNDLE_VERSION)
+ENDMACRO(CHECK_HEADERS)
+
 MACRO(SET_HEADER header content)
-	SET(INT_${header} "${content}")
-	string(STRIP ${INT_${header}} INT_${header})
+    SET(${header} "${content}")
+    string(STRIP ${${header}} ${${header}})
 ENDMACRO(SET_HEADER)
 
 MACRO(SET_HEADERS content)
 	SET(INT_BUNDLE_EXTRAHEADER "${INT_BUNDLE_EXTRAHEADER}\n${content}")
-	string(STRIP ${INT_BUNDLE_EXTRAHEADER} INT_BUNDLE_EXTRAHEADER)
+	string(STRIP "${INT_BUNDLE_EXTRAHEADER}" INT_BUNDLE_EXTRAHEADER)
 ENDMACRO(SET_HEADERS)
 
+MACRO(BUNDLE_PRIVATE_LIBRARY)
+    PARSE_ARGUMENTS(BUNDLE_LIBRARY "SOURCES;LINK_LIBRARIES" "" ${ARGN})
+    LIST(GET BUNDLE_LIBRARY_DEFAULT_ARGS 0 BUNDLE_LIBRARY_NAME)
+    
+    CHECK_HEADERS()
+    
+    SET(BUNDLE_LIBRARY_VERSIONED_NAME ${BUNDLE_SYMBOLICNAME}-${BUNDLE_LIBRARY_NAME}-${BUNDLE_VERSION})
+    
+    add_library(${BUNDLE_LIBRARY_VERSIONED_NAME} SHARED ${BUNDLE_LIBRARY_SOURCES})
+    target_link_libraries(${BUNDLE_LIBRARY_VERSIONED_NAME} ${BUNDLE_LIBRARY_LINK_LIBRARIES})
+ENDMACRO(BUNDLE_PRIVATE_LIBRARY)
+
+MACRO(BUNDLE_LIBRARY)
+    PARSE_ARGUMENTS(BUNDLE_LIBRARY "SOURCES;VERSION;LINK_LIBRARIES" "" ${ARGN})
+    LIST(GET BUNDLE_LIBRARY_DEFAULT_ARGS 0 BUNDLE_LIBRARY_NAME)
+    
+    SET(BUNDLE_LIBRARY_VERSIONED_NAME ${BUNDLE_LIBRARY_NAME}-${BUNDLE_LIBRARY_VERSION})
+    
+    add_library(${BUNDLE_LIBRARY_VERSIONED_NAME} SHARED ${BUNDLE_LIBRARY_SOURCES})
+    target_link_libraries(${BUNDLE_LIBRARY_VERSIONED_NAME} ${BUNDLE_LIBRARY_LINK_LIBRARIES})
+ENDMACRO(BUNDLE_LIBRARY)
+
+MACRO(_parseExportLibraryName _export)
+    STRING(REPLACE "|" ";" _exports ${_export})
+    LIST(LENGTH _exports _size)
+    LIST(GET _exports 0 _library)
+    SET(EXPORT_LIBRARY_NAME ${_library})
+    
+    IF(${_size} EQUAL 2)
+        LIST(GET _exports 1 _version)
+        IF(_version)
+            string(FIND ${_version} "\"" _start)
+            string(FIND ${_version} "\"" _end REVERSE)
+            MATH(EXPR _start ${_start}+1)
+            MATH(EXPR _length ${_end}-${_start})
+            string(SUBSTRING ${_version} ${_start} ${_length} ENDIF)
+            
+            SET(EXPORT_LIBRARY_NAME ${_library}-${ENDIF})
+        ENDIF()
+    ENDIF()
+ENDMACRO()
+
+MACRO(PROCESS_MANIFEST_HEADERS)
+    IF(BUNDLE_DESCRIPTION)
+        SET_HEADERS("Bundle-Description: ${BUNDLE_DESCRIPTION}")
+    ENDIF()
+    IF(BUNDLE_VERSION)
+        SET_HEADERS("Bundle-Version: ${BUNDLE_VERSION}")
+    ENDIF()
+    IF(BUNDLE_NAME)
+        SET_HEADERS("Bundle-Name: ${BUNDLE_NAME}")
+    ENDIF()
+ENDMACRO()
+
+
 MACRO(bundle)
-    PARSE_ARGUMENTS(BUNDLE "SOURCES;FILES;DIRECTORIES;INSTALL_FILES" "INSTALL" ${ARGN})
-    LIST(GET BUNDLE_DEFAULT_ARGS 0 INT_BUNDLE_NAME)
+    PARSE_ARGUMENTS(_BUNDLE "SOURCES;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)
     
-	add_library(${INT_BUNDLE_NAME} SHARED ${BUNDLE_SOURCES})
-	set_property(TARGET ${INT_BUNDLE_NAME} PROPERTY BUNDLE "${CMAKE_CURRENT_BINARY_DIR}/${INT_BUNDLE_NAME}.zip") 
-	
-	if (NOT INT_BUNDLE_SYMBOLICNAME)
-		set(INT_BUNDLE_SYMBOLICNAME ${INT_BUNDLE_NAME})
-	endif (NOT INT_BUNDLE_SYMBOLICNAME)
-	if (NOT INT_BUNDLE_VERSION)
-		set(INT_BUNDLE_VERSION ${DEFAULT_VERSION})
-	endif (NOT INT_BUNDLE_VERSION)
-	if (NOT INT_BUNDLE_DESCRIPTION)
-		set(INT_BUNDLE_DESCRIPTION "${INT_BUNDLE_SYMBOLICNAME} bundle")
-	endif (NOT INT_BUNDLE_DESCRIPTION)
-	
-	set(INT_BUNDLE_NAME_INSTALL ${INT_BUNDLE_NAME}_install)
-	
-	SET(__bundleManifest ${CMAKE_CURRENT_BINARY_DIR}/MANIFEST.MF)
+    CHECK_HEADERS()
+    
+    PROCESS_MANIFEST_HEADERS()
+    
+    set(_BUNDLE_NAME_INSTALL ${_BUNDLE_NAME}_install)
+    
+    if(_BUNDLE_SOURCES)
+        add_library(${_BUNDLE_NAME} SHARED ${_BUNDLE_SOURCES})
+        SET_HEADERS("Bundle-Activator: ${_BUNDLE_NAME}")
+    else(_BUNDLE_SOURCES)
+        add_custom_target(${_BUNDLE_NAME})
+        add_dependencies(bundles ${_BUNDLE_NAME})
+    endif(_BUNDLE_SOURCES)
+    
+    SET(TEMP)
+    foreach(_PRIVATE_LIBRARY ${_BUNDLE_PRIVATE_LIBRARIES})
+        SET(_BUNDLE_LIBRARY_VERSIONED_NAME ${BUNDLE_SYMBOLICNAME}-${_PRIVATE_LIBRARY}-${BUNDLE_VERSION})
+        add_dependencies(${_BUNDLE_NAME} "${_BUNDLE_LIBRARY_VERSIONED_NAME}")
+        install(TARGETS ${_BUNDLE_LIBRARY_VERSIONED_NAME} DESTINATION . COMPONENT ${_BUNDLE_NAME}_install)
+        
+        SET(TEMP ${TEMP} ${_BUNDLE_LIBRARY_VERSIONED_NAME})
+    endforeach()
+    SET(_BUNDLE_PRIVATE_LIBRARIES ${TEMP})
+    UNSET(TEMP)
+    
+    FOREACH(_EXPORT_LIBRARY ${_BUNDLE_EXPORT_LIBRARIES})
+        _parseExportLibraryName(${_EXPORT_LIBRARY})
+        ADD_DEPENDENCIES(${_BUNDLE_NAME} ${EXPORT_LIBRARY_NAME})
+        INSTALL(TARGETS ${EXPORT_LIBRARY_NAME} DESTINATION . COMPONENT ${_BUNDLE_NAME}_install)
+    ENDFOREACH()
+    
+    set_property(TARGET ${_BUNDLE_NAME} PROPERTY BUNDLE "${CMAKE_CURRENT_BINARY_DIR}/${_BUNDLE_NAME}.zip")
+    
+    if(_BUNDLE_SOURCES)
+        list(APPEND _BUNDLE_PRIVATE_LIBRARIES ${_BUNDLE_NAME})
+    endif(_BUNDLE_SOURCES)
+    
+    string (REPLACE ";" "," _BUNDLE_PRIVATE_LIBRARIES "${_BUNDLE_PRIVATE_LIBRARIES}")
+    string (REPLACE ";" "," _BUNDLE_EXPORT_LIBRARIES "${_BUNDLE_EXPORT_LIBRARIES}")
+    string (REPLACE "|" ";" _BUNDLE_EXPORT_LIBRARIES "${_BUNDLE_EXPORT_LIBRARIES}")
+    string (REPLACE ";" "," _BUNDLE_IMPORT_LIBRARIES "${_BUNDLE_IMPORT_LIBRARIES}")
+    string (REPLACE "|" ";" _BUNDLE_IMPORT_LIBRARIES "${_BUNDLE_IMPORT_LIBRARIES}")
+    
+    if(_BUNDLE_ACTIVATOR)
+        SET_HEADERS("Bundle-Activator: ${_BUNDLE_ACTIVATOR}")
+    endif()
+    if(_BUNDLE_PRIVATE_LIBRARIES)
+        SET_HEADERS("Private-Library: ${_BUNDLE_PRIVATE_LIBRARIES}")
+    endif()
+    if(_BUNDLE_EXPORT_LIBRARIES)
+        SET_HEADERS("Export-Library: ${_BUNDLE_EXPORT_LIBRARIES}")
+    endif()
+    if(_BUNDLE_IMPORT_LIBRARIES)
+        SET_HEADERS("Import-Library: ${_BUNDLE_IMPORT_LIBRARIES}")
+    endif()
+    
+    SET(__bundleManifest ${CMAKE_CURRENT_BINARY_DIR}/MANIFEST.MF)
     CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/manifest.in ${__bundleManifest} @ONLY)
-	install (FILES ${__bundleManifest} DESTINATION ./META-INF COMPONENT ${INT_BUNDLE_NAME_INSTALL})
+    install (FILES ${__bundleManifest} DESTINATION ./META-INF COMPONENT ${_BUNDLE_NAME_INSTALL})
     
-	install (TARGETS ${INT_BUNDLE_NAME} DESTINATION . COMPONENT ${INT_BUNDLE_NAME_INSTALL})
-    if (BUNDLE_FILES)
-	    install (FILES ${BUNDLE_FILES} DESTINATION . COMPONENT ${INT_BUNDLE_NAME_INSTALL})
-    endif(BUNDLE_FILES)
-    if (BUNDLE_DIRECTORIES)
-	    install (DIRECTORY ${BUNDLE_DIRECTORIES} DESTINATION . COMPONENT ${INT_BUNDLE_NAME_INSTALL})
-    endif(BUNDLE_DIRECTORIES)
-
-	SET(__bundleConfig ${CMAKE_CURRENT_BINARY_DIR}/CPackConfig-${INT_BUNDLE_NAME}-bundle.cmake)
-	SET(BUNDLE_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
-	CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/CPackConfig.in ${__bundleConfig} @ONLY)
-
-	if(JAR_COMMAND)
-		ADD_CUSTOM_COMMAND(TARGET ${INT_BUNDLE_NAME}
-		POST_BUILD
-			COMMAND ${CPACK_COMMAND} ARGS -C Debug --config ${__bundleConfig}
-			COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/ziptojar
-			COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_BINARY_DIR}/ziptojar ${JAR_COMMAND} -xf ${CMAKE_CURRENT_BINARY_DIR}/${INT_BUNDLE_NAME}.zip
-			COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_BINARY_DIR}/ziptojar ${JAR_COMMAND} -cfm ${CMAKE_CURRENT_BINARY_DIR}/${INT_BUNDLE_NAME}.zip META-INF/MANIFEST.MF .
-			COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/ziptojar
-			WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-		)
-	else(JAR_COMMAND)
-		ADD_CUSTOM_COMMAND(TARGET ${INT_BUNDLE_NAME}
-		POST_BUILD
-			COMMAND ${CPACK_COMMAND} ARGS -C Debug --config ${__bundleConfig}
-			WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-		)
-	endif(JAR_COMMAND)
-	
-	if (BUNDLE_INSTALL)
-		CELIX_ADD_COMPONENT(${INT_BUNDLE_NAME}
-	    	DISPLAY_NAME ${INT_BUNDLE_SYMBOLICNAME}
-	        DESCRIPTION ${INT_BUNDLE_DESCRIPTION}
-	        GROUP bundles
-	    )
-	    add_dependencies( install-${INT_BUNDLE_NAME} ${INT_BUNDLE_NAME} )
-	    
-	    if (BUNDLE_INSTALL_FILES)
-		    install (FILES ${BUNDLE_INSTALL_FILES} DESTINATION include/celix/${INT_BUNDLE_NAME} COMPONENT ${INT_BUNDLE_NAME})
-	    endif(BUNDLE_INSTALL_FILES)
-	    
-	    INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${INT_BUNDLE_NAME}.zip DESTINATION share/celix/bundles COMPONENT ${INT_BUNDLE_NAME})
-    endif(BUNDLE_INSTALL)
-	
-	SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/${INT_BUNDLE_NAME}.zip)
+    if(_BUNDLE_SOURCES)
+        install (TARGETS ${_BUNDLE_NAME} DESTINATION . COMPONENT ${_BUNDLE_NAME_INSTALL})
+    endif(_BUNDLE_SOURCES)
+    
+    if(_BUNDLE_FILES)
+        install (FILES ${_BUNDLE_FILES} DESTINATION . COMPONENT ${_BUNDLE_NAME_INSTALL})
+    endif()
+    if(_BUNDLE_DIRECTORIES)
+        install (DIRECTORY ${_BUNDLE_DIRECTORIES} DESTINATION . COMPONENT ${_BUNDLE_NAME_INSTALL})
+    endif()
+
+    SET(__bundleConfig ${CMAKE_CURRENT_BINARY_DIR}/CPackConfig-${_BUNDLE_NAME}-bundle.cmake)
+    SET(BUNDLE_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR})
+    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/cmake/CPackConfig.in ${__bundleConfig} @ONLY)
+
+    if(JAR_COMMAND)
+        ADD_CUSTOM_COMMAND(TARGET ${_BUNDLE_NAME}
+        POST_BUILD
+            COMMAND ${CPACK_COMMAND} ARGS -C Debug --config ${__bundleConfig}
+            COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/ziptojar
+            COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_BINARY_DIR}/ziptojar ${JAR_COMMAND} -xf ${CMAKE_CURRENT_BINARY_DIR}/${_BUNDLE_NAME}.zip
+            COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_BINARY_DIR}/ziptojar ${JAR_COMMAND} -cfm ${CMAKE_CURRENT_BINARY_DIR}/${_BUNDLE_NAME}.zip META-INF/MANIFEST.MF .
+            COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_CURRENT_BINARY_DIR}/ziptojar
+            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+        )
+    else(JAR_COMMAND)
+        ADD_CUSTOM_COMMAND(TARGET ${_BUNDLE_NAME}
+        POST_BUILD
+            COMMAND ${CPACK_COMMAND} ARGS -C Debug --config ${__bundleConfig}
+            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+        )
+    endif(JAR_COMMAND)
+    
+    if (_BUNDLE_INSTALL)
+        CELIX_ADD_COMPONENT(${_BUNDLE_NAME}
+            DISPLAY_NAME ${BUNDLE_SYMBOLICNAME}
+            DESCRIPTION ${BUNDLE_DESCRIPTION}
+            GROUP bundles
+        )
+        add_dependencies( install-${_BUNDLE_NAME} ${_BUNDLE_NAME} )
+        
+        if (_BUNDLE_INSTALL_FILES)
+            install (FILES ${_BUNDLE_INSTALL_FILES} DESTINATION include/celix/${_BUNDLE_NAME} COMPONENT ${_BUNDLE_NAME})
+        endif()
+        
+        INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_BUNDLE_NAME}.zip DESTINATION share/celix/bundles COMPONENT ${_BUNDLE_NAME})
+    endif()
+    
+    SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/${_BUNDLE_NAME}.zip)
 ENDMACRO(bundle)
 
 MACRO(install_bundle)

Modified: incubator/celix/trunk/cmake/manifest.in
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/manifest.in?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/cmake/manifest.in (original)
+++ incubator/celix/trunk/cmake/manifest.in Mon May 19 09:45:45 2014
@@ -1,5 +1,2 @@
-Bundle-SymbolicName: @INT_BUNDLE_SYMBOLICNAME@
-Bundle-Description: @INT_BUNDLE_DESCRIPTION@
-Bundle-Version: @INT_BUNDLE_VERSION@
-library: @INT_BUNDLE_NAME@
+Bundle-SymbolicName: @BUNDLE_SYMBOLICNAME@
 @INT_BUNDLE_EXTRAHEADER@

Modified: incubator/celix/trunk/examples/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/CMakeLists.txt?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/examples/CMakeLists.txt (original)
+++ incubator/celix/trunk/examples/CMakeLists.txt Mon May 19 09:45:45 2014
@@ -17,15 +17,16 @@
 celix_subproject(EXAMPLES "Option to enable building the Examples" "OFF" DEPS FRAMEWORK LAUNCHER SHELL_TUI LOG_WRITER DEPENDENCY_MANAGER)
 if (EXAMPLES)
     add_subdirectory(hello_world)
-    add_subdirectory(mongoose)
+    add_subdirectory(hello_world_test)
+    #add_subdirectory(mongoose)
     
-    add_subdirectory(whiteboard)
-    add_subdirectory(echo_service)
+    #add_subdirectory(whiteboard)
+    #add_subdirectory(echo_service)
     
-    add_subdirectory(osgi-in-action/chapter04-correct-lookup)
-    add_subdirectory(osgi-in-action/chapter04-correct-listener)
-    add_subdirectory(osgi-in-action/chapter01-greeting-example)
-    add_subdirectory(osgi-in-action/chapter04-paint-example)
+    #add_subdirectory(osgi-in-action/chapter04-correct-lookup)
+    #add_subdirectory(osgi-in-action/chapter04-correct-listener)
+    #add_subdirectory(osgi-in-action/chapter01-greeting-example)
+    #add_subdirectory(osgi-in-action/chapter04-paint-example)
     
-    add_subdirectory(embedding)
+    #add_subdirectory(embedding)
 endif(EXAMPLES)

Modified: incubator/celix/trunk/examples/deploy.cmake
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/deploy.cmake?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/examples/deploy.cmake (original)
+++ incubator/celix/trunk/examples/deploy.cmake Mon May 19 09:45:45 2014
@@ -16,11 +16,11 @@
 # under the License.
 is_enabled(EXAMPLES)
 if (EXAMPLES)
-	deploy(chapter01-greeting-example BUNDLES shell shell_tui log_service chapter01-greeting-example-client chapter01-greeting-example)
-	deploy(chapter04-correct-listener BUNDLES shell shell_tui log_service chapter04-correct-listener)
+	#deploy(chapter01-greeting-example BUNDLES shell shell_tui log_service chapter01-greeting-example-client chapter01-greeting-example)
+	#deploy(chapter04-correct-listener BUNDLES shell shell_tui log_service chapter04-correct-listener)
 	
-	deploy("hello_world" BUNDLES shell shell_tui hello_world 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("echo" BUNDLES echo_server echo_client shell shell_tui log_service log_writer)
+	deploy("hello_world" BUNDLES shell shell_tui org.apache.incubator.celix.helloworld 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("echo" BUNDLES echo_server echo_client shell shell_tui log_service log_writer)
 endif (EXAMPLES)
\ No newline at end of file

Modified: incubator/celix/trunk/examples/hello_world/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/hello_world/CMakeLists.txt?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/examples/hello_world/CMakeLists.txt (original)
+++ incubator/celix/trunk/examples/hello_world/CMakeLists.txt Mon May 19 09:45:45 2014
@@ -15,9 +15,28 @@
 # specific language governing permissions and limitations
 # under the License.
 
-SET_HEADER(BUNDLE_SYMBOLICNAME "apache_celix_examples_hello_world")
-SET_HEADERS("Bundle-Name: Apache Celix Shell TUI") 
-	
-bundle(hello_world SOURCES private/src/activator)
+SET(BUNDLE_SYMBOLICNAME "apache_celix_examples_hello_world")
+SET(BUNDLE_VERSION "0.0.1")
+SET(BUNDLE_NAME "Apache Celix Shell TUI")
+
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-target_link_libraries(hello_world celix_framework)
\ No newline at end of file
+include_directories("public/include")
+
+BUNDLE_LIBRARY(org.apache.incubator.celix.helloworld.sub
+    SOURCES private/src/test
+    VERSION 0.1
+    LINK_LIBRARIES celix_framework
+    )
+
+BUNDLE_PRIVATE_LIBRARY(private
+    SOURCES private/src/activator
+    LINK_LIBRARIES celix_framework org.apache.incubator.celix.helloworld.sub-0.1
+    )
+    
+BUNDLE(org.apache.incubator.celix.helloworld
+    ACTIVATOR "apache_celix_examples_hello_world-private-0.0.1"
+    PRIVATE_LIBRARIES "private"
+    EXPORT_LIBRARIES org.apache.incubator.celix.helloworld.sub|version="0.1"
+    )
+
+

Modified: incubator/celix/trunk/examples/hello_world/private/src/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/hello_world/private/src/activator.c?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/examples/hello_world/private/src/activator.c (original)
+++ incubator/celix/trunk/examples/hello_world/private/src/activator.c Mon May 19 09:45:45 2014
@@ -30,6 +30,8 @@
 #include "bundle_activator.h"
 #include "bundle_context.h"
 
+#include "test.h"
+
 struct userData {
 	char * word;
 };
@@ -49,6 +51,9 @@ celix_status_t bundleActivator_create(bu
 celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
 	struct userData * data = (struct userData *) userData;
 	printf("Hello %s\n", data->word);
+
+	doo();
+
 	return CELIX_SUCCESS;
 }
 

Copied: incubator/celix/trunk/examples/hello_world/private/src/test.c (from r1595802, incubator/celix/trunk/framework/private/include/bundle_revision_private.h)
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/hello_world/private/src/test.c?p2=incubator/celix/trunk/examples/hello_world/private/src/test.c&p1=incubator/celix/trunk/framework/private/include/bundle_revision_private.h&r1=1595802&r2=1595803&rev=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle_revision_private.h (original)
+++ incubator/celix/trunk/examples/hello_world/private/src/test.c Mon May 19 09:45:45 2014
@@ -17,25 +17,16 @@
  *under the License.
  */
 /*
- * bundle_revision_private.h
+ * test.c
  *
- *  \date       Feb 12, 2013
+ *  \date       12 Feb 2014
  *  \author     <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
  *  \copyright  Apache License, Version 2.0
  */
 
+#include <stdio.h>
 
-#ifndef BUNDLE_REVISION_PRIVATE_H_
-#define BUNDLE_REVISION_PRIVATE_H_
-
-#include "bundle_revision.h"
-
-struct bundleRevision {
-	long revisionNr;
-	char *root;
-	char *location;
-	manifest_pt manifest;
-	framework_logger_pt logger;
-};
-
-#endif /* BUNDLE_REVISION_PRIVATE_H_ */
+void doo()
+{
+    printf("Hello from second lib\n");
+}

Copied: incubator/celix/trunk/examples/hello_world/public/include/test.h (from r1595802, incubator/celix/trunk/framework/private/include/bundle_revision_private.h)
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/hello_world/public/include/test.h?p2=incubator/celix/trunk/examples/hello_world/public/include/test.h&p1=incubator/celix/trunk/framework/private/include/bundle_revision_private.h&r1=1595802&r2=1595803&rev=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle_revision_private.h (original)
+++ incubator/celix/trunk/examples/hello_world/public/include/test.h Mon May 19 09:45:45 2014
@@ -17,25 +17,18 @@
  *under the License.
  */
 /*
- * bundle_revision_private.h
+ * test.h
  *
- *  \date       Feb 12, 2013
+ *  \date       12 Feb 2014
  *  \author     <a href="mailto:celix-dev@incubator.apache.org">Apache Celix Project Team</a>
  *  \copyright  Apache License, Version 2.0
  */
 
+#ifndef TEST_H_
+#define TEST_H_
 
-#ifndef BUNDLE_REVISION_PRIVATE_H_
-#define BUNDLE_REVISION_PRIVATE_H_
 
-#include "bundle_revision.h"
+void doo(void);
 
-struct bundleRevision {
-	long revisionNr;
-	char *root;
-	char *location;
-	manifest_pt manifest;
-	framework_logger_pt logger;
-};
 
-#endif /* BUNDLE_REVISION_PRIVATE_H_ */
+#endif /* TEST_H_ */

Copied: incubator/celix/trunk/examples/hello_world_test/CMakeLists.txt (from r1595802, incubator/celix/trunk/examples/hello_world/CMakeLists.txt)
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/hello_world_test/CMakeLists.txt?p2=incubator/celix/trunk/examples/hello_world_test/CMakeLists.txt&p1=incubator/celix/trunk/examples/hello_world/CMakeLists.txt&r1=1595802&r2=1595803&rev=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/examples/hello_world/CMakeLists.txt (original)
+++ incubator/celix/trunk/examples/hello_world_test/CMakeLists.txt Mon May 19 09:45:45 2014
@@ -15,9 +15,16 @@
 # specific language governing permissions and limitations
 # under the License.
 
-SET_HEADER(BUNDLE_SYMBOLICNAME "apache_celix_examples_hello_world")
+SET(BUNDLE_SYMBOLICNAME "apache_celix_examples_hello_world_test")
+SET(BUNDLE_VERSION "0.0.1")
 SET_HEADERS("Bundle-Name: Apache Celix Shell TUI") 
-	
-bundle(hello_world SOURCES private/src/activator)
+    
+bundle(hello_world_test 
+    SOURCES private/src/activator 
+    IMPORT_LIBRARIES "org.apache.incubator.celix.helloworld.sub|version=\"[0.0.1,1.0.0)\"")
+    #IMPORT_LIBRARIES "org.apache.incubator.celix.helloworld.sub;version=\"[1.0,2.0\)\"")
+target_link_libraries(hello_world_test celix_framework)
+target_link_libraries(hello_world_test org.apache.incubator.celix.helloworld.sub-0.1)
 include_directories("${PROJECT_SOURCE_DIR}/utils/public/include")
-target_link_libraries(hello_world celix_framework)
\ No newline at end of file
+include_directories("${PROJECT_SOURCE_DIR}/examples/hello_world/public/include")
+include_directories("private/include")

Copied: incubator/celix/trunk/examples/hello_world_test/private/src/activator.c (from r1595802, incubator/celix/trunk/examples/hello_world/private/src/activator.c)
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/hello_world_test/private/src/activator.c?p2=incubator/celix/trunk/examples/hello_world_test/private/src/activator.c&p1=incubator/celix/trunk/examples/hello_world/private/src/activator.c&r1=1595802&r2=1595803&rev=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/examples/hello_world/private/src/activator.c (original)
+++ incubator/celix/trunk/examples/hello_world_test/private/src/activator.c Mon May 19 09:45:45 2014
@@ -30,6 +30,8 @@
 #include "bundle_activator.h"
 #include "bundle_context.h"
 
+#include "test.h"
+
 struct userData {
 	char * word;
 };
@@ -39,7 +41,7 @@ celix_status_t bundleActivator_create(bu
 	celix_status_t status = bundleContext_getMemoryPool(context, &pool);
 	if (status == CELIX_SUCCESS) {
 		*userData = apr_palloc(pool, sizeof(struct userData));
-		((struct userData *)(*userData))->word = "World";
+		((struct userData *)(*userData))->word = "Import";
 	} else {
 		status = CELIX_START_ERROR;
 	}
@@ -49,6 +51,9 @@ celix_status_t bundleActivator_create(bu
 celix_status_t bundleActivator_start(void * userData, bundle_context_pt context) {
 	struct userData * data = (struct userData *) userData;
 	printf("Hello %s\n", data->word);
+
+	doo();
+
 	return CELIX_SUCCESS;
 }
 

Modified: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/deploy.cmake
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/deploy.cmake?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/deploy.cmake (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/deploy.cmake Mon May 19 09:45:45 2014
@@ -17,6 +17,6 @@
 is_enabled(EXAMPLES)
 if (EXAMPLES)
 	if(PKG_CONFIG_EXECUTABLE)
-		deploy("chapter04-paint-example" BUNDLES chapter04-paint-example circle square triangle shell shell_tui log_service log_writer)
+		#deploy("chapter04-paint-example" BUNDLES chapter04-paint-example circle square triangle shell shell_tui log_service log_writer)
 	endif(PKG_CONFIG_EXECUTABLE)
 endif (EXAMPLES)
\ No newline at end of file

Modified: incubator/celix/trunk/framework/private/include/bundle_revision_private.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/bundle_revision_private.h?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle_revision_private.h (original)
+++ incubator/celix/trunk/framework/private/include/bundle_revision_private.h Mon May 19 09:45:45 2014
@@ -36,6 +36,8 @@ struct bundleRevision {
 	char *location;
 	manifest_pt manifest;
 	framework_logger_pt logger;
+
+	array_list_pt libraryHandles;
 };
 
 #endif /* BUNDLE_REVISION_PRIVATE_H_ */

Modified: incubator/celix/trunk/framework/private/include/framework_private.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/framework_private.h?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/framework_private.h (original)
+++ incubator/celix/trunk/framework/private/include/framework_private.h Mon May 19 09:45:45 2014
@@ -130,7 +130,7 @@ FRAMEWORK_EXPORT bundle_pt findBundle(bu
 FRAMEWORK_EXPORT service_registration_pt findRegistration(service_reference_pt reference);
 
 FRAMEWORK_EXPORT service_reference_pt listToArray(array_list_pt list);
-FRAMEWORK_EXPORT celix_status_t framework_markResolvedModules(framework_pt framework, hash_map_pt wires);
+FRAMEWORK_EXPORT celix_status_t framework_markResolvedModules(framework_pt framework, linked_list_pt wires);
 
 FRAMEWORK_EXPORT array_list_pt framework_getBundles(framework_pt framework);
 FRAMEWORK_EXPORT bundle_pt framework_getBundle(framework_pt framework, char * location);

Modified: incubator/celix/trunk/framework/private/include/resolver.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/resolver.h?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/resolver.h (original)
+++ incubator/celix/trunk/framework/private/include/resolver.h Mon May 19 09:45:45 2014
@@ -31,7 +31,13 @@
 #include "wire.h"
 #include "hash_map.h"
 
-hash_map_pt resolver_resolve(module_pt root);
+struct importer_wires {
+    module_pt importer;
+    linked_list_pt wires;
+};
+typedef struct importer_wires *importer_wires_pt;
+
+linked_list_pt resolver_resolve(module_pt root);
 void resolver_moduleResolved(module_pt module);
 void resolver_addModule(module_pt module);
 void resolver_removeModule(module_pt module);

Modified: incubator/celix/trunk/framework/private/src/bundle_revision.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_revision.c?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_revision.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_revision.c Mon May 19 09:45:45 2014
@@ -35,7 +35,7 @@
 
 static apr_status_t bundleRevision_destroy(void *revisionP);
 
-celix_status_t bundleRevision_create(apr_pool_t *pool, framework_logger_pt logger, char *root, char *location, long revisionNr, char *inputFile, bundle_revision_pt *bundle_revision) {
+celix_status_t bundleRevision_create(apr_pool_t *pool, framework_logger_pt loggera, char *root, char *location, long revisionNr, char *inputFile, bundle_revision_pt *bundle_revision) {
     celix_status_t status = CELIX_SUCCESS;
 	bundle_revision_pt revision = NULL;
 
@@ -58,11 +58,15 @@ celix_status_t bundleRevision_create(apr
                 status = extractBundle(location, root);
             }
 
+            status = CELIX_DO_IF(status, arrayList_create(&(revision->libraryHandles)));
             if (status == CELIX_SUCCESS) {
                 revision->revisionNr = revisionNr;
                 revision->root = apr_pstrdup(pool, root);
                 revision->location = apr_pstrdup(pool, location);
-                revision->logger = logger;
+                revision->logger = loggera;
+
+                arrayList_create(&(revision->libraryHandles));
+
                 *bundle_revision = revision;
 
                 char *manifest = apr_pstrcat(pool, revision->root, "/META-INF/MANIFEST.MF", NULL);
@@ -71,7 +75,7 @@ celix_status_t bundleRevision_create(apr
         }
     }
 
-    framework_logIfError(revision->logger, status, NULL, "Failed to create revision");
+    framework_logIfError(logger, status, NULL, "Failed to create revision");
 
 	return status;
 }
@@ -132,3 +136,16 @@ celix_status_t bundleRevision_getManifes
 
 	return status;
 }
+
+celix_status_t bundleRevision_getHandles(bundle_revision_pt revision, array_list_pt *handles) {
+    celix_status_t status = CELIX_SUCCESS;
+    if (revision == NULL) {
+        status = CELIX_ILLEGAL_ARGUMENT;
+    } else {
+        *handles = revision->libraryHandles;
+    }
+
+    framework_logIfError(logger, status, NULL, "Failed to get handles");
+
+    return status;
+}

Modified: incubator/celix/trunk/framework/private/src/framework.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Mon May 19 09:45:45 2014
@@ -104,6 +104,10 @@ static void *APR_THREAD_FUNC fw_eventDis
 celix_status_t fw_invokeBundleListener(framework_pt framework, bundle_listener_pt listener, bundle_event_pt event, bundle_pt bundle);
 celix_status_t fw_invokeFrameworkListener(framework_pt framework, framework_listener_pt listener, framework_event_pt event, bundle_pt bundle);
 
+static celix_status_t framework_loadBundleLibraries(framework_pt framework, bundle_pt bundle);
+static celix_status_t framework_loadLibraries(framework_pt framework, char *libraries, char *activator, bundle_archive_pt archive, void **activatorHandle);
+static celix_status_t framework_loadLibrary(framework_pt framework, char *library, bundle_archive_pt archive, void **handle);
+
 struct fw_refreshHelper {
     framework_pt framework;
     bundle_pt bundle;
@@ -302,7 +306,7 @@ celix_status_t fw_init(framework_pt fram
 	bundle_state_e state;
 	char *location;
 	module_pt module = NULL;
-	hash_map_pt wires;
+	linked_list_pt wires;
 	array_list_pt archives;
 	bundle_archive_pt archive = NULL;
 	char uuid[APR_UUID_FORMATTED_LENGTH+1];
@@ -351,7 +355,6 @@ celix_status_t fw_init(framework_pt fram
         wires = resolver_resolve(module);
         if (wires != NULL) {
             framework_markResolvedModules(framework, wires);
-            hashMap_destroy(wires, false, false);
         } else {
             status = CELIX_BUNDLE_EXCEPTION;
             fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Unresolved constraints in System Bundle");
@@ -593,34 +596,14 @@ celix_status_t framework_getBundleEntry(
 celix_status_t fw_startBundle(framework_pt framework, bundle_pt bundle, int options) {
 	celix_status_t status = CELIX_SUCCESS;
 
-	hash_map_pt wires = NULL;
-	handle_t handle;
+	linked_list_pt wires = NULL;
 	bundle_context_pt context = NULL;
 	bundle_state_e state;
 	module_pt module = NULL;
-	manifest_pt manifest = NULL;
-	char *library;
-	#ifdef __linux__
-			 char * library_prefix = "lib";
-			 char * library_extension = ".so";
-	#elif __APPLE__
-			 char * library_prefix = "lib";
-			 char * library_extension = ".dylib";
-	#elif WIN32
-			 char * library_prefix = "";
-			 char * library_extension = ".dll";
-	#endif
-
-	char libraryPath[256];
-	long refreshCount;
-	char *archiveRoot;
-	long revisionNumber;
 	activator_pt activator = NULL;
-	bundle_archive_pt archive = NULL;
-	bundle_revision_pt revision = NULL;
 	apr_pool_t *bundlePool = NULL;
 	char *error = NULL;
-
+	char *name = NULL;
 
 	status = CELIX_DO_IF(status, framework_acquireBundleLock(framework, bundle, OSGI_FRAMEWORK_BUNDLE_INSTALLED|OSGI_FRAMEWORK_BUNDLE_RESOLVED|OSGI_FRAMEWORK_BUNDLE_STARTING|OSGI_FRAMEWORK_BUNDLE_ACTIVE));
 	status = CELIX_DO_IF(status, bundle_getState(bundle, &state));
@@ -647,6 +630,7 @@ celix_status_t fw_startBundle(framework_
                 break;
             case OSGI_FRAMEWORK_BUNDLE_INSTALLED:
                 bundle_getCurrentModule(bundle, &module);
+                module_getSymbolicName(module, &name);
                 if (!module_isResolved(module)) {
                     wires = resolver_resolve(module);
                     if (wires == NULL) {
@@ -654,83 +638,57 @@ celix_status_t fw_startBundle(framework_
                         return CELIX_BUNDLE_EXCEPTION;
                     }
                     framework_markResolvedModules(framework, wires);
-                }
-                if (wires != NULL) {
-                    hashMap_destroy(wires, false, false);
+
                 }
                 /* no break */
             case OSGI_FRAMEWORK_BUNDLE_RESOLVED:
+                module = NULL;
+                name = NULL;
+                bundle_getCurrentModule(bundle, &module);
+                module_getSymbolicName(module, &name);
                 status = CELIX_DO_IF(status, bundleContext_create(framework, framework->logger, bundle, &context));
                 status = CELIX_DO_IF(status, bundle_setContext(bundle, context));
-
-                status = CELIX_DO_IF(status, bundle_getArchive(bundle, &archive));
                 status = CELIX_DO_IF(status, bundle_getMemoryPool(bundle, &bundlePool));
-                status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
-                status = CELIX_DO_IF(status, bundleRevision_getManifest(revision, &manifest));
-                if (status == CELIX_SUCCESS) {
-                    library = manifest_getValue(manifest, OSGI_FRAMEWORK_HEADER_LIBRARY);
-                }
-
-                status = CELIX_DO_IF(status, bundleArchive_getRefreshCount(archive, &refreshCount));
-                status = CELIX_DO_IF(status, bundleArchive_getArchiveRoot(archive, &archiveRoot));
-                status = CELIX_DO_IF(status, bundleArchive_getCurrentRevisionNumber(archive, &revisionNumber));
 
                 if (status == CELIX_SUCCESS) {
-                    sprintf(libraryPath, "%s/version%ld.%ld/%s%s%s", archiveRoot, refreshCount, revisionNumber, library_prefix, library, library_extension);
-
-                    // BUG: Can't use apr_dso_load, apr assumes RTLD_GLOBAL for loading libraries.
-                    // apr_dso_handle_t *handle;
-                    // apr_dso_load(&handle, libraryPath, bundle->memoryPool);
-                    handle = fw_openLibrary(libraryPath);
-                    if (handle == NULL) {
-                        char err[1024];
-                        sprintf(err, "library could not be opened: %s", fw_getLastError());
-                        // #TODO this is wrong
-                        error = err;
-                        status =  CELIX_BUNDLE_EXCEPTION;
-                    }
-
-                    if (status == CELIX_SUCCESS) {
-                        bundle_setHandle(bundle, handle);
-
-                        activator = (activator_pt) apr_palloc(bundlePool, (sizeof(*activator)));
-                        if (activator == NULL) {
-                            status = CELIX_ENOMEM;
-                        } else {
-                            void * userData = NULL;
-                            bundle_context_pt context;
-                            create_function_pt create = (create_function_pt) fw_getSymbol((handle_t) bundle_getHandle(bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_CREATE);
-                            start_function_pt start = (start_function_pt) fw_getSymbol((handle_t) bundle_getHandle(bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_START);
-                            stop_function_pt stop = (stop_function_pt) fw_getSymbol((handle_t) bundle_getHandle(bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_STOP);
-                            destroy_function_pt destroy = (destroy_function_pt) fw_getSymbol((handle_t) bundle_getHandle(bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_DESTROY);
-
-                            activator->start = start;
-                            activator->stop = stop;
-                            activator->destroy = destroy;
-                            status = CELIX_DO_IF(status, bundle_setActivator(bundle, activator));
-
-                            status = CELIX_DO_IF(status, framework_setBundleStateAndNotify(framework, bundle, OSGI_FRAMEWORK_BUNDLE_STARTING));
-                            status = CELIX_DO_IF(status, fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_STARTING, bundle));
-
-                            status = CELIX_DO_IF(status, bundle_getContext(bundle, &context));
-
-                            if (status == CELIX_SUCCESS) {
-                                if (create != NULL) {
-                                    status = CELIX_DO_IF(status, create(context, &userData));
-                                    if (status == CELIX_SUCCESS) {
-                                        activator->userData = userData;
-                                    }
-                                }
-                            }
-                            if (status == CELIX_SUCCESS) {
-                                if (start != NULL) {
-                                    status = CELIX_DO_IF(status, start(userData, context));
+                    activator = (activator_pt) apr_palloc(bundlePool, (sizeof(*activator)));
+                    if (activator == NULL) {
+                        status = CELIX_ENOMEM;
+                    } else {
+                        void * userData = NULL;
+                        bundle_context_pt context;
+                        create_function_pt create = (create_function_pt) fw_getSymbol((handle_t) bundle_getHandle(bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_CREATE);
+                        start_function_pt start = (start_function_pt) fw_getSymbol((handle_t) bundle_getHandle(bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_START);
+                        stop_function_pt stop = (stop_function_pt) fw_getSymbol((handle_t) bundle_getHandle(bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_STOP);
+                        destroy_function_pt destroy = (destroy_function_pt) fw_getSymbol((handle_t) bundle_getHandle(bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_DESTROY);
+
+                        activator->start = start;
+                        activator->stop = stop;
+                        activator->destroy = destroy;
+                        status = CELIX_DO_IF(status, bundle_setActivator(bundle, activator));
+
+                        status = CELIX_DO_IF(status, framework_setBundleStateAndNotify(framework, bundle, OSGI_FRAMEWORK_BUNDLE_STARTING));
+                        status = CELIX_DO_IF(status, fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_STARTING, bundle));
+
+                        status = CELIX_DO_IF(status, bundle_getContext(bundle, &context));
+
+                        if (status == CELIX_SUCCESS) {
+                            if (create != NULL) {
+                                status = CELIX_DO_IF(status, create(context, &userData));
+                                if (status == CELIX_SUCCESS) {
+                                    activator->userData = userData;
                                 }
                             }
+                        }
+                        if (status == CELIX_SUCCESS) {
+                            if (start != NULL) {
 
-                            status = CELIX_DO_IF(status, framework_setBundleStateAndNotify(framework, bundle, OSGI_FRAMEWORK_BUNDLE_ACTIVE));
-                            status = CELIX_DO_IF(status, fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_STARTED, bundle));
+                                status = CELIX_DO_IF(status, start(userData, context));
+                            }
                         }
+
+                        status = CELIX_DO_IF(status, framework_setBundleStateAndNotify(framework, bundle, OSGI_FRAMEWORK_BUNDLE_ACTIVE));
+                        status = CELIX_DO_IF(status, fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_STARTED, bundle));
                     }
                 }
 
@@ -788,6 +746,17 @@ celix_status_t framework_updateBundle(fr
 	status = CELIX_DO_IF(status, bundleArchive_setLastModified(archive, time(NULL)));
 	status = CELIX_DO_IF(status, framework_setBundleStateAndNotify(framework, bundle, OSGI_FRAMEWORK_BUNDLE_INSTALLED));
 
+	// TODO Unload all libraries for transition to unresolved
+	bundle_revision_pt revision = NULL;
+	array_list_pt handles = NULL;
+	status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
+    status = CELIX_DO_IF(status, bundleRevision_getHandles(revision, &handles));
+    for (int i = arrayList_size(handles) - 1; i >= 0; i--) {
+        void *handle = arrayList_get(handles, i);
+        fw_closeLibrary(handle);
+    }
+
+
 	status = CELIX_DO_IF(status, fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_UNRESOLVED, bundle));
 	status = CELIX_DO_IF(status, fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_UPDATED, bundle));
 
@@ -906,9 +875,6 @@ celix_status_t fw_stopBundle(framework_p
                     status = CELIX_DO_IF(status, bundle_setContext(bundle, NULL));
                 }
 
-                // #TODO enable dlclose call
-                dlclose(bundle_getHandle(bundle));
-
                 status = CELIX_DO_IF(status, framework_setBundleStateAndNotify(framework, bundle, OSGI_FRAMEWORK_BUNDLE_RESOLVED));
             }
 	    }
@@ -976,6 +942,9 @@ celix_status_t fw_uninstallBundle(framew
 
     status = CELIX_DO_IF(status, framework_setBundleStateAndNotify(framework, bundle, OSGI_FRAMEWORK_BUNDLE_INSTALLED));
 
+    // TODO Unload all libraries for transition to unresolved
+    dlclose(bundle_getHandle(bundle));
+
     status = CELIX_DO_IF(status, fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_UNRESOLVED, bundle));
 
     status = CELIX_DO_IF(status, framework_setBundleStateAndNotify(framework, bundle, OSGI_FRAMEWORK_BUNDLE_UNINSTALLED));
@@ -1627,38 +1596,114 @@ long framework_getNextBundleId(framework
 	return id;
 }
 
-celix_status_t framework_markResolvedModules(framework_pt framework, hash_map_pt resolvedModuleWireMap) {
+celix_status_t framework_markResolvedModules(framework_pt framework, linked_list_pt resolvedModuleWireMap) {
 	if (resolvedModuleWireMap != NULL) {
-		hash_map_iterator_pt iterator = hashMapIterator_create(resolvedModuleWireMap);
-		while (hashMapIterator_hasNext(iterator)) {
-			hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
-			module_pt module = (module_pt) hashMapEntry_getKey(entry);
-			linked_list_pt wires = (linked_list_pt) hashMapEntry_getValue(entry);
+		// hash_map_iterator_pt iterator = hashMapIterator_create(resolvedModuleWireMap);
+		linked_list_iterator_pt iterator = linkedListIterator_create(resolvedModuleWireMap, linkedList_size(resolvedModuleWireMap));
+		while (linkedListIterator_hasPrevious(iterator)) {
+		    importer_wires_pt iw = linkedListIterator_previous(iterator);
+			// hash_map_entry_pt entry = hashMapIterator_nextEntry(iterator);
+			module_pt module = iw->importer;
+
+//			bundle_pt bundle = module_getBundle(module);
+//			bundle_archive_pt archive = NULL;
+//			bundle_getArchive(bundle, &archive);
+//			bundle_revision_pt revision = NULL;
+//			bundleArchive_getCurrentRevision(archive, &revision);
+//			char *root = NULL;
+//			bundleRevision_getRoot(revision, &root);
+//			manifest_pt manifest = NULL;
+//			bundleRevision_getManifest(revision, &manifest);
+//
+//			char *private = manifest_getValue(manifest, OSGI_FRAMEWORK_PRIVATE_LIBRARY);
+//			char *export = manifest_getValue(manifest, OSGI_FRAMEWORK_EXPORT_LIBRARY);
+//
+//			printf("Root %s\n", root);
+
+			// for each library update the reference to the wires, if there are any
+
+			linked_list_pt wires = iw->wires;
+
+//			linked_list_iterator_pt wit = linkedListIterator_create(wires, 0);
+//			while (linkedListIterator_hasNext(wit)) {
+//			    wire_pt wire = linkedListIterator_next(wit);
+//			    module_pt importer = NULL;
+//			    requirement_pt requirement = NULL;
+//			    module_pt exporter = NULL;
+//                capability_pt capability = NULL;
+//			    wire_getImporter(wire, &importer);
+//			    wire_getRequirement(wire, &requirement);
+//
+//			    wire_getExporter(wire, &exporter);
+//			    wire_getCapability(wire, &capability);
+//
+//			    char *importerName = NULL;
+//			    module_getSymbolicName(importer, &importerName);
+//
+//			    char *exporterName = NULL;
+//                module_getSymbolicName(exporter, &exporterName);
+//
+//                version_pt version = NULL;
+//                char *name = NULL;
+//                capability_getServiceName(capability, &name);
+//                capability_getVersion(capability, &version);
+//                char *versionString = NULL;
+//                version_toString(version, framework->mp, &versionString);
+//
+//                printf("Module %s imports library %s:%s from %s\n", importerName, name, versionString, exporterName);
+//			}
 
 			module_setWires(module, wires);
 
 			module_setResolved(module);
 			resolver_moduleResolved(module);
+
+			char *mname = NULL;
+			module_getSymbolicName(module, &mname);
 			framework_markBundleResolved(framework, module);
 		}
-		hashMapIterator_destroy(iterator);
+		linkedListIterator_destroy(iterator);
 	}
 	return CELIX_SUCCESS;
 }
 
 celix_status_t framework_markBundleResolved(framework_pt framework, module_pt module) {
+    celix_status_t status = CELIX_SUCCESS;
 	bundle_pt bundle = module_getBundle(module);
 	bundle_state_e state;
+	char *error = NULL;
 
 	if (bundle != NULL) {
 		framework_acquireBundleLock(framework, bundle, OSGI_FRAMEWORK_BUNDLE_INSTALLED|OSGI_FRAMEWORK_BUNDLE_RESOLVED|OSGI_FRAMEWORK_BUNDLE_ACTIVE);
 		bundle_getState(bundle, &state);
 		if (state != OSGI_FRAMEWORK_BUNDLE_INSTALLED) {
 			printf("Trying to resolve a resolved bundle");
+			status = CELIX_ILLEGAL_STATE;
 		} else {
-			framework_setBundleStateAndNotify(framework, bundle, OSGI_FRAMEWORK_BUNDLE_RESOLVED);
-			// framework_fireBundleEvent(BUNDLE_EVENT_RESOLVED, bundle);
-		}
+		    // Load libraries of this module
+		    bool isSystemBundle = false;
+		    bundle_isSystemBundle(bundle, &isSystemBundle);
+		    if (!isSystemBundle) {
+                status = CELIX_DO_IF(status, framework_loadBundleLibraries(framework, bundle));
+		    }
+
+		    status = CELIX_DO_IF(status, framework_setBundleStateAndNotify(framework, bundle, OSGI_FRAMEWORK_BUNDLE_RESOLVED));
+			status = CELIX_DO_IF(status, fw_fireBundleEvent(framework, OSGI_FRAMEWORK_BUNDLE_EVENT_RESOLVED, bundle));
+		}
+
+		if (status != CELIX_SUCCESS) {
+            module_pt module = NULL;
+            char *symbolicName = NULL;
+            long id = 0;
+            module_getSymbolicName(module, &symbolicName);
+            bundle_getBundleId(bundle, &id);
+            if (error != NULL) {
+                fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not start bundle: %s [%ld]; cause: %s", symbolicName, id, error);
+            } else {
+                fw_logCode(framework->logger, OSGI_FRAMEWORK_LOG_ERROR, status, "Could not start bundle: %s [%ld]", symbolicName, id);
+            }
+        }
+
 		framework_releaseBundleLock(framework, bundle);
 	}
 
@@ -2181,3 +2226,152 @@ celix_status_t bundleActivator_stop(void
 celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
 	return CELIX_SUCCESS;
 }
+
+
+static celix_status_t framework_loadBundleLibraries(framework_pt framework, bundle_pt bundle) {
+    celix_status_t status = CELIX_SUCCESS;
+
+    handle_t handle;
+    bundle_archive_pt archive = NULL;
+    bundle_revision_pt revision = NULL;
+    manifest_pt manifest = NULL;
+
+    #ifdef __linux__
+             char * library_prefix = "lib";
+             char * library_extension = ".so";
+    #elif __APPLE__
+             char * library_prefix = "lib";
+             char * library_extension = ".dylib";
+    #elif WIN32
+             char * library_prefix = "";
+             char * library_extension = ".dll";
+    #endif
+
+    status = CELIX_DO_IF(status, bundle_getArchive(bundle, &archive));
+    status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
+    status = CELIX_DO_IF(status, bundleRevision_getManifest(revision, &manifest));
+    if (status == CELIX_SUCCESS) {
+        char *library = NULL;
+        char *privateLibraries = NULL;
+        char *exportLibraries = NULL;
+        char *activator = NULL;
+
+        library = manifest_getValue(manifest, OSGI_FRAMEWORK_HEADER_LIBRARY);
+        privateLibraries = manifest_getValue(manifest, OSGI_FRAMEWORK_PRIVATE_LIBRARY);
+        exportLibraries = manifest_getValue(manifest, OSGI_FRAMEWORK_EXPORT_LIBRARY);
+        activator = manifest_getValue(manifest, OSGI_FRAMEWORK_BUNDLE_ACTIVATOR);
+
+        if (exportLibraries != NULL) {
+            status = CELIX_DO_IF(status, framework_loadLibraries(framework, exportLibraries, activator, archive, &handle));
+        }
+
+        if (privateLibraries != NULL) {
+            status = CELIX_DO_IF(status, framework_loadLibraries(framework, privateLibraries, activator, archive, &handle));
+        }
+
+        if (library != NULL) {
+            status = CELIX_DO_IF(status, framework_loadLibrary(framework, library, archive, &handle));
+        }
+
+        if (status == CELIX_SUCCESS) {
+            bundle_setHandle(bundle, handle);
+        }
+    }
+
+    framework_logIfError(framework->logger, status, NULL, "Could not load all bundle libraries");
+
+    return status;
+}
+
+// TODO Store all handles for unloading!
+static celix_status_t framework_loadLibraries(framework_pt framework, char *libraries, char *activator, bundle_archive_pt archive, void **activatorHandle) {
+    celix_status_t status = CELIX_SUCCESS;
+
+    char *last;
+    char *token = apr_strtok(libraries, ",", &last);
+    while (token != NULL) {
+        void *handle = NULL;
+        char lib[strlen(token)];
+
+        char *path;
+        char *pathToken = apr_strtok(token, ";", &path);
+        strcpy(lib, pathToken);
+        pathToken = apr_strtok(NULL, ";", &path);
+
+        while (pathToken != NULL) {
+            if (strncmp(pathToken, "version", 7) == 0) {
+                char *ver = strdup(pathToken);
+                char version[strlen(ver) - 9];
+                strncpy(version, ver+9, strlen(ver) - 10);
+                version[strlen(ver) - 10] = '\0';
+
+                strcat(lib, "-");
+                strcat(lib, version);
+            }
+            pathToken = apr_strtok(NULL, ";", &path);
+        }
+
+        status = framework_loadLibrary(framework, lib, archive, &handle);
+
+        if (status == CELIX_SUCCESS) {
+            if (activator != NULL) {
+                if (strcmp(lib, activator) == 0) {
+                    *activatorHandle = handle;
+                }
+            }
+        }
+
+        token = apr_strtok(NULL, ",", &last);
+    }
+
+    framework_logIfError(framework->logger, status, NULL, "Could not load all libraries");
+
+    return status;
+}
+
+static celix_status_t framework_loadLibrary(framework_pt framework, char *library, bundle_archive_pt archive, void **handle) {
+    celix_status_t status = CELIX_SUCCESS;
+    char *error = NULL;
+
+    #ifdef __linux__
+        char * library_prefix = "lib";
+        char * library_extension = ".so";
+    #elif __APPLE__
+        char * library_prefix = "lib";
+        char * library_extension = ".dylib";
+    #elif WIN32
+        char * library_prefix = "";
+        char * library_extension = ".dll";
+    #endif
+
+    char libraryPath[256];
+    long refreshCount;
+    char *archiveRoot;
+    long revisionNumber;
+
+    status = CELIX_DO_IF(status, bundleArchive_getRefreshCount(archive, &refreshCount));
+    status = CELIX_DO_IF(status, bundleArchive_getArchiveRoot(archive, &archiveRoot));
+    status = CELIX_DO_IF(status, bundleArchive_getCurrentRevisionNumber(archive, &revisionNumber));
+
+    sprintf(libraryPath, "%s/version%ld.%ld/%s%s%s", archiveRoot, refreshCount, revisionNumber, library_prefix, library, library_extension);
+
+    *handle = fw_openLibrary(libraryPath);
+    if (*handle == NULL) {
+        char err[1024];
+        error = fw_getLastError();
+        // #TODO this is wrong
+        status =  CELIX_BUNDLE_EXCEPTION;
+    } else {
+        bundle_revision_pt revision = NULL;
+        array_list_pt handles = NULL;
+
+        status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision));
+        status = CELIX_DO_IF(status, bundleRevision_getHandles(revision, &handles));
+
+        arrayList_add(handles, handle);
+    }
+
+    framework_logIfError(framework->logger, status, error, "Could not load library: %s", libraryPath);
+
+    return status;
+}

Modified: incubator/celix/trunk/framework/private/src/manifest_parser.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/manifest_parser.c?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/manifest_parser.c (original)
+++ incubator/celix/trunk/framework/private/src/manifest_parser.c Mon May 19 09:45:45 2014
@@ -79,8 +79,8 @@ celix_status_t manifestParser_create(mod
             parser->bundleSymbolicName = bundleSymbolicName;
         }
 
-        parser->capabilities = manifestParser_parseExportHeader(owner, manifest_getValue(manifest, OSGI_FRAMEWORK_EXPORT_PACKAGE), memory_pool);
-        parser->requirements = manifestParser_parseImportHeader(manifest_getValue(manifest, OSGI_FRAMEWORK_IMPORT_PACKAGE), memory_pool);
+        parser->capabilities = manifestParser_parseExportHeader(owner, manifest_getValue(manifest, OSGI_FRAMEWORK_EXPORT_LIBRARY), memory_pool);
+        parser->requirements = manifestParser_parseImportHeader(manifest_getValue(manifest, OSGI_FRAMEWORK_IMPORT_LIBRARY), memory_pool);
 
         *manifest_parser = parser;
 

Modified: incubator/celix/trunk/framework/private/src/resolver.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/resolver.c?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/resolver.c (original)
+++ incubator/celix/trunk/framework/private/src/resolver.c Mon May 19 09:45:45 2014
@@ -57,12 +57,12 @@ linked_list_pt m_resolvedServices = NULL
 int resolver_populateCandidatesMap(hash_map_pt candidatesMap, module_pt targetModule);
 capability_list_pt resolver_getCapabilityList(linked_list_pt list, char * name);
 void resolver_removeInvalidCandidate(module_pt module, hash_map_pt candidates, linked_list_pt invalid);
-hash_map_pt resolver_populateWireMap(hash_map_pt candidates, module_pt importer, hash_map_pt wireMap);
+linked_list_pt resolver_populateWireMap(hash_map_pt candidates, module_pt importer, linked_list_pt wireMap);
 
-hash_map_pt resolver_resolve(module_pt root) {
+linked_list_pt resolver_resolve(module_pt root) {
 	hash_map_pt candidatesMap = NULL;
-	hash_map_pt wireMap = NULL;
-	hash_map_pt resolved = NULL;
+	linked_list_pt wireMap = NULL;
+	linked_list_pt resolved = NULL;
 	hash_map_iterator_pt iter = NULL;
 
 	if (module_isResolved(root)) {
@@ -93,7 +93,10 @@ hash_map_pt resolver_resolve(module_pt r
 		return NULL;
 	}
 
-	wireMap = hashMap_create(NULL,NULL,NULL,NULL);
+	bundle_pt bundle = module_getBundle(root);
+	apr_pool_t *pool = NULL;
+	bundle_getMemoryPool(bundle, &pool);
+	linkedList_create(pool, &wireMap);
 	resolved = resolver_populateWireMap(candidatesMap, root, wireMap);
 	iter = hashMapIterator_create(candidatesMap);
 	while (hashMapIterator_hasNext(iter)) {
@@ -417,7 +420,7 @@ capability_list_pt resolver_getCapabilit
 	return capabilityList;
 }
 
-hash_map_pt resolver_populateWireMap(hash_map_pt candidates, module_pt importer, hash_map_pt wireMap) {
+linked_list_pt resolver_populateWireMap(hash_map_pt candidates, module_pt importer, linked_list_pt wireMap) {
     linked_list_pt serviceWires;
     apr_pool_t *serviceWires_pool;
     linked_list_pt emptyWires;
@@ -430,9 +433,16 @@ hash_map_pt resolver_populateWireMap(has
 
     if (candidates && importer && wireMap) {
         linked_list_pt candSetList = NULL;
-		if (module_isResolved(importer) || (hashMap_get(wireMap, importer))) {
+		if (module_isResolved(importer)) {
             return wireMap;
         }
+		linked_list_iterator_pt wit = linkedListIterator_create(wireMap, 0);
+		while (linkedListIterator_hasNext(wit)) {
+		    importer_wires_pt iw = linkedListIterator_next(wit);
+		    if (iw->importer == importer) {
+		        return wireMap;
+		    }
+		}
 
         candSetList = (linked_list_pt) hashMap_get(candidates, importer);
 
@@ -442,7 +452,15 @@ hash_map_pt resolver_populateWireMap(has
                     if (linkedList_create(emptyWires_pool, &emptyWires) == APR_SUCCESS) {
                         int candSetIdx = 0;
 						
-						hashMap_put(wireMap, importer, emptyWires);
+						// hashMap_put(wireMap, importer, emptyWires);
+
+                        char *mname = NULL;
+                        module_getSymbolicName(importer, &mname);
+
+						importer_wires_pt importerWires = apr_palloc(bundlePool, sizeof(*importerWires));
+						importerWires->importer = importer;
+						importerWires->wires = emptyWires;
+						linkedList_addElement(wireMap, importerWires);
                         
                         for (candSetIdx = 0; candSetIdx < linkedList_size(candSetList); candSetIdx++) {
                             candidate_set_pt cs = (candidate_set_pt) linkedList_get(candSetList, candSetIdx);
@@ -462,7 +480,8 @@ hash_map_pt resolver_populateWireMap(has
                                     wireMap);
                         }
 
-                        hashMap_put(wireMap, importer, serviceWires);
+                        importerWires->wires = serviceWires;
+                        // hashMap_put(wireMap, importer, serviceWires);
                     }
                 }
             }

Modified: incubator/celix/trunk/framework/private/src/version_range.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/version_range.c?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/version_range.c (original)
+++ incubator/celix/trunk/framework/private/src/version_range.c Mon May 19 09:45:45 2014
@@ -135,15 +135,16 @@ celix_status_t versionRange_parse(apr_po
 			status = CELIX_ILLEGAL_STATE;
 		} else {
 			int vlowL = strcspn(rangeStr+1, ",");
-			char * vlow = (char *) apr_palloc(spool, sizeof(*vlow * vlowL));
+			char * vlow = (char *) apr_palloc(spool, sizeof(*vlow * (vlowL + 1)));
 			if (!vlow) {
 				status = CELIX_ENOMEM;
 			} else {
 				int vhighL;
 				char * vhigh;
 				vlow = strncpy(vlow, rangeStr+1, vlowL);
+				vlow[vlowL] = '\0';
 				vhighL = strlen(rangeStr+1) - vlowL - 2;
-				vhigh = (char *) apr_palloc(spool, sizeof(*vhigh * vhighL));
+				vhigh = (char *) apr_palloc(spool, sizeof(*vhigh * (vhighL+1)));
 				if (!vhigh) {
 					status = CELIX_ENOMEM;
 				} else {					
@@ -153,7 +154,7 @@ celix_status_t versionRange_parse(apr_po
 					char end = rangeStr[rangeL-1];
 
 					vhigh = strncpy(vhigh, rangeStr+vlowL+2, vhighL);
-					
+					vhigh[vhighL] = '\0';
 					status = version_createVersionFromString(pool, vlow, &versionLow);
 					if (status == CELIX_SUCCESS) {
 						version_pt versionHigh = NULL;

Modified: incubator/celix/trunk/framework/public/include/bundle_revision.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/bundle_revision.h?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/bundle_revision.h (original)
+++ incubator/celix/trunk/framework/public/include/bundle_revision.h Mon May 19 09:45:45 2014
@@ -35,6 +35,7 @@
 #include "celix_errno.h"
 #include "manifest.h"
 #include "celix_log.h"
+#include "array_list.h"
 
 /**
  * Typedef for bundle_revision_pt.
@@ -112,6 +113,18 @@ celix_status_t bundleRevision_getRoot(bu
  */
 celix_status_t bundleRevision_getManifest(bundle_revision_pt revision, manifest_pt *manifest);
 
+/**
+ * Retrieves the handles of the installed libraries for this revision.
+ *
+ * @param revision The revision to get the manifest for.
+ * @param[out] handles array_list_pt containing the handles.
+ *
+ * @return Status code indication failure or success:
+ *      - CELIX_SUCCESS when no errors are encountered.
+ *      - CELIX_ILLEGAL_ARGUMENT If <code>revision</code> is illegal.
+ */
+celix_status_t bundleRevision_getHandles(bundle_revision_pt revision, array_list_pt *handles);
+
 #endif /* BUNDLE_REVISION_H_ */
 
 /**

Modified: incubator/celix/trunk/framework/public/include/celix_log.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/celix_log.h?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/celix_log.h (original)
+++ incubator/celix/trunk/framework/public/include/celix_log.h Mon May 19 09:45:45 2014
@@ -56,7 +56,7 @@ struct framework_logger {
 #define framework_logIfError(logger, status, error, fmsg, args...) \
     if (status != CELIX_SUCCESS) { \
         if (error != NULL) { \
-            fw_logCode(logger, OSGI_FRAMEWORK_LOG_ERROR, status, #fmsg"; cause: "#error, ## args); \
+            fw_logCode(logger, OSGI_FRAMEWORK_LOG_ERROR, status, #fmsg";\n Cause: %s", ## args, error); \
         } else { \
             fw_logCode(logger, OSGI_FRAMEWORK_LOG_ERROR, status, #fmsg, ## args); \
         } \

Modified: incubator/celix/trunk/framework/public/include/constants.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/constants.h?rev=1595803&r1=1595802&r2=1595803&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/constants.h (original)
+++ incubator/celix/trunk/framework/public/include/constants.h Mon May 19 09:45:45 2014
@@ -32,6 +32,7 @@ static const char * const OSGI_FRAMEWORK
 static const char * const OSGI_FRAMEWORK_SERVICE_PID = "service.pid";
 static const char * const OSGI_FRAMEWORK_SERVICE_RANKING = "service.ranking";
 
+static const char * const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR = "Bundle-Activator";
 static const char * const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_CREATE = "bundleActivator_create";
 static const char * const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_START = "bundleActivator_start";
 static const char * const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_STOP = "bundleActivator_stop";
@@ -41,8 +42,10 @@ static const char * const OSGI_FRAMEWORK
 
 static const char * const OSGI_FRAMEWORK_BUNDLE_SYMBOLICNAME = "Bundle-SymbolicName";
 static const char * const OSGI_FRAMEWORK_BUNDLE_VERSION = "Bundle-Version";
-static const char * const OSGI_FRAMEWORK_EXPORT_PACKAGE = "Export-Service";
-static const char * const OSGI_FRAMEWORK_IMPORT_PACKAGE = "Import-Service";
+static const char * const OSGI_FRAMEWORK_PRIVATE_LIBRARY = "Private-Library";
+static const char * const OSGI_FRAMEWORK_EXPORT_LIBRARY = "Export-Library";
+static const char * const OSGI_FRAMEWORK_IMPORT_LIBRARY = "Import-Library";
+
 
 static const char * const OSGI_FRAMEWORK_FRAMEWORK_STORAGE = "org.osgi.framework.storage";
 static const char * const OSGI_FRAMEWORK_FRAMEWORK_STORAGE_CLEAN = "org.osgi.framework.storage.clean";



Mime
View raw message