Skip to content

Commit

Permalink
Merge branch 'release-3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
saschazelzer committed Jun 1, 2017
2 parents a85a0d9 + f79e593 commit 3b81b03
Show file tree
Hide file tree
Showing 69 changed files with 1,949 additions and 371 deletions.
16 changes: 10 additions & 6 deletions .travis.yml
Expand Up @@ -19,7 +19,11 @@ matrix:
addons: *valgrind
compiler: gcc
env: BUILD_CONFIGURATION=1
# latest compiler on OS X
# minimum supported compiler on OS X
- os: osx
osx_image: xcode6.4
compiler: clang
env: BUILD_CONFIGURATION=0 MACOSX_DEPLOYMENT_TARGET=10.10
- os: osx
osx_image: xcode7.3
compiler: clang
Expand All @@ -28,15 +32,15 @@ matrix:
osx_image: xcode7.3
compiler: clang
env: BUILD_CONFIGURATION=1 MACOSX_DEPLOYMENT_TARGET=10.11
# minimum supported compiler on OS X
# latest compiler on OS X
- os: osx
osx_image: xcode6.4
osx_image: xcode8.2
compiler: clang
env: BUILD_CONFIGURATION=0 MACOSX_DEPLOYMENT_TARGET=10.10
env: BUILD_CONFIGURATION=0 MACOSX_DEPLOYMENT_TARGET=10.12
- os: osx
osx_image: xcode6.4
osx_image: xcode8.2
compiler: clang
env: BUILD_CONFIGURATION=1 MACOSX_DEPLOYMENT_TARGET=10.10
env: BUILD_CONFIGURATION=1 MACOSX_DEPLOYMENT_TARGET=10.12

cache:
directories:
Expand Down
55 changes: 54 additions & 1 deletion CHANGELOG.rst
Expand Up @@ -6,8 +6,61 @@ All notable changes to this project will be documented in this file.
The format is based on `Keep a Changelog <http://keepachangelog.com/>`_
and this project adheres to `Semantic Versioning <http://semver.org/>`_.

`v3.1.0 <https://github.com/cppmicroservices/cppmicroservices/tree/v3.1.0>`_ (2017-06-01)
-----------------------------------------------------------------------------------------

`Full Changelog <https://github.com/cppmicroservices/cppmicroservices/compare/v3.0.0...v3.1.0>`_

Changed
~~~~~~~

- Improved BadAnyCastException message. `#181 <https://github.com/CppMicroServices/CppMicroServices/issues/181>`_
- Support installing bundles that do not have .DLL/.so/.dylib file extensions. `#205 <https://github.com/CppMicroServices/CppMicroServices/issues/205>`_

Deprecated
~~~~~~~~~~

- The following BundleContext member functions:

* ``RemoveBundleListener``
* ``RemoveFrameworkListener``
* ``RemoveServiceListener``

And the variants of

* ``AddBundleListener``
* ``AddFrameworkListener``,
* ``AddServiceListener``

that take member functions.

- The free functions:

* ``ServiceListenerMemberFunctor``
* ``BundleListenerMemberFunctor``
* ``BindFrameworkListenerToFunctor``

- The functions

* ``ShrinkableVector::operator[std::size_t]``
* ``ShrinkableMap::operator[const Key&]``


Fixed
~~~~~

`v3.0.0 <https://github.com/cppmicroservices/cppmicroservices/tree/v3.0.0>`_
- Cannot add more than one listener if its expressed as a lambda.
`#95 <https://github.com/CppMicroServices/CppMicroServices/issues/95>`_
- Removing Listeners does not work well
`#83 <https://github.com/CppMicroServices/CppMicroServices/issues/83>`_
- Crash when trying to acquire bundle context
`#172 <https://github.com/CppMicroServices/CppMicroServices/issues/172>`_
- Fix for ``unsafe_any_cast``
`#198 <https://github.com/CppMicroServices/CppMicroServices/pull/198>`_
- Stopping a framework while bundle threads are still running may deadlock
`#210 <https://github.com/CppMicroServices/CppMicroServices/issues/210>`_

`v3.0.0 <https://github.com/cppmicroservices/cppmicroservices/tree/v3.0.0>`_ (2017-02-08)
-----------------------------------------------------------------------------------------

