Project JXTA

net.jxta.impl.shell
Class ShellApp

java.lang.Object
  |
  +--net.jxta.impl.shell.ShellApp
Direct Known Subclasses:
cat, chpgrp, clear, env, exit, exportfile, get, grep, groups, help, history, importfile, join, leave, man, mkadv, mkmsg, mkpgrp, mkpipe, more, peerconfig, peerinfo, peers, put, rdvserver, rdvstatus, recv, search, send, set, setenv, share, Shell, sql, sqlshell, talk, version, wc, who, whoami

public abstract class ShellApp
extends java.lang.Object
implements net.jxta.platform.Application

This class is the base class any JXTA Shell application must extend.


Field Summary
protected  net.jxta.document.Advertisement adv
          The advertisement for this application if any.
static int appMiscError
          Something bad happened.
static int appNoError
          The command completed successfully.
static int appParamError
          An error occurred resulting from incorrect or missing parameters.
static int appSpawned
          The command is still running.
protected  net.jxta.pipe.InputPipe consin
          The console input.
protected  net.jxta.pipe.OutputPipe consout
          The console output.
protected  java.lang.String currentcmdline
          We might need the actual command line for custom parsing in one of the command classes located in the impl.shell.bin.* packages.
 java.lang.Thread dependsOn
          If this thread is enabled, then this is the root thread of another command which this command ca
protected  net.jxta.peergroup.PeerGroup group
          The default peergroup associated with this app.
protected  net.jxta.pipe.InputPipe inputPipe
          The "stdin" input pipe for this command.
protected  net.jxta.pipe.OutputPipe outputPipe
          The "stdout" output pipe for this command.
protected  net.jxta.pipe.Pipe pipes
          The pipe service for our default peer group.
protected  java.lang.String returnVar
          if the result is a shell object then store it using this name.
protected  boolean started
          Has this app begun running?
protected  boolean stopped
          Has this app in the process of quitting?
 
Constructor Summary
ShellApp()
           
 
Method Summary
protected  java.lang.String consPollInput()
           
protected  void consprint(java.lang.String line)
           
protected  void consprintln(java.lang.String line)
           
protected  java.lang.String consWaitForInput()
           
 net.jxta.document.Advertisement getAdvertisement()
           
 ShellEnv getEnv()
           
 net.jxta.peergroup.PeerGroup getGroup()
           
 net.jxta.pipe.InputPipe getInputConsPipe()
           
 net.jxta.pipe.InputPipe getInputPipe()
           
 net.jxta.pipe.OutputPipe getOutputConsPipe()
           
 net.jxta.pipe.OutputPipe getOutputPipe()
           
 java.lang.String getReturnVariable()
           
 void help()
           
 void init(net.jxta.peergroup.PeerGroup pg, net.jxta.document.Advertisement adv)
           
 boolean isRootShell()
           
protected  java.lang.String pollInput()
           
protected  void print(java.lang.String line)
           
protected  void println(java.lang.String line)
           
 net.jxta.document.Advertisement setAdvertisement(net.jxta.document.Advertisement adv)
           
 ShellEnv setEnv(ShellEnv e)
           
 net.jxta.peergroup.PeerGroup setGroup(net.jxta.peergroup.PeerGroup g)
           
 net.jxta.pipe.InputPipe setInputConsPipe(net.jxta.pipe.InputPipe ip)
           
 net.jxta.pipe.InputPipe setInputPipe(net.jxta.pipe.InputPipe ip)
          Set the input pipe to the provided pipe.
 net.jxta.pipe.OutputPipe setOutputConsPipe(net.jxta.pipe.OutputPipe op)
           
 net.jxta.pipe.OutputPipe setOutputPipe(net.jxta.pipe.OutputPipe op)
           
 void setReturnVariable(java.lang.String v)
           
 int startApp(java.lang.String[] args)
           
 void stopApp()
           
protected  java.lang.String waitForInput()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

appSpawned

public static final int appSpawned
The command is still running.

appNoError

public static final int appNoError
The command completed successfully.

appParamError

public static final int appParamError
An error occurred resulting from incorrect or missing parameters.

