You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2018/05/27 18:53:05 UTC

[57/60] [abbrv] celix git commit: Merge branch 'develop' into feature/CELIX-426-cxx-api

http://git-wip-us.apache.org/repos/asf/celix/blob/2e04253d/libs/framework/include/celix_bundle_context.h
----------------------------------------------------------------------
diff --cc libs/framework/include/celix_bundle_context.h
index 0000000,bc67b1d..6b0b628
mode 000000,100644..100644
--- a/libs/framework/include/celix_bundle_context.h
+++ b/libs/framework/include/celix_bundle_context.h
@@@ -1,0 -1,735 +1,742 @@@
+ /**
+  *Licensed to the Apache Software Foundation (ASF) under one
+  *or more contributor license agreements.  See the NOTICE file
+  *distributed with this work for additional information
+  *regarding copyright ownership.  The ASF licenses this file
+  *to you under the Apache License, Version 2.0 (the
+  *"License"); you may not use this file except in compliance
+  *with the License.  You may obtain a copy of the License at
+  *
+  *  http://www.apache.org/licenses/LICENSE-2.0
+  *
+  *Unless required by applicable law or agreed to in writing,
+  *software distributed under the License is distributed on an
+  *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  * KIND, either express or implied.  See the License for the
+  *specific language governing permissions and limitations
+  *under the License.
+  */
+ 
+ #include "celix_types.h"
+ #include "celix_service_factory.h"
+ #include "celix_properties.h"
+ #include "celix_array_list.h"
+ 
+ #ifndef CELIX_BUNDLE_CONTEXT_H_
+ #define CELIX_BUNDLE_CONTEXT_H_
+ 
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ 
+ /**
+ * Register a service to the Celix framework.
+ *
+ * @param ctx The bundle context
+ * @param svc the service object. Normally a pointer to a service struct (i.e. a struct with function pointers)
+ * @param serviceName the service name, cannot be NULL
+ * @param properties The meta properties associated with the service. The service registration will take ownership of the properties (i.e. no destroy needed)
+ * @return The serviceId (>= 0) or < 0 if the registration was unsuccessful.
+ */
+ long celix_bundleContext_registerService(celix_bundle_context_t *ctx, void *svc, const char *serviceName, celix_properties_t *properties);
+ 
+ /**
+  * Register a service factory in the framework (for the C language).
+  * The service factory will be called for every bundle requesting/de-requesting a service. This gives the provider the
+  * option to create bundle specific service instances.
+  *
+  * When a service is requested for a bundle the getService of the factory service will be called. This function must
+  * return a valid pointer to a service conform the registered service name or NULL.
+  * When a service in no longer needed for a bundle (e.g. ending the useService(s) calls or when a service tracker is stopped)
+  * the ungetService function of the service factory will be called.
+  *
+  * @param ctx The bundle context
+  * @param factory The pointer to the factory service.
+  * @param serviceName The required service name of the services this factory will produce.
+  * @param properties The optional service factory properties. For a service consumer this will be seen as the service properties.
+  * @return The serviceId (>= 0) or < 0 if the registration was unsuccessful.
+  */
+ long celix_bundleContext_registerServiceFactory(celix_bundle_context_t *ctx, celix_service_factory_t *factory, const char *serviceName, celix_properties_t *props);
+ 
+ /**
+  * Service Registration Options when registering services to the Celix framework.
+  */
+ typedef struct celix_service_registration_options {
+     /**
+      * The service pointer. The actual pointer to the service. For C this is normally a pointer to a struct
+      * with function pointers, but theoretically this can be a pointer to anything (e.g. a pointer to a single function,
+      * or a pointer to a C++ interface implementation, or just a pointer to a data structure).
+      *
+      * The bundle is responsible to keep the service pointer valid as long as it is registered in the Celix framework.
+      */
+     void *svc;
+ 
+     /**
+      * The service factory pointer.
+      * Note if the factory service is set, the svc field will not be used.
+      *
+      * The service factory will be called for every bundle requesting/de-requesting a service. This gives the provider the
+      * option to create bundle specific service instances.
+      *
+      * When a service is requested for a bundle the getService of the factory service will be called. This function must
+      * return a valid pointer to a service conform the registered service name or NULL.
+      * When a service in no longer needed for a bundle (e.g. ending the useService(s) calls when a service tacker is stopped)
+      * the ungetService function of the service factory will be called.
+      *
+      * The bundle is responsible to keep the service factory pointer valid as long as it is registered in the Celix framework.
+      */
+     celix_service_factory_t *factory;
+ 
+     /**
+      * The required service name. This is used to identify the service. A fully qualified name with a namespace is
+      * advisable to prevent name collision. (e.g. EXAMPLE_PRESURE_SENSOR).
+      */
+     const char *serviceName;
+ 
+     /**
+      * The optional service properties. These contain meta information about the service in the
+      * form of string key/values. (e.g. the location of a pressure sensor: location=left-tire).
+      *
+      * When a service is registered the Celix framework will take ownership of the provided properties.
+      * If a registration fails, the properties will be destroyed (freed) by the Celix framework.
+      */
+     celix_properties_t *properties;
+ 
+     /**
+      * The optional service language. If this is NULL, CELIX_FRAMEWORK_SERVICE_LANGUAGE_C is used.
+      */
+     const char *serviceLanguage;
+ 
+     /**
+      * The optional service version (in the form of <MAJOR>.<MINOR>.<MICRO>.<QUALIFIER>).
+      * If present consumer of the service can specific which service version range of
+      * a specific service they are interested in. Note that it is the responsibility of the users to ensure that
+      * service in those version range are compatible (binary of source). It is advisable to use semantic versioning
+      * for this.
+      */
+     const char *serviceVersion;
+ } celix_service_registration_options_t;
+ 
+ /**
+  * Macro to create a empty celix_service_registration_options_t type.
+  */
+ #define CELIX_EMPTY_SERVICE_REGISTRATION_OPTIONS { .svc = NULL, \
+     .factory = NULL, \
+     .serviceName = NULL, \
+     .properties = NULL, \
+     .serviceLanguage = NULL, \
+     .serviceVersion = NULL }
+ 
+ 
+ /**
+ * Register a service to the Celix framework using the provided service registration options.
+ *
+ * @param ctx The bundle context
+ * @param opts The pointer to the registration options. The options are only in the during registration call.
+ * @return The serviceId (>= 0) or < 0 if the registration was unsuccessful.
+ */
+ long celix_bundleContext_registerServiceWithOptions(celix_bundle_context_t *ctx, const celix_service_registration_options_t *opts);
+ 
+ 
+ /**
+  * Unregister the service or service factory with service id.
+  * The service will only be unregistered if the bundle of the bundle context is the owner of the service.
+  *
+  * Will log an error if service id is unknown. Will silently ignore services ids < 0.
+  *
+  * @param ctx The bundle context
+  * @param serviceId The service id
+  */
+ void celix_bundleContext_unregisterService(celix_bundle_context_t *ctx, long serviceId);
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ /**
+  * Finds the highest ranking service and returns the service id.
+  *
+  * @param ctx The bundle context
+  * @param serviceName The required service name
+  * @return If found a valid service id (>= 0) if not found -1.
+  */
+ long celix_bundleContext_findService(celix_bundle_context_t *ctx, const char *serviceName);
+ 
+ /**
+  * Finds the services with the provided service name and returns a list of the found service ids.
+  *
+  * @param ctx The bundle context
+  * @param serviceName The required service name
+  * @return A array list with as value a long int.
+  */
+ celix_array_list_t* celix_bundleContext_findServices(celix_bundle_context_t *ctx, const char *serviceName);
+ 
+ /**
+  * Service filter options which can be used to query for certain services.
+  */
+ typedef struct celix_service_filter_options {
+     /**
+      * The required service name.
+      */
+     const char* serviceName;
+ 
+     /**
+      * The optional version range. If service are registerd with a service version this attribute can be used to
+      * only select service with a version in the version range.
+      * It uses the maven version range format, e.g. [1.0.0,2.0.0) or [1.1.1], etc.
+      */
+     const char* versionRange;
+ 
+     /**
+      * LDAP filter to use for fine tuning the filtering, e.g. (|(location=middle)(location=front))
+      * The filter will be applied to all the user provided and framework provided service properties.
+      */
+     const char* filter;
+ 
+     /**
+      * The optional service language to filter for. If this is NULL or "" the C language will be used.
+      */
+     const char* serviceLanguage;
+ } celix_service_filter_options_t;
+ 
+ /**
+  * Macro to create a empty celix_service_filter_options_t type.
+  */
+ #define CELIX_EMPTY_SERVICE_FILTER_OPTIONS {.serviceName = NULL, .versionRange = NULL, .filter = NULL, .serviceLanguage = NULL}
+ 
+ 
+ /**
+  * Finds the highest ranking service and returns the service id.
+  *
+  * @param ctx The bundle context
+  * @param opts The pointer to the filter options.
+  * @return If found a valid service id (>= 0) if not found -1.
+  */
+ long celix_bundleContext_findServiceWithOptions(celix_bundle_context_t *ctx, const celix_service_filter_options_t *opts);
+ 
+ /**
+  * Finds the services conform the provider filter options and returns a list of the found service ids.
+  *
+  * @param ctx The bundle context
+  * @param opts The pointer to the filter options.
+  * @return A array list with as value a long int.
+  */
+ celix_array_list_t* celix_bundleContext_findServicesWithOptions(celix_bundle_context_t *ctx, const celix_service_filter_options_t *opts);
+ 
+ 
+ /**
+  * track the highest ranking service with the provided serviceName.
+  * The highest ranking services will used for the callback.
+  * If a new and higher ranking services the callback with be called again with the new service.
+  * If a service is removed a the callback with be called with next highest ranking service or NULL as service.
+  *
+  * @param ctx The bundle context.
+  * @param serviceName The required service name to track
+  * @param callbackHandle The data pointer, which will be used in the callbacks
+  * @param set is a required callback, which will be called when a new highest ranking service is set.
+  * @return the tracker id (>=0) or < 0 if unsuccessful.
+  */
+ long celix_bundleContext_trackService(
+         celix_bundle_context_t* ctx,
+         const char* serviceName,
+         void* callbackHandle,
+         void (*set)(void* handle, void* svc)
+ );
+ 
+ /**
+  * track services with the provided serviceName.
+  *
+  * @param ctx The bundle context.
+  * @param serviceName The required service name to track
+  * @param callbackHandle The data pointer, which will be used in the callbacks
+  * @param add is a required callback, which will be called when a service is added and initially for the existing service.
+  * @param remove is a required callback, which will be called when a service is removed
+  * @return the tracker id (>=0) or < 0 if unsuccessful.
+  */
+ long celix_bundleContext_trackServices(
+         celix_bundle_context_t* ctx,
+         const char* serviceName,
+         void* callbackHandle,
+         void (*add)(void* handle, void* svc),
+         void (*remove)(void* handle, void* svc)
+ );
+ 
+ /**
+  * Service Tracker Options used to fine tune which services to track and the callback to be used for the tracked services.
+  */
+ typedef struct celix_service_tracker_options {
+     /**
+      * The service filter options, used to setup the filter for the service to track.
+      */
+     celix_service_filter_options_t filter;
+ 
+     /**
+      * The optional callback pointer used in all the provided callback function (set, add, remove, setWithProperties, etc).
+      */
+     void* callbackHandle;
+ 
+     /**
+      * The optional set callback will be called when a new highest ranking service is available conform the provided
+      * service filter options.
+      * @param handle The callbackHandle pointer as provided in the service tracker options.
+      * @param svc The service pointer of the highest ranking service.
+      */
+     void (*set)(void *handle, void *svc);
+ 
+     /**
+      * The optional setWithProperties callback is handled as the set callback, but with the addition that the service properties
+      * will also be provided to the callback.
+      */
+     void (*setWithProperties)(void *handle, void *svc, const celix_properties_t *props); //highest ranking
+ 
+     /**
+      * The optional setWithOwner callback is handled as the set callback, but with the addition that the service properties
+      * and the bundle owning the service will also be provided to the callback.
+      */
+     void (*setWithOwner)(void *handle, void *svc, const celix_properties_t *props, const celix_bundle_t *svcOwner); //highest ranking
+ 
+     /**
+      * The optional add callback will be called for every current and future service found conform the provided service filter
+      * options as long as the tracker is active.
+      * @param handle The callbackHandle pointer as provided in the service tracker options.
+      * @param svc The service pointer of a service matching the provided service filter options.
+      */
+     void (*add)(void *handle, void *svc);
+ 
+     /**
+      * The optional addWithProperties callback is handled as the add callback, but with the addition that the service properties
+      * will also be provided to the callback.
+      */
+     void (*addWithProperties)(void *handle, void *svc, const celix_properties_t *props);
+ 
+     /**
+      * The optional addWithOwner callback is handled as the add callback, but with the addition that the service properties
+      * and the bundle owning the service will also be provided to the callback.
+      */
+     void (*addWithOwner)(void *handle, void *svc, const celix_properties_t *props, const celix_bundle_t *svcOwner);
+ 
+     /**
+      * The optional remove callback will be called for every service conform the provided service filter options that is
+      * unregistered. When the remove call is finished the removed services should be considered invalid. This means
+      * that the callback provider should ensure that the removed service is not in use or going to be used after the
+      * remove callback is finished.
+      *
+      * @param handle The callbackHandle pointer as provided in the service tracker options.
+      * @param svc The service pointer of a service matching the provided service filter options.
+      */
+     void (*remove)(void *handle, void *svc);
+ 
+     /**
+      * The optional removeWithProperties callback is handled as the remove callback, but with the addition that the service properties
+      * will also be provided to the callback.
+      */
+     void (*removeWithProperties)(void *handle, void *svc, const celix_properties_t *props);
+ 
+     /**
+     * The optional removeWithOwner callback is handled as the remove callback, but with the addition that the service properties
+     * and the bundle owning the service will also be provided to the callback.
+     */
+     void (*removeWithOwner)(void *handle, void *svc, const celix_properties_t *props, const celix_bundle_t *svcOwner);
+ } celix_service_tracking_options_t;
+ 
+ /**
+  * Macro to create a empty celix_service_tracking_options_t type.
+  */
+ #define CELIX_EMPTY_SERVICE_TRACKING_OPTIONS { .filter.serviceName = NULL, \
+     .filter.versionRange = NULL, \
+     .filter.filter = NULL, \
+     .filter.serviceLanguage = NULL, \
+     .callbackHandle = NULL, \
+     .set = NULL, \
+     .add = NULL, \
+     .remove = NULL, \
+     .setWithProperties = NULL, \
+     .addWithProperties = NULL, \
+     .removeWithProperties = NULL, \
+     .setWithOwner = NULL, \
+     .addWithOwner = NULL, \
+     .removeWithOwner = NULL}
+ 
+ /**
+  * Tracks services using the provided tracker options.
+  * The tracker options are only using during this call and can safely be freed/reused after this call returns.
+  *
+  * @param ctx The bundle context.
+  * @param opts The pointer to the tracker options.
+  * @return the tracker id (>=0) or < 0 if unsuccessful.
+  */
+ long celix_bundleContext_trackServicesWithOptions(celix_bundle_context_t *ctx, const celix_service_tracking_options_t *opts);
+ 
+ /**
+  * Stop the tracker with the provided track id.
+  * Could be a service tracker, bundle tracker or service tracker tracker.
+  * Only works for the trackers owned by the bundle of the bundle context.
+  *
+  * Will log a error if the provided tracker id is unknown. Will silently ignore trackerId < 0.
+  */
+ void celix_bundleContext_stopTracker(celix_bundle_context_t *ctx, long trackerId);
+ 
+ 
+ 
+ 
+ 
+ 
+ /**
+  * Use the service with the provided service id using the provided callback. The Celix framework will ensure that
+  * the targeted service cannot be removed during the callback.
+  *
+  * The svc is should only be considered valid during the callback.
+  * If no service is found the callback will not be invoked.
+  *
+  * This function will block till the callback is finished. As result it is possible to provide callback data from the
+  * stack.
+  *
+  * @param ctx The bundle context
+  * @param serviceId the service id.
+  * @param serviceName the service name of the service. Should match with the registered service name of the provided service id (sanity check)
+  * @param callbackHandle The data pointer, which will be used in the callbacks
+  * @param use The callback, which will be called when service is retrieved.
+  * @param bool returns true if a service was found.
+  */
+ bool celix_bundleContext_useServiceWithId(
+         celix_bundle_context_t *ctx,
+         long serviceId,
+         const char *serviceName /*sanity check*/,
+         void *callbackHandle,
+         void (*use)(void *handle, void* svc)
+ );
+ 
+ /**
+  * Use the highest ranking service with the provided service name using the provided callback. The Celix framework will
+  * ensure that the targeted service cannot be removed during the callback.
+  *
+  * The svc is should only be considered valid during the callback.
+  * If no service is found the callback will not be invoked.
+  *
+  * This function will block till the callback is finished. As result it is possible to provide callback data from the
+  * stack.
+  *
+  * @param   ctx The bundle context
+  * @param   serviceName the required service name.
+  * @param   callbackHandle The data pointer, which will be used in the callbacks
+  * @param   use The callback, which will be called when service is retrieved.
+  * @return  True if a service was found.
+  */
+ bool celix_bundleContext_useService(
+         celix_bundle_context_t *ctx,
+         const char* serviceName,
+         void *callbackHandle,
+         void (*use)(void *handle, void *svc)
+ );
+ 
+ /**
+  * Use the services with the provided service name using the provided callback. The Celix framework will
+  * ensure that the targeted service cannot be removed during the callback.
+  *
+  * The svc is should only be considered valid during the callback.
+  * If no service is found the callback will not be invoked.
+  *
+  * This function will block till the callback is finished. As result it is possible to provide callback data from the
+  * stack.
+  *
+  * @param   ctx The bundle context
+  * @param   serviceName the required service name.
+  * @param   callbackHandle The data pointer, which will be used in the callbacks
+  * @param   use The callback, which will be called for every service found.
+  */
+ void celix_bundleContext_useServices(
+         celix_bundle_context_t *ctx,
+         const char* serviceName,
+         void *callbackHandle,
+         void (*use)(void *handle, void *svc)
+ );
+ 
+ /**
+  * Service Use Options used to fine tune which services to use and which callbacks to use.
+  */
+ typedef struct celix_service_use_options {
+     /**
+      * The service filter options, used to setup the filter for the service to track.
+      */
+     celix_service_filter_options_t filter;
+ 
+     /**
+      * The optional callback pointer used in all the provided callback function (set, add, remove, setWithProperties, etc).
+      */
+     void *callbackHandle;
+ 
+     /**
+      * The optional use callback will be called when for every services found conform the service filter options
+      * - in case of findServices - or only for the highest ranking service found - in case of findService -.
+      *
+      * @param handle The callbackHandle pointer as provided in the service tracker options.
+      * @param svc The service pointer of the highest ranking service.
+      */
+     void (*use)(void *handle, void *svc);
+ 
+     /**
+      * The optional useWithProperties callback is handled as the use callback, but with the addition that the service properties
+      * will also be provided to the callback.
+      */
+     void (*useWithProperties)(void *handle, void *svc, const celix_properties_t *props);
+ 
+     /**
+      * The optional useWithOwner callback is handled as the yse callback, but with the addition that the service properties
+      * and the bundle owning the service will also be provided to the callback.
+      */
+     void (*useWithOwner)(void *handle, void *svc, const celix_properties_t *props, const celix_bundle_t *svcOwner);
+ } celix_service_use_options_t;
+ 
+ /**
+  * Macro to create a empty celix_service_use_options_t type.
+  */
+ #define CELIX_EMPTY_SERVICE_USE_OPTIONS {.filter.serviceName = NULL, \
+     .filter.versionRange = NULL, \
+     .filter.filter = NULL, \
+     .filter.serviceLanguage = NULL, \
+     .callbackHandle = NULL, \
+     .use = NULL, \
+     .useWithProperties = NULL, \
+     .useWithOwner = NULL}
+ 
+ /**
+  * Use the services with the provided service filter optons using the provided callback. The Celix framework will
+  * ensure that the targeted service cannot be removed during the callback.
+  *
+  * The svc is should only be considered valid during the callback.
+  * If no service is found the callback will not be invoked.
+  *
+  * This function will block till the callback is finished. As result it is possible to provide callback data from the
+  * stack.
+  *
+  * @param   ctx The bundle context.
+  * @param   opts The required options. Note that the serviceName is required.
+  * @return  True if a service was found.
+  */
+ bool celix_bundleContext_useServiceWithOptions(
+         celix_bundle_context_t *ctx,
+         const celix_service_use_options_t *opts);
+ 
+ 
+ /**
+  * Use the services with the provided service filter optons using the provided callback. The Celix framework will
+  * ensure that the targeted service cannot be removed during the callback.
+  *
+  * The svc is should only be considered valid during the callback.
+  * If no service is found the callback will not be invoked.
+  *
+  * This function will block till the callback is finished. As result it is possible to provide callback data from the
+  * stack.
+  *
+  * @param   ctx The bundle context.
+  * @param   opts The required options. Note that the serviceName is required.
+  */
+ void celix_bundleContext_useServicesWithOptions(
+         celix_bundle_context_t *ctx,
+         const celix_service_use_options_t *opts);
+ 
+ 
+ 
+ 
+ 
+ 
+ 
+ /**
+  * Install and optional start a bundle.
+  *
+  * @param ctx The bundle context
+  * @param bundleLoc The bundle location to the bundle zip file.
+  * @param autoStart If the bundle should also be started.
+  * @return the bundleId (>= 0) or < 0 if the bundle could not be installed and possibly started.
+  */
+ long celix_bundleContext_installBundle(celix_bundle_context_t *ctx, const char *bundleLoc, bool autoStart);
+ 
+ /**
+  * Uninstall the bundle with the provided bundle id. If needed the bundle will be stopped first.
+  *
+  * @param ctx The bundle context
+  * @param bundleId The bundle id to stop
+  * @return true if the bundle is correctly uninstalled. False if not.
+  */
+ bool celix_bundleContext_uninstallBundle(celix_bundle_context_t *ctx, long bundleId);
+ 
+ /**
+  * track bundles
+  * The add bundle callback will also be called for already installed bundles.
+  *
+  * @param ctx               The bundle context.
+  * @param callbackHandle    The data pointer, which will be used in the callbacks
+  * @param add               The callback which will be called for started bundles.
+  * @param remove            The callback which will be called when bundles are stopped.
+  * @return                  The bundle tracker id or < 0 if unsuccessful.
+  */
+ long celix_bundleContext_trackBundles(
+         celix_bundle_context_t* ctx,
+         void* callbackHandle,
+         void (*onStarted)(void* handle, const celix_bundle_t *bundle),
+         void (*onStopped)(void *handle, const celix_bundle_t *bundle)
+ );
+ 
+ 
+ /**
+  * The Service Bundle Tracking options can be used to fine tune the requested bundle tracker options.
+  */
+ typedef struct celix_bundle_tracker_options {
+     /**
+      * The optional callback pointer used in all the provided callback function (set, add, remove, setWithProperties, etc).
+      */
+     void* callbackHandle;
+ 
+     /**
+      * Tracker callback when a bundle is installed.
+      * @param handle    The handle, contains the value of the callbackHandle.
+      * @param bundle    The bundle which has been started.
+      *                  The bundle pointer is only guaranteed to be valid during the callback.
+      */
+     void (*onStarted)(void *handle, const celix_bundle_t *bundle); //highest ranking
+ 
+     /**
+      * Tracker callback when a bundle is removed.
+      * @param handle    The handle, contains the value of the callbackHandle.
+      * @param bundle    The bundle which has been started.
+      *                  The bundle pointer is only guaranteed to be valid during the callback.
+      */
+     void (*onStopped)(void *handle, const celix_bundle_t *bundle);
+ 
+     //TODO callback for on installed, resolved, uninstalled ??
+ 
+     /**
+      *
+      * @param handle    The handle, contains the value of the callbackHandle.
+      * @param event     The bundle event. Is only valid during the callback.
+      */
+     void (*onBundleEvent)(void *handle, const celix_bundle_event_t *event);
+ } celix_bundle_tracking_options_t;
+ 
+ /**
+  * Macro to create a empty celix_service_filter_options_t type.
+  */
+ #define CELIX_EMPTY_BUNDLE_TRACKING_OPTIONS {.callbackHandle = NULL, .onStarted = NULL, .onStopped = NULL, .onBundleEvent = NULL}
+ 
+ /**
+  * Tracks bundles using the provided bundle tracker options.
+  * The tracker options are only using during this call and can safely be freed/reused after this call returns.
+  * (i.e. can be on the stack)
+  *
+  * @param ctx   The bundle context.
+  * @param opts  The pointer to the bundle tracker options.
+  * @return      The bundle tracker id (>=0) or < 0 if unsuccessful.
+  */
+ long celix_bundleContext_trackBundlesWithOptions(
+         celix_bundle_context_t* ctx,
+         const celix_bundle_tracking_options_t *opts
+ );
+ 
+ /**
+  * Use the bundle with the provided bundle id if it is in the active (started) state
+  * The provided callback will be called if the bundle is found and in the active (started) state.
+  *
+  * @param ctx               The bundle context.
+  * @param bundleId          The bundle id.
+  * @param callbackHandle    The data pointer, which will be used in the callbacks
+  * @param use               The callback which will be called for the currently started bundles.
+  *                          The bundle pointers are only guaranteed to be valid during the callback.
+  */
 -void celix_bundleContext_useBundle(
++bool celix_bundleContext_useBundle(
+         celix_bundle_context_t *ctx,
+         long bundleId,
+         void *callbackHandle,
+         void (*use)(void *handle, const celix_bundle_t *bundle)
+ );
+ 
+ /**
+  * Use the currently active (started) bundles.
+  * The provided callback will be called for all the currently started bundles.
+  *
+  * @param ctx               The bundle context.
+  * @param callbackHandle    The data pointer, which will be used in the callbacks
+  * @param use               The callback which will be called for the currently started bundles.
+  *                          The bundle pointers are only guaranteed to be valid during the callback.
+  */
+ void celix_bundleContext_useBundles(
+         celix_bundle_context_t *ctx,
+         void *callbackHandle,
+         void (*use)(void *handle, const celix_bundle_t *bundle)
+ );
+ 
+ 
+ 
+ //TODO add useBundleWithOptions (e.g. which state)
+ //TODO findBundles
+ 
+ /**
+  * Service Tracker Info provided to the service tracker tracker callbacks.
+  */
+ typedef struct celix_service_tracker_info {
+     /**
+      * The parsed service filter, e.g. parsed "(&(objectClass=example_calc)(service.language=C)(meta.info=foo))"
+      */
+     celix_filter_t *filter;
+ 
+     /**
+      *The service name filter attribute parsed from the service filter (i.e. the value of the objectClass attribute key)
+      */
+     const char *serviceName;
+ 
+     /**
+      * The service language filter attribute parsed from the service filter. Can be null
+      */
+     const char *serviceLanguage;
+ 
+     /**
+      * Bundle id of the owner of the service tracker.
+      */
+     long bundleId;
+ } celix_service_tracker_info_t;
+ 
+ /**
+  * Track the service tracker targeting the provided service name. This can be used to track if there is an interest
+  * in a certain service and ad-hoc act on that interest.
+  *
+  * Note that the celix_service_tracker_info_t pointer in the trackerAdd/trackerRemove callbacks are only valid during
+  * the callback.
+  *
+  * This tracker can be stopped with the celix_bundleContext_stopTracker function.
+  *
+  * @param ctx The bundle context
+  * @param serviceName The target service name for the service tracker to track.
+  * @param callbackHandle The callback handle which will be provided as handle in the trackerAdd and trackerRemove callback.
+  * @param trackerAdd Called when a service tracker is added, which tracks the provided service name. Will also be called
+  *                   for all existing service tracker when this tracker is started.
+  * @param trackerRemove Called when a service tracker is removed, which tracks the provided service name
+  * @return The tracker id or <0 if something went wrong (will log an error).
+  */
+ long celix_bundleContext_trackServiceTrackers(
+         celix_bundle_context_t *ctx,
+         const char *serviceName,
+         void *callbackHandle,
+         void (*trackerAdd)(void *handle, const celix_service_tracker_info_t *info),
+         void (*trackerRemove)(void *handle, const celix_service_tracker_info_t *info));
+ 
+ /**
+  * Gets the dependency manager for this bundle context.
+  *
+  * @return the dependency manager or NULL if unsuccessful.
+  */
+ dm_dependency_manager_t* celix_bundleContext_getDependencyManager(celix_bundle_context_t *ctx);
+ 
++/**
++ * Gets the bundle for this bundle context
++ *
++ * @return the bundle or NULL if unsuccessful.
++ */
++celix_bundle_t* celix_bundleContext_getBundle(celix_bundle_context_t *ctx);
++
+ #ifdef __cplusplus
+ }
+ #endif
+ 
+ #endif //CELIX_BUNDLE_CONTEXT_H_

