Handles program arguments and prints usage.

This commit is contained in:
Winston Li 2014-11-03 14:20:12 +00:00
parent dcf8a16d64
commit 3e16106f2d
5 changed files with 244 additions and 117 deletions

View file

@ -7,8 +7,10 @@
</component>
<component name="ChangeListManager">
<list default="true" id="0c822a5a-f421-4f3c-b941-5c2809c4546f" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
<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" />
@ -32,36 +34,26 @@
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="WLGitBridgeApplicationTests.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/application/WLGitBridgeApplicationTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="570">
<caret line="23" column="0" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="WLGitServlet.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLGitServlet.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="225" max-vertical-offset="390">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="390">
<caret line="15" column="56" selection-start-line="15" selection-start-column="56" selection-end-line="15" selection-end-column="56" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="WLGitBridgeServerTests.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/application/WLGitBridgeServerTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="105" max-vertical-offset="315">
<caret line="7" column="13" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="WLReceivePackFactory.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLReceivePackFactory.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="390" max-vertical-offset="720">
<caret line="26" column="67" selection-start-line="26" selection-start-column="67" selection-end-line="26" selection-end-column="67" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="build.xml" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/build.xml">
<provider selected="true" editor-type-id="text-editor">
@ -72,11 +64,21 @@
</provider>
</entry>
</file>
<file leaf-file-name="MANIFEST.MF" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/META-INF/MANIFEST.MF">
<file leaf-file-name="WLGitServletConfig.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLGitServletConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="135">
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="720">
<caret line="11" column="15" selection-start-line="11" selection-start-column="15" selection-end-line="11" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="WLRepositoryResolver.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLRepositoryResolver.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1050">
<caret line="39" column="17" selection-start-line="39" selection-start-column="17" selection-end-line="39" selection-end-column="17" />
<folding />
</state>
</provider>
@ -92,21 +94,21 @@
</provider>
</entry>
</file>
<file leaf-file-name="writelatex-git-bridge.iml" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/writelatex-git-bridge.iml">
<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.0" vertical-offset="300" max-vertical-offset="390">
<caret line="20" column="0" selection-start-line="20" selection-start-column="0" selection-end-line="20" selection-end-column="0" />
<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" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="WLGitBridgeApplication.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeApplication.java">
<file leaf-file-name="InvalidProgramArgumentsException.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/exception/InvalidProgramArgumentsException.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="495">
<caret line="27" column="0" selection-start-line="27" selection-start-column="0" selection-end-line="27" selection-end-column="0" />
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="195">
<caret line="2" column="0" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
<folding />
</state>
</provider>
@ -122,11 +124,11 @@
</provider>
</entry>
</file>
<file leaf-file-name="README.md" pinned="false" current="true" current-in-tab="true">
<file leaf-file-name="README.md" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.04731861" vertical-offset="0" max-vertical-offset="1268">
<caret line="4" column="63" selection-start-line="4" selection-start-column="63" selection-end-line="4" selection-end-column="63" />
<state vertical-scroll-proportion="-2.4" vertical-offset="0" max-vertical-offset="165">
<caret line="4" column="30" selection-start-line="4" selection-start-column="30" selection-end-line="4" selection-end-column="30" />
<folding />
</state>
</provider>
@ -179,16 +181,17 @@
<option value="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/MainTests.java" />
<option value="$PROJECT_DIR$/writelatex-git-bridge.properties" />
<option value="$PROJECT_DIR$/writelatex-git-bridge.iml" />
<option value="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/application/WLGitBridgeApplicationTests.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLRepositoryResolver.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLUploadPackFactory.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLGitServlet.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLReceivePackFactory.java" />
<option value="$PROJECT_DIR$/build.xml" />
<option value="$PROJECT_DIR$/writelatex-git-bridge.xml" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeApplication.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeServer.java" />
<option value="$PROJECT_DIR$/README.md" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/InvalidProgramArgumentsException.java" />
<option value="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/application/WLGitBridgeApplicationTests.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeApplication.java" />
</list>
</option>
</component>
@ -223,7 +226,6 @@
<sortByType />
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
@ -247,6 +249,46 @@
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="writelatex-git-bridge" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="writelatex-git-bridge" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="test" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="test" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="writelatex-git-bridge" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="writelatex-git-bridge" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="test" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="test" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="application" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="writelatex-git-bridge" />
@ -309,6 +351,32 @@
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="writelatex-git-bridge" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="writelatex-git-bridge" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="src" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="wlgitbridge" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="application" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="exception" />
<option name="myItemType" value="com.android.tools.idea.gradle.projectView.AndroidPsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="writelatex-git-bridge" />
@ -325,6 +393,7 @@
</PATH>
</subPane>
</pane>
<pane id="PackagesPane" />
</panes>
</component>
<component name="PropertiesComponent">
@ -356,13 +425,16 @@
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/libs" />
</key>
<key name="MoveClassesOrPackagesDialog.RECENTS_KEY">
<recent name="uk.ac.ic.wlgitbridge" />
<recent name="uk.ac.ic" />
<key name="CreateClassDialog.RecentsKey">
<recent name="uk.ac.ic.wlgitbridge.application" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/libs" />
</key>
<key name="MoveClassesOrPackagesDialog.RECENTS_KEY">
<recent name="uk.ac.ic.wlgitbridge" />
<recent name="uk.ac.ic" />
</key>
</component>
<component name="RunManager" selected="Application.writelatex-git-bridge">
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
@ -415,6 +487,19 @@
</ExternalSystemSettings>
<method />
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<method />
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@ -442,19 +527,6 @@
<listeners />
<method />
</configuration>
<configuration default="true" type="Applet" factoryName="Applet">
<module name="" />
<option name="MAIN_CLASS_NAME" />
<option name="HTML_FILE_NAME" />
<option name="HTML_USED" value="false" />
<option name="WIDTH" value="400" />
<option name="HEIGHT" value="300" />
<option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy" />
<option name="VM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<method />
</configuration>
<configuration default="true" type="Application" factoryName="Application">
<option name="MAIN_CLASS_NAME" />
<option name="VM_PARAMETERS" />
@ -570,14 +642,15 @@
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="2560" height="1413" extended-state="6" />
<editor active="true" />
<editor active="false" />
<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" />
<window_info id="Changes" 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="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="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="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="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" />
@ -590,7 +663,6 @@
<window_info id="Application Servers" 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="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24960938" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.16426513" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<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="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
@ -641,19 +713,10 @@
</buildFile>
</component>
<component name="editorHistoryManager">
<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.0" vertical-offset="105" max-vertical-offset="480">
<caret line="7" column="22" selection-start-line="7" selection-start-column="21" selection-end-line="7" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
<entry file="jar://$PROJECT_DIR$/libs/org.eclipse.jgit-3.5.1.201410131835-r.jar!/org/eclipse/jgit/transport/resolver/RepositoryResolver.class">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="90" max-vertical-offset="240">
<caret line="6" column="17" selection-start-line="6" selection-start-column="17" selection-end-line="6" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
@ -661,7 +724,6 @@
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="240" max-vertical-offset="375">
<caret line="16" column="8" selection-start-line="16" selection-start-column="8" selection-end-line="16" selection-end-column="8" />
<folding />
</state>
</provider>
</entry>
@ -911,15 +973,6 @@
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="90" max-vertical-offset="240">
<caret line="6" column="17" selection-start-line="6" selection-start-column="17" selection-end-line="6" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLGitServletConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="720">
<caret line="11" column="15" selection-start-line="11" selection-start-column="15" selection-end-line="11" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
@ -927,23 +980,6 @@
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="375">
<caret line="16" column="8" selection-start-line="16" selection-start-column="8" selection-end-line="16" selection-end-column="8" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLRepositoryResolver.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="375" max-vertical-offset="1050">
<caret line="39" column="17" selection-start-line="39" selection-start-column="17" selection-end-line="39" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/application/WLGitBridgeApplicationTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="330">
<caret line="13" column="5" selection-start-line="13" selection-start-column="5" selection-end-line="13" selection-end-column="5" />
<folding />
</state>
</provider>
</entry>
@ -955,14 +991,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLGitServlet.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="390">
<caret line="15" column="56" selection-start-line="15" selection-start-column="56" selection-end-line="15" selection-end-column="56" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/writelatex-git-bridge.iml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="390">
@ -995,6 +1023,22 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-2.4" vertical-offset="0" max-vertical-offset="165">
<caret line="4" column="30" selection-start-line="4" selection-start-column="30" selection-end-line="4" selection-end-column="30" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLRepositoryResolver.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="1050">
<caret line="39" column="17" selection-start-line="39" selection-start-column="17" selection-end-line="39" selection-end-column="17" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="300">
@ -1003,10 +1047,26 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeApplication.java">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLGitServlet.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="495">
<caret line="27" column="0" selection-start-line="27" selection-start-column="0" selection-end-line="27" selection-end-column="0" />
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="390">
<caret line="15" column="56" selection-start-line="15" selection-start-column="56" selection-end-line="15" selection-end-column="56" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLGitServletConfig.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="720">
<caret line="11" column="15" selection-start-line="11" selection-start-column="15" selection-end-line="11" selection-end-column="15" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/exception/InvalidProgramArgumentsException.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="195">
<caret line="2" column="0" selection-start-line="2" selection-start-column="0" selection-end-line="2" selection-end-column="0" />
<folding />
</state>
</provider>
@ -1019,10 +1079,18 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/application/WLGitBridgeApplicationTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.04731861" vertical-offset="0" max-vertical-offset="1268">
<caret line="4" column="63" selection-start-line="4" selection-start-column="63" selection-end-line="4" selection-end-column="63" />
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="570">
<caret line="23" column="0" selection-start-line="23" selection-start-column="0" selection-end-line="23" selection-end-column="0" />
<folding />
</state>
</provider>
</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" />
<folding />
</state>
</provider>

