From 7283f1893b1b2841e35009238587046266883c89 Mon Sep 17 00:00:00 2001 From: Winston Li Date: Mon, 3 Nov 2014 14:23:21 +0000 Subject: [PATCH] Added comments to WLGitBridgeApplication. --- services/git-bridge/.idea/workspace.xml | 16 ++++++---------- .../application/WLGitBridgeApplication.java | 13 +++++++++++++ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/services/git-bridge/.idea/workspace.xml b/services/git-bridge/.idea/workspace.xml index 417302fe33..5ccda29b38 100644 --- a/services/git-bridge/.idea/workspace.xml +++ b/services/git-bridge/.idea/workspace.xml @@ -7,11 +7,7 @@ - - - - @@ -97,8 +93,8 @@ - - + + @@ -642,7 +638,7 @@ - + @@ -650,7 +646,7 @@ - + @@ -1089,8 +1085,8 @@ - - + + diff --git a/services/git-bridge/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeApplication.java b/services/git-bridge/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeApplication.java index 7f3d3b023d..6421ff0c3f 100644 --- a/services/git-bridge/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeApplication.java +++ b/services/git-bridge/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeApplication.java @@ -7,6 +7,10 @@ import javax.servlet.ServletException; /** * Created by Winston on 02/11/14. */ + +/** + * Class that represents the application. Parses arguments and gives them to the server, or dies with a usage message. + */ public class WLGitBridgeApplication { public static final int EXIT_CODE_FAILED = 1; @@ -15,6 +19,10 @@ public class WLGitBridgeApplication { private int port; private String rootGitDirectoryPath; + /** + * Constructs an instance of the WriteLatex-Git Bridge application. + * @param args args from main, which should be in the format "port root_git_directory_path" + */ public WLGitBridgeApplication(String[] args) { try { parseArguments(args); @@ -24,6 +32,9 @@ public class WLGitBridgeApplication { } } + /** + * Starts the server with the port number and root directory path given in the command-line arguments. + */ public void run() { try { new WLGitBridgeServer(port, rootGitDirectoryPath).start(); @@ -32,6 +43,8 @@ public class WLGitBridgeApplication { } } + /* Helper methods */ + private void parseArguments(String[] args) throws InvalidProgramArgumentsException { checkArgumentsLength(args); parsePortNumber(args);