http://git-wip-us.apache.org/repos/asf/celix/blob/2e04253d/libs/framework/include/celix_constants.h
----------------------------------------------------------------------
diff --cc libs/framework/include/celix_constants.h
index 0000000,0000000..d46c8fb
new file mode 100644
--- /dev/null
+++ b/libs/framework/include/celix_constants.h
@@@ -1,0 -1,0 +1,79 @@@
++/**
++ *Licensed to the Apache Software Foundation (ASF) under one
++ *or more contributor license agreements.  See the NOTICE file
++ *distributed with this work for additional information
++ *regarding copyright ownership.  The ASF licenses this file
++ *to you under the Apache License, Version 2.0 (the
++ *"License"); you may not use this file except in compliance
++ *with the License.  You may obtain a copy of the License at
++ *
++ *  http://www.apache.org/licenses/LICENSE-2.0
++ *
++ *Unless required by applicable law or agreed to in writing,
++ *software distributed under the License is distributed on an
++ *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
++ * KIND, either express or implied.  See the License for the
++ *specific language governing permissions and limitations
++ *under the License.
++ */
++/*
++ * constants.h
++ *
++ *  \date       Apr 29, 2010
++ *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
++ *  \copyright	Apache License, Version 2.0
++ */
++
++#ifndef CELIX_CONSTANTS_H_
++#define CELIX_CONSTANTS_H_
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#define OSGI_FRAMEWORK_OBJECTCLASS "objectClass"
++#define OSGI_FRAMEWORK_SERVICE_NAME "objectClass" //TODO rename in future?
++#define OSGI_FRAMEWORK_SERVICE_ID "service.id"
++#define OSGI_FRAMEWORK_SERVICE_PID "service.pid"
++#define OSGI_FRAMEWORK_SERVICE_RANKING "service.ranking"
++
++#define CELIX_FRAMEWORK_SERVICE_VERSION "service.version"
++#define CELIX_FRAMEWORK_SERVICE_LANGUAGE "service.lang"
++#define CELIX_FRAMEWORK_SERVICE_C_LANGUAGE "C"
++#define CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE "C++"
++#define CELIX_FRAMEWORK_SERVICE_SHARED_LANGUAGE "shared" //e.g. marker services
++
++#define OSGI_FRAMEWORK_BUNDLE_ACTIVATOR "Bundle-Activator"
++#define OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_CREATE "bundleActivator_create"
++#define OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_START "bundleActivator_start"
++#define OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_STOP "bundleActivator_stop"
++#define OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_DESTROY "bundleActivator_destroy"
++
++#define OSGI_FRAMEWORK_BUNDLE_DM_ACTIVATOR_CREATE "dm_create"
++#define OSGI_FRAMEWORK_BUNDLE_DM_ACTIVATOR_INIT "dm_init"
++#define OSGI_FRAMEWORK_BUNDLE_DM_ACTIVATOR_DESTROY "dm_destroy"
++
++#define OSGI_FRAMEWORK_BUNDLE_SYMBOLICNAME "Bundle-SymbolicName"
++#define OSGI_FRAMEWORK_BUNDLE_VERSION "Bundle-Version"
++#define OSGI_FRAMEWORK_PRIVATE_LIBRARY "Private-Library"
++#define OSGI_FRAMEWORK_EXPORT_LIBRARY "Export-Library"
++#define OSGI_FRAMEWORK_IMPORT_LIBRARY "Import-Library"
++    
++#define OSGI_FRAMEWORK_FRAMEWORK_STORAGE "org.osgi.framework.storage"
++#define OSGI_FRAMEWORK_FRAMEWORK_STORAGE_CLEAN "org.osgi.framework.storage.clean"
++#define OSGI_FRAMEWORK_FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT "onFirstInit"
++#define OSGI_FRAMEWORK_FRAMEWORK_UUID "org.osgi.framework.uuid"
++
++#define CELIX_AUTO_START_0 "CELIX_AUTO_START_0"
++#define CELIX_AUTO_START_1 "CELIX_AUTO_START_1"
++#define CELIX_AUTO_START_2 "CELIX_AUTO_START_2"
++#define CELIX_AUTO_START_3 "CELIX_AUTO_START_3"
++#define CELIX_AUTO_START_4 "CELIX_AUTO_START_4"
++#define CELIX_AUTO_START_5 "CELIX_AUTO_START_5"
++
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* CONSTANTS_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/2e04253d/libs/framework/include/celix_launcher.h
----------------------------------------------------------------------
diff --cc libs/framework/include/celix_launcher.h
index 0000000,579eef7..8675c73
mode 000000,100644..100644
--- a/libs/framework/include/celix_launcher.h
+++ b/libs/framework/include/celix_launcher.h
@@@ -1,0 -1,116 +1,116 @@@
+ /**
+  *Licensed to the Apache Software Foundation (ASF) under one
+  *or more contributor license agreements.  See the NOTICE file
+  *distributed with this work for additional information
+  *regarding copyright ownership.  The ASF licenses this file
+  *to you under the Apache License, Version 2.0 (the
+  *"License"); you may not use this file except in compliance
+  *with the License.  You may obtain a copy of the License at
+  *
+  *  http://www.apache.org/licenses/LICENSE-2.0
+  *
+  *Unless required by applicable law or agreed to in writing,
+  *software distributed under the License is distributed on an
+  *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  * KIND, either express or implied.  See the License for the
+  *specific language governing permissions and limitations
+  *under the License.
+  */
+ /*
+  * celix_launcher.h
+  *
+  *  \date       Jul 30, 2015
+  *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+  *  \copyright	Apache License, Version 2.0
+  */
+ 
 -#ifndef CELIX_LAUNCHER_H
 -#define CELIX_LAUNCHER_H
