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

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

Merge branch 'develop' into feature/CELIX-426-cxx-api


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

Branch: refs/heads/feature/CELIX-426-cxx-api
Commit: 34914e827e7f1937165fbdfe0c21e3c97aa59773
Parents: be6612f 3182ca7
Author: Pepijn Noltes <pe...@gmail.com>
Authored: Thu May 31 17:08:07 2018 +0200
Committer: Pepijn Noltes <pe...@gmail.com>
Committed: Thu May 31 17:08:07 2018 +0200

----------------------------------------------------------------------
 examples/celix-examples/CMakeLists.txt          |   8 +-
 .../bundle_example_c/CMakeLists.txt             |  28 ++++
 .../bundle_example_c/src/bundle_activator.c     |  40 +++++
 .../phase3/src/Phase3BaseActivator.h            |   6 +
 .../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/dependency_manager/CMakeLists.txt          |   4 +-
 libs/framework/include/bundle_activator.h       |  64 +-------
 libs/framework/include/celix/Constants.h        |   2 +-
 libs/framework/include/celix_bundle_activator.h | 148 +++++++++++++++++++
 libs/framework/include/celix_bundle_context.h   |   8 +-
 libs/framework/include/celix_constants.h        |  27 ++--
 libs/framework/include/constants.h              |   2 +-
 libs/framework/include/dm_activator.h           |   2 +-
 .../private/test/bundle_context_test.cpp        |   6 +-
 libs/framework/src/bundle_context.c             |  56 ++++---
 libs/framework/src/framework.c                  |  12 ++
 20 files changed, 311 insertions(+), 126 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/34914e82/examples/celix-examples/CMakeLists.txt
----------------------------------------------------------------------
diff --cc examples/celix-examples/CMakeLists.txt
index 426e854,f11979f..c313e8e
--- a/examples/celix-examples/CMakeLists.txt
+++ b/examples/celix-examples/CMakeLists.txt
@@@ -21,18 -21,16 +21,12 @@@ 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)
 +    add_subdirectory(bundle_example_cxx)
  
      add_subdirectory(services_example_c)
 -
 -    add_subdirectory(best_practice_example_c)
      add_subdirectory(services_example_cxx)
  
- 
-     add_subdirectory(best_practice_example_c)
-     add_subdirectory(best_practice_example_cxx)
- 
-     add_subdirectory(hello_world)
-     add_subdirectory(hello_world_test)
- 
      add_subdirectory(dm_example)
      add_subdirectory(dm_example_cxx)
  

