public class Cli extends Service
Modifier and Type | Class and Description |
---|---|
class |
Cli.CliOutputStream |
class |
Cli.Decoder |
class |
Cli.Pipe
Pipe between another process - its output stream is our input stream its
input stream is our output
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
cd |
static java.lang.String |
help |
static org.slf4j.Logger |
log |
static java.lang.String |
lp |
static java.lang.String |
ls |
static java.lang.String |
pwd |
static java.lang.String |
question |
cfgDir, dnaPool, MESSAGE_RECORDING_FORMAT_BINARY, MESSAGE_RECORDING_FORMAT_XML
Constructor and Description |
---|
Cli(java.lang.String n) |
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String name,
java.io.InputStream out,
java.io.OutputStream in)
add an i/o pair to this cli for the possible purpose attaching this is a
remote process's input and output stream, hence from this side they are
inverted - ie out is an inputstream and in is an output stream
|
void |
attach() |
void |
attach(java.lang.String id)
Pipe or Attach to another processes' Cli different level cli.attach(process
id)
|
void |
attachStdIO() |
java.lang.String |
cd(java.lang.String path) |
void |
clear() |
void |
detach()
unfortunate collision of names :(
this detach() does not detach from services - but detaches from the
std i/o of another process
|
void |
detachStdIO() |
java.lang.String |
echo(java.lang.String msg) |
static ServiceType |
getMetaData()
This static method returns all the details of the class without it having
to be constructed.
|
java.lang.String |
getPrompt() |
void |
ls(java.lang.String path)
FIXME !!! return Object[] and let Cli command processor handle encoding for
return
path is always absolute never relative
|
static void |
main(java.lang.String[] args) |
void |
process(java.lang.String line)
processes input from incoming streams
|
void |
releaseService()
Releases resources, and unregisters service from the runtime
|
void |
startService() |
java.lang.String |
stdout(byte[] data)
this method publishes returning data
|
void |
stopService()
Stops the service.
|
void |
write(byte[] data) |
void |
writePrompt() |
addListener, addListener, addTask, addTask, addTask, addTaskOneShot, allowDisplay, allowDisplay, attach, broadcastState, buildDna, buildDna, buildDnaKeys, buildDnaNames, clearLastError, close, containsTask, copyShallowFrom, createPeer, createPeer, createRootReserved, detach, detach, echoHeartbeat, error, error, error, getAttached, getCfgDir, getComm, getDeclaredMethodNames, getDeclaredMethods, getDescription, getDna, getDnaString, getHostName, getInbox, getInstanceId, getIntanceName, getInterfaceSet, getLastError, getMessageSet, getMetaData, getMethodMap, getMethodNames, getMethods, getMethodToolTip, getMsg, getName, getNotifyList, getNotifyListKeySet, getOutbox, getPeerKey, getPeerName, getServiceResourceFile, getSimpleName, getTasks, getThisThread, getType, hasError, hasPeers, help, help, in, info, info, invoke, invoke, invoke, invokeOn, isAttached, isAttached, isLocal, isReady, isRunning, isRuntime, isVirtual, load, load, logTimeEnable, mergeDna, mergeDna, mergePeerDna, movePeerDna, out, out, preProcessHook, preRoutingHook, publishError, publishQueueStats, publishState, publishStats, publishStatus, purgeTask, purgeTasks, releasePeers, removeAllListeners, removeListener, requiresSecurity, reserve, reserve, reserveRoot, reserveRoot, reserveRootAs, run, save, save, save, send, send, send, send, sendBlocking, sendBlocking, sendBlocking, sendBlocking, sendPeer, setInstanceId, setName, setPeer, setSecurityProvider, setState, setThisThread, setVirtual, sleep, stackToString, startHeartbeat, startPeer, startPeer, startRecording, stopHeartbeat, stopMsgRecording, subscribe, subscribe, subscribe, toString, unsubscribe, unsubscribe, unsubscribe, updateStats, warn, warn
public static final org.slf4j.Logger log
public static final java.lang.String cd
public static final java.lang.String pwd
public static final java.lang.String ls
public static final java.lang.String lp
public static final java.lang.String help
public static final java.lang.String question
public void writePrompt() throws java.io.IOException
java.io.IOException
public java.lang.String getPrompt()
public void clear()
public void process(java.lang.String line) throws java.io.IOException
line
- - line of data from the streamjava.io.IOException
- - can throw from damaged io streampublic void add(java.lang.String name, java.io.InputStream out, java.io.OutputStream in)
name
- - name of pipeout
- - out stream to the remote processin
- - in stream from the remote processpublic void attach()
public void attach(java.lang.String id)
attach
in interface Attachable
attach
in class Service
id
- - service namepublic void attachStdIO()
public java.lang.String cd(java.lang.String path)
public void detach()
detach
in interface Attachable
detach
in class Service
public void detachStdIO()
public java.lang.String echo(java.lang.String msg)
public void ls(java.lang.String path) throws java.io.IOException
path
- pjava.io.IOException
- epublic void write(byte[] data) throws java.io.IOException
java.io.IOException
public java.lang.String stdout(byte[] data)
data
- - byte array to be published from stdout streampublic void startService()
startService
in interface ServiceInterface
startService
in class Service
public void stopService()
Service
stopService
in interface ServiceInterface
stopService
in class Service
public static ServiceType getMetaData()
public void releaseService()
Service
releaseService
in interface ServiceInterface
releaseService
in class Service
public static void main(java.lang.String[] args)