Richard S. Hall <[EMAIL PROTECTED]> writes:

> The spec used to recommend packaging a bundle with its
> interfaces...I am not sure if it still does or not, but it is
> definitely not anti-OSGi.

Today I've been wondering about this too. In many cases, I wish to
define some service interface for clients to use, then write at least
one implementation of the service interface. Clients will rely on the
interfaces, but should have no knowledge of the
implementation(s). What's the right way to package this in OSGi?

If I put the interfaces in the same bundle as the implementation, the
two have to be in different packages to maintain the intended privacy
of the implementation. Alternately, I can place the interfaces in a
bundle, and have both the clients and the implementation bundle rely
on that interface-only bundle. This is based on the assumption that a
given class or interface should only wind up in one bundle. Also, the
latter separated approach seems more favorable to there being multiple
implementations of a single interface, as it wouldn't make sense to
put the interfaces in the first implementation's bundle and have all
other implementations rely on the first.

Since Felix is written largely as an implementation of a separate set
of OSGi interfaces, it's more obvious how it splits the two
domains. For an application or system that's more self-contained,
though, it's harder to figure out a discipline for separating
interfaces and implementations.

Advice and examples would be welcome.

-- 
Steven E. Harris

Reply via email to