http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/celix_api.h ---------------------------------------------------------------------- diff --git a/framework/include/celix_api.h b/framework/include/celix_api.h deleted file mode 100644 index 5129a65..0000000 --- a/framework/include/celix_api.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - *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. - */ - -#ifndef CELIX_CELIX_API_H_ -#define CELIX_CELIX_API_H_ - -#include "properties.h" - -#include "array_list.h" -#include "celix_array_list.h" - -#include "constants.h" - -#include "celix_utils_api.h" - -#include "bundle.h" -#include "celix_bundle.h" - -#include "bundle_context.h" -#include "celix_bundle_context.h" - -#include "service_registration.h" -#include "service_factory.h" -#include "service_reference.h" -#include "service_tracker.h" -#include "service_tracker_customizer.h" -#include "listener_hook_service.h" - -#include "framework.h" -#include "celix_framework_factory.h" -#include "celix_launcher.h" - -#include "dm_dependency_manager.h" -#include "dm_service_dependency.h" - -#endif //CELIX_CELIX_API_H_
http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/celix_bundle.h ---------------------------------------------------------------------- diff --git a/framework/include/celix_bundle.h b/framework/include/celix_bundle.h deleted file mode 100644 index 62fdfd0..0000000 --- a/framework/include/celix_bundle.h +++ /dev/null @@ -1,62 +0,0 @@ -/** - *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 "bundle_state.h" - -#ifndef CELIX_BUNDLE_H_ -#define CELIX_BUNDLE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Returns the bundle id. - * @param bnd The bundle - * @return The bundle id or < 0 if something went wrong. - */ -long celix_bundle_getId(const bundle_t *bnd); - -/** - * Returns the bundle state. - * @param bnd The bundle - * @return The bundle state or OSGI_FRAMEWORK_BUNDLE_UNKNOWN if something went wrong. - */ -celix_bundle_state_e celix_bundle_getState(const bundle_t *bnd); - -/** - * Returns a the use-able entry path for the provided relative path to a bundle resource. - * - * For example if there is a resource entry in the bundle at path 'META-INF/descriptors/foo.descriptor` this call - * will return a absolute or relative path to the extracted location of the bundle resource, e.g.: - * .cache/bundle5/version0.0/META-INF/descriptors/foo.descriptor - * - * The caller is responsible for freeing the returned path entry. - * @param bnd The bundle - * @return A use-able path to the bundle resource entry of NULL if the entry is not found. - */ -char* celix_bundle_getEntry(const bundle_t* bnd, const char *path); - - -#ifdef __cplusplus -} -#endif - -#endif /* CELIX_BUNDLE_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/celix_bundle_context.h ---------------------------------------------------------------------- diff --git a/framework/include/celix_bundle_context.h b/framework/include/celix_bundle_context.h deleted file mode 100644 index 50968e1..0000000 --- a/framework/include/celix_bundle_context.h +++ /dev/null @@ -1,740 +0,0 @@ -/** - *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 - -/********************************************************************************************************************** - ********************************************************************************************************************** - * Updated API - ********************************************************************************************************************** - **********************************************************************************************************************/ - -/** -* 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 (e.g. 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 when a service tacker 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, \ - .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( - 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); - -#ifdef __cplusplus -} -#endif - -#endif //CELIX_BUNDLE_CONTEXT_H_ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/celix_framework.h ---------------------------------------------------------------------- diff --git a/framework/include/celix_framework.h b/framework/include/celix_framework.h deleted file mode 100644 index ac3193e..0000000 --- a/framework/include/celix_framework.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - *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. - */ -#ifndef CELIX_FRAMEWORK_H_ -#define CELIX_FRAMEWORK_H_ - -typedef struct framework celix_framework_t; - -#include "celix_types.h" -#include "celix_properties.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Returns the framework UUID. This is unique for every created framework and will not be the same if the process is - * restarted. - */ -const char* celix_framework_getUUID(const celix_framework_t *fw); - -/** - * Returns the framework bundle context. This is the same as a 'normal' bundle context and can be used to register, use - * and track services. The only difference is that the framework is the bundle. - * @param fw The framework - * @return A pointer to the bundle context of the framework or NULL if something went wrong. - */ -celix_bundle_context_t* celix_framework_getFrameworkContext(const celix_framework_t *fw); - -/** - * Returns the framework bundle. This is the same as a 'normal' bundle, expect that this bundle cannot be uninstalled - * and the `celix_bundle_getEntry` return a entries relative from the working directory. - * @param fw The framework - * @return A pointer to the bundle of the framework or NULL if something went wrong. - */ -celix_bundle_t* celix_framework_getFrameworkBundle(const celix_framework_t *fw); - - -#ifdef __cplusplus -} -#endif - -#endif /* CELIX_FRAMEWORK_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/celix_framework_factory.h ---------------------------------------------------------------------- diff --git a/framework/include/celix_framework_factory.h b/framework/include/celix_framework_factory.h deleted file mode 100644 index 70d2678..0000000 --- a/framework/include/celix_framework_factory.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - *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. - */ - -#ifndef CELIX_FRAMEWORK_FACTORY_H_ -#define CELIX_FRAMEWORK_FACTORY_H_ - -#include "framework.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Creates a new framework. The framework will be in the started state. - * @param config The framework configuration. Can be NULL. - * @return a started framework or NULL - */ -framework_t* frameworkFactory_newFramework(properties_t *config); - - -#ifdef __cplusplus -} -#endif - -#endif /* CELIX_FRAMEWORK_FACTORY_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/celix_launcher.h ---------------------------------------------------------------------- diff --git a/framework/include/celix_launcher.h b/framework/include/celix_launcher.h deleted file mode 100644 index 579eef7..0000000 --- a/framework/include/celix_launcher.h +++ /dev/null @@ -1,116 +0,0 @@ -/** - *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:d...@celix.apache.org">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ - -#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 http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/celix_log.h ---------------------------------------------------------------------- diff --git a/framework/include/celix_log.h b/framework/include/celix_log.h deleted file mode 100644 index 08d096c..0000000 --- a/framework/include/celix_log.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - *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_log.h - * - * \date Jan 12, 2012 - * \author <a href="mailto:d...@celix.apache.org">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ - -#ifndef CELIX_LOG_H_ -#define CELIX_LOG_H_ - -#include <stdio.h> - -#include "celix_errno.h" -#include "framework_exports.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum framework_log_level { - OSGI_FRAMEWORK_LOG_ERROR = 0x00000001, - OSGI_FRAMEWORK_LOG_WARNING = 0x00000002, - OSGI_FRAMEWORK_LOG_INFO = 0x00000003, - OSGI_FRAMEWORK_LOG_DEBUG = 0x00000004, -}; - -typedef enum framework_log_level framework_log_level_t; - -typedef struct framework_logger *framework_logger_pt; - -extern framework_logger_pt logger; - -typedef celix_status_t (*framework_log_function_pt)(framework_log_level_t level, const char *func, const char *file, - int line, const char *msg); - -struct framework_logger { - framework_log_function_pt logFunction; -}; - -#define fw_log(logger, level, fmsg, args...) framework_log(logger, level, __func__, __FILE__, __LINE__, fmsg, ## args) -#define fw_logCode(logger, level, code, fmsg, args...) framework_logCode(logger, level, __func__, __FILE__, __LINE__, code, fmsg, ## args) -#define framework_logIfError(logger, status, error, fmsg, args...) \ - if (status != CELIX_SUCCESS) { \ - if (error != NULL) { \ - fw_logCode(logger, OSGI_FRAMEWORK_LOG_ERROR, status, #fmsg";\n Cause: %s", ## args, error); \ - } else { \ - fw_logCode(logger, OSGI_FRAMEWORK_LOG_ERROR, status, #fmsg, ## args); \ - } \ - } - -FRAMEWORK_EXPORT celix_status_t -frameworkLogger_log(framework_log_level_t level, const char *func, const char *file, int line, const char *fmsg); - -FRAMEWORK_EXPORT void -framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, - const char *fmsg, ...); - -FRAMEWORK_EXPORT void -framework_logCode(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, - celix_status_t code, const char *fmsg, ...); - -#ifdef __cplusplus -} -#endif - -#endif /* CELIX_LOG_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/celix_service_factory.h ---------------------------------------------------------------------- diff --git a/framework/include/celix_service_factory.h b/framework/include/celix_service_factory.h deleted file mode 100644 index 90d2c73..0000000 --- a/framework/include/celix_service_factory.h +++ /dev/null @@ -1,44 +0,0 @@ -/** - *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_properties.h" -#include "bundle.h" - -#ifndef CELIX_SERVICE_FACTORY_H_ -#define CELIX_SERVICE_FACTORY_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct celix_service_factory celix_service_factory_t; - -struct celix_service_factory { - void *handle; - - void* (*getService)(void *handle, const celix_bundle_t *requestingBundle, const celix_properties_t *svcProperties); - - void (*ungetService)(void *handle, const celix_bundle_t *requestingBundle, const celix_properties_t *svcProperties); -}; - -#ifdef __cplusplus -} -#endif - -#endif /* CELIX_SERVICE_FACTORY_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/celix_types.h ---------------------------------------------------------------------- diff --git a/framework/include/celix_types.h b/framework/include/celix_types.h deleted file mode 100644 index 6e02c63..0000000 --- a/framework/include/celix_types.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - *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. - */ - -#ifndef CELIX_CELIX_TYPES_H -#define CELIX_CELIX_TYPES_H - -/** - * Celix types contains the declaration of many of the celix types. - * These types are declared in a separate header for forward declaration - */ - -typedef struct bundle * bundle_pt; -typedef struct bundle bundle_t; -typedef struct bundle celix_bundle_t; - -typedef struct bundleArchive *bundle_archive_pt; -typedef struct bundleArchive bundle_archive_t; - -typedef struct bundleRevision *bundle_revision_pt; -typedef struct bundleRevision bundle_revision_t; - -typedef struct bundleContext *bundle_context_pt; -typedef struct bundleContext bundle_context_t; -typedef struct bundleContext celix_bundle_context_t; - -typedef struct dm_dependency_manager *dm_dependency_manager_pt; -typedef struct dm_dependency_manager dm_dependency_manager_t; - -typedef struct dm_component_struct *dm_component_pt; -typedef struct dm_component_struct dm_component_t; - -typedef struct dm_service_dependency *dm_service_dependency_pt; -typedef struct dm_service_dependency dm_service_dependency_t; - -typedef struct service_factory *service_factory_pt; //deprecated - -#endif //CELIX_CELIX_TYPES_H http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/constants.h ---------------------------------------------------------------------- diff --git a/framework/include/constants.h b/framework/include/constants.h deleted file mode 100644 index 06d89be..0000000 --- a/framework/include/constants.h +++ /dev/null @@ -1,79 +0,0 @@ -/** - *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:d...@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_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/dm_activator.h ---------------------------------------------------------------------- diff --git a/framework/include/dm_activator.h b/framework/include/dm_activator.h deleted file mode 100644 index 86f33db..0000000 --- a/framework/include/dm_activator.h +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * dm_activator_base.h - * - * \date 26 Jul 2014 - * \author <a href="mailto:d...@celix.apache.org">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ - - -#ifndef DM_ACTIVATOR_BASE_H_ -#define DM_ACTIVATOR_BASE_H_ - - -#include "bundle_context.h" -#include "celix_errno.h" -#include "dm_dependency_manager.h" -#include "dm_component.h" -#include "dm_service_dependency.h" -#include "bundle_activator.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Should be implemented by a bundle specific DM activator. - * Should allocate and initialize a bundle specific activator struct. - */ -celix_status_t dm_create(bundle_context_pt context, void ** userData); - -/** - * Should be implemented by a bundle specific DM activator. - * Will be called after the dm_create function. - * Can be used to specify with use of the provided dependency manager the bundle specific components. - */ -celix_status_t dm_init(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager); - -/** - * Should be implemented by a bundle specific DM activator. - * Should deinitialize and deallocate the undle specific activator struct. - */ -celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager); - -#ifdef __cplusplus -} -#endif - -#endif /* DM_ACTIVATOR_BASE_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/dm_component.h ---------------------------------------------------------------------- diff --git a/framework/include/dm_component.h b/framework/include/dm_component.h deleted file mode 100644 index b3236a9..0000000 --- a/framework/include/dm_component.h +++ /dev/null @@ -1,158 +0,0 @@ -/** - *Licensed to the Apache Software Foundation (ASF) under one - *or more contributor license agreements. See the NOTICE file - *distributed with this work for additional information - *regarding copyright ownership. The ASF licenses this file - *to you under the Apache License, Version 2.0 (the - *"License"); you may not use this file except in compliance - *with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - *Unless required by applicable law or agreed to in writing, - *software distributed under the License is distributed on an - *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - *specific language governing permissions and limitations - *under the License. - */ -/* - * dm_component.h - * - * \date 8 Oct 2014 - * \author <a href="mailto:d...@celix.apache.org">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ - -#ifndef COMPONENT_H_ -#define COMPONENT_H_ - -#include <stdbool.h> - -#include "celix_types.h" -#include "celix_errno.h" -#include "properties.h" -#include "array_list.h" -#include "dm_info.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum dm_component_state_enum { - DM_CMP_STATE_INACTIVE = 1, - DM_CMP_STATE_WAITING_FOR_REQUIRED = 2, - DM_CMP_STATE_INSTANTIATED_AND_WAITING_FOR_REQUIRED = 3, - DM_CMP_STATE_TRACKING_OPTIONAL = 4, -} dm_component_state_t; - -#define DM_COMPONENT_MAX_ID_LENGTH 64 -#define DM_COMPONENT_MAX_NAME_LENGTH 128 - -typedef int (*init_fpt)(void *userData); -typedef int (*start_fpt)(void *userData); -typedef int (*stop_fpt)(void *userData); -typedef int (*deinit_fpt)(void *userData); - -/** - * Creates a DM Component - * Caller has ownership. - */ -celix_status_t component_create(bundle_context_t *context, const char* name, dm_component_t **component); - -/** - * Destroys a DM Component - */ -void component_destroy(dm_component_t *component); - - -/** - * Specify if a default 'service.lang=C' should be added to the properties of interfaces if no 'service.lang' has been - * provided. Default is false. Note that this should be set before using component_addInterface. - */ -celix_status_t component_setCLanguageProperty(dm_component_t *component, bool setCLangProp); - - -/** - * Adds a C interface to provide as service to the Celix framework. - * - * @param serviceName the service name. - * @param version The version of the interface (e.g. "1.0.0"), Can be a NULL pointer. - * @param properties To (meta) properties to provide with the service. Can be a NULL pointer. - */ -celix_status_t component_addInterface(dm_component_t *component, const char* serviceName, const char* serviceVersion, const void* service, properties_t *properties); - -/** - * Sets the implementation of the component. e.g. the component handle/self/this pointer. - */ -celix_status_t component_setImplementation(dm_component_t *component, void* implementation); - -/** - * Returns an arraylist of service names. The caller owns the arraylist and strings (char *) - */ -celix_status_t component_getInterfaces(dm_component_t *component, array_list_t **servicesNames); - -/** - * Adds a C service dependency to the component - */ -celix_status_t component_addServiceDependency(dm_component_t *component, dm_service_dependency_t *dep); - -/** - * Removes a C service dependency to the component - */ -celix_status_t component_removeServiceDependency(dm_component_t *component, dm_service_dependency_t *dependency); - -/** - * Returns the current state of the component. - */ -dm_component_state_t component_currentState(dm_component_t *cmp); - -/** - * Returns the implementation of the component. e.g. the component handle/self/this pointer. - */ -void * component_getImplementation(dm_component_t *cmp); - -/** - * Returns the DM component name. This is used when printing information about the component. - */ -const char * component_getName(dm_component_t *cmp); - -/** - * Returns bundle context for the bundle where this DM component is part of. - */ -celix_status_t component_getBundleContext(dm_component_t *component, bundle_context_t **out); - -/** - * Set the component life cycle callbacks. - * The first argument will be the component implementation (@see component_getImplementation) - */ -celix_status_t component_setCallbacks(dm_component_t *component, init_fpt init, start_fpt start, stop_fpt stop, deinit_fpt deinit); - -/** - * Set the component life cycle callbacks using a MACRO for improving the type safety. - */ -#define component_setCallbacksSafe(dmCmp, type, init, start, stop, deinit) \ - do { \ - int (*tmp_init)(type) = (init); \ - int (*tmp_start)(type) = (start); \ - int (*tmp_stop)(type) = (stop); \ - int (*tmp_deinit)(type) = (deinit); \ - component_setCallbacks((dmCmp), (init_fpt)tmp_init, (start_fpt)tmp_start, (stop_fpt)tmp_stop, (deinit_fpt)tmp_deinit); \ - } while(0) - -/** - * Create a DM Component info struct. Containing information about the component. - * Caller has ownership. - */ -celix_status_t component_getComponentInfo(dm_component_t *component, dm_component_info_pt *info); - -/** - * Destroys a DM Component info struct. - */ -void component_destroyComponentInfo(dm_component_info_pt info); - -#ifdef __cplusplus -} -#endif - -#endif /* COMPONENT_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/dm_dependency_manager.h ---------------------------------------------------------------------- diff --git a/framework/include/dm_dependency_manager.h b/framework/include/dm_dependency_manager.h deleted file mode 100644 index 1fce27f..0000000 --- a/framework/include/dm_dependency_manager.h +++ /dev/null @@ -1,83 +0,0 @@ -/** - *Licensed to the Apache Software Foundation (ASF) under one - *or more contributor license agreements. See the NOTICE file - *distributed with this work for additional information - *regarding copyright ownership. The ASF licenses this file - *to you under the Apache License, Version 2.0 (the - *"License"); you may not use this file except in compliance - *with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - *Unless required by applicable law or agreed to in writing, - *software distributed under the License is distributed on an - *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - *specific language governing permissions and limitations - *under the License. - */ -/* - * dm_dependency_manager.h - * - * \date 22 Feb 2014 - * \author <a href="mailto:d...@celix.apache.org">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ - -#ifndef DM_DEPENDENCY_MANAGER_H_ -#define DM_DEPENDENCY_MANAGER_H_ - -#include "celix_types.h" - -#include "celix_errno.h" -#include "array_list.h" -#include "dm_info.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Creates a dependency manager. - * Caller has ownership. - */ - //TODO make this private, dep man should always be retrieved from the bundle context -celix_status_t dependencyManager_create(bundle_context_t *context, dm_dependency_manager_t **manager); - -/** - * Destroys the provided dependency manager - */ -void dependencyManager_destroy(dm_dependency_manager_t *manager); - -/** - * Adds a DM component to the dependency manager - */ -celix_status_t dependencyManager_add(dm_dependency_manager_t *manager, dm_component_t *component); - -/** - * Removes a DM component from the dependency manager and destroys it - */ -celix_status_t dependencyManager_remove(dm_dependency_manager_t *manager, dm_component_t *component); - -/** - * Removes all DM components from the dependency manager - */ -celix_status_t dependencyManager_removeAllComponents(dm_dependency_manager_t *manager); - -/** - * Create and returns a DM Info struct. Which contains information about the state of the DM components - * Caller has ownership. - */ -celix_status_t dependencyManager_getInfo(dm_dependency_manager_t *manager, dm_dependency_manager_info_t **info); - -/** - * Destroys a DM info struct. - */ -void dependencyManager_destroyInfo(dm_dependency_manager_t *manager, dm_dependency_manager_info_t *info); - -#ifdef __cplusplus -} -#endif - -#endif /* DM_DEPENDENCY_MANAGER_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/dm_info.h ---------------------------------------------------------------------- diff --git a/framework/include/dm_info.h b/framework/include/dm_info.h deleted file mode 100644 index 8074ab6..0000000 --- a/framework/include/dm_info.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - *Licensed to the Apache Software Foundation (ASF) under one - *or more contributor license agreements. See the NOTICE file - *distributed with this work for additional information - *regarding copyright ownership. The ASF licenses this file - *to you under the Apache License, Version 2.0 (the - *"License"); you may not use this file except in compliance - *with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - *Unless required by applicable law or agreed to in writing, - *software distributed under the License is distributed on an - *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - *specific language governing permissions and limitations - *under the License. - */ -/* - * dm_server.h - * - * \date 15 Oct 2015 - * \author <a href="mailto:d...@celix.apache.org">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ -#ifndef CELIX_DM_INFO_SERVICE_H -#define CELIX_DM_INFO_SERVICE_H - - - -#include <stdbool.h> -#include "array_list.h" -#include "properties.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define DM_INFO_SERVICE_NAME "dm_info" - - -typedef struct dm_interface_info_struct { - char* name; - properties_pt properties; -} dm_interface_info_t; -typedef struct dm_interface_info_struct *dm_interface_info_pt; - -typedef struct dm_service_dependency_info_struct { - char *filter; - bool available; - bool required; - size_t count; -} dm_service_dependency_info_t; -typedef struct dm_service_dependency_info_struct *dm_service_dependency_info_pt; - -typedef struct dm_component_info_struct { - char id[64]; - char name[128]; - bool active; - char * state; - array_list_pt interfaces; // type dm_interface_info_pt - array_list_pt dependency_list; // type dm_service_dependency_info_pt -} dm_component_info_t; -typedef struct dm_component_info_struct *dm_component_info_pt; - -typedef struct dm_dependency_manager_info_struct { - array_list_pt components; // type dm_component_info -} dm_dependency_manager_info_t; -typedef struct dm_dependency_manager_info_struct *dm_dependency_manager_info_pt; - - -#ifdef __cplusplus -} -#endif - -#endif //CELIX_DM_INFO_SERVICE_H http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/dm_service_dependency.h ---------------------------------------------------------------------- diff --git a/framework/include/dm_service_dependency.h b/framework/include/dm_service_dependency.h deleted file mode 100644 index 9ed78e3..0000000 --- a/framework/include/dm_service_dependency.h +++ /dev/null @@ -1,172 +0,0 @@ -/** - *Licensed to the Apache Software Foundation (ASF) under one - *or more contributor license agreements. See the NOTICE file - *distributed with this work for additional information - *regarding copyright ownership. The ASF licenses this file - *to you under the Apache License, Version 2.0 (the - *"License"); you may not use this file except in compliance - *with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - *Unless required by applicable law or agreed to in writing, - *software distributed under the License is distributed on an - *"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - *specific language governing permissions and limitations - *under the License. - */ -/* - * dm_service_dependency.h - * - * \date 8 Oct 2014 - * \author <a href="mailto:d...@celix.apache.org">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ - -#ifndef DM_SERVICE_DEPENDENCY_H_ -#define DM_SERVICE_DEPENDENCY_H_ - -#include "celix_types.h" -#include "celix_errno.h" -#include "celix_threads.h" -#include "service_reference.h" - -#include "dm_info.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef enum dm_service_dependency_strategy_enum { - DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING, - DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND -} dm_service_dependency_strategy_t; - -typedef int (*service_set_fpt)(void *handle, const void* service); -typedef int (*service_add_fpt)(void *handle, const void* service); -typedef int (*service_change_fpt)(void *handle, const void* service); -typedef int (*service_remove_fpt)(void *handle, const void* service); -typedef int (*service_swap_fpt)(void *handle, const void* oldService, const void* newService); - -typedef celix_status_t (*service_set_with_ref_fpt)(void *handle, service_reference_pt reference, const void* service); -typedef celix_status_t (*service_add_with_ref_fpt)(void *handle, service_reference_pt reference, const void* service); -typedef celix_status_t (*service_change_with_ref_fpt)(void *handle, service_reference_pt reference, const void* service); -typedef celix_status_t (*service_remove_with_ref_fpt)(void *handle, service_reference_pt reference, const void* service); -typedef celix_status_t (*service_swap_with_ref_fpt)(void *handle, service_reference_pt oldReference, const void* oldService, service_reference_pt newReference, const void* newService); - -/** - * Create a service dependency. - * Caller has ownership. - */ -celix_status_t serviceDependency_create(dm_service_dependency_t **dep); - -/** - * Destroys a service dependency. - * Caller has ownership. - */ -celix_status_t serviceDependency_destroy(dm_service_dependency_t **dep); - -/** - * Specify if the service dependency is required. default is false - */ -celix_status_t serviceDependency_setRequired(dm_service_dependency_t *dependency, bool required); - -/** - * Specify if the servide dependency should add a C language filter for this dependency if no "service.lang" part if found the in the provided filter. - * Default is false - */ -celix_status_t serviceDependency_setAddCLanguageFilter(dm_service_dependency_t *dependency, bool addCLangFilter); - - -/** - * Specify if the service dependency update strategy. - * - * The DM_SERVICE_DEPENDENCY_STRATEGY_LOCKING strategy notifies the component in case the dependencies set - * changes (e.g. a dependency is added/removed): the component is responsible for protecting via locks - * the dependencies list and check (always under lock) if the service he's depending on is still available. - * - * The DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND (default when no strategy is explicitly set) reliefs the programmer - * from dealing with service dependencies' consistency issues: in case this strategy is adopted, the component - * is stopped and restarted (i.e. temporarily suspended) upon service dependencies' changes. - * - * Default strategy is DM_SERVICE_DEPENDENCY_STRATEGY_SUSPEND - */ -celix_status_t serviceDependency_setStrategy(dm_service_dependency_t *dependency,dm_service_dependency_strategy_t strategy); - -/** - * Return the service dependency update strategy. - */ -celix_status_t serviceDependency_getStrategy(dm_service_dependency_t *dependency,dm_service_dependency_strategy_t* strategy); - -/** - * Set the service name, version range and filter. - * - * @param serviceName The service name. Must have a value. - * @param serviceVersionRange The service version range, can be a NULL pointer. - * @param filter The (additional) filter to use (e.g. "(location=front)"). Can be a NULL pointer. - */ -celix_status_t serviceDependency_setService(dm_service_dependency_t *dependency, const char* serviceName, const char* serviceVersionRange, const char* filter); - -/** - * Returns the service depenendy filter. - */ -celix_status_t serviceDependency_getFilter(dm_service_dependency_t *dependency, const char** filter); - -/** - * Set the set, add, change, remove and swap function callbacks when services specified by the service dependency - * are (respectively) set, added, changed, removed or swapped. - * The first argument of the callbacks will be the component implement (@see component_getImplementation) - * The second the argument a pointer to an instance of a service struct of the specified service dependency. - */ -celix_status_t serviceDependency_setCallbacks(dm_service_dependency_t *dependency, service_set_fpt set, service_add_fpt add, service_change_fpt change, service_remove_fpt remove, service_swap_fpt swap); - -/** - * Set the set, add, change, remove and swap function callbacks when services specified by the service dependency - * are (respectively) set, added, changed, removed or swapped. - * The first argument of the callbacks will be the component implement (@see component_getImplementation) - * The second argument of th callbacks will be a pointer to an instance of a service struct of the specified service dependency. - * The third argument of th callbacks will be a pointer to a service reference of the a service instance of the specified service dependency. - */ -celix_status_t serviceDependency_setCallbacksWithServiceReference(dm_service_dependency_t *dependency, service_set_with_ref_fpt set, service_add_with_ref_fpt add, service_change_with_ref_fpt change, service_remove_with_ref_fpt remove, service_swap_with_ref_fpt swap); - -/** - * Specifies which field member (pointer to) to update when a service dependencies is set. - * If provided the provided service_lock will be used for locking when updating the service instance. - */ -celix_status_t serviceDependency_setAutoConfigure(dm_service_dependency_t *dependency, celix_thread_mutex_t *service_lock, const void** field); - -#define serviceDependency_setCallbacksSafe(dep, cmpType, servType, set, add, change, remove, swap) \ - do { \ - int (*tmpSet)(cmpType, servType) = set; \ - int (*tmpAdd)(cmpType, servType) = add; \ - int (*tmpChange)(cmpType, servType) = change; \ - int (*tmpRemove)(cmpType, servType) = remove; \ - int (*tmpSwap)(cmpType, servType, servType) = swap; \ - serviceDependency_setCallbacks((dep), (service_set_fpt)tmpSet, (service_add_fpt)tmpAdd, (service_change_fpt)tmpChange, (service_remove_fpt)tmpRemove, (service_swap_fpt)tmpSwap); \ - } while(0) - -/** - * Set the callback handle to be used in the callbacks. Note that this normally should not be set, because the - * result of component_getImplementation() is used - * This can be used in rare cases when the callbacks are actually interceptors. e.g. in the case of C++ support. - */ -celix_status_t serviceDependency_setCallbackHandle(dm_service_dependency_t *dependency, void* handle); - -/** - * Creates a service dependency info. The service dependency info struct contains information about the service dependency. - * The caller is the owner - */ -celix_status_t serviceDependency_getServiceDependencyInfo(dm_service_dependency_t* dep, dm_service_dependency_info_t **info); - -/** - * Destroy a provided service dependency info struct. - */ -void dependency_destroyDependencyInfo(dm_service_dependency_info_t *info); - -#ifdef __cplusplus -} -#endif - -#endif /* DM_SERVICE_DEPENDENCY_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/framework.h ---------------------------------------------------------------------- diff --git a/framework/include/framework.h b/framework/include/framework.h deleted file mode 100644 index 5143f47..0000000 --- a/framework/include/framework.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - *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:d...@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_t; - -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 framework_waitForStop(framework_t *framework); - -FRAMEWORK_EXPORT celix_status_t framework_getFrameworkBundle(framework_t *framework, bundle_t **bundle); - -bundle_context_t* framework_getContext(framework_t *framework); - -#ifdef __cplusplus -} -#endif - -#endif /* FRAMEWORK_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/framework_event.h ---------------------------------------------------------------------- diff --git a/framework/include/framework_event.h b/framework/include/framework_event.h deleted file mode 100644 index d48e64c..0000000 --- a/framework/include/framework_event.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - *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_event.h - * - * \date Oct 8, 2013 - * \author <a href="mailto:d...@celix.apache.org">Apache Celix Project Team</a> - * \copyright Apache License, Version 2.0 - */ - -#ifndef FRAMEWORK_EVENT_H_ -#define FRAMEWORK_EVENT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -enum framework_event_type { - OSGI_FRAMEWORK_EVENT_STARTED = 0x00000001, - OSGI_FRAMEWORK_EVENT_ERROR = 0x00000002, - OSGI_FRAMEWORK_EVENT_PACKAGES_REFRESHED = 0x00000004, - OSGI_FRAMEWORK_EVENT_STARTLEVEL_CHANGED = 0x00000008, - OSGI_FRAMEWORK_EVENT_WARNING = 0x00000010, - OSGI_FRAMEWORK_EVENT_INFO = 0x00000020, - OSGI_FRAMEWORK_EVENT_STOPPED = 0x00000040, - OSGI_FRAMEWORK_EVENT_STOPPED_UPDATE = 0x00000080, - OSGI_FRAMEWORK_EVENT_STOPPED_BOOTCLASSPATH_MODIFIED = 0x00000100, - OSGI_FRAMEWORK_EVENT_WAIT_TIMEDOUT = 0x00000200, -}; - -typedef enum framework_event_type framework_event_type_e; -typedef struct framework_event *framework_event_pt; -#ifdef __cplusplus -} -#endif - -#include "service_reference.h" -#include "bundle.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct framework_event { - long bundleId; - char *bundleSymbolicName; - framework_event_type_e type; - celix_status_t errorCode; - char *error; -}; -#ifdef __cplusplus -} -#endif - -#endif /* FRAMEWORK_EVENT_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/framework_exports.h ---------------------------------------------------------------------- diff --git a/framework/include/framework_exports.h b/framework/include/framework_exports.h deleted file mode 100644 index 50d7f6e..0000000 --- a/framework/include/framework_exports.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - *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. - */ -/* - * exports.h - */ - -#ifndef FRAMEWORK_EXPORTS_H_ -#define FRAMEWORK_EXPORTS_H_ - -/* Cmake will define celix_framework_EXPORTS on Windows when it -configures to build a shared library. If you are going to use -another build system on windows or create the visual studio -projects by hand you need to define celix_framework_EXPORTS when -building a DLL on windows. -*/ -// We are using the Visual Studio Compiler and building Shared libraries - -#if defined _WIN32 || defined __CYGWIN__ - #ifdef celix_framework_EXPORTS - #ifdef __GNUC__ - #define FRAMEWORK_EXPORT __attribute__ ((dllexport)) - #define ACTIVATOR_EXPORT __attribute__ ((dllexport)) - #else - #define ACTIVATOR_EXPORT __declspec(dllexport) - #define FRAMEWORK_EXPORT __declspec(dllexport) // Note: actually gcc seems to also supports this syntax. - #endif - #else - #ifdef __GNUC__ - #define ACTIVATOR_EXPORT __attribute__ ((dllexport)) - #define FRAMEWORK_EXPORT __attribute__ ((dllimport)) - #else - #define ACTIVATOR_EXPORT __declspec(dllexport) - #define FRAMEWORK_EXPORT __declspec(dllimport) // Note: actually gcc seems to also supports this syntax. - #endif - #endif - #define DLL_LOCAL -#else - #if __GNUC__ >= 4 - #define ACTIVATOR_EXPORT __attribute__ ((visibility ("default"))) - #define FRAMEWORK_EXPORT __attribute__ ((visibility ("default"))) - #define FRAMEWORK_LOCAL __attribute__ ((visibility ("hidden"))) - #else - #define ACTIVATOR_EXPORT - #define FRAMEWORK_EXPORT - #define FRAMEWORK_LOCAL - #endif -#endif - -#endif /* FRAMEWORK_EXPORTS_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/3bce889b/framework/include/framework_listener.h ---------------------------------------------------------------------- diff --git a/framework/include/framework_listener.h b/framework/include/framework_listener.h deleted file mode 100644 index f390e3b..0000000 --- a/framework/include/framework_listener.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - *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. - */ -/** - * - * @defgroup FrameworkListener Framework Listener - * @ingroup framework - * @{ - * - * \author <a href="mailto:d...@celix.apache.org">Apache Celix Project Team</a> - * \date Oct 8, 2013 - * \copyright Apache License, Version 2.0 - */ -#ifndef FRAMEWORK_LISTENER_H_ -#define FRAMEWORK_LISTENER_H_ - -typedef struct framework_listener *framework_listener_pt; - -#include "celix_errno.h" -#include "framework_event.h" -#ifdef __cplusplus -extern "C" { -#endif - -struct framework_listener { - void *handle; - - celix_status_t (*frameworkEvent)(void *listener, framework_event_pt event); -}; - -#ifdef __cplusplus -} -#endif - - -#endif /* FRAMEWORK_LISTENER_H_ */ - -/** - * @} - */