Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Help with a Design Pattern: Service interfaces separation from implementation
Help with a Design Pattern: Service interfaces separation from implementation [message #97997] Sun, 23 September 2007 09:09 Go to next message
Eclipse UserFriend
Originally posted by: martin.tomcat.org

Hi forum,

I guess that my question is a generic OSGi question, but since we are using
Equinox I post the question here.

A common design situation (at least for us) is that several services
implements the same service interface.
Like:
Bundle A has a service that implements IMyServiceInterface
Bundle B has also starts a service that implements IMyServiceInterface

We can not have one bundle to start all services of type
IMyServiceInterface, so that is not a slution.

In a prototype we created the IMyServerInterface wasa defined in a separate
bundle. But this gives us MANY
bundles that simply exports a single interface class. The option we had was
to have one big bundle that exposes
all service interfaces.

Which approach is the best? (other options?)

Any advice / comments appreciated

BR

M
Re: Help with a Design Pattern: Service interfaces separation from implementation [message #98031 is a reply to message #97997] Sun, 23 September 2007 16:58 Go to previous messageGo to next message
Simon Kaegi is currently offline Simon KaegiFriend
Messages: 381
Registered: July 2009
Senior Member
Another option is to put the interface classes into each of your
implementation bundles and then both import and export the interface
packages.
The OSGi resolver will "select" one of the bundles as the exporter and all
other bundles as the importers.

There's a few more detail in {3.5.6} of the R4.1 spec that are definitely
worth a read.

HTH
-Simon

"Martin" <martin@tomcat.org> wrote in message
news:fd5agt$35o$1@build.eclipse.org...
> Hi forum,
>
> I guess that my question is a generic OSGi question, but since we are
> using Equinox I post the question here.
>
> A common design situation (at least for us) is that several services
> implements the same service interface.
> Like:
> Bundle A has a service that implements IMyServiceInterface
> Bundle B has also starts a service that implements IMyServiceInterface
>
> We can not have one bundle to start all services of type
> IMyServiceInterface, so that is not a slution.
>
> In a prototype we created the IMyServerInterface wasa defined in a
> separate bundle. But this gives us MANY
> bundles that simply exports a single interface class. The option we had
> was to have one big bundle that exposes
> all service interfaces.
>
> Which approach is the best? (other options?)
>
> Any advice / comments appreciated
>
> BR
>
> M
>
>
>
>
>
>
>
>
>
>
>
>
>
Re: Help with a Design Pattern: Service interfaces separation from implementation [message #102426 is a reply to message #98031] Mon, 03 December 2007 16:46 Go to previous message
Tilo Gau is currently offline Tilo GauFriend
Messages: 36
Registered: July 2009
Member
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi, I hope my question is placed right.

As far as I understood, I should copy the Interface "class" into each
implementation bundle.

What about the bundles which want to use this interface? Should I copy
it there, too? Isn't there a problem to keep all that in sync?

What about the package naming, if I use com.corp.app.BundleA which wants
to use Interface X and com.corp.app.BundleB which implementents X? What
if I want to develop a bundle which implements a third party interface
or if I want to use a third party bundle with a given interfac? Should I
copy the interface package to my bundle just like
com.othercorp.BundleX.interfaces?


And another aspect:
Where would all the wiring happen? Where should I say, BundleA using
InterfaceX is wired to BundleB implementing InterfaceX? As far as I
understood component based development, it is not allowed to be written
in code, because the wiring have to be kept customizable without
altering the bundle itself.


Thank you for your advice in advance and best regards,
T.Gau

Simon Kaegi schrieb:
> Another option is to put the interface classes into each of your
> implementation bundles and then both import and export the interface
> packages.
> The OSGi resolver will "select" one of the bundles as the exporter and all
> other bundles as the importers.
>
> There's a few more detail in {3.5.6} of the R4.1 spec that are definitely
> worth a read.
>
> HTH
> -Simon
>
> "Martin" <martin@tomcat.org> wrote in message
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHVDLOVGRnyruSs/MRAs6fAJ9sBDpnR3RTptYqwRSntEGrC3u9TQCf d/ds
NWVNb1OyBuxDrUd3MWaJXIY=
=vX67
-----END PGP SIGNATURE-----
Previous Topic:Setting a welcome-file
Next Topic:jboss eqquinox ejb call failed
Goto Forum:
  


Current Time: Sat Dec 20 16:42:12 GMT 2014

Powered by FUDForum. Page generated in 0.01579 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software