I'm trying to familiarize myself with the Capability-Requirement model.

Each Capability has a Namespace, Name, and Version. The example given in
the documentation is

@Capability(
    namespace=ExtenderNamespace.EXTENDER_NAMESPACE,// "osgi.extender"
    name="osgi.component",
    version="1.3.0")

This can be read as "I provide version 1.3.0 of the osgi.component
capability of the osgi.extender namespace". There are some other common
namespaces OSGi provides; osgi.implementation is for implementations of a
specification or contract, and osgi.service is used to indicate that a
service can be registered.

osgi.implementation;
    osgi.implementation="osgi.cm";
    version:Version="1.6"

osgi.service;
    objectClass:List<String>="org.osgi.service.cm.ConfigurationAdmin"

At this point, the namespace seems like a generic idea, or concept. I'm
looking for an _implementation_ of a spec. I'm looking for a _service_
that's registered. These kind of overlap to me though, because an
implementation of osgi.cm seemingly includes an implementation of the
ConfigurationAdmin service. Because these are in two different namespaces,
it seems like there could be misconfigurations. For instance if a bundle
provided the ConfigurationAdmin osgi.service Capability, it may not
necessarily provide the osgi.cm osgi.implementation Capability. The reverse
may have the same issue, unless the osgi.cm osgi.implementation Capability
specifically implied the ConfigurationAdmin osgi.service Capability.

Another example mentioned in Core 3.3.5 is for a screen with a known
resolution.

com.acme.screen;
    width:Long=640;
    height:Long=480;
    card=GeForce

At this point, a "screen with a resolution" is at the same conceptual level
as a "specification implementation" or "registered service". A screen with
a resolution is a Capability, a specification implementation is a
Capability, a registered service is a Capability. They are all things that
a Bundle can provide, or require, which I believe is the conceptual level
they all live at; provided by a Bundle, or required by a Bundle. Maybe more
along the lines of provided by a Resource or required by a Resource, but
Bundle should be good enough for now.

So what other concepts or ideas could be provided by a Bundle, or required
by a Bundle? Would a constant String value be something that a Bundle could
provide or require? It seems like it, but it also doesn't seem like
something that we would want to put in a Capability. It seems too small a
concept, or too specific a concept to warrant a Capability. What about a
localized String? It's a bit of a larger concept, as it includes a locale,
a key, as well as the localized string. Something about it though still
doesn't seem to fit well as a Capability. Perhaps it's because there's so
many degrees of variability with the concept. An application could probably
have dozens, hundreds, or thousands of localized strings, even within a
single Bundle. But I wouldn't necessarily expect a Bundle to provide dozens
of screen capabilities, let alone hundreds or thousands. Even though there
are fewer attributes, the concept seems big enough, or complex enough, to
warrant a Capability (width/height vs. locale, key, localized value) that
can be Required.

In the case of a Calculator application, it feels kind of weird if we were
to have an addition, subtraction, multiplication, and division Capability.
For some reason though, an arithmetic Capability feels more natural, same
with a trigonometry Capability, or a geometry Capability. They exist on a
level above the individual operations, being made up of multiple operations
to round out the idea.

In the case of a fully integrated development environment application, it
seems like it would require so many capabilities (reading, parsing,
creating, formatting, highlighting, source control, permissions,
accelerated graphics, pluggable third-party components, native code
execution) that it seems like it would become hard to manage.

The question I have then, is how granular should Capabilities be? Is
addition, or multiplication, or a specific localized string too small a
concept for a Capability? Is a Requirement for "a development environment
with (features)" too large a concept?
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to