View file

@ -1,27 +1,63 @@
package uk.ac.ic.wlgitbridge.application;
import uk.ac.ic.wlgitbridge.application.exception.InvalidProgramArgumentsException;
import javax.servlet.ServletException;
import java.util.Arrays;
/**
* Created by Winston on 02/11/14.
*/
public class WLGitBridgeApplication {
public static final int EXIT_CODE_FAILED = 1;
private static final String USAGE_MESSAGE = "usage: writelatex-git-bridge port root_git_directory_path";
private int port;
private String rootGitDirectoryPath;
public WLGitBridgeApplication(String[] args) {
parseArguments(args);
try {
parseArguments(args);
} catch (InvalidProgramArgumentsException e) {
printUsage();
System.exit(EXIT_CODE_FAILED);
}
}
public void run() {
try {
new WLGitBridgeServer(8080).start();
new WLGitBridgeServer(port, rootGitDirectoryPath).start();
} catch (ServletException e) {
e.printStackTrace();
}
}
private void parseArguments(String[] args) {
System.out.println(Arrays.toString(args));
private void parseArguments(String[] args) throws InvalidProgramArgumentsException {
checkArgumentsLength(args);
parsePortNumber(args);
parseRootGitDirectoryPath(args);
}
private void checkArgumentsLength(String[] args) throws InvalidProgramArgumentsException {
if (args.length < 2) {
throw new InvalidProgramArgumentsException();
}
}
private void parsePortNumber(String[] args) throws InvalidProgramArgumentsException {
try {
port = Integer.parseInt(args[0]);
} catch (NumberFormatException e) {
throw new InvalidProgramArgumentsException();
}
}
private void parseRootGitDirectoryPath(String[] args) {
rootGitDirectoryPath = args[1];
}
private void printUsage() {
System.out.println(USAGE_MESSAGE);
}
}

View file

@ -16,7 +16,7 @@ public class WLGitBridgeServer {
private final Server jettyServer;
private final int port;
public WLGitBridgeServer(final int port) throws ServletException {
public WLGitBridgeServer(final int port, String rootGitDirectoryPath) throws ServletException {
this.port = port;
jettyServer = new Server(port);
configureJettyServer();

View file

@ -0,0 +1,7 @@
package uk.ac.ic.wlgitbridge.application.exception;
/**
* Created by Winston on 03/11/14.
*/
public class InvalidProgramArgumentsException extends Throwable {
}

View file

@ -2,6 +2,7 @@ package uk.ac.ic.wlgitbridge.test.application;
import org.junit.Test;
import org.junit.Assert;
import uk.ac.ic.wlgitbridge.application.WLGitBridgeApplication;
/**
* Created by Winston on 02/11/14.
@ -9,8 +10,23 @@ import org.junit.Assert;
public class WLGitBridgeApplicationTests {
@Test
public void nothingToTest() {
Assert.assertTrue(true);
public void diesIfLessThanTwoArguments() {
}
@Test
public void diesIfFirstArgumentIsInvalidNumber() {
}
@Test
public void setsPortToFirstArgument() {
}
@Test
public void setsRootGitDirectoryPathToSecondArgument() {
}
}