110.

previous chapter table of contents next chapter
  

Partitioning an Application

Jini uses a service view of applications, in contrast to the simple object-oriented view of an application. Of course, a Jini "application" will be made up of objects, but these will be distributed as indivsidual services, which will communicate via their proxy objects. The service view will show these services as they exist on their servers, without any detail about their implementation by objects. This leads to a different way of partitioning an application, not into its component objects, but into its component services. The Jini specification claims that in many monolithic applications there are one or more services waiting to be released, and that making them into services increases their possible uses.

To support this claim, we can look at a smart file viewer application. This application will be given a filename, and based on the structure of the name will decide what type of file it is ( .rtf is Rich Text Format, .gif is a GIF file, and so on). Using this classification, it will then call up an appropriate viewer for that type of file, such as an image viewer or document viewer. A UML class diagram for this application, using a standard object-oriented approach, might look like Figure 1-10.

click to expand
Figure 1-10: UML diagram for an application

There are a number of services that could be extracted from this smart file viewer application. Classifying a file into types is one service that can be used in lots of different situations, not just when you want to view file contents. Each of the different viewer classes is another service.

However, this is not to say that every class should become a service! That would be overkill. What makes these qualify as services is that they all

  • have a simple interface
  • are useful in more than one situation
  • can be replaced or varied

They are reusable, and this is what makes them good candidates for services. They do not require high-bandwidth communication, and they are not completely trivial.

If the application is reorganized as a collection of services, then it could look like Figure 1-11.

click to expand
Figure 1-11: Application as a collection of services

Each service may be running on a different machine on the network (or on the same machine ”it doesn't matter). Each exports a proxy to whatever service locators are running. The SmartViewer application finds and downloads whatever services it needs, as it needs them.

  


A Programmer[ap]s Guide to Jini Technology
A Programmer[ap]s Guide to Jini Technology
ISBN: 1893115801
EAN: N/A
Year: 2000
Pages: 189

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net