++#ifndef CELIX_LAUNCHER_H_
++#define CELIX_LAUNCHER_H_
+ 
+ #include <stdio.h>
+ #include "framework.h"
+ 
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ 
+ 
+ /**
+  * Launched a celix framework and wait (block) till the framework is stopped.
+  * The function will also destroy the framework when it has been stopped.
+  *
+  * The launcher will also setup signal handlers for SIGINT, SIGTERM, SIGUSR1 and SIGUSR2 and initialize libcurl.
+  * For SIGINT and SIGTERM the framework will be stopped
+  * SIGUSR1 and SIGUSR2 will be ignored.
+  *
+  *
+  * @param argc argc as provided in a main function.
+  * @param argv argv as provided in a main function.
+  * @param embeddedConfig The optional embbeded config, will be overriden with the config.properties if found.
+  * @return CELIX_SUCCESS if successful.
+  */
+ int celixLauncher_launchAndWaitForShutdown(int argc, char *argv[], properties_t *embeddedConfig);
+ 
+ 
+ /**
+  * Launches the a celix framework and returns the framework.
+  *
+  * The launcher will also setup signal handlers for SIGINT, SIGTERM, SIGUSR1 and SIGUSR2 and initialize libcurl.
+  * For SIGINT and SIGTERM the framework will be stopped
+  * SIGUSR1 and SIGUSR2 will be ignored.
+  *
+  * @param configFile Path to the config file (config.properties)
+  * @param framework Output parameter for the framework.
+  * @return CELIX_SUCCESS if successful. 
+  */
+ int celixLauncher_launch(const char *configFile, framework_t **framework);
+ 
+ /**
+  * Launches the a celix framework and returns the framework.
+  *
+  * The launcher will also setup signal handlers for SIGINT, SIGTERM, SIGUSR1 and SIGUSR2 and initialize libcurl.
+  * For SIGINT and SIGTERM the framework will be stopped
+  * SIGUSR1 and SIGUSR2 will be ignored.
+  *
+  * @param config FILE* to the config file (config.properties)
+  * @param framework Output parameter for the framework.
+  * @return CELIX_SUCCESS if successful.
+  */
+ int celixLauncher_launchWithStream(FILE *config, framework_t **framework);
+ 
+ /**
+  * Launches the a celix framework and returns the framework.
+  *
+  * The launcher will also setup signal handlers for SIGINT, SIGTERM, SIGUSR1 and SIGUSR2 and initialize libcurl.
+  * For SIGINT and SIGTERM the framework will be stopped
+  * SIGUSR1 and SIGUSR2 will be ignored.
+  *
+  * @param config the config properties.
+  * @param framework Output parameter for the framework.
+  * @return CELIX_SUCCESS if successful.
+  */
+ int celixLauncher_launchWithProperties(properties_t *config, framework_t **framework);
+ 
+ /**
+  * Wait (blocks) for the shutdown of the provided celix framework.
+  * @param framework The framework to wait for.
+  */
+ void celixLauncher_waitForShutdown(framework_t *framework);
+ 
+ /**
+  * Stop the provided celix framework.
+  * @param framework The framework to stop.
+  */
+ void celixLauncher_stop(framework_t *framework);
+ 
+ /**
+  * Destroys the provided framework and if needed stops it first.
+  * @param framework The framework to stop.
+  */
+ void celixLauncher_destroy(framework_t *framework);
+ 
+ #ifdef __cplusplus
+ }
+ #endif
+ 
 -#endif //CELIX_LAUNCHER_H
