celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject celix git commit: CELIX-446: Adds altenertive celix_bundleActivator_* api for the bundle activators
Date Tue, 29 May 2018 18:45:04 GMT
Repository: celix
Updated Branches:
  refs/heads/develop dfa9d1c7c -> 3e27acf53


CELIX-446: Adds altenertive celix_bundleActivator_* api for the bundle activators


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/3e27acf5
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/3e27acf5
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/3e27acf5

Branch: refs/heads/develop
Commit: 3e27acf533a195132934a3a5d6935c95f47c7ea9
Parents: dfa9d1c
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Tue May 29 20:42:36 2018 +0200
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Tue May 29 20:44:54 2018 +0200

----------------------------------------------------------------------
 examples/celix-examples/CMakeLists.txt          |   2 +
 .../bundle_example_c/CMakeLists.txt             |  28 ++++
 .../bundle_example_c/src/bundle_activator.c     |  40 +++++
 .../celix-examples/services_example_c/README.md |  16 +-
 .../src/dynamic_consumer_example.c              |   2 +-
 .../src/dynamic_provider_example.c              |   2 +-
 .../src/simple_consumer_example.c               |   2 +-
 .../src/simple_provider_example.c               |   2 +-
 libs/framework/include/bundle_activator.h       |  64 +-------
 libs/framework/include/celix_bundle_activator.h | 148 +++++++++++++++++++
 libs/framework/include/celix_bundle_context.h   |  15 ++
 libs/framework/include/constants.h              |  15 +-
 libs/framework/include/dm_activator.h           |   2 +-
 libs/framework/src/bundle_context.c             |  48 +++---
 libs/framework/src/framework.c                  |  12 ++
 15 files changed, 305 insertions(+), 93 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/examples/celix-examples/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/celix-examples/CMakeLists.txt b/examples/celix-examples/CMakeLists.txt
index 2ade793..f11979f 100644
--- a/examples/celix-examples/CMakeLists.txt
+++ b/examples/celix-examples/CMakeLists.txt
@@ -21,6 +21,8 @@ else ()
     set(EXAMPLES true) #celix_subproject is only available in the celix project -> using
examples dir in other project is also supported
 endif ()
 if (EXAMPLES)
+    add_subdirectory(bundle_example_c)
+
     add_subdirectory(hello_world)
     add_subdirectory(hello_world_test)
 

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/examples/celix-examples/bundle_example_c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/examples/celix-examples/bundle_example_c/CMakeLists.txt b/examples/celix-examples/bundle_example_c/CMakeLists.txt
new file mode 100644
index 0000000..aabf370
--- /dev/null
+++ b/examples/celix-examples/bundle_example_c/CMakeLists.txt
@@ -0,0 +1,28 @@
+# 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.
+
+add_celix_bundle(bundle_example_c
+    VERSION 1.0.0
+    SOURCES src/bundle_activator.c
+)
+
+add_celix_container(bundle_example_c_container
+    BUNDLES
+        Celix::shell
+        Celix::shell_tui
+        bundle_example_c
+)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/examples/celix-examples/bundle_example_c/src/bundle_activator.c
----------------------------------------------------------------------
diff --git a/examples/celix-examples/bundle_example_c/src/bundle_activator.c b/examples/celix-examples/bundle_example_c/src/bundle_activator.c
new file mode 100644
index 0000000..7b9d0d0
--- /dev/null
+++ b/examples/celix-examples/bundle_example_c/src/bundle_activator.c
@@ -0,0 +1,40 @@
+/**
+ *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_bundle_activator.h"
+#include "celix_bundle.h"
+
+typedef struct activator_data {
+    /*intentional empty*/
+} activator_data_t;
+
+
+
+static celix_status_t activator_start(activator_data_t *data, celix_bundle_context_t *ctx)
{
+    printf("Hello world from C bundle with id %li\n", celix_bundle_getId(celix_bundleContext_getBundle(ctx)));
+    return CELIX_SUCCESS;
+}
+
+static celix_status_t activator_stop(activator_data_t *data, celix_bundle_context_t *ctx)
{
+    printf("Goodbye world from C bundle with id %li\n", celix_bundle_getId(celix_bundleContext_getBundle(ctx)));
+    return CELIX_SUCCESS;
+}
+
+CELIX_GEN_BUNDLE_ACTIVATOR(activator_data_t, activator_start, activator_stop)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/examples/celix-examples/services_example_c/README.md
----------------------------------------------------------------------
diff --git a/examples/celix-examples/services_example_c/README.md b/examples/celix-examples/services_example_c/README.md
index a4f50ba..14c21b0 100644
--- a/examples/celix-examples/services_example_c/README.md
+++ b/examples/celix-examples/services_example_c/README.md
@@ -21,12 +21,20 @@ This example show how services can be provided and consumer by bundles.
 
 The example uses the `celix_bundleContext_registerService` to provide
 services and uses a combination of `celix_bundleContext_useService`,
- `celix_bundleContext_useServices` and `celix_bundleContext_trackServices`
- to consume services.
+`celix_bundleContext_useServices` and `celix_bundleContext_trackServices`
+to consume services.
 
- TODO intro bundle context
+The bundle context is the proxy to the Celix framework for a bundle
+and can be used to:
 
- See the `bundle_context.h` for documentation about these - and other -functions
+- Register services
+- Register service factories
+- Use services
+- Track services
+- Track bundles
+- Track service trackers
+
+See the `bundle_context.h` for documentation about these - and other -functions
 
 # Simple Service Provider & Consumer Example
 

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/examples/celix-examples/services_example_c/src/dynamic_consumer_example.c
----------------------------------------------------------------------
diff --git a/examples/celix-examples/services_example_c/src/dynamic_consumer_example.c b/examples/celix-examples/services_example_c/src/dynamic_consumer_example.c
index cef384c..673a84a 100644
--- a/examples/celix-examples/services_example_c/src/dynamic_consumer_example.c
+++ b/examples/celix-examples/services_example_c/src/dynamic_consumer_example.c
@@ -24,7 +24,7 @@
 #include <constants.h>
 
 #include "example_calc.h"
-#include "bundle_activator.h"
+#include "celix_bundle_activator.h"
 
 typedef struct activator_data {
     celix_bundle_context_t *ctx;

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/examples/celix-examples/services_example_c/src/dynamic_provider_example.c
----------------------------------------------------------------------
diff --git a/examples/celix-examples/services_example_c/src/dynamic_provider_example.c b/examples/celix-examples/services_example_c/src/dynamic_provider_example.c
index 4756718..1b09ab9 100644
--- a/examples/celix-examples/services_example_c/src/dynamic_provider_example.c
+++ b/examples/celix-examples/services_example_c/src/dynamic_provider_example.c
@@ -22,7 +22,7 @@
 #include <stdlib.h>
 
 #include "example_calc.h"
-#include "bundle_activator.h"
+#include "celix_bundle_activator.h"
 #include "constants.h"
 
 typedef struct activator_data {

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/examples/celix-examples/services_example_c/src/simple_consumer_example.c
----------------------------------------------------------------------
diff --git a/examples/celix-examples/services_example_c/src/simple_consumer_example.c b/examples/celix-examples/services_example_c/src/simple_consumer_example.c
index 1204036..e3b1789 100644
--- a/examples/celix-examples/services_example_c/src/simple_consumer_example.c
+++ b/examples/celix-examples/services_example_c/src/simple_consumer_example.c
@@ -24,7 +24,7 @@
 #include <constants.h>
 
 #include "example_calc.h"
-#include "bundle_activator.h"
+#include "celix_bundle_activator.h"
 
 typedef struct activator_data {
     celix_bundle_context_t *ctx;

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/examples/celix-examples/services_example_c/src/simple_provider_example.c
----------------------------------------------------------------------
diff --git a/examples/celix-examples/services_example_c/src/simple_provider_example.c b/examples/celix-examples/services_example_c/src/simple_provider_example.c
index 486225a..d0ebc1d 100644
--- a/examples/celix-examples/services_example_c/src/simple_provider_example.c
+++ b/examples/celix-examples/services_example_c/src/simple_provider_example.c
@@ -21,7 +21,7 @@
 #include <stdlib.h>
 
 #include "example_calc.h"
-#include "bundle_activator.h"
+#include "celix_bundle_activator.h"
 #include "constants.h"
 
 typedef struct activator_data {

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/libs/framework/include/bundle_activator.h
----------------------------------------------------------------------
diff --git a/libs/framework/include/bundle_activator.h b/libs/framework/include/bundle_activator.h
index 3265f65..99ef6bc 100644
--- a/libs/framework/include/bundle_activator.h
+++ b/libs/framework/include/bundle_activator.h
@@ -16,31 +16,16 @@
  *specific language governing permissions and limitations
  *under the License.
  */
-/**
- *
- * @defgroup BundleActivator BundleActivator
- * @ingroup framework
- * @{
- *	\brief		Customizes the starting and stopping of a bundle.
- *	\details	\ref BundleActivator is a header that must be implemented by every
- * 				bundle. The Framework creates/starts/stops/destroys activator instances using the
- * 				functions described in this header. If the bundleActivator_start()
- * 				function executes successfully, it is guaranteed that the same instance's
- * 				bundleActivator_stop() function will be called when the bundle is
- * 				to be stopped. The same applies to the bundleActivator_create() and
- * 				bundleActivator_destroy() functions.
- * 				The Framework must not concurrently call the activator functions.
- *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
- *  \date      	March 18, 2010
- *  \copyright	Apache License, Version 2.0
- */
-#ifndef BUNDLE_ACTIVATOR_H_
-#define BUNDLE_ACTIVATOR_H_
+
+#include <stdlib.h>
 
 #include "bundle_context.h"
 #include "celix_bundle_context.h"
 #include "framework_exports.h"
 
+#ifndef BUNDLE_ACTIVATOR_H_
+#define BUNDLE_ACTIVATOR_H_
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -116,45 +101,6 @@ ACTIVATOR_EXPORT celix_status_t bundleActivator_stop(void *userData,
bundle_cont
 ACTIVATOR_EXPORT celix_status_t
 bundleActivator_destroy(void *userData, bundle_context_t* context);
 
-
-/**
- * This macro generated the required bundle activator functions. These can be used to more
type safe bundle activator
- * entries.
- *
- * The macro will create the following bundlea activator functions:
- * - bundleActivator_create which allocates a pointer to the provided type.
- * - bundleActivator_start/stop which will call the respectively provided typed start/stop
functions.
- * - bundleActivator_destroy will free the allocated for the provided type.
- *
- * @param type The activator type (e.g. 'struct shell_activator').
- * @param start the activator actStart function with the following signature: celix_status_t
(*)(<actType>*, celix_bundle_context_t*).
- * @param stop the activator actStop function with the following signature: celix_status_t
(*)(<actType>*, celix_bundle_context_t*).
- */
-#define CELIX_GEN_BUNDLE_ACTIVATOR(actType, actStart, actStop)                          
                              \
-celix_status_t bundleActivator_create(celix_bundle_context_t *ctx __attribute__((unused)),
void **userData) {          \
-    celix_status_t status = CELIX_SUCCESS;                                              
                              \
-    actType *data = calloc(1, sizeof(*data));                                           
                              \
-    if (data != NULL) {                                                                 
                              \
-        *userData = data;                                                               
                              \
-    } else {                                                                            
                              \
-        status = CELIX_ENOMEM;                                                          
                              \
-    }                                                                                   
                              \
-    return status;                                                                      
                              \
-}                                                                                       
                              \
-                                                                                        
                              \
-celix_status_t bundleActivator_start(void *userData, celix_bundle_context_t *ctx) {     
                              \
-    return actStart((actType*)userData, ctx);                                           
                              \
-}                                                                                       
                              \
-                                                                                        
                              \
-celix_status_t bundleActivator_stop(void *userData, celix_bundle_context_t *ctx) {      
                              \
-    return actStop((actType*)userData, ctx);                                            
                              \
-}                                                                                       
                              \
-                                                                                        
                              \
-celix_status_t bundleActivator_destroy(void *userData, celix_bundle_context_t *ctx __attribute__((unused)))
{          \
-    free(userData);                                                                     
                              \
-    return CELIX_SUCCESS;                                                               
                              \
-}
-
 #ifdef __cplusplus
 }
 #endif

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/libs/framework/include/celix_bundle_activator.h
----------------------------------------------------------------------
diff --git a/libs/framework/include/celix_bundle_activator.h b/libs/framework/include/celix_bundle_activator.h
new file mode 100644
index 0000000..eb7d514
--- /dev/null
+++ b/libs/framework/include/celix_bundle_activator.h
@@ -0,0 +1,148 @@
+/*
+ *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 <stdlib.h>
+
+#include "celix_bundle_context.h"
+
+#ifndef CELIX_BUNDLE_ACTIVATOR_H_
+#define CELIX_BUNDLE_ACTIVATOR_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * Called when this bundle is started so the bundle can create an instance for its activator.
+ * The framework does not assume any type for the activator instance, this is implementation
specific.
+ * The activator instance is handle as a void pointer by the framework, the implementation
must cast it to the
+ * implementation specific type.
+ *
+ * @param ctx The execution context of the bundle being started.
+ * @param[out] userData A pointer to the specific activator instance used by this bundle.
+ *
+ * @return Status code indication failure or success:
+ * 		- CELIX_SUCCESS when no errors are encountered.
+ * 		- Any other status code will mark the bundle as stopped and the framework will remove
this
+ * 		  bundle's listeners, unregister all services, and release all services used by this
bundle.
+ */
+celix_status_t celix_bundleActivator_create(celix_bundle_context_t *ctx, void **userData);
+
+/**
+ * Called when this bundle is started so the Framework can perform the bundle-specific activities
necessary
+ * to start this bundle. This method can be used to register services or to allocate any
resources that this
+ * bundle needs.
+ *
+ * <p>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param userData The activator instance to be used.
+ * @param ctx The execution context of the bundle being started.
+ *
+ * @return Status code indication failure or success:
+ * 		- CELIX_SUCCESS when no errors are encountered.
+ * 		- Any other status code will mark the bundle as stopped and the framework will remove
this
+ * 		  bundle's listeners, unregister all services, and release all services used by this
bundle.
+ */
+celix_status_t celix_bundleActivator_start(void *userData, celix_bundle_context_t *ctx);
+
+/**
+ * Called when this bundle is stopped so the Framework can perform the bundle-specific activities
necessary
+ * to stop the bundle. In general, this method should undo the work that the <code>bundleActivator_start()</code>
+ * function started. There should be no active threads that were started by this bundle when
this bundle returns.
+ * A stopped bundle must not call any Framework objects.
+ *
+ * <p>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param userData The activator instance to be used.
+ * @param ctx The execution context of the bundle being stopped.
+ *
+ * @return Status code indication failure or success:
+ * 		- CELIX_SUCCESS when no errors are encountered.
+ * 		- Any other status code will mark the bundle as stopped and the framework will remove
this
+ * 		  bundle's listeners, unregister all services, and release all services used by this
bundle.
+ */
+celix_status_t celix_bundleActivator_stop(void *userData, celix_bundle_context_t *ctx);
+
+/**
+ * Called when this bundle is stopped so the bundle can destroy the instance of its activator.
In general, this
+ * method should undo the work that the <code>bundleActivator_create()</code>
function initialized.
+ *
+ * <p>
+ * This method must complete and return to its caller in a timely manner.
+ *
+ * @param userData The activator instance to be used.
+ * @param ctx The execution context of the bundle being stopped.
+ *
+ * @return Status code indication failure or success:
+ * 		- CELIX_SUCCESS when no errors are encountered.
+ * 		- Any other status code will mark the bundle as stopped and the framework will remove
this
+ * 		  bundle's listeners, unregister all services, and release all services used by this
bundle.
+ */
+celix_status_t celix_bundleActivator_destroy(void *userData, celix_bundle_context_t* ctx);
+
+
+/**
+ * This macro generated the required bundle activator functions. These can be used to more
type safe bundle activator
+ * entries.
+ *
+ * The macro will create the following bundlea activator functions:
+ * - bundleActivator_create which allocates a pointer to the provided type.
+ * - bundleActivator_start/stop which will call the respectively provided typed start/stop
functions.
+ * - bundleActivator_destroy will free the allocated for the provided type.
+ *
+ * @param type The activator type (e.g. 'struct shell_activator').
+ * @param start the activator actStart function with the following signature: celix_status_t
(*)(<actType>*, celix_bundle_context_t*).
+ * @param stop the activator actStop function with the following signature: celix_status_t
(*)(<actType>*, celix_bundle_context_t*).
+ */
+#define CELIX_GEN_BUNDLE_ACTIVATOR(actType, actStart, actStop)                          
                              \
+celix_status_t celix_bundleActivator_create(celix_bundle_context_t *ctx __attribute__((unused)),
void **userData) {    \
+    celix_status_t status = CELIX_SUCCESS;                                              
                              \
+    actType *data = calloc(1, sizeof(*data));                                           
                              \
+    if (data != NULL) {                                                                 
                              \
+        *userData = data;                                                               
                              \
+    } else {                                                                            
                              \
+        status = CELIX_ENOMEM;                                                          
                              \
+    }                                                                                   
                              \
+    return status;                                                                      
                              \
+}                                                                                       
                              \
+                                                                                        
                              \
+celix_status_t celix_bundleActivator_start(void *userData, celix_bundle_context_t *ctx) {
                             \
+    return actStart((actType*)userData, ctx);                                           
                              \
+}                                                                                       
                              \
+                                                                                        
                              \
+celix_status_t celix_bundleActivator_stop(void *userData, celix_bundle_context_t *ctx) {
                              \
+    return actStop((actType*)userData, ctx);                                            
                              \
+}                                                                                       
                              \
+                                                                                        
                              \
+celix_status_t celix_bundleActivator_destroy(void *userData, celix_bundle_context_t *ctx
__attribute__((unused))) {    \
+    free(userData);                                                                     
                              \
+    return CELIX_SUCCESS;                                                               
                              \
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CELIX_BUNDLE_ACTIVATOR_H_ */
+
+/**
+ * @}
+ */

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/libs/framework/include/celix_bundle_context.h
----------------------------------------------------------------------
diff --git a/libs/framework/include/celix_bundle_context.h b/libs/framework/include/celix_bundle_context.h
index bc67b1d..58dca4e 100644
--- a/libs/framework/include/celix_bundle_context.h
+++ b/libs/framework/include/celix_bundle_context.h
@@ -728,6 +728,21 @@ long celix_bundleContext_trackServiceTrackers(
  */
 dm_dependency_manager_t* celix_bundleContext_getDependencyManager(celix_bundle_context_t
*ctx);
 
+
+/**
+ * Returns the bundle for this bundle context.
+ */
+celix_bundle_t* celix_bundleContext_getBundle(celix_bundle_context_t *ctx);
+
+
+/**
+ * Gets the config property - or environment variable if the config property does not exist
- for the provided name.
+ * @param key The key of the property to receive
+ * @param defaultVal The default value to use if the property is not found (can be NULL)
+ * @return The property value for the provided key or the provided defaultValue is the key
is not found.
+ */
+const char* celix_bundleContext_getProperty(celix_bundle_context_t *ctx, const char *key,
const char *defaultVal);
+
 #ifdef __cplusplus
 }
 #endif

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/libs/framework/include/constants.h
----------------------------------------------------------------------
diff --git a/libs/framework/include/constants.h b/libs/framework/include/constants.h
index 06d89be..b9be0bd 100644
--- a/libs/framework/include/constants.h
+++ b/libs/framework/include/constants.h
@@ -43,10 +43,17 @@ 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_ACTIVATOR_CREATE = "celix_bundleActivator_create";
+static const char *const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_START = "celix_bundleActivator_start";
+static const char *const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_STOP = "celix_bundleActivator_stop";
+static const char *const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_DESTROY = "celix_bundleActivator_destroy";
+
+static const char *const OSGI_FRAMEWORK_DEPRECATED_BUNDLE_ACTIVATOR_CREATE = "bundleActivator_create";
+static const char *const OSGI_FRAMEWORK_DEPRECATED_BUNDLE_ACTIVATOR_START = "bundleActivator_start";
+static const char *const OSGI_FRAMEWORK_DEPRECATED_BUNDLE_ACTIVATOR_STOP = "bundleActivator_stop";
+static const char *const OSGI_FRAMEWORK_DEPRECATED_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";

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/libs/framework/include/dm_activator.h
----------------------------------------------------------------------
diff --git a/libs/framework/include/dm_activator.h b/libs/framework/include/dm_activator.h
index 86f33db..1e06331 100644
--- a/libs/framework/include/dm_activator.h
+++ b/libs/framework/include/dm_activator.h
@@ -35,7 +35,7 @@
 #include "dm_dependency_manager.h"
 #include "dm_component.h"
 #include "dm_service_dependency.h"
-#include "bundle_activator.h"
+#include "celix_bundle_activator.h"
 
 #ifdef __cplusplus
 extern "C" {

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/libs/framework/src/bundle_context.c
----------------------------------------------------------------------
diff --git a/libs/framework/src/bundle_context.c b/libs/framework/src/bundle_context.c
index 4fac5e7..d3a2c1e 100644
--- a/libs/framework/src/bundle_context.c
+++ b/libs/framework/src/bundle_context.c
@@ -105,17 +105,12 @@ celix_status_t bundleContext_destroy(bundle_context_pt context) {
 	return status;
 }
 
-celix_status_t bundleContext_getBundle(bundle_context_pt context, bundle_pt *bundle) {
+celix_status_t bundleContext_getBundle(bundle_context_pt context, bundle_pt *out) {
 	celix_status_t status = CELIX_SUCCESS;
-
-	if (context == NULL) {
-		status = CELIX_ILLEGAL_ARGUMENT;
-	} else {
-		*bundle = context->bundle;
-	}
-
-	framework_logIfError(logger, status, NULL, "Failed to get bundle");
-
+    celix_bundle_t *bnd = celix_bundleContext_getBundle(context);
+    if (out != NULL) {
+        *out = bnd;
+    }
 	return status;
 }
 
@@ -404,18 +399,12 @@ celix_status_t bundleContext_getProperty(bundle_context_pt context,
const char *
 	return bundleContext_getPropertyWithDefault(context, name, NULL, value);
 }
 
-celix_status_t bundleContext_getPropertyWithDefault(bundle_context_pt context, const char*
name, const char* defaultValue, const char** value) {
-    celix_status_t status = CELIX_SUCCESS;
-
-    if (context == NULL || name == NULL) {
-        status = CELIX_ILLEGAL_ARGUMENT;
-    } else {
-        fw_getProperty(context->framework, name, defaultValue, value);
+celix_status_t bundleContext_getPropertyWithDefault(bundle_context_pt context, const char*
name, const char* defaultValue, const char** out) {
+    const char *val = celix_bundleContext_getProperty(context, name, defaultValue);
+    if (out != NULL) {
+        *out = val;
     }
-
-    framework_logIfError(logger, status, NULL, "Failed to get property [name=%s]", name);
-
-    return status;
+    return CELIX_SUCCESS;
 }
 
 
@@ -955,4 +944,21 @@ long celix_bundleContext_trackServiceTrackers(
         free(entry);
     }
     return trackerId;
+}
+
+celix_bundle_t* celix_bundleContext_getBundle(celix_bundle_context_t *ctx) {
+    celix_bundle_t *bnd = NULL;
+    if (ctx != NULL) {
+        bnd = ctx->bundle;
+    }
+    return bnd;
+}
+
+
+const char* celix_bundleContext_getProperty(celix_bundle_context_t *ctx, const char *key,
const char *defaultVal) {
+    const char *val = NULL;
+    if (ctx != NULL) {
+        fw_getProperty(ctx->framework, key, defaultVal, &val);
+    }
+    return val;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/celix/blob/3e27acf5/libs/framework/src/framework.c
----------------------------------------------------------------------
diff --git a/libs/framework/src/framework.c b/libs/framework/src/framework.c
index c28153a..fbae5db 100644
--- a/libs/framework/src/framework.c
+++ b/libs/framework/src/framework.c
@@ -782,9 +782,21 @@ celix_status_t fw_startBundle(framework_pt framework, bundle_pt bundle,
int opti
                         void * userData = NULL;
                         bundle_context_t *context;
                         create_function_fp create = (create_function_fp) fw_getSymbol((handle_t)
bundle_getHandle(bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_CREATE);
+                        if (create == NULL) {
+                            create = fw_getSymbol(bundle_getHandle(bundle), OSGI_FRAMEWORK_DEPRECATED_BUNDLE_ACTIVATOR_CREATE);
+                        }
                         start_function_fp start = (start_function_fp) fw_getSymbol((handle_t)
bundle_getHandle(bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_START);
+                        if (start == NULL) {
+                            start = (start_function_fp) fw_getSymbol((handle_t) bundle_getHandle(bundle),
OSGI_FRAMEWORK_DEPRECATED_BUNDLE_ACTIVATOR_START);
+                        }
                         stop_function_fp stop = (stop_function_fp) fw_getSymbol((handle_t)
bundle_getHandle(bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_STOP);
+                        if (stop == NULL) {
+                            stop = (stop_function_fp) fw_getSymbol((handle_t) bundle_getHandle(bundle),
OSGI_FRAMEWORK_DEPRECATED_BUNDLE_ACTIVATOR_STOP);
+                        }
                         destroy_function_fp destroy = (destroy_function_fp) fw_getSymbol((handle_t)
bundle_getHandle(bundle), OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_DESTROY);
+                        if (destroy == NULL) {
+                            destroy = (destroy_function_fp) fw_getSymbol((handle_t) bundle_getHandle(bundle),
OSGI_FRAMEWORK_DEPRECATED_BUNDLE_ACTIVATOR_DESTROY);
+                        }
 
                         activator->create = create;
                         activator->start = start;


Mime
View raw message