Core Jini Author:W. Keith Edwards A Roadmap Part I of this book, "Foundations," provides some necessary background reading Jini. This information will be useful for savvy readers who just need to understand Jini, what it does, and how it works. But it's also "required reading" for developers who want to build actual, running Jini programs--the chapters in this part highlight th... more »e philosophical differences between Jini and "classical" networked and distributed systems technologies. If you have a good understanding of this material, you're ready to build software that's consistent with the Jini aesthetic. Chapter 1, "A New Computing Paradigm," looks at the history and motivation of Jini. You'll see how Jini is really the fulfillment of the original Java promise: of collections of software and hardware, working together simply and without administration. This chapter also covers the process of getting and installing the Jini software. Chapter 2, "Distributed Systems," provides a glimpse at the basics of distributed systems, and how Jini differs from traditional distributed systems software. Even if you're a handy network programmer, you may want to take a look at this chapter. Jini is fairly unique in the distributed systems world, and it's interesting to see the roots of Jini and understand what problems it's good at solving. Chapter 3, "The Jini Model," introduces the basic concepts in Jini. Fortunately there are very few of these--only five. Understanding these concepts and how they connect to each other will make later reading much easier. Chapter 4, "Deployment Scenarios," covers some scenarios for deploying Jini services. These are development targets, if you will--ways that you as a developer can deploy Jini code that you write. Jini is perhaps unique in all the Java libraries provided by Sun, in that it is specifically designed to support devices which may not have Java Virtual Machines (JVMs) embedded in them. Jini can be used to connect devices with only limited computational ability, just as it can be used to connect large servers and other machines running full-fledged JVMs. This chapter will help you understand the options available to you if you're designing for Jini. These first four chapters comprise Part I of this book--they provide a broad introduction to the Jini technology and how it fits into the world. Part II, "Building with Jini," is a very in-depth look at particular aspects of Jini. It is designed for the professional Java developer who is writing new Jini services or building Jini-enabled devices. Some of the chapters in this part are In Depth chapters that dive deeply into a particular aspect of the Jini technology. Others are structured around large examples that show Jini being applied to real problems. Chapter 5, "Getting Started with Jini," begins with a series of programs designed to introduce you to the core Jini concepts. This series is a set of "Hello, World" style programs that are evolved to illustrate ideas such as lookup, discovery, leasing, and remote events. This chapter is your first introduction to building Jini software from scratch, and covers almost all the basic Jini ideas, as well as an example of using the RMI activation framework. Chapter 6, "In Depth: Discovery," is an in-depth chapter looking at Jini's discovery protocols. These are the means by which Jini services notify the world of their existence, and Jini client applications learn about the clusters or "communities" of services that are available to them. We'll look under the hood at these protocols--understanding what's really going on there is key to understanding how to use them effectively. By the end of this chapter you should understand these protocols well enough to be able to implement them "by hand" if you need to. Chapter 7, "Using Attributes to Describe Services," talks about the Jini notion of attributes . Attributes are objects that can be associated with services to provide descriptive information about them, or even provide additional functionality (such as user interfaces) to extend the behavior of services. This chapter talks about how to use attributes, and how the Jini attribute model meshes nicely with JavaBeans. Chapter 8, "In Depth: Using Lookup Services," moves on to the next major phase in a Jini application's life cycle, the use of the Jini lookup service. Lookup is how applications learn about particular services within a particular community. In this in-depth chapter, you'll see how both clients and services use lookup, and learn how to use some high-level "convenience" APIs to simplify the responsibilities of services with regard to lookup. We'll pay special attention to the issues around federating and connecting Jini communities into larger structures. At this point you should understand the basics of what you need to know to build a very functional and useful Jini client application that can participate in the discovery and lookup process, and allow you to find and browse any Jini service on the network. Chapter 9, "A Jini Lookup Service Browser," introduces a long application that exercises the ideas in the previous chapters. This application is a browser that can find lookup servers and the services registered there, and allow you to view and control the attributes of those services. The code in this chapter builds up a toolkit of useful components for displaying and using service information, which you can reuse in your own applications. Chapter 10, "In Depth: Leasing," gives in-depth coverage of the notion of leasing, which is how Jini manages resources held by remote systems. Leasing is also the key to Jini's ability to "self-heal" a large distributed system. In this chapter, we'll talk about the benefits of leasing, and cover some common idioms that arise again and again when programming with leases. While Chapter 10's focus is on the ideas behind leasing, and in particular how clients can use leasing, Chapter 11, "Exporting Leased Resources," talks about how Jini services can implement leasing. This is the other half of the leasing equation that is started in Chapter 10. With these two chapters, you can "close the loop," exporting a leased resource to a client, which then uses the lease consumer APIs to control it. While the chapters on discovery, lookup, and leasing provide the basics of what you have to do to write a functional Jini service, Chapter 12, "The Well-Behaved Service," provides a summary of the extra steps you can take to provide a useful and useable service. This chapter talks about service administration, the join protocol--which governs how services interact with their communities--and how to provide user interfaces for services. After this coverage of what it takes to be a "good" service, we're ready to build a complete, sophisticated Jini application. Chapter 13, "A Complete Example: The Print Service," presents a long example of a service that allows clients to connect to it to print documents. This program supports administration, persistence, and self-description through attributes, and can serve as the basis for many of the services you will write. And, of course, you'll be able to use this service in conjunction with the other examples in this book. Next, Chapter 14, "In Depth: Remote Events," provides a look at how Jini supports asynchronous notifications between programs. Jini extends the local Java event model with events that can be sent between objects in different JVMs. This remote event model has different semantics than the usual JavaBeans event model--this chapter looks at why this is, and explores some common idioms for using remote events. The remote event model lends itself to the creation of event "adaptors" that can plug into the event pipeline to provide such services as forwarding or storage of events. One of the examples here looks at an "event mailbox" adaptor that can be a useful service in many Jini communities. While the preceding chapters cover topics that are considered core and fundamental to Jini, the next two chapters are a bit different. The next chapters cover topics that are actually implemented as services atop the core Jini infrastructure. Chapter 15, "JavaSpaces," provides an introduction to Sun's JavaSpaces service. This service provides an extremely useful object storage engine. Many applications that use Jini will need a way to store persistent data, and share it for use by other applications. JavaSpaces provides an easy object-based way for them to do this. And JavaSpaces can even serve as the basis for new styles of distributed computation. This chapter looks at the JavaSpaces programming model and philosophy. Chapter 16, "Distributed Transactions," covers transactions, which are one of the most technical concepts in Jini. Transactions are a way for cooperating processes to ensure the integrity of their data. Essentially, transactions are a way to make sure that either an entire set of operations happen completely, or that none of them happen at all. Those of you familiar with database programming are no doubt familiar with transactions, and their power in preventing partial failures. The Jini mod« less