Wrote some Snapshot code.

This commit is contained in:
Winston Li 2014-11-03 18:01:59 +00:00
parent ac55180ba2
commit 8785256229
11 changed files with 302 additions and 162 deletions

View file

@ -7,10 +7,9 @@
</component>
<component name="ChangeListManager">
<list default="true" id="0c822a5a-f421-4f3c-b941-5c2809c4546f" name="Default" comment="">
<change type="MOVED" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotRepositorySource.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotRepositoryBuilder.java" />
<change type="MOVED" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotRepositoryBuilder.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotRepositorySource.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLGitServlet.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLGitServlet.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/handler/WLRepositoryResolver.java" afterPath="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/handler/WLRepositoryResolver.java" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/build.xml" afterPath="$PROJECT_DIR$/build.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
</list>
<ignored path="writelatex-git-bridge.iws" />
@ -34,71 +33,31 @@
</component>
<component name="FileEditorManager">
<leaf>
<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="0" max-vertical-offset="465">
<caret line="18" column="108" selection-start-line="18" selection-start-column="108" selection-end-line="18" selection-end-column="108" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="build.xml" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/build.xml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.82051283" vertical-offset="3780" max-vertical-offset="4365">
<caret line="284" column="30" selection-start-line="284" selection-start-column="30" selection-end-line="284" selection-end-column="30" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Main.java" pinned="false" current="false" current-in-tab="false">
<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="105" max-vertical-offset="300">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="300">
<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="WLRepositoryResolver.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/handler/WLRepositoryResolver.java">
<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">
<state vertical-scroll-proportion="0.0" vertical-offset="120" max-vertical-offset="750">
<caret line="24" column="49" selection-start-line="24" selection-start-column="49" selection-end-line="24" selection-end-column="49" />
<state vertical-scroll-proportion="0.0" vertical-offset="3780" max-vertical-offset="4365">
<caret line="281" column="70" selection-start-line="281" selection-start-column="70" selection-end-line="281" selection-end-column="70" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="RepositorySource.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/bridge/RepositorySource.java">
<file leaf-file-name="SnapshotRepositorySource.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotRepositorySource.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315">
<caret line="12" column="74" selection-start-line="12" selection-start-column="74" selection-end-line="12" selection-end-column="74" />
<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">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="225" max-vertical-offset="1290">
<caret line="24" column="96" selection-start-line="24" selection-start-column="96" selection-end-line="24" selection-end-column="96" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="WLGitBridgeServer.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/application/WLGitBridgeServer.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="554" max-vertical-offset="1185">
<caret line="53" column="9" selection-start-line="53" selection-start-column="9" selection-end-line="53" selection-end-column="9" />
<state vertical-scroll-proportion="0.0" vertical-offset="45" max-vertical-offset="630">
<caret line="31" column="35" selection-start-line="31" selection-start-column="35" selection-end-line="31" selection-end-column="35" />
<folding />
</state>
</provider>
@ -107,25 +66,45 @@
<file leaf-file-name="SnapshotRepositoryBuilder.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotRepositoryBuilder.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="570">
<caret line="13" column="38" selection-start-line="13" selection-start-column="38" selection-end-line="13" selection-end-column="38" />
<state vertical-scroll-proportion="0.0" vertical-offset="30" max-vertical-offset="705">
<caret line="17" column="35" selection-start-line="17" selection-start-column="35" selection-end-line="17" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="SnapshotRepositoryBuilderTests.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/SnapshotRepositoryBuilderTests.java">
<file leaf-file-name="DummySnapshotAPI.java" pinned="false" current="true" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/DummySnapshotAPI.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315">
<caret line="11" column="0" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
<state vertical-scroll-proportion="0.451505" vertical-offset="0" max-vertical-offset="598">
<caret line="18" column="4" selection-start-line="18" selection-start-column="4" selection-end-line="18" selection-end-column="4" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="InvalidRootDirectoryPathException.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/exception/InvalidRootDirectoryPathException.java">
<file leaf-file-name="SnapshotAPI.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotAPI.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="285">
<caret line="10" column="31" selection-start-line="10" selection-start-column="31" selection-end-line="10" selection-end-column="31" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="DummySnapshotDBAPI.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/DummySnapshotDBAPI.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="435">
<caret line="17" column="9" selection-start-line="17" selection-start-column="9" selection-end-line="17" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Snapshot.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/Snapshot.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="195">
<caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
@ -134,6 +113,26 @@
</provider>
</entry>
</file>
<file leaf-file-name="SnapshotDBAPI.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotDBAPI.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="RepositoryBuilder.java" pinned="false" current="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/RepositoryBuilder.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="285">
<caret line="11" column="0" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FindManager">
@ -147,14 +146,6 @@
<component name="IdeDocumentHistory">
<option name="changedFiles">
<list>
<option value="$PROJECT_DIR$/src/uk/ac/ic/WriteLatexRepositoryResolver.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/WLRepositoryResolver.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/WriteLatexUploadPackFactory.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/WLUploadPackFactory.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/WLProjectGitServlet.java" />
<option value="$PROJECT_DIR$/test/uk/ac/ic/test/WriteLatexGitBridgeServerTests.java" />
<option value="$PROJECT_DIR$/test/uk/ac/ic/test/WLGitBridgeServerTests.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/WLGitServlet.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/WLGitBridgeServer.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/Main.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/WLGitBridgeApplication.java" />
@ -194,10 +185,18 @@
<option value="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/git/exception/InvalidRootDirectoryPathException.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/WLGitServlet.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/handler/WLRepositoryResolver.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotRepositorySource.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotRepositoryBuilder.java" />
<option value="$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/SnapshotRepositoryBuilderTests.java" />
<option value="$PROJECT_DIR$/build.xml" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotRepositorySource.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/RepositoryBuilder.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotAPIFacade.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/DummySnapshotAPIFacade.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/Snapshot.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/DummySnapshotDBAPI.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotDBAPI.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotAPI.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotRepositoryBuilder.java" />
<option value="$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/DummySnapshotAPI.java" />
</list>
</option>
</component>
@ -781,13 +780,13 @@
<recent name="uk.ac.ic.wlgitbridge.application" />
<recent name="uk.ac.ic.wlgitbridge.git" />
</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>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/libs" />
</key>
</component>
<component name="RunManager" selected="Application.writelatex-git-bridge">
<configuration default="true" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" factoryName="Plugin">
@ -1069,57 +1068,6 @@
</buildFile>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/git/handler/WLUploadPackTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="195" max-vertical-offset="315">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/MainTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="225" max-vertical-offset="315">
<caret line="15" column="0" selection-start-line="15" selection-start-column="0" selection-end-line="15" selection-end-column="0" />
</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.0" vertical-offset="345" max-vertical-offset="480">
<caret line="23" column="5" selection-start-line="23" selection-start-column="5" selection-end-line="23" selection-end-column="5" />
<folding />
</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="240" max-vertical-offset="390">
<caret line="16" column="48" selection-start-line="16" selection-start-column="48" selection-end-line="16" selection-end-column="48" />
<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="195" max-vertical-offset="315">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
</state>
</provider>
</entry>
<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="37" selection-start-line="7" selection-start-column="37" selection-end-line="12" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/git/WLGitServletTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="195" max-vertical-offset="315">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/git/WLGitServletConfigTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="195" max-vertical-offset="315">
@ -1373,14 +1321,6 @@
</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">
<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>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/git/exception/InvalidRootDirectoryPathException.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="195">
@ -1408,7 +1348,7 @@
<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="465">
<caret line="18" column="108" selection-start-line="18" selection-start-column="108" selection-end-line="18" selection-end-column="108" />
<caret line="18" column="107" selection-start-line="18" selection-start-column="107" selection-end-line="18" selection-end-column="107" />
<folding />
</state>
</provider>
@ -1429,14 +1369,6 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotRepositoryBuilder.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="570">
<caret line="13" column="38" selection-start-line="13" selection-start-column="38" selection-end-line="13" selection-end-column="38" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/test/uk/ac/ic/wlgitbridge/test/writelatex/SnapshotRepositoryBuilderTests.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315">
@ -1447,8 +1379,80 @@
</entry>
<entry file="file://$PROJECT_DIR$/build.xml">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.82051283" vertical-offset="3780" max-vertical-offset="4365">
<caret line="284" column="30" selection-start-line="284" selection-start-column="30" selection-end-line="284" selection-end-column="30" />
<state vertical-scroll-proportion="0.0" vertical-offset="3780" max-vertical-offset="4365">
<caret line="281" column="70" selection-start-line="281" selection-start-column="70" selection-end-line="281" selection-end-column="70" />
<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">
<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>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/RepositoryBuilder.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="15" max-vertical-offset="285">
<caret line="11" column="0" selection-start-line="11" selection-start-column="0" selection-end-line="11" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/Snapshot.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="195">
<caret line="5" column="13" selection-start-line="5" selection-start-column="13" selection-end-line="5" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/DummySnapshotDBAPI.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="435">
<caret line="17" column="9" selection-start-line="17" selection-start-column="9" selection-end-line="17" selection-end-column="9" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotRepositorySource.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="45" max-vertical-offset="630">
<caret line="31" column="35" selection-start-line="31" selection-start-column="35" selection-end-line="31" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotAPI.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="285">
<caret line="10" column="31" selection-start-line="10" selection-start-column="31" selection-end-line="10" selection-end-column="31" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotDBAPI.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="315">
<caret line="13" column="0" selection-start-line="13" selection-start-column="0" selection-end-line="13" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/SnapshotRepositoryBuilder.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="30" max-vertical-offset="705">
<caret line="17" column="35" selection-start-line="17" selection-start-column="35" selection-end-line="17" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/uk/ac/ic/wlgitbridge/writelatex/DummySnapshotAPI.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.451505" vertical-offset="0" max-vertical-offset="598">
<caret line="18" column="4" selection-start-line="18" selection-start-column="4" selection-end-line="18" selection-end-column="4" />
<folding />
</state>
</provider>

