celix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pepijn Noltes <pepijnnol...@gmail.com>
Subject Re: Framework API
Date Sun, 26 May 2013 10:59:04 GMT
On Sat, May 25, 2013 at 12:14 AM, Gerrit Binnenmars <
gerritbinnenmars@gmail.com> wrote:

> Op 23-5-2013 9:27, Alexander Broekhuis schreef:
>  Hi all,
>>  I don't have any objections to this.
>>> I also don't see a cleaner solution without resolving to structs with
>>> functions pointers or struct inheritance. struct inheritance you already
>>> mentioned and for structs with functions pointers will make thinks - in
>>> my
>>> opinion - also unclear.
>>>  I'll update the bundle code to check if the bundle is the framework or
>> not,
>> and forward the call accordingly.
> Alexander, as soon as things get more complicated and polymorphism is
> required again the struct with function
> pointers is preferred according to me. The readability is still
> acceptable. It is used all over the Linux kernel.

Celix already uses struct with function pointers for its services and some
other places and I agree this is also needed for more complex situations.
But for the "main" API (e.g. the OSGi api) a mapping between the (Java)
OSGi spec and C is used (see [2]).
I think this creates a clear api and enables (Java) OSGi knowledge to be
(re)used for Celix. As result I think changes to this mapping should be

That being said, maybe it is an idea to use function pointers in the
(private) bundle struct to allow polymorphism? This way when creating a
bundle an alternative set of lifecycle functions can be provided; although
this means the bundle "constructor" signature will change.

>> A second followup question: Felix uses something they call systembundle
>> activators [1], they provide a rather clean way of embedding the
>> framework.
>> Is this something we would like to have in Celix?
>> Without systembundle activators, the non-OSGi application has to use the
>> frameworkbundle to retrieve a BundleContext and work with it. This works
>> without a problem, but from a code point of view it can become messy.
>> Having systembundle activators makes this cleaner, since the framework
>> takes care of calling the activators. This makes it possible to have a bit
>> more separated implementation for the non-OSGi app.
>> What do you guys think?
>> [1]:
>> http://felix.apache.org/site/**apache-felix-framework-**
>> launching-and-embedding.html#**ApacheFelixFrameworkLaunchinga**
>> ndEmbedding-embedding<http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html#ApacheFelixFrameworkLaunchingandEmbedding-embedding>
> This is a very useful extension for Celix. It can be very useful for a lot
> of legacy code.

Yes, very nice addition. I think this also work great for Celix.

[2] http://incubator.apache.org/celix/documentation/mapping.html

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message