Class BaseInterpreter

  • All Implemented Interfaces:
    java.util.EventListener, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener
    Direct Known Subclasses:
    RepoAdminInterpreter, TenantInterpreter, WorkflowInterpreter

    public abstract class BaseInterpreter
    extends org.springframework.extensions.surf.util.AbstractLifecycleBean
    An interactive console
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseInterpreter()
      Make up a new console.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract java.lang.String executeCommand​(java.lang.String line)
      Execute a single command using the BufferedReader passed in for any data needed.
      static BaseInterpreter getConsoleBean​(org.springframework.context.ApplicationContext context, java.lang.String beanName)  
      java.lang.String getCurrentUserName()
      Get current user name
      protected boolean hasAuthority​(java.lang.String username)  
      java.lang.String interpretCommand​(java.lang.String line)
      Interpret a single command using the BufferedReader passed in for any data needed.
      protected void onBootstrap​(org.springframework.context.ApplicationEvent event)  
      protected void onShutdown​(org.springframework.context.ApplicationEvent event)  
      void rep()
      A Read-Eval-Print loop.
      static void runMain​(java.lang.String beanName)  
      static void runMain​(org.springframework.context.ApplicationContext context, java.lang.String beanName)  
      void setAuthorityService​(AuthorityService authorityService)  
      void setCurrentUserName​(java.lang.String username)  
      void setTransactionService​(TransactionService transactionService)  
      • Methods inherited from class org.springframework.extensions.surf.util.AbstractLifecycleBean

        getApplicationContext, onApplicationEvent, setApplicationContext
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • lastCommand

        protected java.lang.String lastCommand
        Last command issued
    • Constructor Detail

      • BaseInterpreter

        public BaseInterpreter()
        Make up a new console.
    • Method Detail

      • runMain

        public static void runMain​(java.lang.String beanName)
      • runMain

        public static void runMain​(org.springframework.context.ApplicationContext context,
                                   java.lang.String beanName)
      • getConsoleBean

        public static BaseInterpreter getConsoleBean​(org.springframework.context.ApplicationContext context,
                                                     java.lang.String beanName)
      • setTransactionService

        public void setTransactionService​(TransactionService transactionService)
      • setAuthorityService

        public void setAuthorityService​(AuthorityService authorityService)
      • rep

        public void rep()
        A Read-Eval-Print loop.
      • interpretCommand

        public java.lang.String interpretCommand​(java.lang.String line)
                                          throws java.io.IOException
        Interpret a single command using the BufferedReader passed in for any data needed.
        Parameters:
        line - The unparsed command
        Returns:
        The textual output of the command.
        Throws:
        java.io.IOException
      • hasAuthority

        protected boolean hasAuthority​(java.lang.String username)
      • executeCommand

        protected abstract java.lang.String executeCommand​(java.lang.String line)
                                                    throws java.io.IOException
        Execute a single command using the BufferedReader passed in for any data needed. TODO: Use decent parser!
        Parameters:
        line - The unparsed command
        Returns:
        The textual output of the command.
        Throws:
        java.io.IOException
      • getCurrentUserName

        public java.lang.String getCurrentUserName()
        Get current user name
        Returns:
        user name
      • setCurrentUserName

        public void setCurrentUserName​(java.lang.String username)
      • onBootstrap

        protected void onBootstrap​(org.springframework.context.ApplicationEvent event)
        Specified by:
        onBootstrap in class org.springframework.extensions.surf.util.AbstractLifecycleBean
      • onShutdown

        protected void onShutdown​(org.springframework.context.ApplicationEvent event)
        Specified by:
        onShutdown in class org.springframework.extensions.surf.util.AbstractLifecycleBean