View file

@ -6,7 +6,7 @@ import uk.ac.ic.wlgitbridge.git.exception.InvalidRootDirectoryPathException;
import uk.ac.ic.wlgitbridge.git.handler.WLReceivePackFactory;
import uk.ac.ic.wlgitbridge.git.handler.WLRepositoryResolver;
import uk.ac.ic.wlgitbridge.git.handler.WLUploadPackFactory;
import uk.ac.ic.wlgitbridge.writelatex.SnapshotRepositoryBuilder;
import uk.ac.ic.wlgitbridge.writelatex.SnapshotRepositorySource;
import javax.servlet.ServletException;
@ -16,7 +16,7 @@ import javax.servlet.ServletException;
public class WLGitServlet extends GitServlet {
public WLGitServlet(ServletContextHandler servletContextHandler, String rootGitDirectoryPath) throws ServletException, InvalidRootDirectoryPathException {
setRepositoryResolver(new WLRepositoryResolver(rootGitDirectoryPath, new SnapshotRepositoryBuilder()));
setRepositoryResolver(new WLRepositoryResolver(rootGitDirectoryPath, new SnapshotRepositorySource()));
setReceivePackFactory(new WLReceivePackFactory());
setUploadPackFactory(new WLUploadPackFactory());
init(new WLGitServletConfig(servletContextHandler));

View file

@ -8,7 +8,7 @@ import org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import uk.ac.ic.wlgitbridge.git.exception.InvalidRootDirectoryPathException;
import uk.ac.ic.wlgitbridge.bridge.RepositorySource;
import uk.ac.ic.wlgitbridge.writelatex.SnapshotRepositoryBuilder;
import uk.ac.ic.wlgitbridge.writelatex.SnapshotRepositorySource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
@ -21,7 +21,7 @@ public class WLRepositoryResolver implements RepositoryResolver<HttpServletReque
private File rootGitDirectory;
private RepositorySource repositorySource;
public WLRepositoryResolver(String rootGitDirectoryPath, SnapshotRepositoryBuilder repositorySource) throws InvalidRootDirectoryPathException {
public WLRepositoryResolver(String rootGitDirectoryPath, SnapshotRepositorySource repositorySource) throws InvalidRootDirectoryPathException {
this.repositorySource = repositorySource;
initRootGitDirectory(rootGitDirectoryPath);
}

View file

@ -0,0 +1,20 @@
package uk.ac.ic.wlgitbridge.writelatex;
import java.util.List;
/**
* Created by Winston on 03/11/14.
*/
public class DummySnapshotAPI implements SnapshotAPI {
@Override
public List<Snapshot> getSnapshots() {
return null;
}
@Override
public void putSnapshots(List<Snapshot> snapshots) {
}
}

View file

@ -0,0 +1,23 @@
package uk.ac.ic.wlgitbridge.writelatex;
import org.eclipse.jgit.lib.Repository;
import java.util.LinkedList;
import java.util.List;
/**
* Created by Winston on 03/11/14.
*/
public class DummySnapshotDBAPI implements SnapshotDBAPI {
@Override
public boolean repositoryExists(Repository repository) {
return false;
}
@Override
public List<Snapshot> getSnapshotsToAddToRepository(Repository repository) {
return new LinkedList<Snapshot>();
}
}

View file

@ -0,0 +1,13 @@
package uk.ac.ic.wlgitbridge.writelatex;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.lib.Repository;
/**
* Created by Winston on 03/11/14.
*/
public interface RepositoryBuilder {
public void buildRepository(Repository repository) throws RepositoryNotFoundException;
}

View file

@ -0,0 +1,7 @@
package uk.ac.ic.wlgitbridge.writelatex;
/**
* Created by Winston on 03/11/14.
*/
public class Snapshot {
}

View file

@ -0,0 +1,13 @@
package uk.ac.ic.wlgitbridge.writelatex;
import java.util.List;
/**
* Created by Winston on 03/11/14.
*/
public interface SnapshotAPI {
public List<Snapshot> getSnapshots();
public void putSnapshots(List<Snapshot> snapshots);
}

View file

@ -0,0 +1,15 @@
package uk.ac.ic.wlgitbridge.writelatex;
import org.eclipse.jgit.lib.Repository;
import java.util.List;
/**
* Created by Winston on 03/11/14.
*/
public interface SnapshotDBAPI {
public boolean repositoryExists(Repository repository);
public List<Snapshot> getSnapshotsToAddToRepository(Repository repository);
}

View file

@ -2,31 +2,40 @@ package uk.ac.ic.wlgitbridge.writelatex;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import uk.ac.ic.wlgitbridge.bridge.RepositorySource;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* Created by Winston on 03/11/14.
*/
public class SnapshotRepositoryBuilder implements RepositorySource {
public class SnapshotRepositoryBuilder implements RepositoryBuilder {
private SnapshotDBAPI snapshotDBAPI;
private SnapshotAPI snapshotAPI;
public SnapshotRepositoryBuilder() {
snapshotDBAPI = new DummySnapshotDBAPI();
snapshotAPI = new DummySnapshotAPI();
}
@Override
public Repository getRepositoryWithNameAtRootDirectory(String name, File rootDirectory) throws RepositoryNotFoundException {
File repositoryRoot = new File(rootDirectory.getAbsolutePath(), name);
public void buildRepository(Repository repository) throws RepositoryNotFoundException {
if (repository.getObjectDatabase().exists()) {
updateRepositoryFromSnapshots(repository);
} else {
buildRepositoryFromScratch(repository);
}
}
Repository repository = null;
try {
repository = new FileRepositoryBuilder().setWorkTree(repositoryRoot).build();
} catch (IOException e) {
throw new RepositoryNotFoundException(name);
private void updateRepositoryFromSnapshots(Repository repository) {
List<Snapshot> snapshotsToAdd = snapshotDBAPI.getSnapshotsToAddToRepository(repository);
}
private void buildRepositoryFromScratch(Repository repository) throws RepositoryNotFoundException {
if (!snapshotDBAPI.repositoryExists(repository)) {
throw new RepositoryNotFoundException(repository.getDirectory());
}
if (!repository.getObjectDatabase().exists()) {
throw new RepositoryNotFoundException(name);
}
return repository;
updateRepositoryFromSnapshots(repository);
}
}

View file

@ -0,0 +1,36 @@
package uk.ac.ic.wlgitbridge.writelatex;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import uk.ac.ic.wlgitbridge.bridge.RepositorySource;
import java.io.File;
import java.io.IOException;
/**
* Created by Winston on 03/11/14.
*/
public class SnapshotRepositorySource implements RepositorySource {
private RepositoryBuilder repositoryBuilder;
public SnapshotRepositorySource() {
repositoryBuilder = new SnapshotRepositoryBuilder();
}
@Override
public Repository getRepositoryWithNameAtRootDirectory(String name, File rootDirectory) throws RepositoryNotFoundException {
File repositoryDirectory = new File(rootDirectory.getAbsolutePath(), name);
Repository repository = null;
try {
repository = new FileRepositoryBuilder().setWorkTree(repositoryDirectory).build();
} catch (IOException e) {
throw new RepositoryNotFoundException(name);
}
repositoryBuilder.buildRepository(repository);
return repository;
}
}