oreilly.comSafari Books Online.Conferences.
Articles Radar Books  

Learning the JXTA Shell
Pages: 1, 2, 3, 4, 5

Old Favorites

We'll start with a few old shell favorites.

If at any point you need help, the standard *nix man provides man(ual) pages for supported functionality. Typing just man displays information about man itself, along with a list of available commands.

The 'man' command is the primary manual system for the JXTA shell.
The usage of man is:
   JXTA> man <commandName>
  For instance typing
   JXTA> man Shell
         displays man page about the Shell
The following is the list of commands available:
 cat        Display the content of an environment variable
 chpgrp     Change the default peer group
 who        Display member identity in a peer group
 whoami     Display peer and peer-group information

(For a complete list of JXTA shell commands, see "JXTA Commands.")

env, as expected, displays all defined shell environment variables.

peer0 = stored local peer advertisement 
        (class net.jxta.impl.protocol.PeerGroupAdv)
stdout = Default OutputPipe (class net.jxta.impl.shell.ShellOutputPipe)
stdin = Default InputPipe (class net.jxta.impl.shell.ShellInputPipe)
Shell = Root Shell (class net.jxta.impl.shell.bin.Shell.Shell)
consout = Default Console OutputPipe 
          (class net.jxta.impl.shell.ShellOutputPipe)
consin = Default Console InputPipe (class net.jxta.impl.shell.ShellInputPipe)
stdgroup = Default Group (class net.jxta.impl.peergroup.StdPeerGroup)

Comment on this articleHave you explored JXTA? Tell us your first impressions and let others know what you've learned so far.
Post your findings

One thing to note in the above readout is that standard input (reading keyboard input) and output (displaying output to the console) are JXTA pipes, the same conduits by which peers communicate with each other. The same is true for the shell console's consin/consout. We'll delve more into pipes in a bit.

Here are a few more simple commands to try for fun:

  • man | wc
  • env | grep -i stdin
  • cat peer0 | more
  • Shell -s

Getting to know me

Let's get to know ourselves a little, shall we? The whoami command functions as expected, albeit a little more interesting than the standard printing of my username.

<Keywords>NetPeerGroup by default</Keywords>

JXTA>whoami -g
<Keywords>NetPeerGroup by default</Keywords>

The first whoami claims that I am a peer named "milne" with the unique identifier, "jxta://596162..." I am, by default, a member of the "NetPeerGroup" -- more on groups in a moment. I am communicating via TCP directly at IP address, port 6001, and via an HTTP proxy if behind a firewall/NAT. Note that even though I may be using HTTP to get past my firewall, direct TCP communication is still useful for peers on my LAN. The second whoami provides a little more detail about my current peer-group membership, including group identifier and available services.

For more details, there's whoami -l . This is but a pretty representation of the actual peer advertisement, viewable in its native XML by printing the "peer0" environment variable we saw above.

JXTA>whoami -l | more
jxta:PeerGroupAdvertisement : 
  Name : NetPeerGroup
  PeerName : milne
  Keywords : NetPeerGroup by default
  Pid : jxta://59616261646162614A78746150325033237B7161401449269
  Gid : jxta://59616261646162614A757874614D504700000000000000000
  isRendezvous : false
  Services : 
    jxta:ServiceAdvertisement : 
      Name : jxta.service.resolver
      Version : JXTA1.0
      Keywords : resolver
      PipeService : 
      Params :
      Params : tcp://
      Params :
      Params :
      Params :
      Uri : http:/www.jxta.org/download/jxta.jar
      Provider : sun.com

JXTA>cat peer0 | more
<?xml version="1.0"?>
<!DOCTYPE jxta:PeerGroupAdvertisement>
  <Keywords>NetPeerGroup by default</Keywords>

These settings reflect the initial JXTA configurator settings we breezed through earlier. To reconfigure your JXTA peer from within the shell, take a gander at the peerconfig command (type: man peerconfig).

So much, then, for the preamble; let's get on to the interesting P2P pieces.

Pages: 1, 2, 3, 4, 5

Next Pagearrow

P2P Weblogs

Richard Koman Richard Koman's Weblog
Supreme Court Decides Unanimously Against Grokster
Updating as we go. Supremes have ruled 9-0 in favor of the studios in MGM v Grokster. But does the decision have wider import? Is it a death knell for tech? It's starting to look like the answer is no. (Jun 27, 2005)

> More from O'Reilly Developer Weblogs

More Weblogs
FolderShare remote computer search: better privacy than Google Desktop? [Sid Steward]

Data Condoms: Solutions for Private, Remote Search Indexes [Sid Steward]

Behold! Google the darknet/p2p search engine! [Sid Steward]

Open Source & The Fallacy Of Composition [Spencer Critchley]