6.3. Delegation and Callback

Component-based design is “divide and conquer” with clear-cut compartmentalization: Sharing among bundles and services is strictly controlled. This poses a challenge to designing services that work together. For multiple callers to use a service, they must go through the same interface provided by the callee; at the same time, they may all want the callee in slightly different ways.

Suppose we are to design a news service, NewsService, whose HTML contents are needed by services for a pager, a touch panel, and a PC. The data are from the same source, but how they are displayed varies: text only on the pager, no dynamic contents on the touch panel, and full media on the PC.

The news service has a few options to deal ...

Get Programming Open Service Gateways with Java Embedded Server™ Technology now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.