Просмотр исходного кода

Added comments to WLGitBridgeApplication.

Winston Li 12 лет назад
Родитель
Сommit
7283f1893b

+ 6 - 10
services/git-bridge/.idea/workspace.xml

@@ -7,11 +7,7 @@
   </component>
   <component name="ChangeListManager">
     <list default="true" id="0c822a5a-f421-4f3c-b941-5c2809c4546f" name="Default" comment="">
-      <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/exception/InvalidProgramArgumentsException.java" />
       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeApplication.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeApplication.java" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/application/WLGitBridgeApplicationTests.java" afterPath="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/application/WLGitBridgeApplicationTests.java" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeServer.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeServer.java" />
-      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
     </list>
     <ignored path="writelatex-git-bridge.iws" />
     <ignored path=".idea/workspace.xml" />
@@ -97,8 +93,8 @@
       <file leaf-file-name="WLGitBridgeApplication.java" pinned="false" current="true" current-in-tab="true">
         <entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeApplication.java">
           <provider selected="true" editor-type-id="text-editor">
-            <state vertical-scroll-proportion="0.5336427" vertical-offset="0" max-vertical-offset="1293">
-              <caret line="46" column="62" selection-start-line="46" selection-start-column="62" selection-end-line="47" selection-end-column="13" />
+            <state vertical-scroll-proportion="0.52204174" vertical-offset="0" max-vertical-offset="1293">
+              <caret line="45" column="21" selection-start-line="45" selection-start-column="21" selection-end-line="45" selection-end-column="21" />
               <folding />
             </state>
           </provider>
@@ -642,7 +638,7 @@
   </component>
   <component name="ToolWindowManager">
     <frame x="0" y="23" width="2560" height="1413" extended-state="6" />
-    <editor active="false" />
+    <editor active="true" />
     <layout>
       <window_info id="Documentation" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="FLOATING" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" x="100" y="123" width="1166" height="541" />
       <window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
@@ -650,7 +646,7 @@
       <window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
       <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
       <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
-      <window_info id="Ant Build" active="true" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.20117188" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.20117188" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
       <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
       <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
       <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
@@ -1089,8 +1085,8 @@
     </entry>
     <entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeApplication.java">
       <provider selected="true" editor-type-id="text-editor">
-        <state vertical-scroll-proportion="0.5336427" vertical-offset="0" max-vertical-offset="1293">
-          <caret line="46" column="62" selection-start-line="46" selection-start-column="62" selection-end-line="47" selection-end-column="13" />
+        <state vertical-scroll-proportion="0.52204174" vertical-offset="0" max-vertical-offset="1293">
+          <caret line="45" column="21" selection-start-line="45" selection-start-column="21" selection-end-line="45" selection-end-column="21" />
           <folding />
         </state>
       </provider>

+ 13 - 0
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);