++#endif //CELIX_LAUNCHER_H_

http://git-wip-us.apache.org/repos/asf/celix/blob/2e04253d/libs/framework/include/constants.h
----------------------------------------------------------------------
diff --cc libs/framework/include/constants.h
index 0000000,06d89be..ac00241
mode 000000,100644..100644
--- a/libs/framework/include/constants.h
+++ b/libs/framework/include/constants.h
@@@ -1,0 -1,79 +1,20 @@@
+ /**
+  *Licensed to the Apache Software Foundation (ASF) under one
+  *or more contributor license agreements.  See the NOTICE file
+  *distributed with this work for additional information
+  *regarding copyright ownership.  The ASF licenses this file
+  *to you under the Apache License, Version 2.0 (the
+  *"License"); you may not use this file except in compliance
+  *with the License.  You may obtain a copy of the License at
+  *
+  *  http://www.apache.org/licenses/LICENSE-2.0
+  *
+  *Unless required by applicable law or agreed to in writing,
+  *software distributed under the License is distributed on an
+  *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  * KIND, either express or implied.  See the License for the
+  *specific language governing permissions and limitations
+  *under the License.
+  */
 -/*
 - * constants.h
 - *
 - *  \date       Apr 29, 2010
 - *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
 - *  \copyright	Apache License, Version 2.0
 - */
 -
 -#ifndef CONSTANTS_H_
 -#define CONSTANTS_H_
 -
 -#ifdef __cplusplus
 -extern "C" {
 -#endif
 -
 -static const char *const OSGI_FRAMEWORK_OBJECTCLASS = "objectClass";
 -static const char *const OSGI_FRAMEWORK_SERVICE_ID = "service.id";
 -static const char *const OSGI_FRAMEWORK_SERVICE_PID = "service.pid";
 -static const char *const OSGI_FRAMEWORK_SERVICE_RANKING = "service.ranking";
 -
 -static const char *const CELIX_FRAMEWORK_SERVICE_VERSION = "service.version";
 -static const char *const CELIX_FRAMEWORK_SERVICE_LANGUAGE = "service.lang";
 -static const char *const CELIX_FRAMEWORK_SERVICE_C_LANGUAGE = "C";
 -static const char *const CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE = "C++";
 -static const char *const CELIX_FRAMEWORK_SERVICE_SHARED_LANGUAGE = "shared"; //e.g. marker services
 -
 -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";
 -static const char *const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_DESTROY = "bundleActivator_destroy";
 -
 -static const char *const OSGI_FRAMEWORK_BUNDLE_DM_ACTIVATOR_CREATE = "dm_create";
 -static const char *const OSGI_FRAMEWORK_BUNDLE_DM_ACTIVATOR_INIT = "dm_init";
 -static const char *const OSGI_FRAMEWORK_BUNDLE_DM_ACTIVATOR_DESTROY = "dm_destroy";
 -
 -
 -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_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";
 -static const char *const OSGI_FRAMEWORK_FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT = "onFirstInit";
 -static const char *const OSGI_FRAMEWORK_FRAMEWORK_UUID = "org.osgi.framework.uuid";
 -
 -#define CELIX_AUTO_START_0 "CELIX_AUTO_START_0"
 -#define CELIX_AUTO_START_1 "CELIX_AUTO_START_1"
 -#define CELIX_AUTO_START_2 "CELIX_AUTO_START_2"
 -#define CELIX_AUTO_START_3 "CELIX_AUTO_START_3"
 -#define CELIX_AUTO_START_4 "CELIX_AUTO_START_4"
 -#define CELIX_AUTO_START_5 "CELIX_AUTO_START_5"
 -
 -
 -#ifdef __cplusplus
 -}
 -#endif
