Client Request Step Through - rsanchez-wsu/jfiles GitHub Wiki

JFilesServerThread.run()

  1. Read in a transmission from the client in the UTF format.
  2. 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()

  1. Get the user directory.
  2. Open files to store command history.
  3. Get up to space marker in the line read in. This is the command.
  4. Record Command in the command history.
  5. Pass the command to the commands.newInstance() function
  6. Execute the command
  7. If the command was quit, quit.

##Commands.getNewInstance()

  1. Step through the commands enum object until that matches the text is found. Otherwise, return an error.
  2. Create a command of that type sending it the remaining args

##Command creation function (called by all command type creation functions)

  1. Create a parser wit the remaining args.

##Parser creation.

  1. For each argument execute the add function with it. ##Parser.add()
  2. Does this argument start with "-" if not it is a normal argument; store in the args variable.
  3. 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.