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 2012/01/12 14:29:07 UTC

svn commit: r1230520 [1/2] - in /incubator/celix/trunk: cmake/ dependency_manager/ deployment_admin/private/include/ examples/echo_service/client/ examples/osgi-in-action/chapter04-paint-example/paint/private/src/ examples/sender/ examples/whiteboard/t...

Author: abroekhuis
Date: Thu Jan 12 13:29:03 2012
New Revision: 1230520

URL: http://svn.apache.org/viewvc?rev=1230520&view=rev
Log:
Code style fixes

Fixed APR usage and code style issues. Also moved typedefs to the correct files, removing the now obsolete headers.h.

Added:
    incubator/celix/trunk/framework/public/include/archive.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/archive.h
    incubator/celix/trunk/framework/public/include/bundle.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/bundle.h
    incubator/celix/trunk/framework/public/include/bundle_activator.h
    incubator/celix/trunk/framework/public/include/bundle_archive.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/bundle_archive.h
    incubator/celix/trunk/framework/public/include/bundle_context.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/bundle_context.h
    incubator/celix/trunk/framework/public/include/bundle_revision.h
    incubator/celix/trunk/framework/public/include/bundle_state.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/bundle_state.h
    incubator/celix/trunk/framework/public/include/capability.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/capability.h
    incubator/celix/trunk/framework/public/include/celix_errno.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/celix_errno.h
    incubator/celix/trunk/framework/public/include/celix_log.h
    incubator/celix/trunk/framework/public/include/celixbool.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/celixbool.h
    incubator/celix/trunk/framework/public/include/constants.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/constants.h
    incubator/celix/trunk/framework/public/include/filter.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/filter.h
    incubator/celix/trunk/framework/public/include/framework.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/framework.h
    incubator/celix/trunk/framework/public/include/manifest.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/manifest.h
    incubator/celix/trunk/framework/public/include/module.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/module.h
    incubator/celix/trunk/framework/public/include/properties.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/properties.h
    incubator/celix/trunk/framework/public/include/requirement.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/requirement.h
    incubator/celix/trunk/framework/public/include/service_event.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/attribute.h
    incubator/celix/trunk/framework/public/include/service_factory.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/service_factory.h
    incubator/celix/trunk/framework/public/include/service_listener.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/attribute.h
    incubator/celix/trunk/framework/public/include/service_reference.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/service_reference.h
    incubator/celix/trunk/framework/public/include/service_registration.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/service_registration.h
    incubator/celix/trunk/framework/public/include/service_registry.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/service_registry.h
    incubator/celix/trunk/framework/public/include/service_tracker.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/service_tracker.h
    incubator/celix/trunk/framework/public/include/utils.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/utils.h
    incubator/celix/trunk/framework/public/include/version.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/version.h
    incubator/celix/trunk/framework/public/include/version_range.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/version_range.h
    incubator/celix/trunk/framework/public/include/wire.h
      - copied, changed from r1229165, incubator/celix/trunk/framework/private/include/wire.h
Removed:
    incubator/celix/trunk/framework/private/include/archive.h
    incubator/celix/trunk/framework/private/include/bundle.h
    incubator/celix/trunk/framework/private/include/bundle_activator.h
    incubator/celix/trunk/framework/private/include/bundle_archive.h
    incubator/celix/trunk/framework/private/include/bundle_context.h
    incubator/celix/trunk/framework/private/include/bundle_revision.h
    incubator/celix/trunk/framework/private/include/bundle_state.h
    incubator/celix/trunk/framework/private/include/capability.h
    incubator/celix/trunk/framework/private/include/celix_errno.h
    incubator/celix/trunk/framework/private/include/celixbool.h
    incubator/celix/trunk/framework/private/include/component.h
    incubator/celix/trunk/framework/private/include/constants.h
    incubator/celix/trunk/framework/private/include/filter.h
    incubator/celix/trunk/framework/private/include/framework.h
    incubator/celix/trunk/framework/private/include/headers.h
    incubator/celix/trunk/framework/private/include/inputstream.h
    incubator/celix/trunk/framework/private/include/manifest.h
    incubator/celix/trunk/framework/private/include/module.h
    incubator/celix/trunk/framework/private/include/properties.h
    incubator/celix/trunk/framework/private/include/requirement.h
    incubator/celix/trunk/framework/private/include/service_factory.h
    incubator/celix/trunk/framework/private/include/service_reference.h
    incubator/celix/trunk/framework/private/include/service_registration.h
    incubator/celix/trunk/framework/private/include/service_registry.h
    incubator/celix/trunk/framework/private/include/service_tracker.h
    incubator/celix/trunk/framework/private/include/utils.h
    incubator/celix/trunk/framework/private/include/version.h
    incubator/celix/trunk/framework/private/include/version_range.h
    incubator/celix/trunk/framework/private/include/wire.h
Modified:
    incubator/celix/trunk/cmake/Includes.cmake
    incubator/celix/trunk/dependency_manager/dependency_activator_base.h
    incubator/celix/trunk/dependency_manager/dependency_manager.h
    incubator/celix/trunk/dependency_manager/service_component.c
    incubator/celix/trunk/dependency_manager/service_dependency.h
    incubator/celix/trunk/deployment_admin/private/include/deployment_admin.h
    incubator/celix/trunk/deployment_admin/private/include/deployment_package.h
    incubator/celix/trunk/examples/echo_service/client/echo_client_private.h
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c
    incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c
    incubator/celix/trunk/examples/sender/listenerTest.h
    incubator/celix/trunk/examples/whiteboard/tracker_depman/tracker.h
    incubator/celix/trunk/framework/Doxyfile.in
    incubator/celix/trunk/framework/private/include/attribute.h
    incubator/celix/trunk/framework/private/include/bundle_cache.h
    incubator/celix/trunk/framework/private/src/attribute.c
    incubator/celix/trunk/framework/private/src/bundle.c
    incubator/celix/trunk/framework/private/src/bundle_archive.c
    incubator/celix/trunk/framework/private/src/bundle_cache.c
    incubator/celix/trunk/framework/private/src/bundle_context.c
    incubator/celix/trunk/framework/private/src/bundle_revision.c
    incubator/celix/trunk/framework/private/src/capability.c
    incubator/celix/trunk/framework/private/src/filter.c
    incubator/celix/trunk/framework/private/src/framework.c
    incubator/celix/trunk/framework/private/src/manifest_parser.c
    incubator/celix/trunk/framework/private/src/module.c
    incubator/celix/trunk/framework/private/src/requirement.c
    incubator/celix/trunk/framework/private/src/resolver.c
    incubator/celix/trunk/framework/private/src/service_reference.c
    incubator/celix/trunk/framework/private/src/service_registration.c
    incubator/celix/trunk/framework/private/src/service_registry.c
    incubator/celix/trunk/framework/private/src/service_tracker.c
    incubator/celix/trunk/framework/public/include/listener_hook_service.h
    incubator/celix/trunk/launcher/CMakeLists.txt
    incubator/celix/trunk/launcher/launcher.c
    incubator/celix/trunk/log_service/private/include/log.h
    incubator/celix/trunk/log_service/private/include/log_factory.h
    incubator/celix/trunk/log_service/private/include/log_service_impl.h
    incubator/celix/trunk/log_service/public/include/log_entry.h
    incubator/celix/trunk/log_writer/log_writer.h
    incubator/celix/trunk/remote_services/discovery/private/src/discovery.c
    incubator/celix/trunk/remote_services/discovery/private/src/discovery_activator.c
    incubator/celix/trunk/remote_services/example_service/private/src/example_impl.c
    incubator/celix/trunk/remote_services/remote_service_admin/private/include/export_registration_impl.h
    incubator/celix/trunk/remote_services/remote_service_admin/private/include/import_registration_impl.h
    incubator/celix/trunk/remote_services/remote_service_admin/private/src/export_registration_impl.c
    incubator/celix/trunk/remote_services/remote_service_admin/private/src/import_registration_impl.c
    incubator/celix/trunk/remote_services/remote_service_admin/private/src/remote_service_admin_activator.c
    incubator/celix/trunk/remote_services/remote_service_admin/private/src/remote_service_admin_impl.c
    incubator/celix/trunk/remote_services/remote_service_admin/public/include/remote_service_admin.h
    incubator/celix/trunk/remote_services/topology_manager/private/include/topology_manager.h
    incubator/celix/trunk/remote_services/topology_manager/private/src/activator.c
    incubator/celix/trunk/remote_services/topology_manager/private/src/topology_manager.c
    incubator/celix/trunk/shell/command_private.h
    incubator/celix/trunk/shell/inspect_command.c
    incubator/celix/trunk/shell/install_command.c
    incubator/celix/trunk/shell/ps_command.c
    incubator/celix/trunk/shell/shell.c
    incubator/celix/trunk/shell/shell.h
    incubator/celix/trunk/shell/shell_private.h
    incubator/celix/trunk/shell/update_command.c

Modified: incubator/celix/trunk/cmake/Includes.cmake
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/cmake/Includes.cmake?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/cmake/Includes.cmake (original)
+++ incubator/celix/trunk/cmake/Includes.cmake Thu Jan 12 13:29:03 2012
@@ -24,7 +24,7 @@ ENDIF(APR_FOUND)
 
 include_directories(${APR_INCLUDE_DIR})
 include_directories(${APRUTIL_INCLUDE_DIR})
-include_directories("framework/private/include")
+#include_directories("framework/private/include")
 include_directories("framework/public/include")
 
 include(cmake/Packaging.cmake)

Modified: incubator/celix/trunk/dependency_manager/dependency_activator_base.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/dependency_manager/dependency_activator_base.h?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/dependency_manager/dependency_activator_base.h (original)
+++ incubator/celix/trunk/dependency_manager/dependency_activator_base.h Thu Jan 12 13:29:03 2012
@@ -26,7 +26,6 @@
 #ifndef DEPENDENCY_ACTIVATOR_BASE_H_
 #define DEPENDENCY_ACTIVATOR_BASE_H_
 
-#include "headers.h"
 #include "dependency_manager.h"
 #include "service_dependency.h"
 

Modified: incubator/celix/trunk/dependency_manager/dependency_manager.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/dependency_manager/dependency_manager.h?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/dependency_manager/dependency_manager.h (original)
+++ incubator/celix/trunk/dependency_manager/dependency_manager.h Thu Jan 12 13:29:03 2012
@@ -26,8 +26,8 @@
 #ifndef DEPENDENCY_MANAGER_H_
 #define DEPENDENCY_MANAGER_H_
 
-#include "headers.h"
 #include "service_component.h"
