Java Implementation of JXTA Protocols
- Protocol and API
- JXTA Goals
- JXTA Peer and Java
- Overview of the JXTA Protocols JAVA API
- Summary of Java API for JXTA Protocols
- Where JXTA Applications Begin
- The Peer
- Starting JXTA
- Peer Discovery Protocol API
- Peer Resolver Protocol API
- Peer Information Protocol
- Peer Membership Protocol
- Pipe Binding Protocol API
- Peer Endpoint Protocol
In this chapter, you are going to read about the Java implementation of the JXTA protocols. We will highlight the important classes, interfaces, and functionality. The JXTA API is fairly large, not simple, and not always obvious. Consider this chapter an introduction to the API rather than a comprehensive treatment. We will cover important aspects of the JXTA API in more detail in later chapters. The Java version of JXTA is quite large, with almost three hundred Java files in the core platform. In the description here, we will use class diagrams that show relationships, the parent package, and sometimes the methods. Remember that JXTA is evolving, so there may be minor differences over time. With Sun Microsystems' acting stewardship, the changes at this level should be minor. Just in case, please check this book's Web page at http://www.samspublishing.com where we will track all the changes to JXTA from the time this book is published.
Protocol and API
The Java JXTA platform is a series of classes and methods for managing and transmitting application and control data between JXTA compatible peer platforms. These core services are used to create peer-to-peer applications.
One of the first concepts to cover is that JXTA was not initially defined as a Java API. JXTA was originally defined as a set of behaviors and messages. The messages were defined as XML documents with language and operating system independence. The Java version of JXTA is just one of many possible implementations of the JXTA protocols.
A protocol is a repeatable procedure for regulating data transmission between computers. There are implementations of the protocols written in Java, C, Perl, and others. Each of these languages has a different API. The Java API covered in this book is the J2SE (Java 2 Standard Edition) version. There is also a J2ME (Java 2 Micro Edition) version for small devices like phones, PDAs, and other devices. Each API is written to be useful to its developers and does not need to match the Java reference platform in any way other than the JXTA protocol. Some versions, such as the JXTA for the J2ME platform, only implement certain part of the JXTA protocols.
The API can hide many of the details of a protocol. The differences between the Java JXTA API and the JXTA protocol are blurred in some areas and obvious in others. For example, the XML advertisements specified by the protocol are fairly well represented by Java classes and interfaces. Some actions, such as routing, are fairly well hidden from application programmers.
The key parts of the XJTA API are peer membership, pipes, discovery, and the resolver. Less used, but interesting, are the peer endpoint and peer information APIs. In addition, other APIs make up functionalities for rendezvous, gateways, and routers. Rendezvous, gateways, and routers are only of interest to the application developer because of the enhanced services they provide. This chapter covers some of their functionality because it does help to know where some of the mechanics reside.