+ 
 -#endif /* CONSTANTS_H_ */
++#include "celix_constants.h"

http://git-wip-us.apache.org/repos/asf/celix/blob/2e04253d/libs/framework/include/framework.h
----------------------------------------------------------------------
diff --cc libs/framework/include/framework.h
index 0000000,5143f47..6f6827c
mode 000000,100644..100644
--- a/libs/framework/include/framework.h
+++ b/libs/framework/include/framework.h
@@@ -1,0 -1,65 +1,66 @@@
+ /**
+  *Licensed to the Apache Software Foundation (ASF) under one
+  *or more contributor license agreements.  See the NOTICE file
+  *distributed with this work for additional information
+  *regarding copyright ownership.  The ASF licenses this file
+  *to you under the Apache License, Version 2.0 (the
+  *"License"); you may not use this file except in compliance
+  *with the License.  You may obtain a copy of the License at
+  *
+  *  http://www.apache.org/licenses/LICENSE-2.0
+  *
+  *Unless required by applicable law or agreed to in writing,
+  *software distributed under the License is distributed on an
+  *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  * KIND, either express or implied.  See the License for the
+  *specific language governing permissions and limitations
+  *under the License.
+  */
+ /*
+  * framework.h
+  *
+  *  \date       Mar 23, 2010
+  *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+  *  \copyright	Apache License, Version 2.0
+  */
+ 
+ #ifndef FRAMEWORK_H_
+ #define FRAMEWORK_H_
+ 
 -typedef struct activator *activator_pt;
++typedef struct activator * activator_pt;
+ typedef struct activator activator_t;
+ 
 -typedef struct framework *framework_pt;
++typedef struct framework * framework_pt;
+ typedef struct framework framework_t;
+ 
+ #include "celix_errno.h"
+ #include "framework_exports.h"
+ #include "bundle.h"
+ #include "properties.h"
+ #include "bundle_context.h"
+ 
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ 
 -// #TODO: Move to FrameworkFactory according the OSGi Spec
+ FRAMEWORK_EXPORT celix_status_t framework_create(framework_t **framework, properties_t *config);
+ 
+ FRAMEWORK_EXPORT celix_status_t framework_start(framework_t *framework);
+ 
+ FRAMEWORK_EXPORT celix_status_t framework_stop(framework_t *framework);
+ 
+ FRAMEWORK_EXPORT celix_status_t framework_destroy(framework_t *framework);
+ 
++FRAMEWORK_EXPORT celix_status_t fw_init(framework_t *framework);
++
+ FRAMEWORK_EXPORT celix_status_t framework_waitForStop(framework_t *framework);
+ 
 -FRAMEWORK_EXPORT celix_status_t framework_getFrameworkBundle(framework_t *framework, bundle_t **bundle);
++FRAMEWORK_EXPORT celix_status_t framework_getFrameworkBundle(framework_t *framework, bundle_pt *bundle);
+ 
 -bundle_context_t* framework_getContext(framework_t *framework);
