JXTA ==== Sources ------- Text: Project JXTA: A Technology Overview Project JXTA: Java Programmers Guide http://platform.jxta.org/TutorialGraphics.html http://cms.jxta.org/cmswhitepaper.html http://gisp.jxta.org/ Practical: JXTA project InstantP2P application JXTA project P2P shell jnushare client Summary ------- what is JXTA? JXTA is a set of P2P protocols. These protocols allow peers to discover other peers and communicate with each other. The protocols are defined in terms of messages exchanged between peers. JXTA is meant to be platform and transport independent, that is, it is not tied to any single programming language (e.g., Java) or platform (e.g., Linux), and the protocols messages are not tied to any single transport protocol (e.g., TCP/IP) Concepts -------- JXTA defines a number of core concepts upon which its design is based. These concepts are: o Peer - a node that speaks the JXTA protocols o Message - a datagram containing an envelope, protocol headers and bodies. o Peer Group - a collection of cooperating peers o Pipe - an async communication channel for sending/receiving messages o Advertisement - an XML document that publishes the existence of a resource (peer, peer group, pipe, service) Protocols --------- The JXTA core protocols are: o Peer Discovery Protocol used between any peers to find other peers, peer groups, or advertisements. o Peer Information Protocol used to learn about another peer's properties. o Peer Resolver Protocol 'foundation protocol' for the Peer Discovery Protocol and the Peer Information Protocol. Can be used to build other protocols as well. Defines send/recieve 'generic queries' and responses to be sent from one peer to another. o Peer Membership Protocol used to find out about, join and leave groups. o Pipe Binding Protocol used to bind a pipe to an actual endpoint o Peer Endpoint Protocol used to provide routing information for paths between peers (if a direct connection is not possible). How it works ------------ When a peer starts up there are a number of ways it can join the JXTA network (more details: http://platform.jxta.org/TutorialGraphics.html) . The most common way is to use a rendezvous. A rendezvous is a peer that provides a list of other known peers and speaks the discovery protocol. When a new peer comes up it sends a discovery message to the rendezvous and the rendezvous returns information about the peers it knows. Gnerally the peer has the address of the rendezvous hardcoded into it or it reads it from some file. If neither of these apply it can try to discover a local peer using TCP multicast. Because of firewall problems rendezvous often also take on the role of routers. this means that they can be accessed using HTTP as well as the JXTA protocols. Discovery requests for particular peers can be forwarded to other peers/rendezvous if a given peer or rendezvoud cannot fullfill the request. The underlying implementation takes care of getting the messages from one endpoint to the other. Services -------- JXTA is meant to be used as a basis for building P2P services and applications. Services generally extend the available protocols with their own service specific protocols. peers that implement these protocols offer the services. Common services include: indexing, searching, file sharing, authentication, etc. Applications ------------ Applications combine services and make them useable for users. They provide the user interface and logic to use services. Application Features -------------------- We have looked at two file-sharing applications. Both applicatioins are extremely simple in terms of file sharing features provided. They allow a user to share a file, search for files given keywords and download found files. Neither tells who (which peer(s)) has the file, nor any characteristics about the file or characteristics of the peer where it can be downloaded from. Neither shows whether there are multiple copies of the file shared in the network. Neither provides any options about where to download a file from (nor options to combine (swarm) downloads). o InstantP2P - which provides peer to peer as well as group chatting and file sharing. o jnushare - which provides a thread based messaging system and file sharing. InstantP2P makes use of the core JXTA services, in particular the Content Management Service (CMS). The CMS is a JXTA service that supports the sharing and retrieval of content within a peer group. The CMS manages the shared content for a local peer, and allows applications to browse and download content from remote peers. It works by creating advertisements for all shared content and searching through all content advertisements offered by peers in its peer group. more detail: http://cms.jxta.org/cmswhitepaper.html jnushare makes use of the Global Information Sharing Protocol (GISP) which is a distributed indexing service similar to Chord (?). GISP selects peers to be responsible for information about specific keywords. This is done by calculating the MD5 hash value of a keyword and the MD5 hash value of a peer ID, then calculating the difference between these two values. The peer for which the difference is the smallest is responsible for that keyword. When a search is performed the searching peer determines which peer is responsible for the search keyword and sends a query to that peer. more details: http://gisp.jxta.org/ Setting up a local network -------------------------- Setting up a local network (for InstantP2P) is pretty straightforward. When the first client is started up it must be designated as a rendezvous, and not use HTTP. the other clients should also not use HTTP and specify the first client as their rendezvous. Setting up a local network for jnushare proceeds in a similar fashion.