1 / 31

JXTA: Tech Brief

JXTA: Tech Brief. Dan Berger, Suvidhean Dhirakaosal, Essia Hamouda, Demetris Zeinalipour CS 202 Spring 2003. Outline. Problem Statement/Motivation Architecture Overview Experiments/Demonstrations Conclusions. Motivation.

rivka
Télécharger la présentation

JXTA: Tech Brief

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. JXTA: Tech Brief Dan Berger, Suvidhean Dhirakaosal, Essia Hamouda, Demetris Zeinalipour CS 202 Spring 2003

  2. Outline • Problem Statement/Motivation • Architecture Overview • Experiments/Demonstrations • Conclusions

  3. Motivation • Existing P2P solutions have had rapid adoption and success – so why build another? • JXTA attempts to address 3 key “shortcomings” of typical P2P systems: • Interoperability • Platform Independence • Ubiquity

  4. Interoperability • Gnutella for file sharing, ICQ/AIM/Yahoo/Jabber/MSN for instant messaging • But none of them can talk to each other. • This has led to the development of apps like Gaim (linux) and Trillian (windows) that provide a single front-end to multiple protocols. • JXTA aims to standardize at the protocol level.

  5. Platform Independence • JXTA is “independent” of programming language, operating system, and networking platform. • The core of JXTA are protocol definitions, not API’s.

  6. Ubiquity • JXTA was designed to be scalable to any device with a “network heartbeat” – cited examples are: • Sensors • Consumer electronics (toasters, cell phones) • PDAs • Etc.

  7. The Grand Vision

  8. Enough Buzzwords, Already • JXTA proposes a set of services to enable building a securable logical overlay network linking “peers:” • Peer Discovery • Peer Resolution • Rendezvous • Pipe Binding • Endpoint Routing

  9. Gratuitous Architecture Picture

  10. Just the Facts • Each node in the JXTA network • has a “peer id” - a “globally” unique ID (UUID) • Urn:jxta:idform3-31:08:66:42:67:::91:24::73 • Is Autonomous and may operate independently of all peers • Peers (self)organize into peer groups – loosely hierarchical. • All peers belong to the “World” group. • Peers and services are advertised with advertisements (XML documents)

  11. Advertisements • Used to describe peers, peers groups, pipes, content, services and resources • Used to pass info between peers • Are presented in XML • Peer Adv. • Peer group Adv. • Module Class Adv. • Module Spec. Adv. • Module Implementation Adv.

  12. Discovery Query <xs:element name="DiscoveryQuery" type="jxta:DiscoveryQuery"/> <xsd:simpleType name="DiscoveryQueryType"> <xsd:restriction base="xsd:string"> <!-- peer --> <xsd:enumeration value="0"/> </xsd:restriction> </xsd:simpleType> <xs:complexType name="DiscoveryQuery"> <xs:sequence> <xs:element name="Type" type="jxta:DiscoveryQueryType"/> <xs:element name="Threshold" type="xs:unsignedInt" minOccurs="0"/> <xs:element name="Attr" type="xs:string" minOccurs="0"/> <xs:element name="Value" type="xs:string" minOccurs="0"/> <!-- The following should refer to a peer adv, but is instead a whole doc for historical reasons --> <xs:element name="PeerAdv" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType>

  13. Discovery • LAN-based (broadcast) • Invitation (in or out of band, via an advertisement) • Cascaded (controlled view across discovered peers) • Rendezvous (napster-esqe)

  14. Resolution • In general – a service that resolves advertisements into endpoints. • JXTA ships with one implementation – “Rendezvous” – in which hosts serve as switchboards for messages. • More complex/decentralized resolvers are possible, but not specified/provided.

  15. Pipes • Pipes are unidirectional communication channels. • Peers can host input pipes (incoming messages), or output pipes (outgoing messages). • Pipes can be chained to link peers across multiple logical hops, and can be one-to-many. • Pipes are bound to peer ids, not IP address.

  16. Pipe

  17. Routing • Allows peers to discover routes for reaching a peer which can not be directly connected to. • I.e. behind a firewall, NAT device, different network platform, etc.

  18. Experiments

  19. Required Components • www.jxta.org has Java and C implementations of the core protocols. • The C version is based on the APR (apache portable runtime) and trails behind the JAVA version in terms of functionality and ease of use. • For Java – requires the J2SE JDK

  20. Installation & Configuration • Install a JRE/JDK (e.g. Sun 1.3.1_1) • Download the latest JXTAInst_VM.exe InstallAnywhere installer (JXTA v2.0) http://download.jxta.org/easyinstall/install.html (4.71MB) (Or download JXTAInst.exe which contains VM) • Download tutorials/code from http://www.jxta.org/project/www/Tutorials.html

  21. JXTA Jars • JXTA’s core uses 13 other JAR files like Jetty portable Web/Servlet Server, Log4J apache’s generic logging API. • Directory Structure so far • /InstantP2P -> A “full-fledged” instant P2P application • /lib -> The JAR Files • /lib/jxta.jar -> Contains the JXTA Programming API • /Shell -> Command-line Interface to JXTA • /tutorials -> Tutorials that we downloaded individually

  22. Step 0: Source/Compiling“Creating a PeerGroup” java -classpath jxta.jar;OTHER_JAR_FILES.jar; Hello import net.jxta.peergroup.*; import net.jxta.impl.id.UUID.*; import net.jxta.impl.id.binaryID.*; public class Hello { static PeerGroup netPeerGroup = null; static DigestTool digestTool = new DigestTool(); public static void main(String args[]) { try { netPeerGroup = PeerGroupFactory.newNetPeerGroup(); System.out.println("Hello from JXTA group " +netPeerGroup.getPeerGroupName() ); System.out.println(" Group ID = " +netPeerGroup.getPeerGroupID().toString()); System.out.println(" Peer name = " + netPeerGroup.getPeerName()); System.out.println(" Peer ID = " + netPeerGroup.getPeerID().toString()); }catch(Exception e){e.printStackTrace();} } }

  23. Step 1 : Running the code 1 2 Now a .jxtadirectory is created on disk which contains all settings On the next run we only fill in an authentication box 3 4

  24. Step 2 : JXTA Sockets! (as of v2.0) • JXTA introduces a Socket API which is similar to the familiar sockets. • The Socket API attempts to make JXTA Pipe programming easier. (JxtaSocket is a bi-directional Pipe) • JxtaServerSocket: Server socket that waits for connections from clients. • JxtaSocket: Socket class used to create the I/O streams for both clients and servers.

  25. Step 3 : JXTA Sockets Example • In this example we use to types of “advertisement” Discovery Services: • LAN-based discovery: Local broadcast over the subnet. (224.0.0.0 to 239.255.255.255) • Works if peers are within the same subnet or if multicast-enabled routers are connecting the peers • Discovery via rendezvous points A peer at a well-known address has the task of knowing and disseminating locations of peers. • Works if peers are fire-walled in which case direct connection between peers is not feasible.

  26. Step 3 : JXTA Sockets Example Rendevouz Service 6 a)connect, b)receive msg, c) send msg back Server Client FIREWALL 5 a)connect, b)receive msg, c) send msg back The Server I want 4 My ServerSocket (multicast channel) to connect to is 2 ID is uuid...BC uuid...BC 3 read the text file 1 read the text file socket.adv <!DOCTYPE jxta:PipeAdvertisement> <jxta:PipeAdvertisement xmlns:jxta="http://jxta.org"> <Id> urn:jxta:uuid-59616261646162614A757874614D504725184FBC </Id> <Type> JxtaUnicast </Type> <Name> socket example </Name> </jxta:PipeAdvertisement>

  27. JXTA Sockets Code Snippets Server (main snippets) // create, and Start the default jxta NetPeerGroup PeerGroupnetPeerGroup = PeerGroupFactory.newNetPeerGroup(); // Read file from disk FileInputStream is = new FileInputStream("socket.adv"); // Generate Pipe Advertisment PipeAdvertisement pipeAdv = (PipeAdvertisement)AdvertisementFactory. new Advertisement(is); // Launch ServerSocket JxtaServerSocket serverSocket = new JxtaServerSocket(netPeerGroup, socEx.pipeAdv); // if client connects, spawn two new Threads (input/output). JxtaSocket socket = serverSocket.accept(); OutputStream out = socket.getOutputStream(); InputStream in = socket.getInputStream(); // send a message String msg = “Hello JXTA”; out.write(msg.getbytes()); // receive message back in.read(inbuf, 0, bufsize);

  28. JXTA Sockets Code Snippets Client (main snippets) // create, and Start the default jxta NetPeerGroup PeerGroupnetPeerGroup = PeerGroupFactory.newNetPeerGroup(); // Read file from disk FileInputStream is = new FileInputStream("socket.adv"); // Generate Pipe Advertisment PipeAdvertisement pipeAdv = (PipeAdvertisement)AdvertisementFactory. new Advertisement(is); // Launch Socket along with 2 new Threads (input/output). JxtaSocket socket = new JxtaSocket(netPeerGroup, pipeAdv); OutputStream out = socket.getOutputStream(); InputStream in = socket.getInputStream(); // receive message read = in.read(inbuf, 0, bufsize); System.out.println(">> " + new String(inbuf)); // send message back out.write(inbuf, 0, read);

  29. JXTA Sockets Code Snippets Server acting also as Rendezvous Client connecting to Rendezvous

  30. Conclusions

  31. Ongoing JXTA Projects Full list available at : http://apps.jxta.org/servlets/ProjectHome Gnougat: A Fully decentralized file caching RossetChat: Localized JXTA Peer Text Messaging Radiojxta: delivering audio content over JXTA networks P2Pconference: A tool to conduct remote, text-based conferences InstantP2P: To be interactively displayed.

More Related