++FRAMEWORK_EXPORT bundle_context_t* framework_getContext(framework_t *framework);
+ 
+ #ifdef __cplusplus
+ }
+ #endif
+ 
+ #endif /* FRAMEWORK_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/2e04253d/libs/framework/include/service_reference.h
----------------------------------------------------------------------
diff --cc libs/framework/include/service_reference.h
index 0000000,3d84526..18b5455
mode 000000,100644..100644
--- a/libs/framework/include/service_reference.h
+++ b/libs/framework/include/service_reference.h
@@@ -1,0 -1,75 +1,76 @@@
+ /**
+  *Licensed to the Apache Software Foundation (ASF) under one
+  *or more contributor license agreements.  See the NOTICE file
+  *distributed with this work for additional information
+  *regarding copyright ownership.  The ASF licenses this file
+  *to you under the Apache License, Version 2.0 (the
+  *"License"); you may not use this file except in compliance
+  *with the License.  You may obtain a copy of the License at
+  *
+  *  http://www.apache.org/licenses/LICENSE-2.0
+  *
+  *Unless required by applicable law or agreed to in writing,
+  *software distributed under the License is distributed on an
+  *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  * KIND, either express or implied.  See the License for the
+  *specific language governing permissions and limitations
+  *under the License.
+  */
+ /*
+  * service_reference.h
+  *
+  *  \date       Jul 20, 2010
+  *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+  *  \copyright	Apache License, Version 2.0
+  */
+ 
+ #ifndef SERVICE_REFERENCE_H_
+ #define SERVICE_REFERENCE_H_
+ 
+ typedef struct serviceReference * service_reference_pt;
++typedef struct serviceReference service_reference_t;
+ 
+ #include "celixbool.h"
+ #include "array_list.h"
+ #include "service_registration.h"
+ #include "bundle.h"
+ #include "framework_exports.h"
+ 
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
+ 
+ FRAMEWORK_EXPORT celix_status_t serviceReference_getBundle(service_reference_pt reference, bundle_pt *bundle);
+ 
+ FRAMEWORK_EXPORT bool
+ serviceReference_isAssignableTo(service_reference_pt reference, bundle_pt requester, const char *serviceName);
+ 
+ FRAMEWORK_EXPORT celix_status_t
+ serviceReference_getProperty(service_reference_pt reference, const char *key, const char **value);
+ 
+ FRAMEWORK_EXPORT celix_status_t
+ serviceReference_getPropertyWithDefault(service_reference_pt reference, const char *key, const char* def, const char **value);
+ 
+ FRAMEWORK_EXPORT celix_status_t
+ serviceReference_getPropertyKeys(service_reference_pt reference, char **keys[], unsigned int *size);
+ 
+ FRAMEWORK_EXPORT celix_status_t
+ serviceReference_getServiceRegistration(service_reference_pt reference, service_registration_pt *registration);
+ 
+ FRAMEWORK_EXPORT celix_status_t
+ serviceReference_equals(service_reference_pt reference, service_reference_pt compareTo, bool *equal);
+ 
+ FRAMEWORK_EXPORT unsigned int serviceReference_hashCode(const void *referenceP);
+ 
+ FRAMEWORK_EXPORT int serviceReference_equals2(const void *reference1, const void *reference2);
+ 
+ FRAMEWORK_EXPORT celix_status_t
+ serviceReference_compareTo(service_reference_pt reference, service_reference_pt compareTo, int *compare);
+ 
+ FRAMEWORK_EXPORT celix_status_t serviceReference_getUsingBundles(service_reference_pt ref, array_list_pt *out);
+ 
+ #ifdef __cplusplus
+ }
+ #endif
+ 
+ #endif /* SERVICE_REFERENCE_H_ */