http://git-wip-us.apache.org/repos/asf/celix/blob/34914e82/examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.h
----------------------------------------------------------------------
diff --cc examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.h
index 951b18a,0f3d813..d42ad41
--- a/examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.h
+++ b/examples/celix-examples/dm_example_cxx/phase3/src/Phase3BaseActivator.h
@@@ -20,17 -20,16 +20,23 @@@
  #ifndef CELIX_PHASE3BASEACTIVATOR_H
  #define CELIX_PHASE3BASEACTIVATOR_H
  
 -#include "celix/dm/DmActivator.h"
 +#include "celix/IBundleActivator.h"
 +#include "Phase3Cmp.h"
  
 -using namespace celix::dm;
 -
 -class Phase3BaseActivator : public DmActivator {
 +class Phase3BaseActivator : public celix::IBundleActivator {
  public:
 -    Phase3BaseActivator(DependencyManager& mng) : DmActivator(mng), cmp(mng.createComponent<Phase3Cmp>()) {}
 -    void init();
 +    Phase3BaseActivator(){}
 +    virtual ~Phase3BaseActivator(){}
++
++    Phase3BaseActivator(const Phase3BaseActivator&) = delete;
++    Phase3BaseActivator(Phase3BaseActivator&&) = delete;
++    Phase3BaseActivator& operator=(const Phase3BaseActivator&) = delete;
++    Phase3BaseActivator& operator=(Phase3BaseActivator&&) = delete;
++
 +    celix_status_t start(celix::BundleContext& ctx) override;
 +    celix_status_t stop(celix::BundleContext& ctx) override;
  protected:
 -    celix::dm::Component<Phase3Cmp>& cmp;
 +    celix::dm::Component<Phase3Cmp> *cmp{nullptr};
  };
  
  #endif //CELIX_PHASE3BASEACTIVATOR_H

http://git-wip-us.apache.org/repos/asf/celix/blob/34914e82/libs/framework/include/celix/Constants.h
----------------------------------------------------------------------
diff --cc libs/framework/include/celix/Constants.h
index 8317069,0000000..b957f61
mode 100644,000000..100644
--- a/libs/framework/include/celix/Constants.h
+++ b/libs/framework/include/celix/Constants.h
@@@ -1,47 -1,0 +1,47 @@@
 +/**
 + *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 CXX_CELIX_CONSTANTS_H
 +#define CXX_CELIX_CONSTANTS_H
 +
 +#include "celix_constants.h"
 +
 +namespace celix {
 +    class Constants {
 +    public:
-         static constexpr const char *const SERVICE_NAME  = OSGI_FRAMEWORK_OBJECTCLASS;
++        static constexpr const char *const SERVICE_NAME = OSGI_FRAMEWORK_OBJECTCLASS;
 +        static constexpr const char *const SERVICE_ID = OSGI_FRAMEWORK_SERVICE_ID;
 +        static constexpr const char *const SERVICE_PID = OSGI_FRAMEWORK_SERVICE_PID;
 +        static constexpr const char *const SERVICE_RANKING = OSGI_FRAMEWORK_SERVICE_RANKING;
 +
 +        static constexpr const char *const SERVICE_VERSION = CELIX_FRAMEWORK_SERVICE_VERSION;
 +        static constexpr const char *const SERVICE_LANGUAGE = CELIX_FRAMEWORK_SERVICE_LANGUAGE;
 +        static constexpr const char *const SERVICE_C_LANG = CELIX_FRAMEWORK_SERVICE_C_LANGUAGE;
 +        static constexpr const char *const SERVICE_CXX_LANG = CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE;
 +        static constexpr const char *const SERVICE_SHARED_LANG = CELIX_FRAMEWORK_SERVICE_SHARED_LANGUAGE; //e.g. marker services
 +
 +        static constexpr const char *const FRAMEWORK_STORAGE = OSGI_FRAMEWORK_FRAMEWORK_STORAGE;
 +        static constexpr const char *const FRAMEWORK_CLEAN = OSGI_FRAMEWORK_FRAMEWORK_STORAGE_CLEAN;
 +        static constexpr const char *const FRAMEWORK_CLEAN_ON_FIRST_INIT = OSGI_FRAMEWORK_FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT;
 +        static constexpr const char *const FRAMEWORK_UUID = OSGI_FRAMEWORK_FRAMEWORK_UUID;
 +    };
 +}
 +
 +#endif //CXX_CELIX_CONSTANTS_H

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

http://git-wip-us.apache.org/repos/asf/celix/blob/34914e82/libs/framework/include/constants.h
----------------------------------------------------------------------
diff --cc libs/framework/include/constants.h
index ac00241,b9be0bd..d9680b3
--- a/libs/framework/include/constants.h
+++ b/libs/framework/include/constants.h
@@@ -16,5 -16,71 +16,5 @@@
   *specific language governing permissions and limitations
   *under the License.
   */
 -/*
 - * constants.h
 - *
 - *  \date       Apr 29, 2010
 - *  \author    	<a href="mailto:dev@celix.apache.org">Apache Celix Project Team</a>
 - *  \copyright	Apache License, Version 2.0
 - */
 -
 -#ifndef CONSTANTS_H_
 -#define CONSTANTS_H_
 -
 -#ifdef __cplusplus
 -extern "C" {
 -#endif
 -
 -static const char *const OSGI_FRAMEWORK_OBJECTCLASS = "objectClass";
 -static const char *const OSGI_FRAMEWORK_SERVICE_ID = "service.id";
 -static const char *const OSGI_FRAMEWORK_SERVICE_PID = "service.pid";
 -static const char *const OSGI_FRAMEWORK_SERVICE_RANKING = "service.ranking";
 -
 -static const char *const CELIX_FRAMEWORK_SERVICE_VERSION = "service.version";
 -static const char *const CELIX_FRAMEWORK_SERVICE_LANGUAGE = "service.lang";
 -static const char *const CELIX_FRAMEWORK_SERVICE_C_LANGUAGE = "C";
 -static const char *const CELIX_FRAMEWORK_SERVICE_CXX_LANGUAGE = "C++";
 -static const char *const CELIX_FRAMEWORK_SERVICE_SHARED_LANGUAGE = "shared"; //e.g. marker services
 -
 -static const char *const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR = "Bundle-Activator";
 -
 -static const char *const OSGI_FRAMEWORK_BUNDLE_ACTIVATOR_CREATE = "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";
 -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
  
- #include "celix_constants.h"
 -#endif /* CONSTANTS_H_ */
++#include "celix_constants.h"

http://git-wip-us.apache.org/repos/asf/celix/blob/34914e82/libs/framework/src/bundle_context.c
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/celix/blob/34914e82/libs/framework/src/framework.c
----------------------------------------------------------------------