Articles Weblogs Books School Short Cuts Podcasts  

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
stdin = Default InputPipe (class
Shell = Root Shell (class
consout = Default Console OutputPipe 
consin = Default Console InputPipe (class
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:/
      Provider :

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