Class CommandProcessorImpl

    • Field Detail

      • converters

        protected final java.util.Set<Converter> converters
      • 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 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)
      • 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)