org.apache.felix.gogo.runtime
Class CommandProcessorImpl

java.lang.Object
  extended by org.apache.felix.gogo.runtime.CommandProcessorImpl
All Implemented Interfaces:
CommandProcessor

public class CommandProcessorImpl
extends Object
implements CommandProcessor


Field Summary
protected  Map<String,Object> commands
           
protected  Map<String,Object> constants
           
protected  Set<Converter> converters
           
protected  Set<CommandSessionListener> listeners
           
protected  WeakHashMap<CommandSession,Object> sessions
           
protected  ThreadIO threadIO
           
 
Fields inherited from interface org.apache.felix.service.command.CommandProcessor
COMMAND_FUNCTION, COMMAND_SCOPE
 
Constructor Summary
CommandProcessorImpl(ThreadIO tio)
           
 
Method Summary
 void addCommand(String scope, Object target)
           
 void addCommand(String scope, Object target, Class<?> functions)
           
 void addCommand(String scope, Object target, String function)
           
 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)
           
 Set<String> getCommands()
           
protected  void put(String name, Object target)
           
 void removeCommand(Object target)
           
 void removeCommand(String scope, String function)
           
 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 Detail

converters

protected final Set<Converter> converters

listeners

protected final Set<CommandSessionListener> listeners

commands

protected final Map<String,Object> commands

constants

protected final Map<String,Object> constants

threadIO

protected final ThreadIO threadIO

sessions

protected final WeakHashMap<CommandSession,Object> sessions
Constructor Detail

CommandProcessorImpl

public CommandProcessorImpl(ThreadIO tio)
Method Detail

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)

addConstant

public Object addConstant(String name,
                          Object target)

removeConstant

public Object removeConstant(String name)

addCommand

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

removeCommand

public void removeCommand(String scope,
                          String function)

removeCommand

public void removeCommand(Object target)

put

protected void put(String name,
                   Object target)

convert

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

eval

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


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.