public class CommandSessionImpl extends Object implements CommandSession, Converter
CommandSession.Utils
Modifier and Type | Field and Description |
---|---|
protected Channel[] |
channels |
static String |
COMMANDS |
static String |
CONSTANTS |
protected OutputStream |
err |
protected InputStream |
in |
protected OutputStream |
out |
protected PrintStream |
perr |
protected PrintStream |
pout |
static String |
SESSION_CLOSED |
protected ConcurrentMap<String,Object> |
variables |
static String |
VARIABLES |
OPTION_NO_GLOB
CONVERTER_CLASSES, INSPECT, LINE, PART
Modifier | Constructor and Description |
---|---|
protected |
CommandSessionImpl(CommandProcessorImpl shell,
CommandSessionImpl parent) |
protected |
CommandSessionImpl(CommandProcessorImpl shell,
InputStream in,
OutputStream out,
OutputStream err) |
Modifier and Type | Method and Description |
---|---|
ClassLoader |
classLoader() |
void |
classLoader(ClassLoader classLoader) |
void |
close()
Close this command session.
|
Object |
convert(Class<?> desiredType,
Object in)
Convert an object to another type.
|
org.apache.felix.gogo.runtime.CommandSessionImpl.JobImpl |
createJob(CharSequence command) |
Path |
currentDir() |
void |
currentDir(Path path) |
static org.apache.felix.gogo.runtime.CommandSessionImpl.JobImpl |
currentJob() |
Object |
doConvert(Class<?> desiredType,
Object in) |
Object |
execute(CharSequence commandline)
Execute a program in this session.
|
Object |
expr(CharSequence expr) |
org.apache.felix.gogo.runtime.CommandSessionImpl.JobImpl |
foregroundJob()
Get the current foreground job or null.
|
CharSequence |
format(Object result,
int inspect)
Convert an object to string form (CharSequence).
|
CharSequence |
format(Object target,
int level,
Converter escape)
Convert an objet to a CharSequence object in the requested format.
|
Object |
get(String name)
Get the value of a variable.
|
PrintStream |
getConsole()
Return the PrintStream for the console.
|
InputStream |
getKeyboard()
Return the input stream that is the first of the pipeline.
|
ConcurrentMap<String,Object> |
getVariables() |
Object |
invoke(Object target,
String name,
List<Object> args) |
List<Job> |
jobs()
List jobs.
|
CommandProcessor |
processor() |
Object |
put(String name,
Object value)
Set the value of a variable.
|
Path |
redirect(Path path,
int mode) |
void |
setJobListener(JobListener listener)
Set the job listener for this session.
|
public static final String SESSION_CLOSED
public static final String VARIABLES
public static final String COMMANDS
public static final String CONSTANTS
protected InputStream in
protected OutputStream out
protected PrintStream pout
protected OutputStream err
protected PrintStream perr
protected Channel[] channels
protected final ConcurrentMap<String,Object> variables
protected CommandSessionImpl(CommandProcessorImpl shell, CommandSessionImpl parent)
protected CommandSessionImpl(CommandProcessorImpl shell, InputStream in, OutputStream out, OutputStream err)
public CommandProcessor processor()
public ConcurrentMap<String,Object> getVariables()
public Path currentDir()
currentDir
in interface CommandSession
public void currentDir(Path path)
currentDir
in interface CommandSession
public ClassLoader classLoader()
classLoader
in interface CommandSession
public void classLoader(ClassLoader classLoader)
classLoader
in interface CommandSession
public void close()
CommandSession
close
in interface AutoCloseable
close
in interface CommandSession
public Object execute(CharSequence commandline) throws Exception
CommandSession
execute
in interface CommandSession
Exception
public InputStream getKeyboard()
CommandSession
getKeyboard
in interface CommandSession
public Object get(String name)
CommandSession
get
in interface CommandSession
public Object put(String name, Object value)
CommandSession
put
in interface CommandSession
name
- Name of the variable.value
- Value of the variablepublic PrintStream getConsole()
CommandSession
getConsole
in interface CommandSession
public CharSequence format(Object target, int level, Converter escape) throws Exception
Converter
public Object convert(Class<?> desiredType, Object in)
CommandSession
convert
in interface CommandSession
convert
in interface Converter
desiredType
- The type that the returned object can be assigned toin
- The object that must be convertedpublic CharSequence format(Object result, int inspect)
CommandSession
format
in interface CommandSession
public Object expr(CharSequence expr)
public Object invoke(Object target, String name, List<Object> args) throws Exception
Exception
public List<Job> jobs()
CommandSession
jobs
in interface CommandSession
public static org.apache.felix.gogo.runtime.CommandSessionImpl.JobImpl currentJob()
public org.apache.felix.gogo.runtime.CommandSessionImpl.JobImpl foregroundJob()
CommandSession
foregroundJob
in interface CommandSession
public void setJobListener(JobListener listener)
CommandSession
setJobListener
in interface CommandSession
public org.apache.felix.gogo.runtime.CommandSessionImpl.JobImpl createJob(CharSequence command)
Copyright © 2006–2019 The Apache Software Foundation. All rights reserved.