Cover image for JXTA in a Nutshell

Book description

Scott Oaks, lead author of O'Reilly's new JXTA in a Nutshell says,"Fundamental scalability and centralization forces are constraining the Internet and are restricting its growth. Peer-to-peer networks like JXTA are essential to bring the internet to the next level of scalability, management and security in order to handle unconstrained exchanges of information between peers and the wave of new consumer devices." Written by the key members of Sun Microsystem's Project JXTA, JXTA in a Nutshell is the definitive reference to the most solid platform yet for Peer-to-Peer distributed computing. "P2P" enables users with the same networking application to connect with each other and directly access files from one another's hard drives. JXTA is a giant step forward in the evolution of P2P. O'Reilly's pioneering reference is the first and last word on this powerful distributed computing technology. JXTA in a Nutshell delivers all the information you need to get started, including an overview of P2P distributed computing, an explanation of the JXTA Project's new platform, and ways that developers can become a part of the development effort. JXTA in a Nutshell introduces major concepts in a hands-on way by explaining them in context to the shell, and contains a complete reference to the JXTA application bindings. Also included is the full JXTA protocol specification. The book covers important topics such as security, and how the JXTA technology fits into the standard Java classes.

Table of Contents

  1. JXTA in a Nutshell
    1. Preface
      1. About the Example Programs
      2. Organization of This Book
      3. Conventions Used in This Book
      4. We’d Like to Hear From You
      5. Acknowledgments
    2. I. Introducing JXTA
      1. 1. Introduction to JXTA
        1. What Is JXTA?
          1. jxta.org
        2. Why JXTA?
        3. JXTA Overview
        4. Summary
      2. 2. Getting Started with JXTA
        1. Setting Up a Java Environment
          1. The Java Platform
          2. The JXTA Class Files and Programs
        2. Basic JXTA Concepts
          1. JXTA Shell Syntax
        3. JXTA Peers
        4. Peergroups
          1. Peergroup Services
          2. Creating Peergroups
          3. Joining Groups
          4. Canceling Group Membership
        5. Discovery
          1. Dynamic Discovery
          2. Static Discovery Through Rendezvous Peers
          3. Other Discovery Mechanisms
          4. Relay Peers
        6. JXTA Application Configuration
          1. Re-Entering Configuration Information
          2. Firewall and NAT Traversal
          3. Command Line-Based Configuration
          4. Caching
        7. Pipes
          1. Peer Endpoints
          2. Pipe Abstraction
          3. Nonlocalized Connections
          4. Fault-Tolerant Constructs
          5. Pipe Endpoint Binding
          6. Pipe Communication Mode
          7. Pipes and Peergroups
          8. Pipe Examples
          9. Messages
        8. Advertisements
          1. Obtaining Advertisements
        9. Summary
      3. 3. A Hello World Example
        1. Peergroups
        2. Running JXTA Applications
        3. Advertisements
          1. The Document Interface
            1. Structured document interfaces
          2. Working with Advertisements
          3. Building Advertisements
        4. Peergroup Services
        5. Summary
      4. 4. Service Advertisement and Discovery
        1. An Auctioning Example
          1. The Client/Server Auctioning Model
          2. The P2P Auctioning Model
        2. JXTA Discovery
          1. Discovery Scope
          2. The Asynchronous Discovery Model
        3. The Service Implementation
          1. Creating the Peergroup
            1. The peergroup ID
        4. The Application Implementation
        5. Running the Example
          1. Peer Cache Manager
            1. Troubleshooting the cache
          2. Rerunning the Applications
        6. Key Benefits of Discovery
          1. Performance Improves as the System Ages
          2. Reliability from an Unreliable and Unpredictable Network
        7. Summary
      5. 5. The Pipe API
        1. Creating Pipes
          1. The PipeAdvertisement Class
          2. The PipeID Class
          3. Types of Pipes
          4. Inconsistent Advertisements
          5. Publishing Advertisements
          6. The Pipe Service
        2. Pipe Messages
          1. The Message Interface
            1. Reading messages
            2. Creating messages
          2. The StructuredDocument Class
            1. Reading structured documents
            2. Creating structured documents
          3. Creating Output Pipes
        3. Pipe Discovery
          1. Creating the Pipe Advertisement
          2. Discovering the Peer Pipe Advertisement
          3. Connecting to the Remote Peer
          4. Sending the Auction Request
          5. Receiving Big Messages
        4. Running the Pipe Example
        5. Event-Based Programming
        6. Summary
      6. 6. JXTA Network Services
        1. JXTA Services
          1. Peer Services
          2. Peergroup Services
          3. Why Services?
        2. JXTA Modules
          1. Module Class Advertisement
          2. Module Specification Advertisement
          3. Module Implementation Advertisement
          4. Module Publishing and Instantiation
        3. A Peer Service Example
          1. The RestoPeer as a Peer Service
          2. The HungryPeer Example
          3. Running the Example
          4. Pipe Versus Service Advertisement Publishing
        4. A Peergroup Service Example
          1. The RestoPeer Peergroup Service
            1. The pipe ID
            2. The separated service class
          2. The HungryPeer Implementation
        5. Integration with Other Network Services
          1. Running This Example
        6. Summary
      7. 7. Security
        1. JXTA Security Framework
          1. Communications Security
          2. Anonymity
        2. JXTA Cryptography
        3. JXTA Keys
          1. Key Management
          2. Key Classes
          3. The KeyBuilder Class
          4. Creating an RSA Key Pair
          5. Creating an RC4 Key
        4. The JxtaCrypto Interface
        5. Ciphers
          1. An RC4 Cipher Example
        6. The Signature Class
        7. The Hash Class
          1. The MAC Class
        8. Secure JXTA Pipes
        9. User Credentials
        10. JXTA Authentication
        11. Summary
    3. II. Quick Reference
      1. 8. How to Use This Quick Reference
        1. Finding a Quick-Reference Entry
        2. Reading a Quick-Reference Entry
          1. Class Name, Package Name, Availability, and Flags
          2. Description
          3. Synopsis
            1. Member availability and flags
            2. Functional grouping of members
          4. Class Hierarchy
          5. Cross References
          6. A Note About Class Names
      2. 9. The net.jxta.* Packages
        1. Package net.jxta.codat
        2. Codat
        3. CodatID
        4. Metadata
        5. Package net.jxta.credential
        6. AuthenticationCredential
        7. Credential
        8. Package net.jxta.discovery
        9. DiscoveryEvent
        10. DiscoveryListener
        11. DiscoveryService
        12. Package net.jxta.document
        13. Advertisement
        14. AdvertisementFactory
        15. AdvertisementFactory.Instantiator
        16. Attributable
        17. Attribute
        18. Document
        19. Element
        20. MimeMediaType
        21. StructuredDocument
        22. StructuredDocumentFactory
        23. StructuredDocumentFactory.Instantiator
        24. StructuredDocumentFactory.Instantiator.ExtensionMapping
        25. StructuredDocumentUtils
        26. StructuredTextDocument
        27. TextDocument
        28. TextElement
        29. Package net.jxta.endpoint
        30. EndpointAddress
        31. EndpointFilterListener
        32. EndpointListener
        33. EndpointMessenger
        34. EndpointProtocol
        35. EndpointService
        36. Message
        37. MessageElement
        38. MessageElementEnumeration
        39. Package net.jxta.exception
        40. DiscardQueryException
        41. HandshakeInProgressException
        42. JxtaError
        43. JxtaException
        44. NoResponseException
        45. PeerGroupException
        46. ProtocolNotSupportedException
        47. ResendQueryException
        48. ServiceNotFoundException
        49. UnknownServiceException
        50. ViolationException
        51. Package net.jxta.id
        52. ID
        53. IDFactory
        54. IDFactory.Instantiator
        55. Package net.jxta.index
        56. IndexService
        57. IndexService.BadDocumentException
        58. IndexService.BadQueryException
        59. IndexService.Index
        60. IndexService.IndexException
        61. IndexService.ReverseIndex
        62. Package net.jxta.membership
        63. Authenticator
        64. MembershipService
        65. Package net.jxta.peer
        66. PeerID
        67. PeerInfoEvent
        68. PeerInfoListener
        69. PeerInfoService
        70. Package net.jxta.peergroup
        71. PeerGroup
        72. PeerGroupFactory
        73. PeerGroupID
        74. Package net.jxta.pipe
        75. InputPipe
        76. OutputPipe
        77. OutputPipeEvent
        78. OutputPipeListener
        79. PipeID
        80. PipeMsgEvent
        81. PipeMsgListener
        82. PipeService
        83. Package net.jxta.platform
        84. Application
        85. JxtaLoader
        86. Module
        87. ModuleClassID
        88. ModuleSpecID
        89. Package net.jxta.protocol
        90. DiscoveryQueryMsg
        91. DiscoveryResponseMsg
        92. EndpointAdvertisement
        93. ModuleClassAdvertisement
        94. ModuleImplAdvertisement
        95. ModuleSpecAdvertisement
        96. PeerAdvertisement
        97. PeerGroupAdvertisement
        98. PeerInfoQueryMessage
        99. PeerInfoResponseMessage
        100. PipeAdvertisement
        101. RdvAdvertisement
        102. ResolverQueryMsg
        103. ResolverResponseMsg
        104. TransportAdvertisement
        105. Package net.jxta.rendezvous
        106. RendezvousEvent
        107. RendezvousListener
        108. RendezVousManager
        109. RendezVousMonitor
        110. RendezVousService
        111. Package net.jxta.resolver
        112. GenericResolver
        113. QueryHandler
        114. ResolverService
        115. Package net.jxta.service
        116. Service
        117. Package net.jxta.util
        118. ClassFactory
        119. SimpleRdvManager
        120. SimpleRdvMonitor
        121. SimpleRdvMonitor.RdV
        122. StringEnumeration
      3. 10. The jxta.security.* Packages
        1. Package jxta.security.cipher
        2. Cipher
        3. Key
        4. Package jxta.security.crypto
        5. JxtaCrypto
        6. Package jxta.security.exceptions
        7. CryptoException
        8. Package jxta.security.hash
        9. Hash
        10. Package jxta.security.keyexchange
        11. KeyExchange
        12. Package jxta.security.mac
        13. MAC
        14. Package jxta.security.publickey
        15. PublicKey
        16. PublicKeyAlgorithm
        17. PublickeyData
        18. RSAPrivateKey
        19. RSAPrivatekeyData
        20. RSAPublicKey
        21. RSAPublickeyData
        22. Package jxta.security.random
        23. RandomData
        24. Package jxta.security.signature
        25. Signature
        26. Package jxta.security.util
        27. Description
        28. GetOpt
        29. URLBase64
        30. Util
      4. 11. The jxta.security.impl.* Packages
        1. Package jxta.security.impl.cipher
        2. KeyBuilder
        3. NullCipher
        4. RC4Cipher
        5. SecretKey
        6. Package jxta.security.impl.crypto
        7. JxtaCryptoSuite
        8. Package jxta.security.impl.hash
        9. MD5Hash
        10. NullHash
        11. SHA1Hash
        12. Package jxta.security.impl.keyexchange
        13. NullKeyExchange
        14. Package jxta.security.impl.mac
        15. MACAlgorithm
        16. NullMAC
        17. Package jxta.security.impl.publickey
        18. NullRSA
        19. RSA
        20. RSAKey
        21. Package jxta.security.impl.random
        22. JRandom
        23. Package jxta.security.impl.signature
        24. NullSignature
        25. RSASignature
      5. 12. The JXTA Shell Reference
        1. cat
        2. chpgrp
        3. clear
        4. env
        5. exit
        6. exportfile
        7. get
        8. grep
        9. groups
        10. history
        11. importfile
        12. instjar
        13. join
        14. leave
        15. man
        16. mkadv
        17. mkmsg
        18. mkpgrp
        19. mkpipe
        20. more
        21. peerconfig
        22. peerinfo
        23. peers
        24. put
        25. rdvserver
        26. rdvstatus
        27. recv
        28. search
        29. send
        30. set, setenv
        31. share
        32. Shell
        33. talk
        34. uninstjar
        35. version
        36. wc
        37. who
        38. whoami
      6. 13. The JXTA Protocol Specification
        1. Core Protocols
        2. Standard Services Protocols
        3. Endpoint Messages
        4. Requirements for JXTA Protocols
        5. JXTA Assumptions
        6. Why JXTA?
        7. The JXTA Three-Layer Cake
        8. Conceptual Overview
          1. Peers
          2. Peergroups
          3. Network Services
            1. Service invocation
            2. JXTA-enabled service
          4. Pipes
          5. Messages
          6. Advertisements
          7. Modules
          8. Credentials
          9. IDs
          10. Contents
        9. JXTA Core Protocol Specification
        10. Endpoint Routing Protocol
          1. Route Information
          2. Route Query Request
          3. Route Answer Request
          4. Endpoint Service
            1. Behavior
          5. Endpoint Router Transport Protocol
          6. Queries and Responses
            1. Endpoint Router message element
            2. Endpoint Router endpoint address format
            3. Reference implementation of the Endpoint Router
        11. Peer Resolver Protocol
          1. Resolver Query Message
          2. Resolver Response Message
          3. Listener and Element Naming
          4. Handler Name
          5. Policies and Quality of Service
      7. 14. The JXTA Advertisement Specification
        1. XML and JXTA Advertisements
        2. Peer Advertisements
        3. Peergroup Advertisements
        4. Pipe Advertisements
        5. Module Class Advertisements
        6. Module Specification Advertisement
        7. Module Implementation Advertisements
        8. Rendezvous Advertisements
      8. 15. The JXTA ID Specification
        1. Format of a JXTA ID URN
        2. Using JXTA IDs in Protocols
        3. Example JXTA ID URNs
        4. JXTA ID Properties
        5. JXTA ID Formats
        6. JXTA ID Types
          1. Peergroup IDs
          2. Peer IDs
          3. Codat IDs
          4. Pipe IDs
          5. Module Class IDs
          6. Module Specification IDs
          7. JXTA ID Formats: “jxta” ID Format
        7. JXTA ID UUID Format Type
          1. JXTA UUID Field Definitions
          2. JXTA UUID Codat ID Fields
          3. JXTA UUID Peergroup ID Fields
          4. JXTA UUID Peer ID Fields
          5. JXTA UUID Pipe ID Fields
          6. JXTA UUID Module Class ID Fields
          7. JXTA UUID Module Specification ID Fields
      9. 16. The JXTA Message Specification
        1. Messages
        2. Elements
          1. Name
          2. Type
          3. Content
        3. Binary Message Format
          1. Conventions
          2. Message
          3. Namespace
          4. Element
        4. XML Message Format
          1. Message
          2. Element
          3. Name
          4. mime_type
          5. Encoding
          6. Content
      10. 17. The JXTA Standard Services Protocol Specification
        1. Peer Discovery Protocol
          1. Discovery Query Message
          2. Discovery Response Message
          3. Behavior
        2. Rendezvous Protocol
          1. Behavior
          2. Messages
          3. Propagation Control
            1. LeaseRequest message
            2. LeaseGranted message
            3. LeaseCancelled message
        3. Peer Information Protocol
          1. Obtaining PIP Responses
          2. Response Message
        4. Pipe Binding Protocol
          1. Pipe-Binding Query Message
          2. Pipe-Binding Answer Message
      11. 18. The JXTA Standard Transport Bindings Specification
        1. TCP/IP Transport Binding
          1. TCP/IP Wire Format
            1. Header
            2. Body
          2. Connection States
          3. Keepalive Optimization
        2. HTTP Transport Binding
          1. Message Receiver
            1. block
            2. Message Relay
            3. obtainLease
            4. Ping
            5. poll
            6. renewLease
            7. Send JXTA Message
    4. 19. Bibliography
    5. Class, Method, and Field Index
    6. Index
    7. Colophon