Client Request Step Through - rsanchez-wsu/jfiles GitHub Wiki
JFilesServerThread.run()
- Read in a transmission from the client in the UTF format.
- Send it to the handle method of the server object. Note that although a method of the server object is called the clients thread is used. The method has the synchronized keyword so that wo commands are ton executed at the same time.
##JFilesServer.handle()
- Get the user directory.
- Open files to store command history.
- Get up to space marker in the line read in. This is the command.
- Record Command in the command history.
- Pass the command to the commands.newInstance() function
- Execute the command
- If the command was quit, quit.
##Commands.getNewInstance()
- Step through the commands enum object until that matches the text is found. Otherwise, return an error.
- Create a command of that type sending it the remaining args
##Command creation function (called by all command type creation functions)
- Create a parser wit the remaining args.
##Parser creation.
- For each argument execute the add function with it. ##Parser.add()
- Does this argument start with "-" if not it is a normal argument; store in the args variable.
- If the argument starts with - it is flag "-foo:boo" sets the flag foo to boo "-foo" sets the flag foo to the null string.