Package org.apache.felix.gogo.runtime
Class CommandProcessorImpl
- java.lang.Object
-
- org.apache.felix.gogo.runtime.CommandProcessorImpl
-
- All Implemented Interfaces:
CommandProcessor
public class CommandProcessorImpl extends java.lang.Object implements CommandProcessor
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.concurrent.ConcurrentMap<java.lang.String,java.util.Map<java.lang.Object,java.lang.Integer>>
commands
protected java.util.Map<java.lang.String,java.lang.Object>
constants
protected java.util.Set<Converter>
converters
protected java.util.Set<CommandSessionListener>
listeners
protected java.util.WeakHashMap<CommandSession,java.lang.Object>
sessions
protected boolean
stopped
protected ThreadIO
threadIO
-
Fields inherited from interface org.apache.felix.service.command.CommandProcessor
COMMAND_FUNCTION, COMMAND_SCOPE
-
-
Constructor Summary
Constructors Constructor Description CommandProcessorImpl(ThreadIO tio)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCommand(java.lang.String scope, java.lang.Object target)
void
addCommand(java.lang.String scope, java.lang.Object target, java.lang.Class<?> functions)
void
addCommand(java.lang.String scope, java.lang.Object target, java.lang.Class<?> functions, int ranking)
void
addCommand(java.lang.String scope, java.lang.Object target, java.lang.String function)
void
addCommand(java.lang.String scope, java.lang.Object target, java.lang.String function, int ranking)
java.lang.Object
addConstant(java.lang.String name, java.lang.Object target)
void
addConverter(Converter c)
void
addListener(CommandSessionListener l)
java.lang.Object
convert(java.lang.Class<?> desiredType, java.lang.Object in)
CommandSession
createSession(java.io.InputStream in, java.io.PrintStream out, java.io.PrintStream err)
Create a new command session associated with IO streams.java.lang.Object
eval(CommandSession session, java.lang.Object[] argv)
java.lang.Object
expr(CommandSessionImpl session, java.lang.CharSequence expr)
java.util.Set<java.lang.String>
getCommands()
void
removeCommand(java.lang.Object target)
void
removeCommand(java.lang.String scope, java.lang.String function)
void
removeCommand(java.lang.String scope, java.lang.String function, java.lang.Object target)
java.lang.Object
removeConstant(java.lang.String name)
void
removeConverter(Converter c)
void
removeListener(CommandSessionListener l)
void
stop()
-
-
-
Field Detail
-
converters
protected final java.util.Set<Converter> converters
-
listeners
protected final java.util.Set<CommandSessionListener> listeners
-
commands
protected final java.util.concurrent.ConcurrentMap<java.lang.String,java.util.Map<java.lang.Object,java.lang.Integer>> commands
-
constants
protected final java.util.Map<java.lang.String,java.lang.Object> constants
-
threadIO
protected final ThreadIO threadIO
-
sessions
protected final java.util.WeakHashMap<CommandSession,java.lang.Object> sessions
-
stopped
protected boolean stopped
-
-
Constructor Detail
-
CommandProcessorImpl
public CommandProcessorImpl(ThreadIO tio)
-
-
Method Detail
-
createSession
public CommandSession createSession(java.io.InputStream in, java.io.PrintStream out, java.io.PrintStream err)
Description copied from interface:CommandProcessor
Create a new command session associated with IO streams. The session is bound to the life cycle of the bundle getting this service. The session will be automatically closed when this bundle is stopped or the service is returned. The shell will provide any available commands to this session and can set additional variables.- Specified by:
createSession
in interfaceCommandProcessor
- Parameters:
in
- The value used for System.inout
- The stream used for System.outerr
- The stream used for System.err- Returns:
- A new session.
-
stop
public void stop()
-
addConverter
public void addConverter(Converter c)
-
removeConverter
public void removeConverter(Converter c)
-
addListener
public void addListener(CommandSessionListener l)
-
removeListener
public void removeListener(CommandSessionListener l)
-
getCommands
public java.util.Set<java.lang.String> getCommands()
-
addCommand
public void addCommand(java.lang.String scope, java.lang.Object target)
-
addCommand
public void addCommand(java.lang.String scope, java.lang.Object target, java.lang.Class<?> functions)
-
addCommand
public void addCommand(java.lang.String scope, java.lang.Object target, java.lang.Class<?> functions, int ranking)
-
addConstant
public java.lang.Object addConstant(java.lang.String name, java.lang.Object target)
-
removeConstant
public java.lang.Object removeConstant(java.lang.String name)
-
addCommand
public void addCommand(java.lang.String scope, java.lang.Object target, java.lang.String function)
-
addCommand
public void addCommand(java.lang.String scope, java.lang.Object target, java.lang.String function, int ranking)
-
removeCommand
public void removeCommand(java.lang.String scope, java.lang.String function)
-
removeCommand
public void removeCommand(java.lang.String scope, java.lang.String function, java.lang.Object target)
-
removeCommand
public void removeCommand(java.lang.Object target)
-
convert
public java.lang.Object convert(java.lang.Class<?> desiredType, java.lang.Object in)
-
eval
public java.lang.Object eval(CommandSession session, java.lang.Object[] argv) throws java.lang.Exception
- Throws:
java.lang.Exception
-
expr
public java.lang.Object expr(CommandSessionImpl session, java.lang.CharSequence expr)
-
-