`Full Changelog <https://github.com/cppmicroservices/cppmicroservices/compare/v2.1.1...v3.0.0>`_
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Expand Up @@ -398,7 +398,7 @@ CHECK_INCLUDE_FILE_CXX(cxxabi.h US_HAVE_CXXABI_H)
# c++11 regular expressions are used in the unit tests.
# Currently the default C++ library for gcc < 4.9 doesn't
# fully support c++11 regex.
# Generelize the detection of regex and make its availability
# Generalize the detection of regex and make its availability
# conditional of wether the compiler's C++ library supports it
# or not.
# This can be removed once the minimum supported gcc version is 4.9
Expand Down
17 changes: 10 additions & 7 deletions README.rst
Expand Up @@ -4,9 +4,11 @@
+-------------+-------------------------+--------------------------+
| Branch | GCC 4.6 | Visual Studio 2013 |
| +-------------------------+--------------------------+
| | XCode 6.4 | Visual Studio 2015 |
| | Xcode 6.4 | Visual Studio 2015 |
| +-------------------------+--------------------------+
| | XCode 7.3 | MinGW-w64 |
| | Xcode 7.3 | MinGW-w64 |
| +-------------------------+--------------------------+
| | Xcode 8.2 | |
+=============+=========================+==========================+
| master | |Linux Build Status| | |Windows Build status| |
+-------------+-------------------------+--------------------------+
Expand Down Expand Up @@ -56,16 +58,17 @@ Minimum required compiler versions:

- GCC 4.6
- Clang 3.1
- Clang from XCode 6.4
- Clang from Xcode 6.4
- Visual Studio 2013

Below is a list of tested compiler/OS combinations:

- GCC 4.6.3 (Ubuntu 12.04) via Travis CI
- GCC 6.2.1 (Fedora 25)
- Clang 3.8.0 (Fedora 25)
- Clang XCode 6.4 (OS X 10.10) via Travis CI
- Clang XCode 7.3 (OS X 10.11) via Travis CI
- Clang Xcode 6.4 (OS X 10.10) via Travis CI
- Clang Xcode 7.3 (OS X 10.11) via Travis CI
- Clang Xcode 8.2 (OS X 10.12) via Travis CI
- Visual Studio 2013 via Appveyor
- Visual Studio 2015 via Appveyor
- Visual Studio 2017 RC (Windows 7)
Expand Down Expand Up @@ -182,6 +185,6 @@ file for details about the contribution process.
.. |RTD Build Status (stable)| image:: https://readthedocs.org/projects/cppmicroservices/badge/?version=stable&style=flat-square
:target: http://docs.cppmicroservices.org/en/stable/?badge=stable
:alt: Documentation Status (stable)
.. |RTD Build Status (development)| image:: https://readthedocs.org/projects/cppmicroservices/badge/?version=development&style=flat-square
:target: http://docs.cppmicroservices.org/en/development/?badge=development
.. |RTD Build Status (development)| image:: https://readthedocs.org/projects/cppmicroservices/badge/?version=latest&style=flat-square
:target: http://docs.cppmicroservices.org/en/latest/?badge=development
:alt: Documentation Status (development)
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
3.0.0
3.1.0
5 changes: 4 additions & 1 deletion cmake/usFunctionCreateTestBundle.cmake
Expand Up @@ -2,6 +2,9 @@
macro(_us_create_test_bundle_helper)

add_library(${name} ${_srcs})
if(US_BUILD_SHARED_LIBS AND US_TEST_LIBRARY_EXTENSION)
set_target_properties(${name} PROPERTIES SUFFIX ${US_TEST_LIBRARY_EXTENSION})
endif()
set_property(TARGET ${name}
APPEND PROPERTY COMPILE_DEFINITIONS US_BUNDLE_NAME=${name})
set_property(TARGET ${name} PROPERTY US_BUNDLE_NAME ${name})
Expand Down Expand Up @@ -41,7 +44,7 @@ function(usFunctionCreateTestBundle name)
endfunction()

