Basic JXTA Concepts

Now that we have all of this software, we’ll use it to explain a little more about the basic JXTA concepts we outlined in Chapter 1, including how a JXTA application is constructed. We’ll use the JXTA Shell as the basis for our exploration, since it provides us with an interactive tool that uses the JXTA platform to perform its operations.

JXTA Shell Syntax

Before we dive into the shell, here are some notes on its syntax. Like any shell, the JXTA Shell issues a prompt (JXTA>) at which you type in commands.

Shell commands have two kinds of output. Most of them simply send their output to the screen. Some commands, however, produce an object as their output. These objects should be saved in a shell variable. If you do not save the object, most commands will create a new object with a default name to hold the return value; if you’re going to need the object, it’s easier to assign a name to it yourself. Shell variables are created in JXTA by assigning a new name to the output of such a command.

Here are some simple examples. The env command produces as its output a list of all the shell variables and their values:

JXTA>env stdin = Default InputPipe (class net.jxta.impl.shell.ShellInputPipe) parentShell = Root Shell (class net.jxta.impl.shell.bin.Shell.Shell) Shell = Root Shell (class net.jxta.impl.shell.bin.Shell.Shell) stdout = Default OutputPipe (class net.jxta.impl.pipe.NonBlockingOutputPipe) consout = Console OutputPipe (class net.jxta.impl.shell.ShellOutputPipe) ...

Get JXTA in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.