Class CommandSessionImpl
java.lang.Object
org.apache.felix.gogo.runtime.CommandSessionImpl
- All Implemented Interfaces:
AutoCloseable, CommandSession, Converter
-
Nested Class Summary
Nested classes/interfaces inherited from interface CommandSession
CommandSession.Utils -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Channel[]static final Stringstatic final Stringprotected OutputStreamprotected InputStreamprotected OutputStreamprotected PrintStreamprotected PrintStreamstatic final Stringprotected final ConcurrentMap<String, Object> static final StringFields inherited from interface CommandSession
OPTION_NO_GLOBFields inherited from interface Converter
CONVERTER_CLASSES, INSPECT, LINE, PART -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCommandSessionImpl(CommandProcessorImpl shell, InputStream in, OutputStream out, OutputStream err) protectedCommandSessionImpl(CommandProcessorImpl shell, CommandSessionImpl parent) -
Method Summary
Modifier and TypeMethodDescriptionvoidclassLoader(ClassLoader classLoader) voidclose()Close this command session.Convert an object to another type.org.apache.felix.gogo.runtime.CommandSessionImpl.JobImplcreateJob(CharSequence command) voidcurrentDir(Path path) static org.apache.felix.gogo.runtime.CommandSessionImpl.JobImplexecute(CharSequence commandline) Execute a program in this session.expr(CharSequence expr) org.apache.felix.gogo.runtime.CommandSessionImpl.JobImplGet the current foreground job or null.Convert an object to string form (CharSequence).Convert an objet to a CharSequence object in the requested format.Get the value of a variable.Return the PrintStream for the console.Return the input stream that is the first of the pipeline.jobs()List jobs.Set the value of a variable.voidsetJobListener(JobListener listener) Set the job listener for this session.
-
Field Details
-
SESSION_CLOSED
- See Also:
-
VARIABLES
- See Also:
-
COMMANDS
- See Also:
-
CONSTANTS
- See Also:
-
in
-
out
-
pout
-
err
-
perr
-
channels
-
variables
-
-
Constructor Details
-
CommandSessionImpl
-
CommandSessionImpl
protected CommandSessionImpl(CommandProcessorImpl shell, InputStream in, OutputStream out, OutputStream err)
-
-
Method Details
-
processor
-
getVariables
-
currentDir
- Specified by:
currentDirin interfaceCommandSession
-
currentDir
- Specified by:
currentDirin interfaceCommandSession
-
classLoader
- Specified by:
classLoaderin interfaceCommandSession
-
classLoader
- Specified by:
classLoaderin interfaceCommandSession
-
close
public void close()Description copied from interface:CommandSessionClose this command session. After the session is closed, it will throw IllegalStateException when it is used.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCommandSession
-
execute
Description copied from interface:CommandSessionExecute a program in this session.- Specified by:
executein interfaceCommandSession- Parameters:
commandline- the commandline- Returns:
- the result of the execution
- Throws:
Exception- on exception
-
getKeyboard
Description copied from interface:CommandSessionReturn the input stream that is the first of the pipeline. This stream is sometimes necessary to communicate directly to the end user. For example, a "less" or "more" command needs direct input from the keyboard to control the paging.- Specified by:
getKeyboardin interfaceCommandSession- Returns:
- InpuStream used closest to the user or null if input is from a file.
-
get
Description copied from interface:CommandSessionGet the value of a variable.- Specified by:
getin interfaceCommandSession- Parameters:
name- the name- Returns:
- Object
-
put
Description copied from interface:CommandSessionSet the value of a variable.- Specified by:
putin interfaceCommandSession- Parameters:
name- Name of the variable.value- Value of the variable- Returns:
- Object
-
getConsole
Description copied from interface:CommandSessionReturn the PrintStream for the console. This must always be the stream "closest" to the user. This stream can be used to post messages that bypass the piping. If the output is piped to a file, then the object returned must be null.- Specified by:
getConsolein interfaceCommandSession- Returns:
- PrintStream the console print stream
-
format
Description copied from interface:ConverterConvert an objet to a CharSequence object in the requested format. The format can be INSPECT, LINE, or PART. Other values must throw IllegalArgumentException. -
convert
Description copied from interface:CommandSessionConvert an object to another type.- Specified by:
convertin interfaceCommandSession- Specified by:
convertin interfaceConverter- Parameters:
desiredType- the typein- the instance- Returns:
- Object
-
doConvert
-
format
Description copied from interface:CommandSessionConvert an object to string form (CharSequence). The level is defined in the Converter interface, it can be one of INSPECT, LINE, PART. This function always returns a non null value. As a last resort, toString is called on the Object.- Specified by:
formatin interfaceCommandSession- Parameters:
result- the targetinspect- the level- Returns:
- CharSequence
-
expr
-
invoke
-
redirect
-
jobs
Description copied from interface:CommandSessionList jobs. Always return a non-null list.- Specified by:
jobsin interfaceCommandSession- Returns:
- List<Job>
-
currentJob
public static org.apache.felix.gogo.runtime.CommandSessionImpl.JobImpl currentJob() -
foregroundJob
public org.apache.felix.gogo.runtime.CommandSessionImpl.JobImpl foregroundJob()Description copied from interface:CommandSessionGet the current foreground job or null.- Specified by:
foregroundJobin interfaceCommandSession- Returns:
- Job
-
setJobListener
Description copied from interface:CommandSessionSet the job listener for this session.- Specified by:
setJobListenerin interfaceCommandSession- Parameters:
listener- the listener
-
createJob
-