function(usFunctionCreateTestBundleWithResources name)
cmake_parse_arguments(US_TEST "SKIP_BUNDLE_LIST;LINK_RESOURCES;APPEND_RESOURCES" "RESOURCES_ROOT" "SOURCES;RESOURCES;BINARY_RESOURCES;LINK_LIBRARIES" "" ${ARGN})
cmake_parse_arguments(US_TEST "SKIP_BUNDLE_LIST;LINK_RESOURCES;APPEND_RESOURCES" "RESOURCES_ROOT;LIBRARY_EXTENSION" "SOURCES;RESOURCES;BINARY_RESOURCES;LINK_LIBRARIES" "" ${ARGN})

set(_mode )
if(US_TEST_LINK_RESOURCES)
Expand Down
7 changes: 3 additions & 4 deletions doc/man/cppmicroservices-shellservice.7.rst
Expand Up @@ -5,12 +5,11 @@
Shell Service
=============

The Shell Service provides an interface to interact with a
C++ Micro Services framework and to issue commands. It does not define
a user interface, see :any:`usShell3(1)` for a client with a
The Shell Service provides an interface to interact with and issue commands to
a C++ Micro Services framework. See :any:`usShell3(1)` for a client with a
textual interface.

.. warning::

This bundle has not reached a stable version yet. Its design and API
may change between releases in a backwards incompatible way.
may change between releases in a backwards incompatible way.
2 changes: 1 addition & 1 deletion doc/src/tutorial/dictionaryclient2/Activator.cpp
Expand Up @@ -89,7 +89,7 @@ class US_ABI_LOCAL Activator : public BundleActivator
// MutexLocker lock(&m_mutex);

// Listen for events pertaining to dictionary services.
m_context.AddServiceListener(this, &Activator::ServiceChanged,
m_context.AddServiceListener(std::bind(&Activator::ServiceChanged, this, std::placeholders::_1),
std::string("(&(") + Constants::OBJECTCLASS + "=" +
us_service_interface_iid<IDictionaryService>() + ")" + "(Language=*))");

Expand Down
6 changes: 4 additions & 2 deletions doc/src/tutorial/eventlistener/Activator.cpp
Expand Up @@ -51,7 +51,7 @@ class Activator : public BundleActivator
void Start(BundleContext context)
{
std::cout << "Starting to listen for service events." << std::endl;
context.AddServiceListener(this, &Activator::ServiceChanged);
listenerToken = context.AddServiceListener(std::bind(&Activator::ServiceChanged, this, std::placeholders::_1));
}

/**
Expand All @@ -62,7 +62,7 @@ class Activator : public BundleActivator
*/
void Stop(BundleContext context)
{
context.RemoveServiceListener(this, &Activator::ServiceChanged);
context.RemoveListener(std::move(listenerToken));
std::cout << "Stopped listening for service events." << std::endl;

// Note: It is not required that we remove the listener here,
Expand Down Expand Up @@ -91,6 +91,8 @@ class Activator : public BundleActivator
std::cout << "Ex1: Service of type " << objectClass << " modified." << std::endl;
}
}

ListenerToken listenerToken;
};

}
Expand Down
9 changes: 3 additions & 6 deletions framework/doc/bundle_properties.rst
Expand Up @@ -16,11 +16,11 @@ and cannot be altered by the bundle author:
Bundle authors must always add the following property to their bundle's
``manifest.json`` file:

- ``bundle.name`` - The human readable name of the bundle (type
- ``bundle.symbolic_name`` - The human readable name of the bundle (type
``std::string``)

C++ Micro Services will not install any bundle which doesn't contain a
valid 'bundle.name' property in its ``manifest.json`` file.
valid 'bundle.symbolic_name' property in its ``manifest.json`` file.

Bundle authors can add custom properties by providing a
``manifest.json`` file, embedded as a top-level resource into the bundle
Expand All @@ -31,7 +31,7 @@ be:
.. code:: json
{
"bundle.name" : "my bundle",
"bundle.symbolic_name" : "my bundle",
"bundle.version" : "1.0.2",
"bundle.description" : "This bundle provides an awesome service",
"authors" : [ "John Doe", "Douglas Reynolds", "Daniel Cannady" ],
Expand All @@ -50,9 +50,6 @@ Services library specifies the following standard keys for re-use in
``std::string``)
- ``bundle.description`` - A description for the bundle (type
``std::string``)
- ``bundle.autoload_dir`` - A custom auto-load directory for the bundle
(type ``std::string``). If not set, this property defaults to the
bundle's library name.

.. note::

Expand Down
81 changes: 40 additions & 41 deletions framework/doc/resources.rst
@@ -1,58 +1,42 @@
.. _concept-resources:

The Resources System
====================

The C++ Micro Services library provides a generic resources system to
embed arbitrary files into a bundle's shared library (the size
limitation per resource is 2GB, due to the used ZIP format).