+#include "bundle_context.h"
 
 struct dependencyManager {
 	BUNDLE_CONTEXT context;

Modified: incubator/celix/trunk/dependency_manager/service_component.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/dependency_manager/service_component.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/dependency_manager/service_component.c (original)
+++ incubator/celix/trunk/dependency_manager/service_component.c Thu Jan 12 13:29:03 2012
@@ -24,7 +24,6 @@
  */
 #include <stdlib.h>
 
-#include "headers.h"
 #include "dependency_manager.h"
 #include "service_component.h"
 #include "service_component_private.h"

Modified: incubator/celix/trunk/dependency_manager/service_dependency.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/dependency_manager/service_dependency.h?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/dependency_manager/service_dependency.h (original)
+++ incubator/celix/trunk/dependency_manager/service_dependency.h Thu Jan 12 13:29:03 2012
@@ -28,7 +28,8 @@
 
 #include <stdbool.h>
 
-#include "headers.h"
+#include "service_reference.h"
+#include "service_tracker.h"
 
 struct serviceDependency {
 	char * interface;

Modified: incubator/celix/trunk/deployment_admin/private/include/deployment_admin.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/deployment_admin/private/include/deployment_admin.h?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/deployment_admin/private/include/deployment_admin.h (original)
+++ incubator/celix/trunk/deployment_admin/private/include/deployment_admin.h Thu Jan 12 13:29:03 2012
@@ -8,7 +8,9 @@
 #ifndef DEPLOYMENT_ADMIN_H_
 #define DEPLOYMENT_ADMIN_H_
 
-#include "headers.h"
+#include <apr_thread_proc.h>
+
+#include "bundle_context.h"
 
 typedef struct deployment_admin *deployment_admin_t;
 

Modified: incubator/celix/trunk/deployment_admin/private/include/deployment_package.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/deployment_admin/private/include/deployment_package.h?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/deployment_admin/private/include/deployment_package.h (original)
+++ incubator/celix/trunk/deployment_admin/private/include/deployment_package.h Thu Jan 12 13:29:03 2012
@@ -8,7 +8,12 @@
 #ifndef DEPLOYMENT_PACKAGE_H_
 #define DEPLOYMENT_PACKAGE_H_
 
-#include "headers.h"
+#include <apr_general.h>
+
+#include "version.h"
+#include "bundle_context.h"
+
+#include "array_list.h"
 
 struct bundle_info {
 	char *path;

Modified: incubator/celix/trunk/examples/echo_service/client/echo_client_private.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/echo_service/client/echo_client_private.h?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/examples/echo_service/client/echo_client_private.h (original)
+++ incubator/celix/trunk/examples/echo_service/client/echo_client_private.h Thu Jan 12 13:29:03 2012
@@ -29,8 +29,6 @@
 #include <stdbool.h>
 #include <pthread.h>
 
-#include "headers.h"
-
 struct echoClient {
 	SERVICE_TRACKER tracker;
 	bool running;

Modified: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/activator.c Thu Jan 12 13:29:03 2012
@@ -30,6 +30,7 @@
 #include "paint_frame.h"
 #include "service_tracker.h"
 #include "service_reference.h"
+#include "service_registration.h"
 
 struct paintFrameActivatorData {
 	SERVICE_REGISTRATION reg;
@@ -99,8 +100,10 @@ celix_status_t addingServ(void * handle,
 celix_status_t addedServ(void * handle, SERVICE_REFERENCE ref, void * service) {
 	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
 	SERVICE_REGISTRATION reg = NULL;
+	PROPERTIES props = NULL;
 	serviceReference_getServiceRegistration(ref, &reg);
-	char * serviceName = properties_get(reg->properties, "name");
+	serviceRegistration_getProperties(reg, &props);
+	char * serviceName = properties_get(props, "name");
 	paintFrame_addShape(data->paint_frame, data->context, service);
 	return CELIX_SUCCESS;
  }
@@ -108,16 +111,20 @@ celix_status_t addedServ(void * handle, 
 celix_status_t modifiedServ(void * handle, SERVICE_REFERENCE ref, void * service) {
 	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
 	SERVICE_REGISTRATION reg = NULL;
+	PROPERTIES props = NULL;
 	serviceReference_getServiceRegistration(ref, &reg);
-	char * serviceName = properties_get(reg->properties, "name");
+	serviceRegistration_getProperties(reg, &props);
+	char * serviceName = properties_get(props, "name");
 	return CELIX_SUCCESS;
 }
 
 celix_status_t removedServ(void * handle, SERVICE_REFERENCE ref, void * service) {
 	struct paintFrameActivatorData * data = (struct paintFrameActivatorData *) handle;
 	SERVICE_REGISTRATION reg = NULL;
+	PROPERTIES props = NULL;
 	serviceReference_getServiceRegistration(ref, &reg);
-	char * serviceName = properties_get(reg->properties, "name");
+	serviceRegistration_getProperties(reg, &props);
+	char * serviceName = properties_get(props, "name");
 	paintFrame_removeShape(data->paint_frame, service);
 	return CELIX_SUCCESS;
 }

Modified: incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c (original)
+++ incubator/celix/trunk/examples/osgi-in-action/chapter04-paint-example/paint/private/src/paint_frame.c Thu Jan 12 13:29:03 2012
@@ -21,7 +21,6 @@
 #include <stdbool.h>
 #include <glib.h>
 #include <gdk/gdk.h>
-#include "headers.h"
 #include "bundle_context.h"
 #include "bundle.h"
 #include "utils.h"

Modified: incubator/celix/trunk/examples/sender/listenerTest.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/sender/listenerTest.h?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/examples/sender/listenerTest.h (original)
+++ incubator/celix/trunk/examples/sender/listenerTest.h Thu Jan 12 13:29:03 2012
@@ -26,8 +26,6 @@
 #ifndef LISTENERTEST_H_
 #define LISTENERTEST_H_
 
-#include "headers.h"
-
 void serviceChanged(SERVICE_LISTENER listener, SERVICE_EVENT event);
 
 

Modified: incubator/celix/trunk/examples/whiteboard/tracker_depman/tracker.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/examples/whiteboard/tracker_depman/tracker.h?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/examples/whiteboard/tracker_depman/tracker.h (original)
+++ incubator/celix/trunk/examples/whiteboard/tracker_depman/tracker.h Thu Jan 12 13:29:03 2012
@@ -26,7 +26,6 @@
 #ifndef TRACKER_H_
 #define TRACKER_H_
 
-#include "headers.h"
 #include "service_component.h"
 #include "log_service.h"
 

Modified: incubator/celix/trunk/framework/Doxyfile.in
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/Doxyfile.in?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/Doxyfile.in (original)
+++ incubator/celix/trunk/framework/Doxyfile.in Thu Jan 12 13:29:03 2012
@@ -270,7 +270,7 @@ SUBGROUPING            = YES
 # be useful for C code in case the coding convention dictates that all compound 
 # types are typedef'ed and only the typedef is referenced, never the tag name.
 
-TYPEDEF_HIDES_STRUCT   = NO
+TYPEDEF_HIDES_STRUCT   = YES
 
 # The SYMBOL_CACHE_SIZE determines the size of the internal cache use to 
 # determine which symbols to keep in memory and which to flush to disk. 
@@ -581,7 +581,7 @@ INPUT_ENCODING         = UTF-8
 # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
 # *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
 
-FILE_PATTERNS          = 
+FILE_PATTERNS          = *.h
 
 # The RECURSIVE tag can be used to turn specify whether or not subdirectories 
 # should be searched for input files as well. Possible values are YES and NO. 

Modified: incubator/celix/trunk/framework/private/include/attribute.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/attribute.h?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/attribute.h (original)
+++ incubator/celix/trunk/framework/private/include/attribute.h Thu Jan 12 13:29:03 2012
@@ -29,13 +29,11 @@
 #include <apr_general.h>
 #include "celix_errno.h"
 
-struct attribute {
-	char * key;
-	char * value;
-};
-
 typedef struct attribute * ATTRIBUTE;
 
 celix_status_t attribute_create(char * key, char * value, apr_pool_t *memory_pool, ATTRIBUTE *attribute);
 
+celix_status_t attribute_getKey(ATTRIBUTE attribute, char **key);
+celix_status_t attribute_getValue(ATTRIBUTE attribute, char **value);
+
 #endif /* ATTRIBUTE_H_ */

Modified: incubator/celix/trunk/framework/private/include/bundle_cache.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/include/bundle_cache.h?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/include/bundle_cache.h (original)
+++ incubator/celix/trunk/framework/private/include/bundle_cache.h Thu Jan 12 13:29:03 2012
@@ -26,17 +26,79 @@
 #ifndef BUNDLE_CACHE_H_
 #define BUNDLE_CACHE_H_
 
+/**
+ * @defgroup BundleCache BundleCache
+ * @ingroup framework
+ * @{
+ */
+
 #include "properties.h"
 #include "array_list.h"
 #include "bundle_archive.h"
 
+/**
+ * Type definition for the BUNDLE_CACHE abstract data type.
+ */
 typedef struct bundleCache * BUNDLE_CACHE;
 
+/**
+ * Creates the bundle cache using the supplied configuration map.
+ *
+ * @param configurationMap Set with properties to use for this cache
+ * @param mp The memory pool to use for allocation the cache
+ * @param bundle_cache Output parameter for the created cache
+ * @return Status code indication failure or success:
+ * 		- CELIX_SUCCESS when no errors are encountered.
+ * 		- CELIX_ILLEGAL_ARGUMENT If <code>bundle_cache</code> not is null.
+ * 		- CELIX_ENOMEM If allocating memory for <code>bundle_cache</code> failed.
+ */
 celix_status_t bundleCache_create(PROPERTIES configurationMap, apr_pool_t *mp, BUNDLE_CACHE *bundle_cache);
-celix_status_t bundleCache_destroy(BUNDLE_CACHE cache);
-celix_status_t bundleCache_getArchives(BUNDLE_CACHE cache, ARRAY_LIST *archives);
-celix_status_t bundleCache_createArchive(BUNDLE_CACHE cache, long id, char * location, char *inputFile, apr_pool_t *bundlePool, BUNDLE_ARCHIVE *archive);
+
+/**
+ * Recreates and retrieves the list of archives for the given bundle cache.
+ * Archives are recreated on the bundle cache memory pool, the list for the results is created on the suplied pool, and is owned by the caller.
+ *
+ * @param cache The cache to recreate archives out
+ * @param pool The pool on which the list of archives is created
+ * @param archives List with recreated archives
+ * @return Status code indication failure or success:
+ * 		- CELIX_SUCCESS when no errors are encountered.
+ * 		- CELIX_ILLEGAL_ARGUMENT If <code>archives</code> not is null.
+ * 		- CELIX_ENOMEM If allocating memory for <code>archives</code> failed.
+ * 		- CELIX_FILE_IO_EXCEPTION If the cache cannot be opened or read.
+ */
+celix_status_t bundleCache_getArchives(BUNDLE_CACHE cache, apr_pool_t *pool, ARRAY_LIST *archives);
+
+/**
+ * Creates a new archive for the given bundle (using the id and location). The archive is created on the supplied bundlePool.
+ *
+ * @param cache The cache to create an archive in
+ * @param bundlePool The pool to use for the archive creation
+ * @param id The id of the bundle
+ * @param location The location identifier of the bundle
+ * @param inputFile Input identifier to read the bundle data from
+ * @param archive The archive to create
+ *
+ * @return Status code indication failure or success:
+ * 		- CELIX_SUCCESS when no errors are encountered.
+ * 		- CELIX_ILLEGAL_ARGUMENT If <code>bundle_archive</code> not is null.
+ * 		- CELIX_ENOMEM If allocating memory for <code>bundle_archive</code> failed.
+ */
+celix_status_t bundleCache_createArchive(BUNDLE_CACHE cache, apr_pool_t *bundlePool, long id, char * location, char *inputFile, BUNDLE_ARCHIVE *archive);
+
+/**
+ * Deletes the entire bundle cache.
+ *
+ * @param cache the cache to delete
+ * @return Status code indication failure or success:
+ * 		- CELIX_SUCCESS when no errors are encountered.
+ * 		- CELIX_ILLEGAL_ARGUMENT If the cache is invalid
+ * 		- CELIX_FILE_IO_EXCEPTION If the cache cannot be opened or read.
+ */
 celix_status_t bundleCache_delete(BUNDLE_CACHE cache);
 
+/**
+ * @}
+ */
 
 #endif /* BUNDLE_CACHE_H_ */

Modified: incubator/celix/trunk/framework/private/src/attribute.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/attribute.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/attribute.c (original)
+++ incubator/celix/trunk/framework/private/src/attribute.c Thu Jan 12 13:29:03 2012
@@ -27,6 +27,11 @@
 
 #include "attribute.h"
 
+struct attribute {
+	char * key;
+	char * value;
+};
+
 celix_status_t attribute_create(char * key, char * value, apr_pool_t *memory_pool, ATTRIBUTE *attribute) {
 	celix_status_t status = CELIX_SUCCESS;
 
@@ -46,3 +51,13 @@ celix_status_t attribute_create(char * k
 
 	return status;
 }
+
+celix_status_t attribute_getKey(ATTRIBUTE attribute, char **key) {
+	*key = attribute->key;
+	return CELIX_SUCCESS;
+}
+
+celix_status_t attribute_getValue(ATTRIBUTE attribute, char **value) {
+	*value = attribute->value;
+	return CELIX_SUCCESS;
+}

Modified: incubator/celix/trunk/framework/private/src/bundle.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle.c Thu Jan 12 13:29:03 2012
@@ -38,6 +38,23 @@
 #include "resolver.h"
 #include "utils.h"
 
+struct bundle {
+	BUNDLE_CONTEXT context;
+	ACTIVATOR activator;
+	BUNDLE_STATE state;
+	void * handle;
+	BUNDLE_ARCHIVE archive;
+	ARRAY_LIST modules;
+	MANIFEST manifest;
+	apr_pool_t *memoryPool;
+
+	apr_thread_mutex_t *lock;
+	int lockCount;
+	apr_os_thread_t lockThread;
+
+	struct framework * framework;
+};
+
 celix_status_t bundle_createModule(BUNDLE bundle, MODULE *module);
 celix_status_t bundle_closeRevisions(BUNDLE bundle);
 
@@ -134,8 +151,16 @@ celix_status_t bundle_destroy(BUNDLE bun
 	return CELIX_SUCCESS;
 }
 
-BUNDLE_ARCHIVE bundle_getArchive(BUNDLE bundle) {
-	return bundle->archive;
+celix_status_t bundle_getArchive(BUNDLE bundle, BUNDLE_ARCHIVE *archive) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (bundle != NULL && *archive == NULL) {
+		*archive = bundle->archive;
+	} else {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	return status;
 }
 
 celix_status_t bundle_getCurrentModule(BUNDLE bundle, MODULE *module) {
@@ -332,17 +357,22 @@ celix_status_t bundle_isUsed(BUNDLE bund
 
 celix_status_t bundle_revise(BUNDLE bundle, char * location, char *inputFile) {
 	celix_status_t status = CELIX_SUCCESS;
-	status = bundleArchive_revise(bundle_getArchive(bundle), location, inputFile);
+
+	BUNDLE_ARCHIVE archive = NULL;
+	status = bundle_getArchive(bundle, &archive);
 	if (status == CELIX_SUCCESS) {
-		MODULE module;
-		status = bundle_createModule(bundle, &module);
+		status = bundleArchive_revise(archive, location, inputFile);
 		if (status == CELIX_SUCCESS) {
-			status = bundle_addModule(bundle, module);
-		} else {
-			bool rolledback;
-			status = bundleArchive_rollbackRevise(bundle_getArchive(bundle), &rolledback);
+			MODULE module;
+			status = bundle_createModule(bundle, &module);
 			if (status == CELIX_SUCCESS) {
-				status = CELIX_BUNDLE_EXCEPTION;
+				status = bundle_addModule(bundle, module);
+			} else {
+				bool rolledback;
+				status = bundleArchive_rollbackRevise(archive, &rolledback);
+				if (status == CELIX_SUCCESS) {
+					status = CELIX_BUNDLE_EXCEPTION;
+				}
 			}
 		}
 	}
@@ -363,10 +393,14 @@ celix_status_t bundle_addModule(BUNDLE b
 celix_status_t bundle_isSystemBundle(BUNDLE bundle, bool *systemBundle) {
 	celix_status_t status = CELIX_SUCCESS;
 	long bundleId;
+	BUNDLE_ARCHIVE archive = NULL;
 
-	status = bundleArchive_getId(bundle_getArchive(bundle), &bundleId);
+	status = bundle_getArchive(bundle, &archive);
 	if (status == CELIX_SUCCESS) {
-		*systemBundle = (bundleId == 0);
+		status = bundleArchive_getId(archive, &bundleId);
+		if (status == CELIX_SUCCESS) {
+			*systemBundle = (bundleId == 0);
+		}
 	}
 
 	return status;
@@ -465,27 +499,31 @@ celix_status_t bundle_unlock(BUNDLE bund
 }
 
 celix_status_t bundle_close(BUNDLE bundle) {
-	BUNDLE_ARCHIVE archive;
+	BUNDLE_ARCHIVE archive = NULL;
 	
 	celix_status_t status = CELIX_SUCCESS;
 
     bundle_closeModules(bundle);
     bundle_closeRevisions(bundle);
-    archive = bundle_getArchive(bundle);
-    bundleArchive_close(archive);
+    status = bundle_getArchive(bundle, &archive);
+    if (status == CELIX_SUCCESS) {
+		bundleArchive_close(archive);
+    }
 
     return status;
 }
 
 celix_status_t bundle_closeAndDelete(BUNDLE bundle) {
-    BUNDLE_ARCHIVE archive;
-	
 	celix_status_t status = CELIX_SUCCESS;
 
+	BUNDLE_ARCHIVE archive = NULL;
+
     bundle_closeModules(bundle);
     bundle_closeRevisions(bundle);
-    archive = bundle_getArchive(bundle);
-    bundleArchive_closeAndDelete(archive);
+    status = bundle_getArchive(bundle, &archive);
+    if (status == CELIX_SUCCESS) {
+    	bundleArchive_closeAndDelete(archive);
+    }
 
     return status;
 }
@@ -530,7 +568,11 @@ celix_status_t bundle_refresh(BUNDLE bun
 
 celix_status_t bundle_getBundleId(BUNDLE bundle, long *id) {
 	celix_status_t status = CELIX_SUCCESS;
-	status = bundleArchive_getId(bundle_getArchive(bundle), id);
+	BUNDLE_ARCHIVE archive = NULL;
+	status = bundle_getArchive(bundle, &archive);
+	if (status == CELIX_SUCCESS) {
+		status = bundleArchive_getId(archive, id);
+	}
 	return status;
 }
 
@@ -549,3 +591,39 @@ celix_status_t bundle_getServicesInUse(B
 
 	return status;
 }
+
+celix_status_t bundle_getMemoryPool(BUNDLE bundle, apr_pool_t **pool) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (bundle != NULL && *pool == NULL) {
+		*pool = bundle->memoryPool;
+	} else {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	return status;
+}
+
+celix_status_t bundle_setFramework(BUNDLE bundle, FRAMEWORK framework) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (bundle != NULL && framework != NULL) {
+		bundle->framework = framework;
+	} else {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	return status;
+}
+
+celix_status_t bundle_getFramework(BUNDLE bundle, FRAMEWORK *framework) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (bundle != NULL && *framework == NULL) {
+		*framework = bundle->framework;
+	} else {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	return status;
+}

Modified: incubator/celix/trunk/framework/private/src/bundle_archive.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_archive.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_archive.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_archive.c Thu Jan 12 13:29:03 2012
@@ -32,7 +32,6 @@
 
 #include "bundle_archive.h"
 #include "bundle_revision.h"
-#include "headers.h"
 #include "linked_list_iterator.h"
 
 
@@ -149,14 +148,6 @@ celix_status_t bundleArchive_destroy(BUN
 		if (archive->archiveRootDir != NULL) {
 			apr_dir_close(archive->archiveRootDir);
 		}
-		if (archive->revisions != NULL) {
-			LINKED_LIST_ITERATOR iter = linkedListIterator_create(archive->revisions, 0);
-			while (linkedListIterator_hasNext(iter)) {
-				BUNDLE_REVISION revision = linkedListIterator_next(iter);
-				bundleRevision_destroy(revision);
-			}
-			linkedListIterator_destroy(iter);
-		}
 	}
 
 	archive = NULL;
@@ -559,7 +550,7 @@ celix_status_t bundleArchive_createRevis
 		
 		sprintf(root, "%s/version%ld.%ld", archive->archiveRoot, refreshCount, revNr);
 		if (apr_pool_create(&pool, archive->mp) == APR_SUCCESS) {
-			status = bundleRevision_create(root, location, revNr, inputFile, pool, &revision);
+			status = bundleRevision_create(pool, root, location, revNr, inputFile, &revision);
 
 			if (status != CELIX_SUCCESS) {
 				apr_pool_destroy(pool);

Modified: incubator/celix/trunk/framework/private/src/bundle_cache.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_cache.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_cache.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_cache.c Thu Jan 12 13:29:03 2012
@@ -34,7 +34,6 @@
 
 #include "bundle_cache.h"
 #include "bundle_archive.h"
-#include "headers.h"
 #include "constants.h"
 
 struct bundleCache {
@@ -44,6 +43,7 @@ struct bundleCache {
 };
 
 static celix_status_t bundleCache_deleteTree(char * directory, apr_pool_t *mp);
+static apr_status_t bundleCache_destroy(void *cacheP);
 
 celix_status_t bundleCache_create(PROPERTIES configurationMap, apr_pool_t *mp, BUNDLE_CACHE *bundle_cache) {
     celix_status_t status;
@@ -53,6 +53,8 @@ celix_status_t bundleCache_create(PROPER
     if (cache == NULL) {
         status = CELIX_ENOMEM;
     } else {
+    	apr_pool_pre_cleanup_register(mp, cache, bundleCache_destroy);
+
 		if (configurationMap != NULL && mp != NULL && *bundle_cache == NULL) {
             char * cacheDir = properties_get(configurationMap, (char *) FRAMEWORK_STORAGE);
 			cache->configurationMap = configurationMap;
@@ -72,7 +74,8 @@ celix_status_t bundleCache_create(PROPER
 	return status;
 }
 
-celix_status_t bundleCache_destroy(BUNDLE_CACHE cache) {
+apr_status_t bundleCache_destroy(void *cacheP) {
+	BUNDLE_CACHE cache = cacheP;
     properties_destroy(cache->configurationMap);
     return CELIX_SUCCESS;
 }
@@ -81,52 +84,21 @@ celix_status_t bundleCache_delete(BUNDLE
 	return bundleCache_deleteTree(cache->cacheDir, cache->mp);
 }
 
-static celix_status_t bundleCache_deleteTree(char * directory, apr_pool_t *mp) {
-    celix_status_t status = CELIX_SUCCESS;
-	apr_dir_t *dir;
-
-	if (directory && mp) {
-        if (apr_dir_open(&dir, directory, mp) == APR_SUCCESS) {
-            apr_finfo_t dp;
-            while ((apr_dir_read(&dp, APR_FINFO_DIRENT|APR_FINFO_TYPE, dir)) == APR_SUCCESS) {
-                if ((strcmp((dp.name), ".") != 0) && (strcmp((dp.name), "..") != 0)) {
-                    char * subdir = (char *)malloc(strlen(directory) + strlen(dp.name) + 2);
-                    strcpy(subdir, directory);
-                    strcat(subdir, "/");
-                    strcat(subdir, dp.name);
-
-                    if (dp.filetype == APR_DIR) {
-                        bundleCache_deleteTree(subdir, mp);
-                    } else {
-                        remove(subdir);
-                    }
-					free(subdir);
-                }
-            }
-            remove(directory);
-        } else {
-            status = CELIX_FILE_IO_EXCEPTION;
-        }
-	} else {
-	    status = CELIX_ILLEGAL_ARGUMENT;
-	}
-
-	return status;
-}
+celix_status_t bundleCache_getArchives(BUNDLE_CACHE cache, apr_pool_t *pool, ARRAY_LIST *archives) {
+	celix_status_t status = CELIX_SUCCESS;
 
-celix_status_t bundleCache_getArchives(BUNDLE_CACHE cache, ARRAY_LIST *archives) {
 	apr_dir_t *dir;
-	apr_status_t status = apr_dir_open(&dir, cache->cacheDir, cache->mp);
+	apr_status_t aprStatus = apr_dir_open(&dir, cache->cacheDir, pool);
 
-	if (status == APR_ENOENT) {
+	if (aprStatus == APR_ENOENT) {
 		apr_dir_make(cache->cacheDir, APR_UREAD|APR_UWRITE|APR_UEXECUTE, cache->mp);
-		status = apr_dir_open(&dir, cache->cacheDir, cache->mp);
+		aprStatus = apr_dir_open(&dir, cache->cacheDir, pool);
 	}
 
-	if (status == APR_SUCCESS) {
+	if (aprStatus == APR_SUCCESS) {
         ARRAY_LIST list = NULL;
 		apr_finfo_t dp;
-        arrayList_create(cache->mp, &list);
+        arrayList_create(pool, &list);
         
         while ((apr_dir_read(&dp, APR_FINFO_DIRENT|APR_FINFO_TYPE, dir)) == APR_SUCCESS) {
             char * archiveRoot = (char *)malloc(strlen(cache->cacheDir) + strlen(dp.name) + 2);
@@ -161,8 +133,7 @@ celix_status_t bundleCache_getArchives(B
 	return status;
 }
 
-celix_status_t bundleCache_createArchive(BUNDLE_CACHE cache, long id, char * location, char *inputFile, apr_pool_t *bundlePool,
-        BUNDLE_ARCHIVE *bundle_archive) {
+celix_status_t bundleCache_createArchive(BUNDLE_CACHE cache, apr_pool_t *bundlePool, long id, char * location, char *inputFile, BUNDLE_ARCHIVE *bundle_archive) {
     celix_status_t status;
 	char archiveRoot[256];
     BUNDLE_ARCHIVE archive;
@@ -175,3 +146,36 @@ celix_status_t bundleCache_createArchive
 
 	return status;
 }
+
+static celix_status_t bundleCache_deleteTree(char * directory, apr_pool_t *mp) {
+    celix_status_t status = CELIX_SUCCESS;
+	apr_dir_t *dir;
+
+	if (directory && mp) {
+        if (apr_dir_open(&dir, directory, mp) == APR_SUCCESS) {
+            apr_finfo_t dp;
+            while ((apr_dir_read(&dp, APR_FINFO_DIRENT|APR_FINFO_TYPE, dir)) == APR_SUCCESS) {
+                if ((strcmp((dp.name), ".") != 0) && (strcmp((dp.name), "..") != 0)) {
+                    char *subdir = (char *) apr_palloc(mp, sizeof(*subdir) * (strlen(directory) + strlen(dp.name) + 2));
+                    strcpy(subdir, directory);
+                    strcat(subdir, "/");
+                    strcat(subdir, dp.name);
+
+                    if (dp.filetype == APR_DIR) {
+                        bundleCache_deleteTree(subdir, mp);
+                    } else {
+                    	apr_file_remove(subdir, mp);
+                    }
+                }
+            }
+            apr_dir_close(dir);
+            apr_dir_remove(directory, mp);
+        } else {
+            status = CELIX_FILE_IO_EXCEPTION;
+        }
+	} else {
+	    status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	return status;
+}

Modified: incubator/celix/trunk/framework/private/src/bundle_context.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_context.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_context.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_context.c Thu Jan 12 13:29:03 2012
@@ -28,6 +28,7 @@
 
 #include "bundle_context.h"
 #include "framework.h"
+#include "bundle.h"
 
 struct bundleContext {
 	struct framework * framework;
@@ -43,15 +44,20 @@ celix_status_t bundleContext_create(FRAM
 	    context = malloc(sizeof(*context));
 
 		if (context != NULL) {
+			apr_pool_t *pool = NULL;
+
             context->pool = NULL;
 			context->framework = framework;
 			context->bundle = bundle;
 
-			if (apr_pool_create(&context->pool, bundle->memoryPool) != APR_SUCCESS) {
-				status = CELIX_ENOMEM;
-			}
+			status = bundle_getMemoryPool(bundle, &pool);
+			if (status == CELIX_SUCCESS) {
+				if (apr_pool_create(&context->pool, pool) != APR_SUCCESS) {
+					status = CELIX_ENOMEM;
+				}
 
-			*bundle_context = context;
+				*bundle_context = context;
+			}
 		} else {
 			status = CELIX_ENOMEM;
 		}

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=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_revision.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_revision.c Thu Jan 12 13:29:03 2012
@@ -19,12 +19,17 @@ struct bundleRevision {
 	char *location;
 };
 
-celix_status_t bundleRevision_create(char *root, char *location, long revisionNr, char *inputFile, apr_pool_t *pool, BUNDLE_REVISION *bundle_revision) {
+static apr_status_t bundleRevision_destroy(void *revisionP);
+
+celix_status_t bundleRevision_create(apr_pool_t *pool, char *root, char *location, long revisionNr, char *inputFile, BUNDLE_REVISION *bundle_revision) {
     celix_status_t status = CELIX_SUCCESS;
 	BUNDLE_REVISION revision = NULL;
 
 	revision = (BUNDLE_REVISION) apr_pcalloc(pool, sizeof(*revision));
-    if (revision != NULL) {
+    if (!revision) {
+    	status = CELIX_ENOMEM;
+    } else {
+    	apr_pool_pre_cleanup_register(pool, revision, bundleRevision_destroy);
     	// TODO: This overwrites an existing revision, is this supposed to happen?
     	apr_status_t apr_status = apr_dir_make(root, APR_UREAD|APR_UWRITE|APR_UEXECUTE, pool);
         if ((apr_status != APR_SUCCESS) && (apr_status != APR_EEXIST)) {
@@ -50,7 +55,8 @@ celix_status_t bundleRevision_create(cha
 	return status;
 }
 
-celix_status_t bundleRevision_destroy(BUNDLE_REVISION revision) {
+apr_status_t bundleRevision_destroy(void *revisionP) {
+	BUNDLE_REVISION revision = revisionP;
 	return CELIX_SUCCESS;
 }
 

Modified: incubator/celix/trunk/framework/private/src/capability.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/capability.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/capability.c (original)
+++ incubator/celix/trunk/framework/private/src/capability.c Thu Jan 12 13:29:03 2012
@@ -52,14 +52,17 @@ celix_status_t capability_create(apr_poo
 		(*capability)->version = NULL;
 		status = version_createEmptyVersion(pool, &(*capability)->version);
 		if (status == CELIX_SUCCESS) {
-			ATTRIBUTE versionAttribute;
+			ATTRIBUTE versionAttribute = NULL;
 			ATTRIBUTE serviceAttribute = (ATTRIBUTE) hashMap_get(attributes, "service");
-			(*capability)->serviceName = serviceAttribute->value;
-
-			versionAttribute = (ATTRIBUTE) hashMap_get(attributes, "version");
-			if (versionAttribute != NULL) {
-				(*capability)->version = NULL;
-				status = version_createVersionFromString(pool, versionAttribute->value, &(*capability)->version);
+			status = attribute_getValue(serviceAttribute, &(*capability)->serviceName);
+			if (status == CELIX_SUCCESS) {
+				versionAttribute = (ATTRIBUTE) hashMap_get(attributes, "version");
+				if (versionAttribute != NULL) {
+					char *versionStr = NULL;
+					attribute_getValue(versionAttribute, &versionStr);
+					(*capability)->version = NULL;
+					status = version_createVersionFromString(pool, versionStr, &(*capability)->version);
+				}
 			}
 		}
 	}

Modified: incubator/celix/trunk/framework/private/src/filter.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/filter.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/filter.c (original)
+++ incubator/celix/trunk/framework/private/src/filter.c Thu Jan 12 13:29:03 2012
@@ -27,8 +27,8 @@
 #include <stdlib.h>
 #include <ctype.h>
 
-#include "headers.h"
 #include "filter.h"
+#include "array_list.h"
 
 typedef enum operand
 {

Modified: incubator/celix/trunk/framework/private/src/framework.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Thu Jan 12 13:29:03 2012
@@ -57,6 +57,37 @@
 #include "linked_list_iterator.h"
 #include "service_reference.h"
 #include "listener_hook_service.h"
+#include "service_registration.h"
+#include "celix_log.h"
+
+struct framework {
+	struct bundle * bundle;
+	HASH_MAP installedBundleMap;
+	HASH_MAP installRequestMap;
+	ARRAY_LIST serviceListeners;
+
+	long nextBundleId;
+	struct serviceRegistry * registry;
+	BUNDLE_CACHE cache;
+
+	apr_thread_cond_t *shutdownGate;
+	apr_thread_cond_t *condition;
+
+	apr_thread_mutex_t *installRequestLock;
+	apr_thread_mutex_t *mutex;
+	apr_thread_mutex_t *bundleLock;
+
+	apr_os_thread_t globalLockThread;
+	ARRAY_LIST globalLockWaitersList;
+	int globalLockCount;
+
+	bool interrupted;
+	bool shutdown;
+
+	apr_pool_t *mp;
+
+	PROPERTIES configurationMap;
+};
 
 struct activator {
 	void * userData;
@@ -143,7 +174,6 @@ celix_status_t framework_create(FRAMEWOR
                                     status = CELIX_FRAMEWORK_EXCEPTION;
                                 } else {
                                     (*framework)->bundle = bundle;
-                                    (*framework)->bundle->framework = (*framework);
 
                                     (*framework)->installedBundleMap = NULL;
                                     (*framework)->registry = NULL;
@@ -162,6 +192,8 @@ celix_status_t framework_create(FRAMEWOR
                                     (*framework)->serviceListeners = NULL;
                                     (*framework)->shutdownGate = NULL;
                                     (*framework)->configurationMap = config;
+
+                                    status = bundle_setFramework((*framework)->bundle, (*framework));
                                 }
                             }
                         }
@@ -183,6 +215,7 @@ celix_status_t framework_destroy(FRAMEWO
 	    HASH_MAP_ENTRY entry = hashMapIterator_nextEntry(iterator);
 		BUNDLE bundle = hashMapEntry_getValue(entry);
 		char * location = hashMapEntry_getKey(entry);
+		BUNDLE_ARCHIVE archive = NULL;
 
 		// for each installed bundle, clean up memory
 		MODULE mod = NULL;
@@ -197,7 +230,9 @@ celix_status_t framework_destroy(FRAMEWO
 			linkedListIterator_destroy(iter);
 		}
 
-		bundleArchive_destroy(bundle->archive);
+		if (bundle_getArchive(bundle, &archive) == CELIX_SUCCESS) {
+			bundleArchive_destroy(archive);
+		}
 		bundle_destroy(bundle);
 		hashMapIterator_remove(iterator);
 	}
@@ -212,8 +247,6 @@ celix_status_t framework_destroy(FRAMEWO
 
 	hashMap_destroy(framework->installedBundleMap, false, false);
 
-	bundleCache_destroy(framework->cache);
-
 	apr_pool_destroy(framework->mp);
 
 	return status;
@@ -226,6 +259,7 @@ celix_status_t fw_init(FRAMEWORK framewo
 	MODULE module = NULL;
 	HASH_MAP wires;
 	ARRAY_LIST archives;
+	BUNDLE_ARCHIVE archive = NULL;
 
 	if (status != CELIX_SUCCESS) {
 		framework_releaseBundleLock(framework, framework->bundle);
@@ -251,7 +285,8 @@ celix_status_t fw_init(FRAMEWORK framewo
 
 	framework->installedBundleMap = hashMap_create(string_hash, NULL, string_equals, NULL);
 
-	status = bundleArchive_getLocation(bundle_getArchive(framework->bundle), &location);
+	status = bundle_getArchive(framework->bundle, &archive);
+	status = bundleArchive_getLocation(archive, &location);
 	hashMap_put(framework->installedBundleMap, location, framework->bundle);
 
 	status = bundle_getCurrentModule(framework->bundle, &module);
@@ -269,7 +304,7 @@ celix_status_t fw_init(FRAMEWORK framewo
 	}
 
 	// reload archives from cache
-	status = bundleCache_getArchives(framework->cache, &archives);
+	status = bundleCache_getArchives(framework->cache, framework->mp, &archives);
 	if (status != CELIX_SUCCESS) {
 	    return status;
 	} else {
@@ -443,7 +478,7 @@ celix_status_t fw_installBundle2(FRAMEWO
 	apr_pool_create(&bundlePool, framework->mp);
 	if (archive == NULL) {
 		id = framework_getNextBundleId(framework);
-		status = bundleCache_createArchive(framework->cache, id, location, inputFile, bundlePool, &bundle_archive);
+		status = bundleCache_createArchive(framework->cache, bundlePool, id, location, inputFile, &bundle_archive);
 		if (status != CELIX_SUCCESS) {
 		    framework_releaseInstallLock(framework, location);
 		    return status;
@@ -480,26 +515,30 @@ celix_status_t framework_getBundleEntry(
 	celix_status_t status = CELIX_SUCCESS;
 
 	BUNDLE_REVISION revision;
+	BUNDLE_ARCHIVE archive = NULL;
 
-	status = bundleArchive_getCurrentRevision(bundle_getArchive(bundle), &revision);
+	status = bundle_getArchive(bundle, &archive);
 	if (status == CELIX_SUCCESS) {
-		char *root;
-		if ((strlen(name) > 0) && (name[0] == '/')) {
-			name++;
-		}
-
-		
-		status = bundleRevision_getRoot(revision, &root);
+		status = bundleArchive_getCurrentRevision(archive, &revision);
 		if (status == CELIX_SUCCESS) {
-			char *e = NULL;
-			apr_status_t ret;
-			apr_finfo_t info;
-			apr_filepath_merge(&e, root, name, APR_FILEPATH_NOTABOVEROOT, framework->mp);
-			ret = apr_stat(&info, e, APR_FINFO_DIRENT|APR_FINFO_TYPE, framework->mp);
-			if (ret == APR_ENOENT) {
-				(*entry) = NULL;
-			} else if (ret == APR_SUCCESS || ret == APR_INCOMPLETE) {
-				(*entry) = apr_pstrdup(pool, e);
+			char *root;
+			if ((strlen(name) > 0) && (name[0] == '/')) {
+				name++;
+			}
+
+
+			status = bundleRevision_getRoot(revision, &root);
+			if (status == CELIX_SUCCESS) {
+				char *e = NULL;
+				apr_status_t ret;
+				apr_finfo_t info;
+				apr_filepath_merge(&e, root, name, APR_FILEPATH_NOTABOVEROOT, framework->mp);
+				ret = apr_stat(&info, e, APR_FINFO_DIRENT|APR_FINFO_TYPE, framework->mp);
+				if (ret == APR_ENOENT) {
+					(*entry) = NULL;
+				} else if (ret == APR_SUCCESS || ret == APR_INCOMPLETE) {
+					(*entry) = apr_pstrdup(pool, e);
+				}
 			}
 		}
 	}
@@ -507,7 +546,7 @@ celix_status_t framework_getBundleEntry(
 	return status;
 }
 
-celix_status_t fw_startBundle(FRAMEWORK framework, BUNDLE bundle, int options ATTRIBUTE_UNUSED) {
+celix_status_t fw_startBundle(FRAMEWORK framework, BUNDLE bundle, int options) {
 	celix_status_t lock = framework_acquireBundleLock(framework, bundle, BUNDLE_INSTALLED|BUNDLE_RESOLVED|BUNDLE_STARTING|BUNDLE_ACTIVE);
 
 	HASH_MAP wires;
@@ -533,6 +572,8 @@ celix_status_t fw_startBundle(FRAMEWORK 
 	char *archiveRoot;
 	long revisionNumber;
 	ACTIVATOR activator;
+	BUNDLE_ARCHIVE archive = NULL;
+	apr_pool_t *bundlePool = NULL;
 
 	if (lock != CELIX_SUCCESS) {
 		printf("Unable to start\n");
@@ -577,16 +618,17 @@ celix_status_t fw_startBundle(FRAMEWORK 
 			}
 			bundle_setContext(bundle, context);
 
-			if (getManifest(bundle_getArchive(bundle), bundle->memoryPool, &manifest) == CELIX_SUCCESS) {
+			bundle_getArchive(bundle, &archive);
+			bundle_getMemoryPool(bundle, &bundlePool);
+
+			if (getManifest(archive, bundlePool, &manifest) == CELIX_SUCCESS) {
                 bundle_setManifest(bundle, manifest);
                 library = manifest_getValue(manifest, HEADER_LIBRARY);
 			}
 
-	
-
-			bundleArchive_getRefreshCount(bundle_getArchive(bundle), &refreshCount);
-			bundleArchive_getArchiveRoot(bundle_getArchive(bundle), &archiveRoot);
-			bundleArchive_getCurrentRevisionNumber(bundle_getArchive(bundle), &revisionNumber);
+			bundleArchive_getRefreshCount(archive, &refreshCount);
+			bundleArchive_getArchiveRoot(archive, &archiveRoot);
+			bundleArchive_getCurrentRevisionNumber(archive, &revisionNumber);
 
 			sprintf(libraryPath, "%s/version%ld.%ld/%s%s%s",
 					archiveRoot,
@@ -613,7 +655,7 @@ celix_status_t fw_startBundle(FRAMEWORK 
 
 			bundle_setHandle(bundle, handle);
 
-			activator = (ACTIVATOR) apr_palloc(bundle->memoryPool, (sizeof(*activator)));
+			activator = (ACTIVATOR) apr_palloc(bundlePool, (sizeof(*activator)));
 			if (activator == NULL) {
 			    return CELIX_ENOMEM;
 			} else {
@@ -658,11 +700,12 @@ celix_status_t fw_startBundle(FRAMEWORK 
 }
 
 celix_status_t framework_updateBundle(FRAMEWORK framework, BUNDLE bundle, char *inputFile) {
+	celix_status_t status;
 	celix_status_t lock = framework_acquireBundleLock(framework, bundle, BUNDLE_INSTALLED|BUNDLE_RESOLVED|BUNDLE_ACTIVE);
 	BUNDLE_STATE oldState;
 	char *location;
 	bool locked;
-	celix_status_t status;
+	BUNDLE_ARCHIVE archive = NULL;
 
 	if (lock != CELIX_SUCCESS) {
 		printf("Cannot update bundle, in wrong state");
@@ -671,8 +714,9 @@ celix_status_t framework_updateBundle(FR
 	}
 	
 	bundle_getState(bundle, &oldState);
+	bundle_getArchive(bundle, &archive);
 	
-	bundleArchive_getLocation(bundle_getArchive(bundle), &location);
+	bundleArchive_getLocation(archive, &location);
 
 	if (oldState == BUNDLE_ACTIVE) {
 		fw_stopBundle(framework, bundle, false);
@@ -688,7 +732,7 @@ celix_status_t framework_updateBundle(FR
 	bundle_revise(bundle, location, inputFile);
 	framework_releaseGlobalLock(framework);
 
-	status = bundleArchive_setLastModified(bundle_getArchive(bundle), time(NULL));
+	status = bundleArchive_setLastModified(archive, time(NULL));
 	framework_setBundleStateAndNotify(framework, bundle, BUNDLE_INSTALLED);
 
 	// Refresh packages?
@@ -810,9 +854,10 @@ celix_status_t fw_uninstallBundle(FRAMEW
             framework_releaseGlobalLock(framework);
             status = CELIX_ILLEGAL_STATE;
         } else {
-            BUNDLE_ARCHIVE archive = bundle_getArchive(bundle);
+            BUNDLE_ARCHIVE archive = NULL;
             char * location;
 			BUNDLE target;
+			status = bundle_getArchive(bundle, &archive);
             status = bundleArchive_getLocation(archive, &location);
             // TODO sync issues?
             target = (BUNDLE) hashMap_remove(framework->installedBundleMap, location);
@@ -976,7 +1021,9 @@ celix_status_t fw_getDependentBundles(FR
     if (*list == NULL && exporter != NULL && framework != NULL) {
 		ARRAY_LIST modules;
 		int modIdx = 0;
-        arrayList_create(exporter->memoryPool, list);
+		apr_pool_t *pool = NULL;
+		bundle_getMemoryPool(exporter, &pool);
+        arrayList_create(pool, list);
 
         modules = bundle_getModules(exporter);
         for (modIdx = 0; modIdx < arrayList_size(modules); modIdx++) {
@@ -1042,24 +1089,31 @@ celix_status_t fw_registerService(FRAMEW
 		apr_pool_t *subpool;
 		SERVICE_REFERENCE ref = NULL;
 		listener_hook_service_t hook;
+		apr_pool_t *pool = NULL;
 
-		arrayList_create(bundle->memoryPool, &infos);
+		bundle_getMemoryPool(bundle, &pool);
+
+		arrayList_create(pool, &infos);
 		for (i = 0; i > arrayList_size(framework->serviceListeners); i++) {
 			FW_SERVICE_LISTENER listener = arrayList_get(framework->serviceListeners, i);
 			apr_pool_t *pool;
 			BUNDLE_CONTEXT context;
 			listener_hook_info_t info;
+			BUNDLE_CONTEXT lContext = NULL;
+
 			bundle_getContext(bundle, &context);
 			bundleContext_getMemoryPool(context, &pool);
 			info = apr_palloc(pool, sizeof(*info));
-			info->context = listener->bundle->context;
+
+			bundle_getContext(listener->bundle, &lContext);
+			info->context = lContext;
 			info->removed = false;
 			filter_getString(listener->filter, &info->filter);
 
 			arrayList_add(infos, info);
 		}
 
-		apr_pool_create(&subpool, bundle->memoryPool);
+		apr_pool_create(&subpool, pool);
 
 		serviceRegistry_createServiceReference(framework->registry, subpool, *registration, &ref);
 		hook = fw_getService(framework, framework->bundle, ref);
@@ -1094,14 +1148,18 @@ celix_status_t fw_registerServiceFactory
     return CELIX_SUCCESS;
 }
 
-celix_status_t fw_getServiceReferences(FRAMEWORK framework, ARRAY_LIST *references, BUNDLE bundle ATTRIBUTE_UNUSED, const char * serviceName, char * sfilter) {
+celix_status_t fw_getServiceReferences(FRAMEWORK framework, ARRAY_LIST *references, BUNDLE bundle, const char * serviceName, char * sfilter) {
 	FILTER filter = NULL;
 	int refIdx = 0;
+	apr_pool_t *pool = NULL;
+
+	bundle_getMemoryPool(bundle, &pool);
+
 	if (sfilter != NULL) {
-		filter = filter_create(sfilter, bundle->memoryPool);
+		filter = filter_create(sfilter, pool);
 	}
 
-	serviceRegistry_getServiceReferences(framework->registry, bundle->memoryPool, serviceName, filter, references);
+	serviceRegistry_getServiceReferences(framework->registry, pool, serviceName, filter, references);
 
 	if (filter != NULL) {
 		filter_destroy(filter);
@@ -1111,8 +1169,10 @@ celix_status_t fw_getServiceReferences(F
 		SERVICE_REFERENCE ref = (SERVICE_REFERENCE) arrayList_get(*references, refIdx);
 		SERVICE_REGISTRATION reg = NULL;
 		char * serviceName;
+		PROPERTIES props = NULL;
 		serviceReference_getServiceRegistration(ref, &reg);
-		serviceName = properties_get(reg->properties, (char *) OBJECTCLASS);
+		serviceRegistration_getProperties(reg, &props);
+		serviceName = properties_get(props, (char *) OBJECTCLASS);
 		if (!serviceReference_isAssignableTo(ref, bundle, serviceName)) {
 			arrayList_remove(*references, refIdx);
 			refIdx--;
@@ -1122,7 +1182,7 @@ celix_status_t fw_getServiceReferences(F
 	return CELIX_SUCCESS;
 }
 
-void * fw_getService(FRAMEWORK framework, BUNDLE bundle ATTRIBUTE_UNUSED, SERVICE_REFERENCE reference) {
+void * fw_getService(FRAMEWORK framework, BUNDLE bundle, SERVICE_REFERENCE reference) {
 	return serviceRegistry_getService(framework->registry, bundle, reference);
 }
 
@@ -1136,7 +1196,7 @@ celix_status_t fw_getBundleServicesInUse
 	return status;
 }
 
-bool framework_ungetService(FRAMEWORK framework, BUNDLE bundle ATTRIBUTE_UNUSED, SERVICE_REFERENCE reference) {
+bool framework_ungetService(FRAMEWORK framework, BUNDLE bundle, SERVICE_REFERENCE reference) {
 	return serviceRegistry_ungetService(framework->registry, bundle, reference);
 }
 
@@ -1153,9 +1213,15 @@ void fw_addServiceListener(FRAMEWORK fra
 	int i;
 	
 	FW_SERVICE_LISTENER fwListener = (FW_SERVICE_LISTENER) malloc(sizeof(*fwListener));
+	apr_pool_t *pool = NULL;
+
+	BUNDLE_CONTEXT context = NULL;
+
+	bundle_getMemoryPool(bundle, &pool);
+
 	fwListener->bundle = bundle;
 	if (sfilter != NULL) {
-		FILTER filter = filter_create(sfilter, bundle->memoryPool);
+		FILTER filter = filter_create(sfilter, pool);
 		fwListener->filter = filter;
 	} else {
 		fwListener->filter = NULL;
@@ -1167,7 +1233,10 @@ void fw_addServiceListener(FRAMEWORK fra
 	serviceRegistry_getListenerHooks(framework->registry, subpool, &listenerHooks);
 
 	info = apr_palloc(subpool, sizeof(*info));
-	info->context = bundle->context;
+
+	bundle_getContext(bundle, &context);
+	info->context = context;
+
 	info->removed = false;
 	info->filter = sfilter == NULL ? NULL : apr_pstrdup(subpool, sfilter);
 
@@ -1198,8 +1267,13 @@ void fw_removeServiceListener(FRAMEWORK 
 	for (i = 0; i < arrayList_size(framework->serviceListeners); i++) {
 		element = (FW_SERVICE_LISTENER) arrayList_get(framework->serviceListeners, i);
 		if (element->listener == listener && element->bundle == bundle) {
+			BUNDLE_CONTEXT lContext = NULL;
+
 			info = apr_palloc(pool, sizeof(*info));
-			info->context = element->bundle->context;
+
+			bundle_getContext(element->bundle, &context);
+			info->context = lContext;
+
 			// TODO Filter toString;
 			filter_getString(element->filter, &info->filter);
 			info->removed = true;
@@ -1225,7 +1299,10 @@ void fw_removeServiceListener(FRAMEWORK 
 			SERVICE_REFERENCE ref = arrayList_get(listenerHooks, i);
 			listener_hook_service_t hook = fw_getService(framework, framework->bundle, ref);
 			ARRAY_LIST infos = NULL;
-			arrayList_create(bundle->memoryPool, &infos);
+			apr_pool_t *pool = NULL;
+
+			bundle_getMemoryPool(bundle, &pool);
+			arrayList_create(pool, &infos);
 			arrayList_add(infos, info);
 			hook->removed(hook->handle, infos);
 			serviceRegistry_ungetService(framework->registry, framework->bundle, ref);
@@ -1241,8 +1318,10 @@ void fw_serviceChanged(FRAMEWORK framewo
 	if (arrayList_size(framework->serviceListeners) > 0) {
 		for (i = 0; i < arrayList_size(framework->serviceListeners); i++) {
 			int matched = 0;
+			PROPERTIES props = NULL;
 			element = (FW_SERVICE_LISTENER) arrayList_get(framework->serviceListeners, i);
-			matched = (element->filter == NULL) || filter_match(element->filter, registration->properties);
+			serviceRegistration_getProperties(registration, &props);
+			matched = (element->filter == NULL) || filter_match(element->filter, props);
 			if (matched) {
 				SERVICE_REFERENCE reference = NULL;
 				SERVICE_EVENT event;
@@ -1384,8 +1463,10 @@ BUNDLE framework_getBundleById(FRAMEWORK
 	BUNDLE bundle = NULL;
 	while (hashMapIterator_hasNext(iter)) {
 		BUNDLE b = hashMapIterator_nextValue(iter);
+		BUNDLE_ARCHIVE archive = NULL;
 		long bid;
-		bundleArchive_getId(bundle_getArchive(b), &bid);
+		bundle_getArchive(b, &archive);
+		bundleArchive_getId(archive, &bid);
 		if (bid == id) {
 			bundle = b;
 			break;
@@ -1624,7 +1705,10 @@ static void *APR_THREAD_FUNC framework_s
 		bundle_getState(bundle, &state);
 		if (state == BUNDLE_ACTIVE || state == BUNDLE_STARTING) {
 			char *location;
-			bundleArchive_getLocation(bundle_getArchive(bundle), &location);
+			BUNDLE_ARCHIVE archive = NULL;
+
+			bundle_getArchive(bundle, &archive);
+			bundleArchive_getLocation(archive, &location);
 			fw_stopBundle(fw, bundle, 0);
 		}
 	}
@@ -1666,6 +1750,30 @@ static void *APR_THREAD_FUNC framework_s
 	return NULL;
 }
 
+celix_status_t framework_getMemoryPool(FRAMEWORK framework, apr_pool_t **pool) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (framework != NULL && *pool == NULL) {
+		*pool = framework->mp;
+	} else {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	return status;
+}
+
+celix_status_t framework_getFrameworkBundle(FRAMEWORK framework, BUNDLE *bundle) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (framework != NULL && *bundle == NULL) {
+		*bundle = framework->bundle;
+	} else {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	return status;
+}
+
 celix_status_t bundleActivator_start(void * userData, BUNDLE_CONTEXT context) {
 	// nothing to do
 	return CELIX_SUCCESS;

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=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/manifest_parser.c (original)
+++ incubator/celix/trunk/framework/private/src/manifest_parser.c Thu Jan 12 13:29:03 2012
@@ -302,10 +302,12 @@ static LINKED_LIST manifestParser_parseI
                 }
                 
                 if (attribute_create(apr_pstrdup(memory_pool, "service"), path, memory_pool, &name) == CELIX_SUCCESS) {
-                    hashMap_put(attributes, name->key, name);
+                	char *key = NULL;
+                	attribute_getKey(name, &key);
+                    hashMap_put(attributes, key, name);
                 }
 
-                req = requirement_create(memory_pool, directives, attributes);
+                requirement_create(memory_pool, directives, attributes, &req);
                 linkedList_addElement(requirements, req);
             }
         }
@@ -352,7 +354,9 @@ static LINKED_LIST manifestParser_parseE
             }
 
             if (attribute_create(apr_pstrdup(memory_pool, "service"), path, memory_pool, &name) == CELIX_SUCCESS) {
-                hashMap_put(attributes, name->key, name);
+            	char *key = NULL;
+				attribute_getKey(name, &key);
+				hashMap_put(attributes, key, name);
             }
 
             capability_create(memory_pool, module, directives, attributes, &cap);

Modified: incubator/celix/trunk/framework/private/src/module.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/module.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/module.c (original)
+++ incubator/celix/trunk/framework/private/src/module.c Thu Jan 12 13:29:03 2012
@@ -32,6 +32,7 @@
 #include "linked_list_iterator.h"
 #include "capability.h"
 #include "wire.h"
+#include "bundle.h"
 
 struct module {
 	LINKED_LIST capabilities;
@@ -54,33 +55,36 @@ MODULE module_create(MANIFEST headerMap,
     MODULE module;
     MANIFEST_PARSER mp;
     apr_pool_t *pool;
+    apr_pool_t *bundlePool = NULL;
 
     module = NULL;
     pool = NULL;
 
     if (headerMap != NULL) {
-        module = (MODULE) apr_palloc(bundle->memoryPool, sizeof(*module));
+    	bundle_getMemoryPool(bundle, &bundlePool);
+
+        module = (MODULE) apr_palloc(bundlePool, sizeof(*module));
         module->headerMap = headerMap;
-        module->id = apr_pstrdup(bundle->memoryPool, moduleId);
+        module->id = apr_pstrdup(bundlePool, moduleId);
         module->bundle = bundle;
         module->resolved = false;
 
         module->dependentImporters = NULL;
-        arrayList_create(bundle->memoryPool, &module->dependentImporters);
+        arrayList_create(bundlePool, &module->dependentImporters);
 
-        if (apr_pool_create(&pool, bundle->memoryPool) == APR_SUCCESS) {
+        if (apr_pool_create(&pool, bundlePool) == APR_SUCCESS) {
             if (manifestParser_create(module, headerMap, pool, &mp) == CELIX_SUCCESS) {
             	module->symbolicName = NULL;
-            	manifestParser_getSymbolicName(mp, bundle->memoryPool, &module->symbolicName);
+            	manifestParser_getSymbolicName(mp, bundlePool, &module->symbolicName);
 
                 module->version = NULL;
-                manifestParser_getBundleVersion(mp, bundle->memoryPool, &module->version);
+                manifestParser_getBundleVersion(mp, bundlePool, &module->version);
 
                 module->capabilities = NULL;
-                manifestParser_getCapabilities(mp, bundle->memoryPool, &module->capabilities);
+                manifestParser_getCapabilities(mp, bundlePool, &module->capabilities);
 
                 module->requirements = NULL;
-                manifestParser_getRequirements(mp, bundle->memoryPool, &module->requirements);
+                manifestParser_getRequirements(mp, bundlePool, &module->requirements);
 
                 module->wires = NULL;
             } else {
@@ -97,21 +101,24 @@ MODULE module_createFrameworkModule(BUND
     apr_pool_t *capabilities_pool;
     apr_pool_t *requirements_pool;
     apr_pool_t *dependentImporters_pool;
+    apr_pool_t *bundlePool = NULL;
+
+    bundle_getMemoryPool(bundle, &bundlePool);
 
-	module = (MODULE) apr_palloc(bundle->memoryPool, sizeof(*module));
+	module = (MODULE) apr_palloc(bundlePool, sizeof(*module));
 	if (module) {
-	    if (apr_pool_create(&capabilities_pool, bundle->memoryPool) == APR_SUCCESS) {
-	        if (apr_pool_create(&requirements_pool, bundle->memoryPool) == APR_SUCCESS) {
-	            if (apr_pool_create(&dependentImporters_pool, bundle->memoryPool) == APR_SUCCESS) {
-                    module->id = apr_pstrdup(bundle->memoryPool, "0");
-                    module->symbolicName = apr_pstrdup(bundle->memoryPool, "framework");
+	    if (apr_pool_create(&capabilities_pool, bundlePool) == APR_SUCCESS) {
+	        if (apr_pool_create(&requirements_pool, bundlePool) == APR_SUCCESS) {
+	            if (apr_pool_create(&dependentImporters_pool, bundlePool) == APR_SUCCESS) {
+                    module->id = apr_pstrdup(bundlePool, "0");
+                    module->symbolicName = apr_pstrdup(bundlePool, "framework");
                     module->version = NULL;
-                    version_createVersion(bundle->memoryPool, 1, 0, 0, "", &module->version);
+                    version_createVersion(bundlePool, 1, 0, 0, "", &module->version);
 
                     linkedList_create(capabilities_pool, &module->capabilities);
                     linkedList_create(requirements_pool, &module->requirements);
                     module->dependentImporters = NULL;
-                    arrayList_create(bundle->memoryPool, &module->dependentImporters);
+                    arrayList_create(bundlePool, &module->dependentImporters);
                     module->wires = NULL;
                     module->headerMap = NULL;
                     module->resolved = false;
@@ -124,13 +131,6 @@ MODULE module_createFrameworkModule(BUND
 }
 
 void module_destroy(MODULE module) {
-	LINKED_LIST_ITERATOR reqIter = linkedListIterator_create(module->requirements, 0);
-	while (linkedListIterator_hasNext(reqIter)) {
-		REQUIREMENT req = linkedListIterator_next(reqIter);
-		requirement_destroy(req);
-	}
-	linkedListIterator_destroy(reqIter);
-
 	arrayList_destroy(module->dependentImporters);
 
 	module->headerMap = NULL;
@@ -234,7 +234,9 @@ void module_removeDependentImporter(MODU
 
 ARRAY_LIST module_getDependents(MODULE module) {
     ARRAY_LIST dependents = NULL;
-    arrayList_create(module->bundle->memoryPool, &dependents);
+    apr_pool_t *bundlePool = NULL;
+    bundle_getMemoryPool(module->bundle, &bundlePool);
+    arrayList_create(bundlePool, &dependents);
 
     arrayList_addAll(dependents, module->dependentImporters);
 

Modified: incubator/celix/trunk/framework/private/src/requirement.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/requirement.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/requirement.c (original)
+++ incubator/celix/trunk/framework/private/src/requirement.c Thu Jan 12 13:29:03 2012
@@ -35,28 +35,45 @@ struct requirement {
 	HASH_MAP directives;
 };
 
-REQUIREMENT requirement_create(apr_pool_t *pool, HASH_MAP directives, HASH_MAP attributes) {
-	ATTRIBUTE versionAttribute = NULL;
-	ATTRIBUTE serviceAttribute = NULL;
-	REQUIREMENT requirement = (REQUIREMENT) malloc(sizeof(*requirement));
+apr_status_t requirement_destroy(void *requirementP);
 
-	requirement->attributes = attributes;
-	requirement->directives = directives;
+celix_status_t requirement_create(apr_pool_t *pool, HASH_MAP directives, HASH_MAP attributes, REQUIREMENT *requirement) {
+	celix_status_t status = CELIX_SUCCESS;
 
-	requirement->versionRange = NULL;
-	versionRange_createInfiniteVersionRange(pool, &requirement->versionRange);
-	versionAttribute = (ATTRIBUTE) hashMap_get(attributes, "version");
-	if (versionAttribute != NULL) {
-		requirement->versionRange = NULL;
-		versionRange_parse(pool, versionAttribute->value, &requirement->versionRange);
+	*requirement = (REQUIREMENT) apr_palloc(pool, sizeof(**requirement));
+	if (!*requirement) {
+		status = CELIX_ENOMEM;
+	} else {
+		ATTRIBUTE serviceAttribute = NULL;
+		ATTRIBUTE versionAttribute = NULL;
+
+		apr_pool_pre_cleanup_register(pool, *requirement, requirement_destroy);
+
+		(*requirement)->attributes = attributes;
+		(*requirement)->directives = directives;
+
+		serviceAttribute = (ATTRIBUTE) hashMap_get(attributes, "service");
+		status = attribute_getValue(serviceAttribute, &(*requirement)->targetName);
+		if (status == CELIX_SUCCESS) {
+			(*requirement)->versionRange = NULL;
+			status = versionRange_createInfiniteVersionRange(pool, &(*requirement)->versionRange);
+			if (status == CELIX_SUCCESS) {
+				versionAttribute = (ATTRIBUTE) hashMap_get(attributes, "version");
+				if (versionAttribute != NULL) {
+					char *versionStr = NULL;
+					attribute_getValue(versionAttribute, &versionStr);
+					(*requirement)->versionRange = NULL;
+					status = versionRange_parse(pool, versionStr, &(*requirement)->versionRange);
+				}
+			}
+		}
 	}
-	serviceAttribute = (ATTRIBUTE) hashMap_get(attributes, "service");
-	requirement->targetName = serviceAttribute->value;
 
-	return requirement;
+	return status;
 }
 
-void requirement_destroy(REQUIREMENT requirement) {
+apr_status_t requirement_destroy(void *requirementP) {
+	REQUIREMENT requirement = requirementP;
 	HASH_MAP_ITERATOR attrIter = hashMapIterator_create(requirement->attributes);
 	while (hashMapIterator_hasNext(attrIter)) {
 		ATTRIBUTE attr = hashMapIterator_nextValue(attrIter);
@@ -70,21 +87,31 @@ void requirement_destroy(REQUIREMENT req
 	requirement->directives = NULL;
 	requirement->versionRange = NULL;
 
-	free(requirement);
+	return APR_SUCCESS;
 }
 
-VERSION_RANGE requirement_getVersionRange(REQUIREMENT requirement) {
-	return requirement->versionRange;
+celix_status_t requirement_getVersionRange(REQUIREMENT requirement, VERSION_RANGE *range) {
+	*range = requirement->versionRange;
+	return CELIX_SUCCESS;
 }
 
-char * requirement_getTargetName(REQUIREMENT requirement) {
-	return requirement->targetName;
+celix_status_t requirement_getTargetName(REQUIREMENT requirement, char **targetName) {
+	*targetName = requirement->targetName;
+	return CELIX_SUCCESS;
 }
 
-bool requirement_isSatisfied(REQUIREMENT requirement, CAPABILITY capability) {
-	bool inRange = false;
+celix_status_t requirement_isSatisfied(REQUIREMENT requirement, CAPABILITY capability, bool *inRange) {
+	celix_status_t status = CELIX_SUCCESS;
 	VERSION version = NULL;
-	capability_getVersion(capability, &version);
-	versionRange_isInRange(requirement_getVersionRange(requirement), version, &inRange);
-	return inRange;
+	VERSION_RANGE range = NULL;
+
+	status = capability_getVersion(capability, &version);
+	if (status == CELIX_SUCCESS) {
+		status = requirement_getVersionRange(requirement, &range);
+		if (status == CELIX_SUCCESS) {
+			status = versionRange_isInRange(range, version, inRange);
+		}
+	}
+
+	return status;
 }

Modified: incubator/celix/trunk/framework/private/src/resolver.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/resolver.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/resolver.c (original)
+++ incubator/celix/trunk/framework/private/src/resolver.c Thu Jan 12 13:29:03 2012
@@ -29,6 +29,7 @@
 
 #include "resolver.h"
 #include "linked_list_iterator.h"
+#include "bundle.h"
 
 struct capabilityList {
 	char * serviceName;
@@ -125,6 +126,12 @@ int resolver_populateCandidatesMap(HASH_
     int c;
     REQUIREMENT req;
     CAPABILITY_LIST capList;
+    apr_pool_t *bundlePool = NULL;
+    BUNDLE bundle = NULL;
+
+    bundle = module_getBundle(targetModule);
+    bundle_getMemoryPool(bundle, &bundlePool);
+
 
 	if (hashMap_containsKey(candidatesMap, targetModule)) {
 		return 0;
@@ -132,24 +139,30 @@ int resolver_populateCandidatesMap(HASH_
 
 	hashMap_put(candidatesMap, targetModule, NULL);
 
-	if (apr_pool_create(&candSetList_pool, module_getBundle(targetModule)->memoryPool) == APR_SUCCESS) {
+	if (apr_pool_create(&candSetList_pool, bundlePool) == APR_SUCCESS) {
 	    if (linkedList_create(candSetList_pool, &candSetList) == CELIX_SUCCESS) {
             for (i = 0; i < linkedList_size(module_getRequirements(targetModule)); i++) {
+            	char *targetName = NULL;
                 req = (REQUIREMENT) linkedList_get(module_getRequirements(targetModule), i);
-                capList = resolver_getCapabilityList(m_resolvedServices, requirement_getTargetName(req));
+                requirement_getTargetName(req, &targetName);
+                capList = resolver_getCapabilityList(m_resolvedServices, targetName);
 
-                if (apr_pool_create(&candidates_pool, module_getBundle(targetModule)->memoryPool) == APR_SUCCESS) {
+                if (apr_pool_create(&candidates_pool, bundlePool) == APR_SUCCESS) {
                     if (linkedList_create(candidates_pool, &candidates) == CELIX_SUCCESS) {
                         for (c = 0; (capList != NULL) && (c < linkedList_size(capList->capabilities)); c++) {
                             CAPABILITY cap = (CAPABILITY) linkedList_get(capList->capabilities, c);
-                            if (requirement_isSatisfied(req, cap)) {
+                            bool satisfied = false;
+                            requirement_isSatisfied(req, cap, &satisfied);
+                            if (satisfied) {
                                 linkedList_addElement(candidates, cap);
                             }
                         }
-                        capList = resolver_getCapabilityList(m_unresolvedServices, requirement_getTargetName(req));
+                        capList = resolver_getCapabilityList(m_unresolvedServices, targetName);
                         for (c = 0; (capList != NULL) && (c < linkedList_size(capList->capabilities)); c++) {
                             CAPABILITY cap = (CAPABILITY) linkedList_get(capList->capabilities, c);
-                            if (requirement_isSatisfied(req, cap)) {
+                            bool satisfied = false;
+                            requirement_isSatisfied(req, cap, &satisfied);
+                            if (satisfied) {
                                 linkedList_addElement(candidates, cap);
                             }
                         }
@@ -170,7 +183,7 @@ int resolver_populateCandidatesMap(HASH_
                         }
 
                         if (linkedList_size(candidates) == 0) {
-                            if (apr_pool_create(&invalid_pool, module_getBundle(targetModule)->memoryPool) == APR_SUCCESS) {
+                            if (apr_pool_create(&invalid_pool, bundlePool) == APR_SUCCESS) {
                                 if (linkedList_create(invalid_pool, &invalid) == CELIX_SUCCESS) {
 									char *name = NULL;
                                     resolver_removeInvalidCandidate(targetModule, candidatesMap, invalid);
@@ -179,7 +192,7 @@ int resolver_populateCandidatesMap(HASH_
                                     
                                     module_getSymbolicName(targetModule, &name);
 
-                                    printf("Unable to resolve: %s, %s\n", name, requirement_getTargetName(req));
+                                    printf("Unable to resolve: %s, %s\n", name, targetName);
                                 }
                             }
                             return -1;
@@ -249,11 +262,16 @@ void resolver_addModule(MODULE module) {
     CAPABILITY cap;
     CAPABILITY_LIST list;
     apr_pool_t *capabilities_pool;
+    apr_pool_t *bundlePool = NULL;
+	BUNDLE bundle = NULL;
+
+	bundle = module_getBundle(module);
+	bundle_getMemoryPool(bundle, &bundlePool);
 
 	if (m_modules == NULL) {
-	    if (apr_pool_create(&modules_pool, module_getBundle(module)->memoryPool) == APR_SUCCESS) {
-	        if (apr_pool_create(&unresolvedServices_pool, module_getBundle(module)->memoryPool) == APR_SUCCESS) {
-	            if (apr_pool_create(&resolvedServices_pool, module_getBundle(module)->memoryPool) == APR_SUCCESS) {
+	    if (apr_pool_create(&modules_pool, bundlePool) == APR_SUCCESS) {
+	        if (apr_pool_create(&unresolvedServices_pool, bundlePool) == APR_SUCCESS) {
+	            if (apr_pool_create(&resolvedServices_pool, bundlePool) == APR_SUCCESS) {
 	                linkedList_create(modules_pool, &m_modules);
 	                linkedList_create(unresolvedServices_pool, &m_unresolvedServices);
 	                linkedList_create(resolvedServices_pool, &m_resolvedServices);
@@ -271,7 +289,7 @@ void resolver_addModule(MODULE module) {
             capability_getServiceName(cap, &serviceName);
             list = resolver_getCapabilityList(m_unresolvedServices, serviceName);
             if (list == NULL) {
-                if (apr_pool_create(&capabilities_pool, module_getBundle(module)->memoryPool) == APR_SUCCESS) {
+                if (apr_pool_create(&capabilities_pool, bundlePool) == APR_SUCCESS) {
                     list = (CAPABILITY_LIST) apr_palloc(capabilities_pool, sizeof(*list));
                     if (list != NULL) {
                         list->serviceName = apr_pstrdup(capabilities_pool, serviceName);
@@ -315,9 +333,14 @@ void resolver_moduleResolved(MODULE modu
     LINKED_LIST capsCopy;
     apr_pool_t *capsCopy_pool;
     apr_pool_t *capabilities_pool;
+    apr_pool_t *bundlePool = NULL;
+	BUNDLE bundle = NULL;
+
+	bundle = module_getBundle(module);
+	bundle_getMemoryPool(bundle, &bundlePool);
 
 	if (module_isResolved(module)) {
-	    if (apr_pool_create(&capsCopy_pool, module_getBundle(module)->memoryPool) == APR_SUCCESS) {
+	    if (apr_pool_create(&capsCopy_pool, bundlePool) == APR_SUCCESS) {
 	        if (linkedList_create(capsCopy_pool, &capsCopy) == APR_SUCCESS) {
                 LINKED_LIST wires = NULL;
 
@@ -340,8 +363,10 @@ void resolver_moduleResolved(MODULE modu
                     for (wireIdx = 0; (wires != NULL) && (wireIdx < linkedList_size(wires)); wireIdx++) {
                         WIRE wire = (WIRE) linkedList_get(wires, wireIdx);
                         REQUIREMENT req = NULL;
+                        bool satisfied = false;
                         wire_getRequirement(wire, &req);
-                        if (requirement_isSatisfied(req, cap)) {
+						requirement_isSatisfied(req, cap, &satisfied);
+                        if (satisfied) {
                             linkedList_set(capsCopy, capIdx, NULL);
                             break;
                         }
@@ -358,7 +383,7 @@ void resolver_moduleResolved(MODULE modu
 
                         list = resolver_getCapabilityList(m_resolvedServices, serviceName);
                         if (list == NULL) {
-                            if (apr_pool_create(&capabilities_pool, module_getBundle(module)->memoryPool) == APR_SUCCESS) {
+                            if (apr_pool_create(&capabilities_pool, bundlePool) == APR_SUCCESS) {
                                 list = (CAPABILITY_LIST) apr_palloc(capabilities_pool, sizeof(*list));
                                 if (list != NULL) {
                                     list->serviceName = apr_pstrdup(capabilities_pool, serviceName);
@@ -397,6 +422,11 @@ HASH_MAP resolver_populateWireMap(HASH_M
     apr_pool_t *serviceWires_pool;
     LINKED_LIST emptyWires;
     apr_pool_t *emptyWires_pool;
+    apr_pool_t *bundlePool = NULL;
+	BUNDLE bundle = NULL;
+
+	bundle = module_getBundle(importer);
+	bundle_getMemoryPool(bundle, &bundlePool);
 
     if (candidates && importer && wireMap) {
         LINKED_LIST candSetList = NULL;
@@ -406,8 +436,8 @@ HASH_MAP resolver_populateWireMap(HASH_M
 
         candSetList = (LINKED_LIST) hashMap_get(candidates, importer);
 
-        if (apr_pool_create(&serviceWires_pool, module_getBundle(importer)->memoryPool) == APR_SUCCESS) {
-            if (apr_pool_create(&emptyWires_pool, module_getBundle(importer)->memoryPool) == APR_SUCCESS) {
+        if (apr_pool_create(&serviceWires_pool, bundlePool) == APR_SUCCESS) {
+            if (apr_pool_create(&emptyWires_pool, bundlePool) == APR_SUCCESS) {
                 if (linkedList_create(serviceWires_pool, &serviceWires) == APR_SUCCESS) {
                     if (linkedList_create(emptyWires_pool, &emptyWires) == APR_SUCCESS) {
                         int candSetIdx = 0;

Modified: incubator/celix/trunk/framework/private/src/service_reference.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_reference.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_reference.c (original)
+++ incubator/celix/trunk/framework/private/src/service_reference.c Thu Jan 12 13:29:03 2012
@@ -27,6 +27,7 @@
 
 #include "service_registry.h"
 #include "service_reference.h"
+#include "service_registration.h"
 #include "module.h"
 #include "wire.h"
 #include "bundle.h"
@@ -102,7 +103,10 @@ bool serviceReference_isAssignableTo(SER
 celix_status_t serviceReference_getUsingBundles(SERVICE_REFERENCE reference, apr_pool_t *pool, ARRAY_LIST *bundles) {
 	celix_status_t status = CELIX_SUCCESS;
 
-	*bundles = serviceRegistry_getUsingBundles(reference->registration->registry, pool, reference);
+	SERVICE_REGISTRY registry = NULL;
+	serviceRegistration_getRegistry(reference->registration, &registry);
+
+	*bundles = serviceRegistry_getUsingBundles(registry, pool, reference);
 
 	return status;
 }

Modified: incubator/celix/trunk/framework/private/src/service_registration.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_registration.c?rev=1230520&r1=1230519&r2=1230520&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_registration.c (original)
+++ incubator/celix/trunk/framework/private/src/service_registration.c Thu Jan 12 13:29:03 2012
@@ -31,6 +31,23 @@
 #include "service_factory.h"
 #include "service_reference.h"
 
+struct serviceRegistration {
+	SERVICE_REGISTRY registry;
+	char * className;
+	// SERVICE_REFERENCE reference;
+	ARRAY_LIST references;
+	BUNDLE bundle;
+	PROPERTIES properties;
+	void * svcObj;
+	long serviceId;
+
+	apr_thread_mutex_t *mutex;
+	bool isUnregistering;
+
+	bool isServiceFactory;
+	void *serviceFactory;
+};
+
 celix_status_t serviceRegistration_createInternal(apr_pool_t *pool, SERVICE_REGISTRY registry, BUNDLE bundle, char * serviceName, long serviceId,
         void * serviceObject, PROPERTIES dictionary, bool isFactory, SERVICE_REGISTRATION *registration);
 
@@ -139,3 +156,63 @@ celix_status_t serviceRegistration_getSe
     }
     return CELIX_SUCCESS;
 }
+
+celix_status_t serviceRegistration_getProperties(SERVICE_REGISTRATION registration, PROPERTIES *properties) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (registration != NULL && *properties == NULL) {
+		*properties = registration->properties;
+	} else {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	return status;
+}
+
+celix_status_t serviceRegistration_getRegistry(SERVICE_REGISTRATION registration, SERVICE_REGISTRY *registry) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (registration != NULL && *registry == NULL) {
+		*registry = registration->registry;
+	} else {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	return status;
+}
+
+celix_status_t serviceRegistration_getServiceReferences(SERVICE_REGISTRATION registration, ARRAY_LIST *references) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (registration != NULL && *references == NULL) {
+		*references = registration->references;
+	} else {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	return status;
+}
+
+celix_status_t serviceRegistration_getBundle(SERVICE_REGISTRATION registration, BUNDLE *bundle) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (registration != NULL && *bundle == NULL) {
+		*bundle = registration->bundle;
+	} else {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	return status;
+}
+
+celix_status_t serviceRegistration_getServiceName(SERVICE_REGISTRATION registration, char **serviceName) {
+	celix_status_t status = CELIX_SUCCESS;
+
+	if (registration != NULL && *serviceName == NULL) {
+		*serviceName = registration->className;
+	} else {
+		status = CELIX_ILLEGAL_ARGUMENT;
+	}
+
+	return status;
+}