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_GLOBCONVERTER_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 CommandSessionpublic void currentDir(Path path)
currentDir in interface CommandSessionpublic ClassLoader classLoader()
classLoader in interface CommandSessionpublic void classLoader(ClassLoader classLoader)
classLoader in interface CommandSessionpublic void close()
CommandSessionclose in interface AutoCloseableclose in interface CommandSessionpublic Object execute(CharSequence commandline) throws Exception
CommandSessionexecute in interface CommandSessioncommandline - the commandlineException - on exceptionpublic InputStream getKeyboard()
CommandSessiongetKeyboard in interface CommandSessionpublic Object get(String name)
CommandSessionget in interface CommandSessionname - the namepublic Object put(String name, Object value)
CommandSessionput in interface CommandSessionname - Name of the variable.value - Value of the variablepublic PrintStream getConsole()
CommandSessiongetConsole in interface CommandSessionpublic CharSequence format(Object target, int level, Converter escape) throws Exception
Converterpublic Object convert(Class<?> desiredType, Object in)
CommandSessionconvert in interface CommandSessionconvert in interface ConverterdesiredType - the typein - the instancepublic CharSequence format(Object result, int inspect)
CommandSessionformat in interface CommandSessionresult - the targetinspect - the levelpublic Object expr(CharSequence expr)
public Object invoke(Object target, String name, List<Object> args) throws Exception
Exceptionpublic List<Job> jobs()
CommandSessionjobs in interface CommandSessionpublic static org.apache.felix.gogo.runtime.CommandSessionImpl.JobImpl currentJob()
public org.apache.felix.gogo.runtime.CommandSessionImpl.JobImpl foregroundJob()
CommandSessionforegroundJob in interface CommandSessionpublic void setJobListener(JobListener listener)
CommandSessionsetJobListener in interface CommandSessionlistener - the listenerpublic org.apache.felix.gogo.runtime.CommandSessionImpl.JobImpl createJob(CharSequence command)
Copyright © 2006–2022 The Apache Software Foundation. All rights reserved.