http://git-wip-us.apache.org/repos/asf/celix/blob/2e04253d/libs/framework/private/mock/bundle_context_mock.c
----------------------------------------------------------------------
diff --cc libs/framework/private/mock/bundle_context_mock.c
index 0000000,7c0b6e6..d22fced
mode 000000,100644..100644
--- a/libs/framework/private/mock/bundle_context_mock.c
+++ b/libs/framework/private/mock/bundle_context_mock.c
@@@ -1,0 -1,363 +1,364 @@@
+ /**
+  *Licensed to the Apache Software Foundation (ASF) under one
+  *or more contributor license agreements.  See the NOTICE file
+  *distributed with this work for additional information
+  *regarding copyright ownership.  The ASF licenses this file
+  *to you under the Apache License, Version 2.0 (the
+  *"License"); you may not use this file except in compliance
+  *with the License.  You may obtain a copy of the License at
+  *
+  *  http://www.apache.org/licenses/LICENSE-2.0
+  *
+  *Unless required by applicable law or agreed to in writing,
+  *software distributed under the License is distributed on an
+  *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  * KIND, either express or implied.  See the License for the
+  *specific language governing permissions and limitations
+  *under the License.
+  */
+ /*
+  * bundle_context_mock.c
+  *
+  *  \date       Feb 6, 2013
+  *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+  *  \copyright  Apache License, Version 2.0
+  */
+ #include <CppUTestExt/MockSupport_c.h>
+ #include "CppUTestExt/MockSupport_c.h"
+ 
+ #include "bundle_context.h"
+ #include "celix_bundle_context.h"
+ 
+ celix_status_t bundleContext_create(framework_pt framework, framework_logger_pt logger, bundle_pt bundle, bundle_context_pt *bundle_context) {
+ 	mock_c()->actualCall("bundleContext_create")
+ 			->withPointerParameters("framework", framework)
+ 			->withPointerParameters("logger", logger)
+ 			->withPointerParameters("bundle", bundle)
+ 			->withOutputParameter("bundle_context", (void **) bundle_context);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ celix_status_t bundleContext_destroy(bundle_context_pt context) {
+ 	return CELIX_SUCCESS;
+ }
+ 
+ celix_status_t bundleContext_getBundle(bundle_context_pt context, bundle_pt *bundle) {
+ 	mock_c()->actualCall("bundleContext_getBundle")
+ 			->withPointerParameters("context", context)
+ 			->withOutputParameter("bundle", (void **) bundle);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundleContext_getFramework(bundle_context_pt context, framework_pt *framework) {
+ 	mock_c()->actualCall("bundleContext_getFramework")
+ 			->withPointerParameters("context", context)
+ 			->withOutputParameter("framework", (void **) framework);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundleContext_installBundle(bundle_context_pt context, const char * location, bundle_pt *bundle) {
+ 	mock_c()->actualCall("bundleContext_installBundle")
+ 			->withPointerParameters("context", context)
+ 			->withStringParameters("location", location)
+ 			->withOutputParameter("bundle", (void **) bundle);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundleContext_installBundle2(bundle_context_pt context, const char * location, const char *inputFile, bundle_pt *bundle) {
+ 	mock_c()->actualCall("bundleContext_installBundle2")
+ 			->withPointerParameters("context", context)
+ 			->withStringParameters("location", location)
+ 			->withStringParameters("inputFile", inputFile)
+ 			->withOutputParameter("bundle", (void **) bundle);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ celix_status_t bundleContext_registerService(bundle_context_pt context, const char * serviceName, const void * svcObj,
+         properties_pt properties, service_registration_pt *service_registration) {
+ 	mock_c()->actualCall("bundleContext_registerService")
+ 			->withPointerParameters("context", context)
+ 			->withStringParameters("serviceName", serviceName)
+ 			->withPointerParameters("svcObj", (void*)svcObj)
+ 			->withPointerParameters("properties", properties)
+ 			->withOutputParameter("service_registration", (void **) service_registration);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundleContext_registerServiceFactory(bundle_context_pt context, const char * serviceName, service_factory_pt factory,
+         properties_pt properties, service_registration_pt *service_registration) {
+ 	mock_c()->actualCall("bundleContext_registerServiceFactory")
+ 			->withPointerParameters("context", context)
+ 			->withStringParameters("serviceName", serviceName)
+ 			->withPointerParameters("factory", factory)
+ 			->withPointerParameters("properties", properties)
+ 			->withOutputParameter("service_registration", (void **) service_registration);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ celix_status_t bundleContext_getServiceReferences(bundle_context_pt context, const char * serviceName, const char * filter, array_list_pt *service_references) {
+ 	mock_c()->actualCall("bundleContext_getServiceReferences")
+ 			->withPointerParameters("context", context)
+ 			->withStringParameters("serviceName", serviceName)
+ 			->withStringParameters("filter", filter)
+ 			->withOutputParameter("service_references", (void **) service_references);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundleContext_getServiceReference(bundle_context_pt context, const char * serviceName, service_reference_pt *service_reference) {
+ 	mock_c()->actualCall("bundleContext_getServiceReference")
+ 			->withPointerParameters("context", context)
+ 			->withStringParameters("serviceName", serviceName)
+ 			->withOutputParameter("service_reference", (void **) service_reference);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundleContext_retainServiceReference(bundle_context_pt context, service_reference_pt reference) {
+     mock_c()->actualCall("bundleContext_retainServiceReference")
+             ->withPointerParameters("context", context)
+             ->withPointerParameters("reference", reference);
+     return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundleContext_ungetServiceReference(bundle_context_pt context, service_reference_pt reference) {
+     mock_c()->actualCall("bundleContext_ungetServiceReference")
+             ->withPointerParameters("context", context)
+             ->withPointerParameters("reference", reference);
+     return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundleContext_getService(bundle_context_pt context, service_reference_pt reference, void **service_instance) {
+ 	mock_c()->actualCall("bundleContext_getService")
+ 			->withPointerParameters("context", context)
+ 			->withPointerParameters("reference", reference)
+ 			->withOutputParameter("service_instance", (void **) service_instance);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundleContext_ungetService(bundle_context_pt context, service_reference_pt reference, bool *result) {
+ 	mock_c()->actualCall("bundleContext_ungetService")
+ 			->withPointerParameters("context", context)
+ 			->withPointerParameters("reference", reference)
+ 			->withOutputParameter("result", (int *) result);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ celix_status_t bundleContext_getBundles(bundle_context_pt context, array_list_pt *bundles) {
+ 	mock_c()->actualCall("bundleContext_getBundles")
+ 			->withPointerParameters("context", context)
+ 			->withOutputParameter("bundles", bundles);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundleContext_getBundleById(bundle_context_pt context, long id, bundle_pt *bundle) {
+ 	mock_c()->actualCall("bundleContext_getBundleById")
+ 			->withPointerParameters("context", context)
+ 			->withLongIntParameters("id", id)
+ 			->withOutputParameter("bundle", bundle);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ celix_status_t bundleContext_addServiceListener(bundle_context_pt context, service_listener_pt listener, const char * filter) {
+ 	mock_c()->actualCall("bundleContext_addServiceListener")
+ 		->withPointerParameters("context", context)
+ 		->withPointerParameters("listener", listener)
+ 		->withStringParameters("filter", filter);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundleContext_removeServiceListener(bundle_context_pt context, service_listener_pt listener) {
+ 	mock_c()->actualCall("bundleContext_removeServiceListener")
+ 		->withPointerParameters("context", context)
+ 		->withPointerParameters("listener", listener);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ celix_status_t bundleContext_addBundleListener(bundle_context_pt context, bundle_listener_pt listener) {
+ 	mock_c()->actualCall("bundleContext_addBundleListener");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundleContext_removeBundleListener(bundle_context_pt context, bundle_listener_pt listener) {
+ 	mock_c()->actualCall("bundleContext_removeBundleListener");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ celix_status_t bundleContext_getProperty(bundle_context_pt context, const char *name, const char** value) {
+ 	mock_c()->actualCall("bundleContext_getProperty")
+ 			->withPointerParameters("context", context)
+ 			->withStringParameters("name", name)
+ 			->withOutputParameter("value", value);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ long celix_bundleContext_registerService(bundle_context_t *ctx, void *svc, const char *serviceName, properties_t *properties) {
+ 	mock_c()->actualCall("celix_bundleContext_registerCService")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withStringParameters("serviceName", serviceName)
+ 			->withPointerParameters("svc", svc)
+ 			->withPointerParameters("properties", properties);
+ 	return mock_c()->returnValue().value.longIntValue;
+ }
+ 
+ long celix_bundleContext_registerServiceWithOptions(celix_bundle_context_t *ctx, const celix_service_registration_options_t *opts) {
+ 	mock_c()->actualCall("celix_bundleContext_registerServiceWithOptions")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withConstPointerParameters("opts", opts);
+ 	return mock_c()->returnValue().value.longIntValue;
+ }
+ 
+ void celix_bundleContext_unregisterService(bundle_context_t *ctx, long serviceId) {
+ 	mock_c()->actualCall("celix_bundleContext_unregisterService")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withLongIntParameters("serviceId", serviceId);
+ }
+ 
+ bool celix_bundleContext_useServiceWithId(
+ 		bundle_context_t *ctx,
+ 		long serviceId,
+ 		const char *serviceName,
+ 		void *callbackHandle,
+ 		void (*use)(void *handle, void* svc)
+ ) {
+ 	mock_c()->actualCall("celix_bundleContext_registerServiceForLang")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withLongIntParameters("serviceId", serviceId)
+ 			->withStringParameters("serviceName", serviceName)
+ 			->withPointerParameters("callbackHandle", callbackHandle)
+ 			->withPointerParameters("use", use);
+ 	return mock_c()->returnValue().value.boolValue;
+ }
+ 
+ dm_dependency_manager_t* celix_bundleContext_getDependencyManager(bundle_context_t *ctx) {
+ 	mock_c()->actualCall("celix_bundleContext_getDependencyManager");
+ 	return mock_c()->returnValue().value.pointerValue;
+ }
+ 
+ long celix_bundleContext_trackBundlesWithOptions(
+ 		bundle_context_t* ctx,
+ 		const celix_bundle_tracking_options_t *opts) {
+ 	mock_c()->actualCall("celix_bundleContext_trackBundlesWithOptions")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withConstPointerParameters("opts", opts);
+ 	return mock_c()->returnValue().value.longIntValue;
+ }
+ 
+ long celix_bundleContext_trackBundles(
+ 		bundle_context_t* ctx,
+ 		void* callbackHandle,
+ 		void (*onStarted)(void* handle, const bundle_t *bundle),
+ 		void (*onStopped)(void *handle, const bundle_t *bundle)) {
+ 	mock_c()->actualCall("celix_bundleContext_trackBundles")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withPointerParameters("callbackHandle", callbackHandle)
+ 			->withPointerParameters("onStarted", onStarted)
+ 			->withPointerParameters("onStopped", onStopped);
+ 	return mock_c()->returnValue().value.longIntValue;
+ }
+ 
+ 
+ void celix_bundleContext_useBundles(
+ 		bundle_context_t *ctx,
+ 		void *callbackHandle,
+ 		void (*use)(void *handle, const bundle_t *bundle)) {
+ 	mock_c()->actualCall("celix_bundleContext_useBundles")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withPointerParameters("callbackHandle", callbackHandle)
+ 			->withPointerParameters("use", use);
+ }
+ 
+ 
 -void celix_bundleContext_useBundle(
++bool celix_bundleContext_useBundle(
+ 		bundle_context_t *ctx,
+ 		long bundleId,
+ 		void *callbackHandle,
+ 		void (*use)(void *handle, const bundle_t *bundle)) {
+ 	mock_c()->actualCall("celix_bundleContext_useBundle")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withLongIntParameters("bundleId", bundleId)
+ 			->withPointerParameters("callbackHandle", callbackHandle)
+ 			->withPointerParameters("use", use);
++	return mock_c()->returnValue().value.boolValue;
+ }
+ 
+ void celix_bundleContext_stopTracker(bundle_context_t *ctx, long trackerId) {
+ 	mock_c()->actualCall("celix_bundleContext_stopTracker")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withLongIntParameters("trackerId", trackerId);
+ }
+ 
+ long celix_bundleContext_installBundle(bundle_context_t *ctx, const char *bundleLoc, bool autoStart) {
+ 	mock_c()->actualCall("celix_bundleContext_installBundle")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withStringParameters("bundleLoc", bundleLoc)
+ 			->withBoolParameters("autoStart", autoStart);
+ 	return mock_c()->returnValue().value.longIntValue;
+ }
+ 
+ bool celix_bundleContext_uninstallBundle(bundle_context_t *ctx, long bundleId) {
+ 	mock_c()->actualCall("celix_bundleContext_uninstallBundle")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withLongIntParameters("bundleId", bundleId);
+ 	return mock_c()->returnValue().value.boolValue;
+ }
+ 
+ bool celix_bundleContext_useServiceWithOptions(
+ 		celix_bundle_context_t *ctx,
+ 		const celix_service_use_options_t *opts) {
+ 	mock_c()->actualCall("celix_bundleContext_useServiceWithOptions")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withConstPointerParameters("opts", opts);
+ 	return mock_c()->returnValue().value.boolValue;
+ }
+ 
+ 
+ void celix_bundleContext_useServicesWithOptions(
+ 		celix_bundle_context_t *ctx,
+ 		const celix_service_use_options_t *opts) {
+ 	mock_c()->actualCall("celix_bundleContext_useServicesWithOptions")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withConstPointerParameters("opts", opts);
+ }
+ 
+ long celix_bundleContext_registerServiceFactory(celix_bundle_context_t *ctx, celix_service_factory_t *factory, const char *serviceName, celix_properties_t *props) {
+ 	mock_c()->actualCall("celix_bundleContext_registerServiceFactory")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withStringParameters("serviceName", serviceName)
+ 			->withPointerParameters("factory", factory)
+ 			->withPointerParameters("props", props);
+ 	return mock_c()->returnValue().value.longIntValue;
+ }
+ 
+ long celix_bundleContext_findService(celix_bundle_context_t *ctx, const char *serviceName) {
+ 	mock_c()->actualCall("celix_bundleContext_findService")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withStringParameters("serviceName", serviceName);
+ 	return mock_c()->returnValue().value.longIntValue;
+ }
+ 
+ 
+ long celix_bundleContext_findServiceWithOptions(celix_bundle_context_t *ctx, const celix_service_filter_options_t *opts) {
+ 	mock_c()->actualCall("celix_bundleContext_findServiceWithOptions")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withConstPointerParameters("opts", opts);
+ 	return mock_c()->returnValue().value.longIntValue;
+ }
+ 
+ 
+ celix_array_list_t* celix_bundleContext_findServices(celix_bundle_context_t *ctx, const char *serviceName) {
+ 	mock_c()->actualCall("celix_bundleContext_findServices")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withStringParameters("serviceName", serviceName);
+ 	return mock_c()->returnValue().value.pointerValue;
+ }
+ 
+ celix_array_list_t* celix_bundleContext_findServicesWithOptions(celix_bundle_context_t *ctx, const celix_service_filter_options_t *opts) {
+ 	mock_c()->actualCall("celix_bundleContext_findServicesWithOptions")
+ 			->withPointerParameters("ctx", ctx)
+ 			->withConstPointerParameters("opts", opts);
+ 	return mock_c()->returnValue().value.pointerValue;
+ }

http://git-wip-us.apache.org/repos/asf/celix/blob/2e04253d/libs/framework/private/mock/bundle_mock.c
----------------------------------------------------------------------
diff --cc libs/framework/private/mock/bundle_mock.c
index 0000000,8ab5068..b842ffb
mode 000000,100644..100644
--- a/libs/framework/private/mock/bundle_mock.c
+++ b/libs/framework/private/mock/bundle_mock.c
@@@ -1,0 -1,294 +1,308 @@@
+ /**
+  *Licensed to the Apache Software Foundation (ASF) under one
+  *or more contributor license agreements.  See the NOTICE file
+  *distributed with this work for additional information
+  *regarding copyright ownership.  The ASF licenses this file
+  *to you under the Apache License, Version 2.0 (the
+  *"License"); you may not use this file except in compliance
+  *with the License.  You may obtain a copy of the License at
+  *
+  *  http://www.apache.org/licenses/LICENSE-2.0
+  *
+  *Unless required by applicable law or agreed to in writing,
+  *software distributed under the License is distributed on an
+  *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  * KIND, either express or implied.  See the License for the
+  *specific language governing permissions and limitations
+  *under the License.
+  */
+ /*
+  * bundle_mock.c
+  *
+  *  \date       Feb 7, 2013
+  *  \author     <a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
+  *  \copyright  Apache License, Version 2.0
+  */
+ #include <CppUTestExt/MockSupport_c.h>
+ #include "CppUTestExt/MockSupport_c.h"
+ 
+ #include "bundle_private.h"
+ 
+ celix_status_t bundle_create(bundle_pt * bundle) {
+ 	mock_c()->actualCall("bundle_create")
+ 			->withOutputParameter("bundle", bundle);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_createFromArchive(bundle_pt * bundle, framework_pt framework, bundle_archive_pt archive) {
+ 	mock_c()->actualCall("bundle_createFromArchive")
+ 			->withPointerParameters("bundle", bundle)
+ 			->withPointerParameters("framework", framework)
+ 			->withPointerParameters("archive", archive);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_destroy(bundle_pt bundle) {
+ 	mock_c()->actualCall("destroy");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ celix_status_t bundle_isSystemBundle(bundle_pt bundle, bool *systemBundle) {
+ 	mock_c()->actualCall("bundle_isSystembundle")
+ 			->withPointerParameters("bundle", bundle)
+ 			->withOutputParameter("systemBundle", systemBundle);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_getArchive(bundle_pt bundle, bundle_archive_pt *archive) {
+ 	mock_c()->actualCall("bundle_getArchive");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_getCurrentModule(bundle_pt bundle, module_pt *module) {
+ 	mock_c()->actualCall("bundle_getCurrentModule")
+ 		->withPointerParameters("bundle", bundle)
+ 		->withOutputParameter("module", (void **) module);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ array_list_pt bundle_getModules(bundle_pt bundle) {
+ 	mock_c()->actualCall("bundle_getModules");
+ 	return mock_c()->returnValue().value.pointerValue;
+ }
+ 
+ void * bundle_getHandle(bundle_pt bundle) {
+ 	mock_c()->actualCall("bundle_getHandle");
+ 	return mock_c()->returnValue().value.pointerValue;
+ }
+ 
+ void bundle_setHandle(bundle_pt bundle, void * handle) {
+ 	mock_c()->actualCall("bundle_setHandle");
+ }
+ 
+ activator_pt bundle_getActivator(bundle_pt bundle) {
+ 	mock_c()->actualCall("bundle_getActivator");
+ 	return mock_c()->returnValue().value.pointerValue;
+ }
+ 
+ celix_status_t bundle_setActivator(bundle_pt bundle, activator_pt activator) {
+ 	mock_c()->actualCall("bundle_setActivator");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_getContext(bundle_pt bundle, bundle_context_pt *context) {
+ 	mock_c()->actualCall("bundle_getContext")
+ 			->withPointerParameters("bundle", bundle)
+ 			->withOutputParameter("context", context);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_setContext(bundle_pt bundle, bundle_context_pt context) {
+ 	mock_c()->actualCall("bundle_setContext");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_getEntry(bundle_pt bundle, const char * name, char **entry) {
+ 	mock_c()->actualCall("bundle_getEntry")
+ 			->withPointerParameters("bundle", bundle)
+ 			->withStringParameters("name", name)
+ 			->withOutputParameter("entry", entry);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_start(bundle_pt bundle) {
+ 	mock_c()->actualCall("bundle_start");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_startWithOptions(bundle_pt bundle, int options) {
+ 	mock_c()->actualCall("bundle_startWithOptions");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_update(bundle_pt bundle, const char *inputFile) {
+ 	mock_c()->actualCall("bundle_update");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_stop(bundle_pt bundle) {
+ 	mock_c()->actualCall("bundle_stop");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_stopWithOptions(bundle_pt bundle, int options) {
+ 	mock_c()->actualCall("bundle_stopWithOptions");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_uninstall(bundle_pt bundle) {
+ 	mock_c()->actualCall("bundle_uninstall");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ celix_status_t bundle_setState(bundle_pt bundle, bundle_state_e state) {
+ 	mock_c()->actualCall("bundle_setState");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_setPersistentStateInactive(bundle_pt bundle) {
+ 	mock_c()->actualCall("bundle_setPersistentStateInactive");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_setPersistentStateUninstalled(bundle_pt bundle) {
+ 	mock_c()->actualCall("bundle_setPersistentStateUninstalled");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ void uninstallBundle(bundle_pt bundle) {
+ 	mock_c()->actualCall("uninstallBundle");
+ }
+ 
+ 
+ celix_status_t bundle_revise(bundle_pt bundle, const char * location, const char *inputFile) {
+ 	mock_c()->actualCall("bundle_revise");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_addModule(bundle_pt bundle, module_pt module) {
+ 	mock_c()->actualCall("bundle_addModule");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_closeModules(bundle_pt bundle) {
+ 	mock_c()->actualCall("bundle_closeModules");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ // Service Reference Functions
+ array_list_pt getUsingBundles(service_reference_pt reference) {
+ 	mock_c()->actualCall("getUsingBundles");
+ 	return mock_c()->returnValue().value.pointerValue;
+ }
+ 
+ 
+ int compareTo(service_reference_pt a, service_reference_pt b) {
+ 	mock_c()->actualCall("service_reference_pt");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ celix_status_t bundle_getState(bundle_pt bundle, bundle_state_e *state) {
+ 	mock_c()->actualCall("bundle_getState")
+ 			->withPointerParameters("bundle", bundle)
+ 			->withOutputParameter("state", state);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_isLockable(bundle_pt bundle, bool *lockable) {
+ 	mock_c()->actualCall("bundle_isLockable")
+ 			->withPointerParameters("bundle", bundle)
+ 			->withOutputParameter("lockable", lockable);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_getLockingThread(bundle_pt bundle, celix_thread_t *thread) {
+ 	mock_c()->actualCall("bundle_getLockingThread")
+ 			->withPointerParameters("bundle", bundle)
+ 			->withOutputParameter("thread", thread);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_lock(bundle_pt bundle, bool *locked) {
+ 	mock_c()->actualCall("bundle_lock")
+ 			->withPointerParameters("bundle", bundle)
+ 			->withOutputParameter("locked", locked);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_unlock(bundle_pt bundle, bool *unlocked) {
+ 	mock_c()->actualCall("bundle_unlock")
+ 			->withPointerParameters("bundle", bundle)
+ 			->withOutputParameter("unlocked", unlocked);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ celix_status_t bundle_closeAndDelete(bundle_pt bundle) {
+ 	mock_c()->actualCall("bundle_closeAndDelete");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_close(bundle_pt bundle) {
+ 	mock_c()->actualCall("bundle_close");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ celix_status_t bundle_refresh(bundle_pt bundle) {
+ 	mock_c()->actualCall("bundle_refresh");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_getBundleId(bundle_pt bundle, long *id) {
+ 	mock_c()->actualCall("bundle_getBundleId")
+ 			->withPointerParameters("bundle", bundle)
+ 			->withOutputParameter("id", id);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
+ celix_status_t bundle_getRegisteredServices(bundle_pt bundle, array_list_pt *list) {
+ 	mock_c()->actualCall("bundle_getRegisteredServices")
+ 			->withPointerParameters("bundle", bundle)
+ 			->withOutputParameter("list", list);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_getServicesInUse(bundle_pt bundle, array_list_pt *list) {
+ 	mock_c()->actualCall("bundle_getServicesInUse")
+ 			->withPointerParameters("bundle", bundle)
+ 			->withOutputParameter("list", list);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_setFramework(bundle_pt bundle, framework_pt framework) {
+ 	mock_c()->actualCall("bundle_setFramework");
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ celix_status_t bundle_getFramework(bundle_pt bundle, framework_pt *framework) {
+ 	mock_c()->actualCall("bundle_getFramework")
+ 			->withPointerParameters("bundle", bundle)
+ 			->withOutputParameter("framework", framework);
+ 	return mock_c()->returnValue().value.intValue;
+ }
+ 
+ long celix_bundle_getId(const bundle_t *bnd) {
+ 	mock_c()->actualCall("celix_bundle_getId")
+ 			->withConstPointerParameters("bnd", bnd);
+ 	return mock_c()->returnValue().value.longIntValue;
+ }
+ 
+ celix_bundle_state_e celix_bundle_getState(const bundle_t *bnd) {
+ 	mock_c()->actualCall("celix_bundle_getState")
+ 			->withConstPointerParameters("bnd", bnd);
+ 	return (celix_bundle_state_e)mock_c()->returnValue().value.intValue;
+ }
+ 
+ 
++celix_status_t bundle_getBundleLocation(bundle_pt bundle, const char **location) {
++	mock_c()->actualCall("bundle_getBundleLocation")
++			->withPointerParameters("bundle", bundle)
++			->withOutputParameter("location", location);
++	return mock_c()->returnValue().value.intValue;
++}
++
++
++celix_status_t bundle_getBundleCache(bundle_pt bundle, const char **cache) {
++	mock_c()->actualCall("bundle_getBundleCache")
++			->withPointerParameters("bundle", bundle)
++			->withOutputParameter("cache", cache);
++	return mock_c()->returnValue().value.intValue;
++}
+