Class WorkspaceCommands

    • Constructor Detail

      • WorkspaceCommands

        public WorkspaceCommands()
      • WorkspaceCommands

        public WorkspaceCommands​(edu.uiuc.ncsa.security.util.cli.IOInterface ioInterface)
    • Method Detail

      • getLogger

        public edu.uiuc.ncsa.security.core.util.MyLoggingFacade getLogger()
      • getEnv

        public edu.uiuc.ncsa.security.core.configuration.XProperties getEnv()
      • setEnv

        public void setEnv​(edu.uiuc.ncsa.security.core.configuration.XProperties xp)
      • isSwingGUI

        public boolean isSwingGUI()
      • setSwingGUI

        public void setSwingGUI​(boolean swingGUI)
      • splashScreen

        protected void splashScreen()
      • showHelp4Help

        protected void showHelp4Help()
      • showGeneralHelp

        protected void showGeneralHelp()
      • variableLookup

        protected edu.uiuc.ncsa.security.util.cli.InputLine variableLookup​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
        Replaces ) commands prefixed with a by their value from the symbol table.
        Parameters:
        inputLine -
        Returns:
      • setWorkspace

        public void setWorkspace​(QDLWorkspace workspace)
      • shutdown

        protected void shutdown()
      • doFontCommand

        protected Object doFontCommand​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • fontReport

        protected String fontReport​(Font font)
      • _doFontList

        protected void _doFontList​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
                            throws Throwable
        Throws:
        Throwable
      • editDone

        public void editDone​(EditDoneEvent editDoneEvent)
      • doSICommand

        protected Object doSICommand​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _doSIRemove

        protected Object _doSIRemove​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _doSISet

        protected Object _doSISet​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _doSIResume

        protected Object _doSIResume​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • cloneInterpreter

        protected QDLInterpreter cloneInterpreter​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _doSIList

        protected Object _doSIList​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • doFileCommands

        protected Object doFileCommands​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
                                 throws Throwable
        Throws:
        Throwable
      • useExternalEditor

        protected boolean useExternalEditor()
      • _doFileEdit

        protected Object _doFileEdit​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
                              throws Throwable
        Throws:
        Throwable
      • _doBufferReload

        protected Object _doBufferReload​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
                                  throws Throwable
        Throws:
        Throwable
      • getBufferDefaultSavePath

        public String getBufferDefaultSavePath()
      • _doBufferPath

        protected Object _doBufferPath​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _doBufferCheck

        protected Object _doBufferCheck​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _doBufferReset

        protected Object _doBufferReset​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _doBufferRun

        protected Object _doBufferRun​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _saveAllBuffers

        protected void _saveAllBuffers()
                                throws Throwable
        Save all of the buffers. This just invokes the save method since there is a lot of state to ferret out and it is best to hand it off.
        Throws:
        Throwable
      • _doBufferWrite

        protected Object _doBufferWrite​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
                                 throws Throwable
        Throws:
        Throwable
      • _doBufferWrite

        protected Object _doBufferWrite​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine,
                                        boolean doOuput)
                                 throws Throwable
        Used internally, This has a flag to suppress certain messages.
        Parameters:
        inputLine -
        doOuput -
        Returns:
        Throws:
        Throwable
      • isUseExternalEditor

        public boolean isUseExternalEditor()
      • setUseExternalEditor

        public void setUseExternalEditor​(boolean useExternalEditor)
      • getExternalEditorName

        public String getExternalEditorName()
      • setExternalEditorName

        public void setExternalEditorName​(String externalEditorName)
      • _doEditor

        protected Object _doEditor​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _doBufferEdit

        protected Object _doBufferEdit​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
                                throws Throwable
        Throws:
        Throwable
      • getTempDir

        protected File getTempDir()
      • _doBufferDelete

        protected Object _doBufferDelete​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _fileDir

        protected Object _fileDir​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _fileMkDir

        protected Object _fileMkDir​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _fileRmDir

        protected Object _fileRmDir​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _fileDelete

        protected Object _fileDelete​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _fileCopy

        protected Object _fileCopy​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
        Copies any two files on the system including between VFS.
      • _fileCopy

        protected Object _fileCopy​(String source,
                                   String target,
                                   boolean isBinary)
      • _doBufferList

        protected Object _doBufferList​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _doBufferShow

        protected Object _doBufferShow​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _doBufferLink

        protected Object _doBufferLink​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _doHelp

        protected boolean _doHelp​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
        Boolean values function that returns true if the inputline has some form of help in it.
        Parameters:
        inputLine -
        Returns:
      • _doBufferCreate

        protected Object _doBufferCreate​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • doEnvCommand

        protected Object doEnvCommand​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
        This has several states:
        • clear (no args) -- clear the environment
        • drop name -- remove a variable
        • get name - show the value of a variable
        • list (no args) - print the entire environment
        • load filename - add the variables in the file to the current state
        • save [file] - save the environment to a file. No arg means to use the current env file.
        • set key value - set a variable to a given value.
        Parameters:
        inputLine -
        Returns:
      • _envSave

        protected Object _envSave​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _envLoad

        protected Object _envLoad​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _envDrop

        protected Object _envDrop​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _envGet

        protected Object _envGet​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _envSet

        protected Object _envSet​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _envList

        protected Object _envList​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • doModulesCommand

        protected Object doModulesCommand​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
        Optional list argument. Print out the current modules the system knows about
        Parameters:
        inputLine -
        Returns:
      • _moduleImports

        protected Object _moduleImports​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _modulesList

        protected Object _modulesList​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • doFuncs

        protected Object doFuncs​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
        Modes are
        • [list] - list all of the variables
        • help [name argCount] - no arguments means list all, otherwise, find the function with the signature.
        • drop name - remove a local function. This does not remove a function from a module.
        Parameters:
        inputLine -
        Returns:
      • _doFuncEdit

        protected Object _doFuncEdit​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _funcsDrop

        protected Object _funcsDrop​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _funcsHelp

        protected Object _funcsHelp​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • printList

        protected Object printList​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine,
                                   TreeSet<String> list)
        Any list of strings (functions, variables, modules, etc.) is listed using this formatting function. If understands command line switches for width, columns and does some regex's too.
        Parameters:
        inputLine -
        list - A simple list items, e.g., names of functions or variables.
        Returns:
      • _funcsListSystem

        protected Object _funcsListSystem​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _funcsList

        protected Object _funcsList​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • getFunctionList

        public List<String> getFunctionList()
        This is used in public facing queries to the workspace, from e.g. an SAS instance getting/updating the current functions in the workspace.
        Returns:
      • resolveRealHelpName

        protected String[] resolveRealHelpName​(String text)
      • getFunctionHelp

        public String getFunctionHelp​(String text)
      • getHelpTopic

        public String getHelpTopic​(String text)
      • getHelpTopicExample

        public String getHelpTopicExample​(String text)
      • doVars

        protected Object doVars​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
        Either show all variables (no arg or argument of "list") or

        drop name -- remove the given symbol from the local symbol table. This does not effect modules.
        Parameters:
        inputLine -
        Returns:
      • _doVarEdit

        protected Object _doVarEdit​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • restoreVariable

        public Object restoreVariable​(String varName,
                                      List<String> content,
                                      boolean isText,
                                      boolean isStem)
      • _varsSystem

        protected Object _varsSystem​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _varsDrop

        protected Object _varsDrop​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _varsList

        protected Object _varsList​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • doHelp

        protected Object doHelp​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
        Just print the general help
             )help (* | name)  [arg_count]
         
        * will print the first line of all user defined functions in the workspace.
        Otherwise name is the name of a function, system or user defined
        The optional arg_count is ignored for system functions, but will call up detailed information for the user functions.
        Parameters:
        inputLine -
        Returns:
      • getFunctionDocFromVariable

        protected List<String> getFunctionDocFromVariable​(String name,
                                                          int argCount)
      • getModuleDocFromVariable

        protected List<String> getModuleDocFromVariable​(String name)
      • getAltLookup

        public edu.uiuc.ncsa.security.core.util.DoubleHashMap<String,​String> getAltLookup()
      • doWS

        protected Object doWS​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
        Commands are:
        • load filename -- loads the given file, replacing the current state
        • save filename -- serializes the current workspace to the file
        • clear -- clears the state completely.
        • id -- print the currently named id, i.e., the name of the file if loaded
        Parameters:
        inputLine -
        Returns:
      • _wsListDrop

        protected Object _wsListDrop​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _fileVFS

        protected Object _fileVFS​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • isPrettyPrint

        public boolean isPrettyPrint()
      • setPrettyPrint

        public void setPrettyPrint​(boolean prettyPrint)
      • isOnOrTrue

        protected boolean isOnOrTrue​(String x)
      • onOrOff

        protected String onOrOff​(boolean b)
      • printAllWSVars

        protected void printAllWSVars()
      • getWSVariable

        protected Object getWSVariable​(String key)
      • _wsGet

        protected int _wsGet​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _wsLibList

        protected int _wsLibList​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
                          throws Throwable
        This will either print out the information about a single workspace (if a file is given) or every workspace in a directory. It accepts regexes as a file filter too
         )ws lib /home/me/qdl/var/ws -r ws.*\\.*
         
        Prints out all the ws info for ws*.* in the directory. If a file is given, the regex is ignored.
        Parameters:
        inputLine -
        Returns:
        Throws:
        Throwable
      • _resolveLibFile

        protected String _resolveLibFile​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • processJavaLibEntry

        protected WorkspaceCommands.WSLibEntry processJavaLibEntry​(boolean isVFS,
                                                                   String fullPath,
                                                                   File currentFile)
                                                            throws Throwable
        Looks for a lib entry that was serialized using Java serialization.
        Parameters:
        isVFS -
        fullPath -
        currentFile -
        Returns:
        Throws:
        Throwable
      • _wsSet

        protected Object _wsSet​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • listEditors

        protected void listEditors()
      • getDescription

        public String getDescription()
      • setDescription

        public void setDescription​(String description)
        Human readable dscription of this workspace.
      • getWSID

        public String getWSID()
      • setWSID

        public void setWSID​(String wsID)
      • _wsEchoMode

        protected Object _wsEchoMode​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _wsClear

        protected Object _wsClear​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _wsSave

        protected int _wsSave​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • _xmlWSQDLLoad

        public void _xmlWSQDLLoad​(QDLInterpreter qdlInterpreter,
                                  Reader reader)
                           throws Throwable
        Just loads and runs a Reader. This is mostly used in serialization tests.
        Parameters:
        reader -
        Throws:
        Throwable
      • getLastResult

        public Object getLastResult()
      • writeFile

        protected long writeFile​(String fullPath,
                                 String payload,
                                 boolean compress)
                          throws Throwable
        write the payload to the correct file (VFS or local), compressing as needed.
        Parameters:
        fullPath -
        payload -
        compress -
        Returns:
        Throws:
        Throwable
      • _xmlWSJavaLoad

        public boolean _xmlWSJavaLoad​(String fullPath)
      • _xmlWSJavaLoad

        public boolean _xmlWSJavaLoad​(InputStream fis)
      • _wsLoad

        protected Object _wsLoad​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
                          throws Throwable
        Throws:
        Throwable
      • isDebugOn

        public boolean isDebugOn()
        Specified by:
        isDebugOn in interface edu.uiuc.ncsa.security.core.Logable
      • setDebugOn

        public void setDebugOn​(boolean debugOn)
        Specified by:
        setDebugOn in interface edu.uiuc.ncsa.security.core.Logable
      • debug

        public void debug​(String x)
        Specified by:
        debug in interface edu.uiuc.ncsa.security.core.Logable
      • info

        public void info​(String x)
        Specified by:
        info in interface edu.uiuc.ncsa.security.core.Logable
      • warn

        public void warn​(String x)
        Specified by:
        warn in interface edu.uiuc.ncsa.security.core.Logable
      • error

        public void error​(String x)
        Specified by:
        error in interface edu.uiuc.ncsa.security.core.Logable
      • say

        public void say​(String x)
        Prints with the default indent and a linefeed.
        Parameters:
        x -
      • sayi

        protected void sayi​(String x)
        prints with the current indent and a linefeed.
        Parameters:
        x -
      • sayii

        protected void sayii​(String x)
        Double indent -- useful for lists.
        Parameters:
        x -
      • setState

        public void setState​(State state)
        This is used in serialization tests. Generally you should never set the state this way.
        Parameters:
        state -
      • getState

        public State getState()
        Creates the top-level state object for the system. All other state objects are dervied from it.
        Returns:
      • runMacro

        public void runMacro​(List<String> commands)
      • setupJavaModule

        protected void setupJavaModule​(State state,
                                       QDLLoader loader,
                                       boolean importASAP)
      • resolveAgainstRoot

        protected File resolveAgainstRoot​(String file)
      • isCompressXML

        public boolean isCompressXML()
      • setCompressXML

        public void setCompressXML​(boolean compressXML)
      • hasEditors

        public boolean hasEditors()
      • getQdlEditors

        public edu.uiuc.ncsa.security.util.cli.editing.Editors getQdlEditors()
      • setQdlEditors

        public void setQdlEditors​(edu.uiuc.ncsa.security.util.cli.editing.Editors qdlEditors)
      • fromConfigFile

        public void fromConfigFile​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
                            throws Throwable
        Throws:
        Throwable
      • setQdlEnvironment

        public void setQdlEnvironment​(QDLEnvironment qdlEnvironment)
      • loadQE

        public void loadQE​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine,
                           String cfgName)
                    throws Throwable
        Throws:
        Throwable
      • isQELoaded

        protected boolean isQELoaded()
      • figureOutFont

        protected void figureOutFont​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
      • initAutosave

        protected void initAutosave()
      • init

        public void init​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
                  throws Throwable
        Bootstraps the whole thing.
        Parameters:
        inputLine -
        Throws:
        Throwable
      • isRunScript

        public boolean isRunScript()
      • fromCommandLine

        protected void fromCommandLine​(edu.uiuc.ncsa.security.util.cli.InputLine inputLine)
                                throws Throwable
        Throws:
        Throwable
      • isEchoModeOn

        public boolean isEchoModeOn()
      • setEchoModeOn

        public void setEchoModeOn​(boolean echoModeOn)
      • readline

        public String readline()
      • getIoInterface

        public edu.uiuc.ncsa.security.util.cli.IOInterface getIoInterface()
      • setIoInterface

        public void setIoInterface​(edu.uiuc.ncsa.security.util.cli.IOInterface ioInterface)
      • updateWSState

        protected boolean updateWSState​(WorkspaceCommands newCommands)
        This takes an updated WorkspaceCommands object and updates the currently active workspace. When this is done, there is new state and all the values ofr newCommnads have been migrated. This takes care to get the IOInterface right since if that is not handled correctly, the entire workspace hangs unrecoverably.
        Parameters:
        newCommands -
        Returns:
      • isAutosaveOn

        public boolean isAutosaveOn()
      • setAutosaveOn

        public void setAutosaveOn​(boolean autosaveOn)
      • getAutosaveInterval

        public long getAutosaveInterval()
      • setAutosaveInterval

        public void setAutosaveInterval​(long autosaveInterval)
      • isAutosaveMessagesOn

        public boolean isAutosaveMessagesOn()
      • setAutosaveMessagesOn

        public void setAutosaveMessagesOn​(boolean autosaveMessagesOn)
      • isAssertionsOn

        public boolean isAssertionsOn()
      • setAssertionsOn

        public void setAssertionsOn​(boolean assertionsOn)
      • isAnsiModeOn

        public boolean isAnsiModeOn()
      • setAnsiModeOn

        public void setAnsiModeOn​(boolean ansiModeOn)
      • setSwingTerminal

        public void setSwingTerminal​(SwingTerminal swingTerminal)
      • setWorkspaceCommandsProvider

        public static void setWorkspaceCommandsProvider​(WorkspaceCommandsProvider workspaceCommandsProvider)
      • getInstance

        public static WorkspaceCommands getInstance()
        Factory method to create an instance. This is needed if you intend to override this class, since there is a bootstrapping issue with the QDLWorkspace otherwise. set this as needed first.
        Returns:
      • getInstance

        public static WorkspaceCommands getInstance​(edu.uiuc.ncsa.security.util.cli.IOInterface ioInterface)
      • newInstance

        public WorkspaceCommands newInstance()
        Use this to create new instances of this with same IOInterface as the instance. The idea is that the static factory creates a single instance and that can be used to create others. This allows for overrides to be used in the base classes. Set the static method once and override the non-static methods.
        Returns:
      • newInstance

        public WorkspaceCommands newInstance​(edu.uiuc.ncsa.security.util.cli.IOInterface ioInterface)
      • getFont

        public Font getFont()
      • setFont

        public void setFont​(Font font)
      • getLibLoaders

        public List<LibLoader> getLibLoaders()
        Override for custom LibLoaders. These will be processed in the order given.
        Returns: