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 Object implements CommandProcessor

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final ConcurrentMap<String,Map<Object,Integer>>`
`commands`
`protected final Map<String,Object>`
`constants`
`protected final Set<Converter>`
`converters`
`protected final Set<CommandSessionListener>`
`listeners`
`protected final WeakHashMap<CommandSession,Object>`
`sessions`
`protected boolean`
`stopped`
`protected final 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

Modifier and Type
Method
Description
`void`
`addCommand(String scope, Object target)`
`void`
`addCommand(String scope, Object target, Class<?> functions)`
`void`
`addCommand(String scope, Object target, Class<?> functions, int ranking)`
`void`
`addCommand(String scope, Object target, String function)`
`void`
`addCommand(String scope, Object target, String function, int ranking)`
`Object`
`addConstant(String name, Object target)`
`void`
`addConverter(Converter c)`
`void`
`addListener(CommandSessionListener l)`
`Object`
`convert(Class<?> desiredType, Object in)`
`CommandSession`
`createSession(InputStream in, PrintStream out, PrintStream err)`
Create a new command session associated with IO streams.
`Object`
`eval(CommandSession session, Object[] argv)`
`Object`
`expr(CommandSessionImpl session, CharSequence expr)`
`Set<String>`
`getCommands()`
`void`
`removeCommand(Object target)`
`void`
`removeCommand(String scope, String function)`
`void`
`removeCommand(String scope, String function, Object target)`
`Object`
`removeConstant(String name)`
`void`
`removeConverter(Converter c)`
`void`
`removeListener(CommandSessionListener l)`
`void`
`stop()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### converters

protected final Set<Converter> converters

### listeners

protected final Set<CommandSessionListener> listeners

### commands

protected final ConcurrentMap<String,Map<Object,Integer>> commands

### constants

protected final Map<String,Object> constants

### threadIO

protected final ThreadIO threadIO

### sessions

protected final WeakHashMap<CommandSession,Object> sessions

### stopped

protected boolean stopped

## Constructor Details

### CommandProcessorImpl

public CommandProcessorImpl(ThreadIO tio)

## Method Details

### createSession

public CommandSession createSession(InputStream in, PrintStream out, 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 interface `CommandProcessor`
Parameters:
  `in` - The value used for System.in
  `out` - The stream used for System.out
  `err` - 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 Set<String> getCommands()

### addCommand

public void addCommand(String scope, Object target)

### addCommand

public void addCommand(String scope, Object target, Class<?> functions)

### addCommand

public void addCommand(String scope, Object target, Class<?> functions, int ranking)

### addConstant

public Object addConstant(String name, Object target)

### removeConstant

public Object removeConstant(String name)

### addCommand

public void addCommand(String scope, Object target, String function)

### addCommand

public void addCommand(String scope, Object target, String function, int ranking)

### removeCommand

public void removeCommand(String scope, String function)

### removeCommand

public void removeCommand(String scope, String function, Object target)

### removeCommand

public void removeCommand(Object target)

### convert

public Object convert(Class<?> desiredType, Object in)

### eval

public Object eval(CommandSession session, Object[] argv) throws Exception

Throws:
  `Exception`

### expr

public Object expr(CommandSessionImpl session, CharSequence expr)