appMiscError

public static final int appMiscError
Something bad happened. Don't know what it means, don't care why it happened.

group

protected net.jxta.peergroup.PeerGroup group
The default peergroup associated with this app.

pipes

protected net.jxta.pipe.Pipe pipes
The pipe service for our default peer group.

adv

protected net.jxta.document.Advertisement adv
The advertisement for this application if any. nor

inputPipe

protected net.jxta.pipe.InputPipe inputPipe
The "stdin" input pipe for this command.

outputPipe

protected net.jxta.pipe.OutputPipe outputPipe
The "stdout" output pipe for this command.

consin

protected net.jxta.pipe.InputPipe consin
The console input. Differs from the stdin if stdin has been redirected. consin is not normally redirected.

consout

protected net.jxta.pipe.OutputPipe consout
The console output. Differs from the stdout if stdout has been redirected. consout is not normally redirected.

returnVar

protected java.lang.String returnVar
if the result is a shell object then store it using this name.

started

protected volatile boolean started
Has this app begun running?

stopped

protected volatile boolean stopped
Has this app in the process of quitting?

currentcmdline

protected java.lang.String currentcmdline
We might need the actual command line for custom parsing in one of the command classes located in the impl.shell.bin.* packages. (This does not seem to work.)

dependsOn

public java.lang.Thread dependsOn
If this thread is enabled, then this is the root thread of another command which this command ca
Constructor Detail

ShellApp

public ShellApp()
Method Detail

init

public void init(net.jxta.peergroup.PeerGroup pg,
                 net.jxta.document.Advertisement adv)
Specified by:
init in interface net.jxta.platform.Application

startApp

public int startApp(java.lang.String[] args)
Specified by:
startApp in interface net.jxta.platform.Application

stopApp

public void stopApp()
Specified by:
stopApp in interface net.jxta.platform.Application

isRootShell

public boolean isRootShell()

getEnv

public final ShellEnv getEnv()

setEnv

public final ShellEnv setEnv(ShellEnv e)

getGroup

public final net.jxta.peergroup.PeerGroup getGroup()

setGroup

public final net.jxta.peergroup.PeerGroup setGroup(net.jxta.peergroup.PeerGroup g)

getAdvertisement

public net.jxta.document.Advertisement getAdvertisement()

setAdvertisement

public net.jxta.document.Advertisement setAdvertisement(net.jxta.document.Advertisement adv)

getInputPipe

public final net.jxta.pipe.InputPipe getInputPipe()

setInputPipe

public final net.jxta.pipe.InputPipe setInputPipe(net.jxta.pipe.InputPipe ip)
Set the input pipe to the provided pipe. The previous pipe is returned.

getOutputPipe

public final net.jxta.pipe.OutputPipe getOutputPipe()

setOutputPipe

public final net.jxta.pipe.OutputPipe setOutputPipe(net.jxta.pipe.OutputPipe op)

getInputConsPipe

public final net.jxta.pipe.InputPipe getInputConsPipe()

setInputConsPipe

public final net.jxta.pipe.InputPipe setInputConsPipe(net.jxta.pipe.InputPipe ip)

getOutputConsPipe

public final net.jxta.pipe.OutputPipe getOutputConsPipe()

setOutputConsPipe

public final net.jxta.pipe.OutputPipe setOutputConsPipe(net.jxta.pipe.OutputPipe op)

setReturnVariable

public void setReturnVariable(java.lang.String v)

getReturnVariable

public java.lang.String getReturnVariable()

println

protected final void println(java.lang.String line)

print

protected final void print(java.lang.String line)

pollInput

protected final java.lang.String pollInput()
                                    throws java.io.IOException

waitForInput

protected final java.lang.String waitForInput()
                                       throws java.io.IOException

consprint

protected final void consprint(java.lang.String line)

consprintln

protected final void consprintln(java.lang.String line)

consPollInput

protected final java.lang.String consPollInput()
                                        throws java.io.IOException

consWaitForInput

protected final java.lang.String consWaitForInput()
                                           throws java.io.IOException

help

public void help()

Project JXTA