The following features are supported:

- Embed arbitrary data into shared or static bundles or executables.
- Data is embedded in a compressed format (zip) with a configurable
compression level.
- Resources are accessed via a Bundle instance, providing individual
resource lookup and access for each bundle.
- Resources are managed in a tree hierarchy, modeling the original
child - parent relationship on the file-system.
- The BundleResource class provides a high-level API for accessing
resource information and traversing the resource tree.
- The BundleResourceStream class provides an STL input stream derived
class for the seamless usage of embedded resource data in third-party
libraries.

The following conventions and limitations apply:
The Resource System
===================

The C++ Micro Services library provides a generic resource system that allows you to:

- Embed resources in a bundle.
- Access resources at runtime.

The features and limitations of the resource system are described in more detail in
the following sections.

- Resource entries are stored with case-insensitive names. On
case-sensitive file systemes, adding resources with the same name but
different capitalization will lead to an error.
- Looking up resources by name at runtime *is* case sensitive.
- The CppMicroServices library will search for a valid zip file inside
a shared library, starting from the end of the file. If other zip
files are embedded in the bundle as well (e.g. as an additional
resource embedded via the Windows RC compiler or using other
techniques), it will stop at the first valid zip file and use it a
the resource container.

Embedding Resources in a Bundle
-------------------------------

Resources are embedded into a bundle's shared or static library (or into
an executable) by using the :program:`usResourceCompiler3` executable. It will
create a ZIP archive of all input files and can append it to the bundle
file. See :any:`usResourceCompiler3(1)` for the command line reference.
file with a configurable compression level. See :any:`usResourceCompiler3(1)`
for the command line reference.


Accessing Resources at Runtime
------------------------------

Each bundle provides access to its embedded resources via the
:any:`Bundle <cppmicroservices::Bundle>` class which provides methods
Each bundle provides individual resource lookup and access to its embedded
resources via the :any:`Bundle <cppmicroservices::Bundle>` class which provides methods
returning :any:`BundleResource <cppmicroservices::BundleResource>`
objects. The :any:`BundleResourceStream <cppmicroservices::BundleResourceStream>`
class provides a ``std::istream`` compatible object to access the
resource contents.
objects. The BundleResource class provides a high-level API for accessing
resource information and traversing the resource tree.

The :any:`BundleResourceStream <cppmicroservices::BundleResourceStream>`
class provides a ``std::istream`` compatible object for the seamless usage of
embedded resource data in third-party libraries.

Resources are managed in a tree hierarchy, modeling the original parent-child
relationship on the file-system.

The following example shows how to retrieve a resource from each
currently installed bundle whose path is specified by a bundle property:
Expand All @@ -66,10 +50,10 @@ This example could be enhanced to dynamically react to bundles being
started and stopped, making use of the popular *extender pattern* from
OSGi.

Runtime overhead
Runtime Overhead
----------------

The resources system has the following runtime characteristics:
The resource system has the following runtime characteristics:

- During static initialization of a bundle, it's ZIP archive header
data (if available) is parsed and stored in memory.
Expand All @@ -79,3 +63,18 @@ The resources system has the following runtime characteristics:
- Creating a ``BundleResourceStream`` object will allocate memory for
the uncompressed resource data and inflate it. The memory will be
free'ed after the ``BundleResourceStream`` object is destroyed.

Conventions and Limitations
---------------------------

- Resources have a size limitation of 2GB due to the use of the ZIP format.
- Resource entries are stored with case-insensitive names. On
case-sensitive file systems, adding resources with the same name but
different capitalization will lead to an error.
- Looking up resources by name at runtime *is* case sensitive.
- The CppMicroServices library will search for a valid zip file inside
a shared library, starting from the end of the file. If other zip
files are embedded in the bundle as well (e.g. as an additional
resource embedded via the Windows RC compiler or using other
techniques), it will stop at the first valid zip file and use it as
the resource container.

0 comments on commit 3b81b03

Please sign in to comment.