- 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
- Summary
Summary of Java API for JXTA Protocols
JXTA protocols are used to help peers discover, interact, and manage P2P applications. The protocols are not applications in themselves and require much more code to create something useful. The API hides a lot of detail about the P2P network, and its management that makes writing a JXTA application much easier than developing a P2P capable application from scratch. This section introduces the various APIs that we will discuss in detail later in the chapter.
Peer Discovery API
The peer discovery is an implementation of a searching mechanism with a local cache and the ability to forward requests.
The root of the discovery API is the DiscoveryService class. The DiscoveryService is obtained from the PeerGroup class, because discovery is always limited to its group.
Peer Resolver API
The resolver API is used by other APIs that need a request/response format. The resolver is accessed through the ResolverService interface.
The resolver should be thought of as a network-wide query. Instead of specifying a single peer, a group of peers is queried. An example of a use for this is the discovery service that passes a query to multiple rendezvous in search of answers.
Peer Information API
Peer information API is a way to request status information about a peer. The peer information API is accessed via the PeerInfoService.
Peer Membership Protocol
The peer membership API, like the discovery API, is only from the viewpoint and context of the peer group. The membership API is really in two partsthe membership authentication and credentialing. Credentialing is used in much of the messaging to prove that the peer is a valid member of the group, so the communications containing the credential are valid.
The membership protocol is accessed via the MembershipService abstract class. Note that this may be converted to an interface in a future version of the JXTA Java API.
Pipe Binding API
Pipe binding API is one of the more dynamic APIs. The reason is that the API is used for many different styles of pipe. The protocol is accessed via the PipeService.
It should be noted that the pipe service uses the resolver and the endpoint services. A module called EndpointRouter does the routing of pipes.
The PipeService interface does not define pipes, just the creation and management of pipes. Pipes are defined by implementing the InputPipe and OutputPipe interfaces.
Peer Endpoint API
The peer endpoint API is an API that is mostly invisible to JXTA application developers. The reason is that the endpoint API is really an implementation of a router. There are uncountable numbers of routers in use in corporations and the Internet that are just as invisible to the writers of browsers and other network software. However, this API can be used directly by applications that could be used to create applications that are more powerful. This API holds the key to accessing the transports available to other peer services, such as pipes and the resolver.
The key difference between a router and the endpoint router is that the routing is performed in the peer instead of a specialized piece of hardware and software. In the future, it is possible that there will be dedicated JXTA routers, but there is a great advantage to controlling your own destiny and routes. The API is probably less efficient than a dedicated router, but the endpoint router is built to route in some of the worst conditions caused by the mess of corporate LANs, firewalls, proxy servers, and NAT devices.
The router uses the resolver to query other peers for parts of the route. The endpoint protocols, such as TCP and HTTP, are defined and managed here too. The endpoint API is accessed with the EndpointService interface.