<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src/main/java"/>
- <classpathentry kind="src" output="bin/test-classes" path="src/test/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="lib" path="ext/jcommander-1.17.jar" sourcepath="ext/src/jcommander-1.17.jar"/>
- <classpathentry kind="lib" path="ext/log4j-1.2.17.jar" sourcepath="ext/src/log4j-1.2.17.jar"/>
- <classpathentry kind="lib" path="ext/slf4j-api-1.6.6.jar" sourcepath="ext/src/slf4j-api-1.6.6.jar"/>
- <classpathentry kind="lib" path="ext/slf4j-log4j12-1.6.6.jar" sourcepath="ext/src/slf4j-log4j12-1.6.6.jar"/>
- <classpathentry kind="lib" path="ext/mail-1.4.3.jar" sourcepath="ext/src/mail-1.4.3.jar"/>
- <classpathentry kind="lib" path="ext/javax.servlet-api-3.0.1.jar" sourcepath="ext/src/javax.servlet-api-3.0.1.jar"/>
- <classpathentry kind="lib" path="ext/jetty-webapp-8.1.13.v20130916.jar" sourcepath="ext/src/jetty-webapp-8.1.13.v20130916.jar"/>
- <classpathentry kind="lib" path="ext/jetty-ajp-8.1.13.v20130916.jar" sourcepath="ext/src/jetty-ajp-8.1.13.v20130916.jar"/>
- <classpathentry kind="lib" path="ext/wicket-1.4.21.jar" sourcepath="ext/src/wicket-1.4.21.jar"/>
- <classpathentry kind="lib" path="ext/wicket-auth-roles-1.4.21.jar" sourcepath="ext/src/wicket-auth-roles-1.4.21.jar"/>
- <classpathentry kind="lib" path="ext/wicket-extensions-1.4.21.jar" sourcepath="ext/src/wicket-extensions-1.4.21.jar"/>
- <classpathentry kind="lib" path="ext/googlecharts-1.4.21.jar" sourcepath="ext/src/googlecharts-1.4.21.jar"/>
- <classpathentry kind="lib" path="ext/lucene-core-3.6.1.jar" sourcepath="ext/src/lucene-core-3.6.1.jar"/>
- <classpathentry kind="lib" path="ext/lucene-highlighter-3.6.1.jar" sourcepath="ext/src/lucene-highlighter-3.6.1.jar"/>
- <classpathentry kind="lib" path="ext/lucene-memory-3.6.1.jar" sourcepath="ext/src/lucene-memory-3.6.1.jar"/>
- <classpathentry kind="lib" path="ext/lucene-queries-3.6.1.jar" sourcepath="ext/src/lucene-queries-3.6.1.jar"/>
- <classpathentry kind="lib" path="ext/jakarta-regexp-1.4.jar"/>
- <classpathentry kind="lib" path="ext/pegdown-1.4.1.jar" sourcepath="ext/src/pegdown-1.4.1.jar"/>
- <classpathentry kind="lib" path="ext/parboiled-java-1.1.5.jar" sourcepath="ext/src/parboiled-java-1.1.5.jar"/>
- <classpathentry kind="lib" path="ext/parboiled-core-1.1.5.jar" sourcepath="ext/src/parboiled-core-1.1.5.jar"/>
- <classpathentry kind="lib" path="ext/asm-4.1.jar" sourcepath="ext/src/asm-4.1.jar"/>
- <classpathentry kind="lib" path="ext/asm-tree-4.1.jar" sourcepath="ext/src/asm-tree-4.1.jar"/>
- <classpathentry kind="lib" path="ext/asm-analysis-4.1.jar" sourcepath="ext/src/asm-analysis-4.1.jar"/>
- <classpathentry kind="lib" path="ext/asm-util-4.1.jar" sourcepath="ext/src/asm-util-4.1.jar"/>
- <classpathentry kind="lib" path="ext/wikitext-core-1.4.jar" sourcepath="ext/src/wikitext-core-1.4.jar"/>
- <classpathentry kind="lib" path="ext/twiki-core-1.4.jar" sourcepath="ext/src/twiki-core-1.4.jar"/>
- <classpathentry kind="lib" path="ext/textile-core-1.4.jar" sourcepath="ext/src/textile-core-1.4.jar"/>
- <classpathentry kind="lib" path="ext/tracwiki-core-1.4.jar" sourcepath="ext/src/tracwiki-core-1.4.jar"/>
- <classpathentry kind="lib" path="ext/mediawiki-core-1.4.jar" sourcepath="ext/src/mediawiki-core-1.4.jar"/>
- <classpathentry kind="lib" path="ext/confluence-core-1.4.jar" sourcepath="ext/src/confluence-core-1.4.jar"/>
- <classpathentry kind="lib" path="ext/org.eclipse.jgit-3.1.0.201310021548-r.jar" sourcepath="ext/src/org.eclipse.jgit-3.1.0.201310021548-r.jar"/>
- <classpathentry kind="lib" path="ext/jsch-0.1.46.jar" sourcepath="ext/src/jsch-0.1.46.jar"/>
- <classpathentry kind="lib" path="ext/JavaEWAH-0.5.6.jar" sourcepath="ext/src/JavaEWAH-0.5.6.jar"/>
- <classpathentry kind="lib" path="ext/org.eclipse.jgit.http.server-3.1.0.201310021548-r.jar" sourcepath="ext/src/org.eclipse.jgit.http.server-3.1.0.201310021548-r.jar"/>
- <classpathentry kind="lib" path="ext/bcprov-jdk15on-1.47.jar" sourcepath="ext/src/bcprov-jdk15on-1.47.jar"/>
- <classpathentry kind="lib" path="ext/bcmail-jdk15on-1.47.jar" sourcepath="ext/src/bcmail-jdk15on-1.47.jar"/>
- <classpathentry kind="lib" path="ext/bcpkix-jdk15on-1.47.jar" sourcepath="ext/src/bcpkix-jdk15on-1.47.jar"/>
- <classpathentry kind="lib" path="ext/rome-0.9.jar" sourcepath="ext/src/rome-0.9.jar"/>
- <classpathentry kind="lib" path="ext/jdom-1.0.jar" sourcepath="ext/src/jdom-1.0.jar"/>
- <classpathentry kind="lib" path="ext/gson-1.7.2.jar" sourcepath="ext/src/gson-1.7.2.jar"/>
- <classpathentry kind="lib" path="ext/groovy-all-1.8.8.jar" sourcepath="ext/src/groovy-all-1.8.8.jar"/>
- <classpathentry kind="lib" path="ext/unboundid-ldapsdk-2.3.0.jar" sourcepath="ext/src/unboundid-ldapsdk-2.3.0.jar"/>
- <classpathentry kind="lib" path="ext/ivy-2.2.0.jar" sourcepath="ext/src/ivy-2.2.0.jar"/>
- <classpathentry kind="lib" path="ext/jcalendar-1.3.2.jar"/>
- <classpathentry kind="lib" path="ext/commons-compress-1.4.1.jar" sourcepath="ext/src/commons-compress-1.4.1.jar"/>
- <classpathentry kind="lib" path="ext/xz-1.0.jar" sourcepath="ext/src/xz-1.0.jar"/>
- <classpathentry kind="lib" path="ext/commons-io-2.2.jar" sourcepath="ext/src/commons-io-2.2.jar"/>
- <classpathentry kind="lib" path="ext/force-partner-api-24.0.0.jar" sourcepath="ext/src/force-partner-api-24.0.0.jar"/>
- <classpathentry kind="lib" path="ext/force-wsc-24.0.0.jar" sourcepath="ext/src/force-wsc-24.0.0.jar"/>
- <classpathentry kind="lib" path="ext/js-1.7R2.jar" sourcepath="ext/src/js-1.7R2.jar"/>
- <classpathentry kind="lib" path="ext/freemarker-2.3.19.jar" sourcepath="ext/src/freemarker-2.3.19.jar"/>
- <classpathentry kind="lib" path="ext/waffle-jna-1.5.jar" sourcepath="ext/src/waffle-jna-1.5.jar"/>
- <classpathentry kind="lib" path="ext/platform-3.5.0.jar" sourcepath="ext/src/platform-3.5.0.jar"/>
- <classpathentry kind="lib" path="ext/jna-3.5.0.jar" sourcepath="ext/src/jna-3.5.0.jar"/>
- <classpathentry kind="lib" path="ext/guava-13.0.1.jar" sourcepath="ext/src/guava-13.0.1.jar"/>
- <classpathentry kind="lib" path="ext/libpam4j-1.7.jar" sourcepath="ext/src/libpam4j-1.7.jar"/>
- <classpathentry kind="lib" path="ext/commons-codec-1.7.jar" sourcepath="ext/src/commons-codec-1.7.jar"/>
- <classpathentry kind="lib" path="ext/junit-4.11.jar" sourcepath="ext/src/junit-4.11.jar"/>
- <classpathentry kind="lib" path="ext/hamcrest-core-1.3.jar" sourcepath="ext/src/hamcrest-core-1.3.jar"/>
- <classpathentry kind="lib" path="ext/selenium-java-2.28.0.jar" sourcepath="ext/src/selenium-java-2.28.0.jar"/>
- <classpathentry kind="lib" path="ext/selenium-support-2.28.0.jar" sourcepath="ext/src/selenium-support-2.28.0.jar"/>
- <classpathentry kind="lib" path="ext/selenium-firefox-driver-2.28.0.jar" sourcepath="ext/src/selenium-firefox-driver-2.28.0.jar"/>
- <classpathentry kind="lib" path="ext/selenium-remote-driver-2.28.0.jar" sourcepath="ext/src/selenium-remote-driver-2.28.0.jar"/>
- <classpathentry kind="lib" path="ext/cglib-nodep-2.1_3.jar" sourcepath="ext/src/cglib-nodep-2.1_3.jar"/>
- <classpathentry kind="lib" path="ext/json-20080701.jar" sourcepath="ext/src/json-20080701.jar"/>
- <classpathentry kind="lib" path="ext/selenium-api-2.28.0.jar" sourcepath="ext/src/selenium-api-2.28.0.jar"/>
- <classpathentry kind="lib" path="ext/httpclient-4.2.1.jar" sourcepath="ext/src/httpclient-4.2.1.jar"/>
- <classpathentry kind="lib" path="ext/httpcore-4.2.1.jar" sourcepath="ext/src/httpcore-4.2.1.jar"/>
- <classpathentry kind="lib" path="ext/commons-logging-1.1.1.jar" sourcepath="ext/src/commons-logging-1.1.1.jar"/>
- <classpathentry kind="lib" path="ext/commons-exec-1.1.jar" sourcepath="ext/src/commons-exec-1.1.jar"/>
+ <classpathentry kind="src" path="src/main/java" />
+ <classpathentry kind="src" path="src/test/java" output="bin/test-classes" />
+ <classpathentry kind="src" path="src/main/resources" />
+ <classpathentry kind="lib" path="ext/dagger-1.1.0.jar" sourcepath="ext/src/dagger-1.1.0.jar" />
+ <classpathentry kind="lib" path="ext/javax.inject-1.jar" sourcepath="ext/src/javax.inject-1.jar" />
+ <classpathentry kind="lib" path="ext/dagger-compiler-1.1.0.jar" sourcepath="ext/src/dagger-compiler-1.1.0.jar" />
+ <classpathentry kind="lib" path="ext/javawriter-2.1.1.jar" sourcepath="ext/src/javawriter-2.1.1.jar" />
+ <classpathentry kind="lib" path="ext/jcommander-1.17.jar" sourcepath="ext/src/jcommander-1.17.jar" />
+ <classpathentry kind="lib" path="ext/log4j-1.2.17.jar" sourcepath="ext/src/log4j-1.2.17.jar" />
+ <classpathentry kind="lib" path="ext/slf4j-api-1.6.6.jar" sourcepath="ext/src/slf4j-api-1.6.6.jar" />
+ <classpathentry kind="lib" path="ext/slf4j-log4j12-1.6.6.jar" sourcepath="ext/src/slf4j-log4j12-1.6.6.jar" />
+ <classpathentry kind="lib" path="ext/mail-1.4.3.jar" sourcepath="ext/src/mail-1.4.3.jar" />
+ <classpathentry kind="lib" path="ext/javax.servlet-api-3.0.1.jar" sourcepath="ext/src/javax.servlet-api-3.0.1.jar" />
+ <classpathentry kind="lib" path="ext/jetty-webapp-8.1.13.v20130916.jar" sourcepath="ext/src/jetty-webapp-8.1.13.v20130916.jar" />
+ <classpathentry kind="lib" path="ext/jetty-ajp-8.1.13.v20130916.jar" sourcepath="ext/src/jetty-ajp-8.1.13.v20130916.jar" />
+ <classpathentry kind="lib" path="ext/wicket-1.4.21.jar" sourcepath="ext/src/wicket-1.4.21.jar" />
+ <classpathentry kind="lib" path="ext/wicket-auth-roles-1.4.21.jar" sourcepath="ext/src/wicket-auth-roles-1.4.21.jar" />
+ <classpathentry kind="lib" path="ext/wicket-extensions-1.4.21.jar" sourcepath="ext/src/wicket-extensions-1.4.21.jar" />
+ <classpathentry kind="lib" path="ext/googlecharts-1.4.21.jar" sourcepath="ext/src/googlecharts-1.4.21.jar" />
+ <classpathentry kind="lib" path="ext/lucene-core-3.6.1.jar" sourcepath="ext/src/lucene-core-3.6.1.jar" />
+ <classpathentry kind="lib" path="ext/lucene-highlighter-3.6.1.jar" sourcepath="ext/src/lucene-highlighter-3.6.1.jar" />
+ <classpathentry kind="lib" path="ext/lucene-memory-3.6.1.jar" sourcepath="ext/src/lucene-memory-3.6.1.jar" />
+ <classpathentry kind="lib" path="ext/lucene-queries-3.6.1.jar" sourcepath="ext/src/lucene-queries-3.6.1.jar" />
+ <classpathentry kind="lib" path="ext/jakarta-regexp-1.4.jar" />
+ <classpathentry kind="lib" path="ext/pegdown-1.4.1.jar" sourcepath="ext/src/pegdown-1.4.1.jar" />
+ <classpathentry kind="lib" path="ext/parboiled-java-1.1.5.jar" sourcepath="ext/src/parboiled-java-1.1.5.jar" />
+ <classpathentry kind="lib" path="ext/parboiled-core-1.1.5.jar" sourcepath="ext/src/parboiled-core-1.1.5.jar" />
+ <classpathentry kind="lib" path="ext/asm-4.1.jar" sourcepath="ext/src/asm-4.1.jar" />
+ <classpathentry kind="lib" path="ext/asm-tree-4.1.jar" sourcepath="ext/src/asm-tree-4.1.jar" />
+ <classpathentry kind="lib" path="ext/asm-analysis-4.1.jar" sourcepath="ext/src/asm-analysis-4.1.jar" />
+ <classpathentry kind="lib" path="ext/asm-util-4.1.jar" sourcepath="ext/src/asm-util-4.1.jar" />
+ <classpathentry kind="lib" path="ext/wikitext-core-1.4.jar" sourcepath="ext/src/wikitext-core-1.4.jar" />
+ <classpathentry kind="lib" path="ext/twiki-core-1.4.jar" sourcepath="ext/src/twiki-core-1.4.jar" />
+ <classpathentry kind="lib" path="ext/textile-core-1.4.jar" sourcepath="ext/src/textile-core-1.4.jar" />
+ <classpathentry kind="lib" path="ext/tracwiki-core-1.4.jar" sourcepath="ext/src/tracwiki-core-1.4.jar" />
+ <classpathentry kind="lib" path="ext/mediawiki-core-1.4.jar" sourcepath="ext/src/mediawiki-core-1.4.jar" />
+ <classpathentry kind="lib" path="ext/confluence-core-1.4.jar" sourcepath="ext/src/confluence-core-1.4.jar" />
+ <classpathentry kind="lib" path="ext/org.eclipse.jgit-3.1.0.201310021548-r.jar" sourcepath="ext/src/org.eclipse.jgit-3.1.0.201310021548-r.jar" />
+ <classpathentry kind="lib" path="ext/jsch-0.1.46.jar" sourcepath="ext/src/jsch-0.1.46.jar" />
+ <classpathentry kind="lib" path="ext/JavaEWAH-0.5.6.jar" sourcepath="ext/src/JavaEWAH-0.5.6.jar" />
+ <classpathentry kind="lib" path="ext/org.eclipse.jgit.http.server-3.1.0.201310021548-r.jar" sourcepath="ext/src/org.eclipse.jgit.http.server-3.1.0.201310021548-r.jar" />
+ <classpathentry kind="lib" path="ext/bcprov-jdk15on-1.47.jar" sourcepath="ext/src/bcprov-jdk15on-1.47.jar" />
+ <classpathentry kind="lib" path="ext/bcmail-jdk15on-1.47.jar" sourcepath="ext/src/bcmail-jdk15on-1.47.jar" />
+ <classpathentry kind="lib" path="ext/bcpkix-jdk15on-1.47.jar" sourcepath="ext/src/bcpkix-jdk15on-1.47.jar" />
+ <classpathentry kind="lib" path="ext/rome-0.9.jar" sourcepath="ext/src/rome-0.9.jar" />
+ <classpathentry kind="lib" path="ext/jdom-1.0.jar" sourcepath="ext/src/jdom-1.0.jar" />
+ <classpathentry kind="lib" path="ext/gson-1.7.2.jar" sourcepath="ext/src/gson-1.7.2.jar" />
+ <classpathentry kind="lib" path="ext/groovy-all-1.8.8.jar" sourcepath="ext/src/groovy-all-1.8.8.jar" />
+ <classpathentry kind="lib" path="ext/unboundid-ldapsdk-2.3.0.jar" sourcepath="ext/src/unboundid-ldapsdk-2.3.0.jar" />
+ <classpathentry kind="lib" path="ext/ivy-2.2.0.jar" sourcepath="ext/src/ivy-2.2.0.jar" />
+ <classpathentry kind="lib" path="ext/jcalendar-1.3.2.jar" />
+ <classpathentry kind="lib" path="ext/commons-compress-1.4.1.jar" sourcepath="ext/src/commons-compress-1.4.1.jar" />
+ <classpathentry kind="lib" path="ext/xz-1.0.jar" sourcepath="ext/src/xz-1.0.jar" />
+ <classpathentry kind="lib" path="ext/commons-io-2.2.jar" sourcepath="ext/src/commons-io-2.2.jar" />
+ <classpathentry kind="lib" path="ext/force-partner-api-24.0.0.jar" sourcepath="ext/src/force-partner-api-24.0.0.jar" />
+ <classpathentry kind="lib" path="ext/force-wsc-24.0.0.jar" sourcepath="ext/src/force-wsc-24.0.0.jar" />
+ <classpathentry kind="lib" path="ext/js-1.7R2.jar" sourcepath="ext/src/js-1.7R2.jar" />
+ <classpathentry kind="lib" path="ext/freemarker-2.3.19.jar" sourcepath="ext/src/freemarker-2.3.19.jar" />
+ <classpathentry kind="lib" path="ext/waffle-jna-1.5.jar" sourcepath="ext/src/waffle-jna-1.5.jar" />
+ <classpathentry kind="lib" path="ext/platform-3.5.0.jar" sourcepath="ext/src/platform-3.5.0.jar" />
+ <classpathentry kind="lib" path="ext/jna-3.5.0.jar" sourcepath="ext/src/jna-3.5.0.jar" />
+ <classpathentry kind="lib" path="ext/guava-13.0.1.jar" sourcepath="ext/src/guava-13.0.1.jar" />
+ <classpathentry kind="lib" path="ext/libpam4j-1.7.jar" sourcepath="ext/src/libpam4j-1.7.jar" />
+ <classpathentry kind="lib" path="ext/commons-codec-1.7.jar" sourcepath="ext/src/commons-codec-1.7.jar" />
+ <classpathentry kind="lib" path="ext/junit-4.11.jar" sourcepath="ext/src/junit-4.11.jar" />
+ <classpathentry kind="lib" path="ext/hamcrest-core-1.3.jar" sourcepath="ext/src/hamcrest-core-1.3.jar" />
+ <classpathentry kind="lib" path="ext/selenium-java-2.28.0.jar" sourcepath="ext/src/selenium-java-2.28.0.jar" />
+ <classpathentry kind="lib" path="ext/selenium-support-2.28.0.jar" sourcepath="ext/src/selenium-support-2.28.0.jar" />
+ <classpathentry kind="lib" path="ext/selenium-firefox-driver-2.28.0.jar" sourcepath="ext/src/selenium-firefox-driver-2.28.0.jar" />
+ <classpathentry kind="lib" path="ext/selenium-remote-driver-2.28.0.jar" sourcepath="ext/src/selenium-remote-driver-2.28.0.jar" />
+ <classpathentry kind="lib" path="ext/cglib-nodep-2.1_3.jar" sourcepath="ext/src/cglib-nodep-2.1_3.jar" />
+ <classpathentry kind="lib" path="ext/json-20080701.jar" sourcepath="ext/src/json-20080701.jar" />
+ <classpathentry kind="lib" path="ext/selenium-api-2.28.0.jar" sourcepath="ext/src/selenium-api-2.28.0.jar" />
+ <classpathentry kind="lib" path="ext/httpclient-4.2.1.jar" sourcepath="ext/src/httpclient-4.2.1.jar" />
+ <classpathentry kind="lib" path="ext/httpcore-4.2.1.jar" sourcepath="ext/src/httpcore-4.2.1.jar" />
+ <classpathentry kind="lib" path="ext/commons-logging-1.1.1.jar" sourcepath="ext/src/commons-logging-1.1.1.jar" />
+ <classpathentry kind="lib" path="ext/commons-exec-1.1.jar" sourcepath="ext/src/commons-exec-1.1.jar" />
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" />
+ <classpathentry kind="src" path="src/main/dagger">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="output" path="bin/classes" />
</classpath>
/build-next.xml
/*.ps1
/*.sh
+/*.factorypath
+/src/main/dagger
# a scope to each directory.
sourceDirectories:
- compile 'src/main/java'
+- compile 'src/main/dagger' apt
- test 'src/test/java'
# Moxie supports one site-scoped directory for mx:doc
- site 'src/site'
#
dependencies:
+# Dagger dependency injection library (annotation processor)
+- compile 'com.squareup.dagger:dagger:1.1.0' :war apt
+- compile 'com.squareup.dagger:dagger-compiler:1.1.0' :war optional apt
# Standard dependencies
- compile 'com.beust:jcommander:1.17' :fedclient :authority
- compile 'log4j:log4j:1.2.17' :war :fedclient :authority
</mx:webxml>\r
\r
<!-- Gitblit jar -->\r
- <mx:genjar destfile="${webinf}/lib/gitblit.jar" includeresources="false" excludeclasspathjars="true">\r
- <!-- Specify all web.xml servlets and filters -->\r
- <class name="com.gitblit.GitBlit" />\r
- <class name="com.gitblit.Keys" />\r
- <class name="com.gitblit.DownloadZipFilter" />\r
- <class name="com.gitblit.DownloadZipServlet" />\r
- <class name="com.gitblit.EnforceAuthenticationFilter" />\r
- <class name="com.gitblit.FederationServlet" />\r
- <class name="com.gitblit.GitFilter" />\r
- <class name="com.gitblit.git.GitServlet" />\r
- <class name="com.gitblit.LogoServlet" />\r
- <class name="com.gitblit.PagesFilter" />\r
- <class name="com.gitblit.PagesServlet" />\r
- <class name="com.gitblit.RobotsTxtServlet" />\r
- <class name="com.gitblit.RpcFilter" />\r
- <class name="com.gitblit.RpcServlet" />\r
- <class name="com.gitblit.SyndicationFilter" />\r
- <class name="com.gitblit.SyndicationServlet" />\r
- <class name="com.gitblit.SparkleShareInviteServlet" />\r
- <class name="com.gitblit.wicket.GitblitWicketFilter" />\r
- <class name="com.gitblit.wicket.GitBlitWebApp" />\r
- <!-- Manually include alternative User Services -->\r
- <class name="com.gitblit.LdapUserService" />\r
- <class name="com.gitblit.RedmineUserService" />\r
- <class name="com.gitblit.SalesforceUserService" />\r
- <class name="com.gitblit.WindowsUserService" />\r
- <class name="com.gitblit.PAMUserService" />\r
- </mx:genjar>\r
+ <mx:jar destfile="${webinf}/lib/gitblit.jar" includeresources="false" />\r
\r
<!-- Build the WAR file -->\r
<mx:zip basedir="${war.dir}" destfile="${project.targetDirectory}/${distribution.warfile}" compress="true" >\r
</mx:webxml>\r
\r
<!-- Gitblit classes -->\r
- <mx:genjar destfile="${webinf}/lib/gitblit.jar" includeresources="false" excludeclasspathjars="true">\r
- <!-- Specify all web.xml servlets and filters -->\r
- <class name="com.gitblit.GitBlit" />\r
- <class name="com.gitblit.Keys" />\r
- <class name="com.gitblit.DownloadZipFilter" />\r
- <class name="com.gitblit.DownloadZipServlet" />\r
- <class name="com.gitblit.EnforceAuthenticationFilter" />\r
- <class name="com.gitblit.FederationServlet" />\r
- <class name="com.gitblit.GitFilter" />\r
- <class name="com.gitblit.git.GitServlet" />\r
- <class name="com.gitblit.LogoServlet" />\r
- <class name="com.gitblit.PagesFilter" />\r
- <class name="com.gitblit.PagesServlet" />\r
- <class name="com.gitblit.RobotsTxtServlet" />\r
- <class name="com.gitblit.RpcFilter" />\r
- <class name="com.gitblit.RpcServlet" />\r
- <class name="com.gitblit.SyndicationFilter" />\r
- <class name="com.gitblit.SyndicationServlet" />\r
- <class name="com.gitblit.SparkleShareInviteServlet" />\r
- <class name="com.gitblit.wicket.GitblitWicketFilter" />\r
- <class name="com.gitblit.wicket.GitBlitWebApp" />\r
- <!-- Manually include alternative User Services -->\r
- <class name="com.gitblit.LdapUserService" />\r
- <class name="com.gitblit.RedmineUserService" />\r
- <class name="com.gitblit.SalesforceUserService" />\r
- <class name="com.gitblit.WindowsUserService" />\r
- <class name="com.gitblit.PAMUserService" />\r
- </mx:genjar>\r
+ <mx:jar destfile="${webinf}/lib/gitblit.jar" includeresources="false" />\r
\r
<!-- Build Express Zip file -->\r
<mx:zip basedir="${express.dir}" destfile="${project.targetDirectory}/${express.zipfile}">\r
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/main/dagger" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" isTestSource="false" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="module-library">
+ <library name="dagger-1.1.0.jar">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/ext/dagger-1.1.0.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/ext/src/dagger-1.1.0.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="javax.inject-1.jar">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/ext/javax.inject-1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/ext/src/javax.inject-1.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="dagger-compiler-1.1.0.jar">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/ext/dagger-compiler-1.1.0.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/ext/src/dagger-compiler-1.1.0.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
+ <orderEntry type="module-library">
+ <library name="javawriter-2.1.1.jar">
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/ext/javawriter-2.1.1.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES>
+ <root url="jar://$MODULE_DIR$/ext/src/javawriter-2.1.1.jar!/" />
+ </SOURCES>
+ </library>
+ </orderEntry>
<orderEntry type="module-library">
<library name="jcommander-1.17.jar">
<CLASSES>
\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.manager.IRuntimeManager;\r
+import com.gitblit.manager.ISessionManager;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
import com.gitblit.utils.StringUtils;\r
*/\r
public abstract class AccessRestrictionFilter extends AuthenticationFilter {\r
\r
+ protected final IRuntimeManager runtimeManager;\r
+\r
+ protected final IRepositoryManager repositoryManager;\r
+\r
+ protected AccessRestrictionFilter(\r
+ IRuntimeManager runtimeManager,\r
+ ISessionManager sessionManager,\r
+ IRepositoryManager repositoryManager) {\r
+ super(sessionManager);\r
+ this.runtimeManager = runtimeManager;\r
+ this.repositoryManager = repositoryManager;\r
+ }\r
+\r
/**\r
* Extract the repository name from the url.\r
*\r
String fullUrl = getFullUrl(httpRequest);\r
String repository = extractRepositoryName(fullUrl);\r
\r
- IRuntimeManager runtimeManager = GitBlit.getManager(IRuntimeManager.class);\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
-\r
if (repositoryManager.isCollectingGarbage(repository)) {\r
logger.info(MessageFormat.format("ARF: Rejecting request for {0}, busy collecting garbage!", repository));\r
httpResponse.sendError(HttpServletResponse.SC_FORBIDDEN);\r
\r
protected transient Logger logger = LoggerFactory.getLogger(getClass());\r
\r
+ protected final ISessionManager sessionManager;\r
+\r
+ protected AuthenticationFilter(ISessionManager sessionManager) {\r
+ this.sessionManager = sessionManager;\r
+ }\r
+\r
/**\r
* doFilter does the actual work of preprocessing the request to ensure that\r
* the user may proceed.\r
* @return user\r
*/\r
protected UserModel getUser(HttpServletRequest httpRequest) {\r
- ISessionManager sessionManager = GitBlit.getManager(ISessionManager.class);\r
UserModel user = sessionManager.authenticate(httpRequest, requiresClientCertificate());\r
return user;\r
}\r
import java.util.TreeSet;\r
\r
import javax.imageio.ImageIO;\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServlet;\r
import javax.servlet.http.HttpServletRequest;\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class BranchGraphServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private final Stroke[] strokeCache;\r
\r
- public BranchGraphServlet() {\r
+ private final IStoredSettings settings;\r
+\r
+ private final IRepositoryManager repositoryManager;\r
+\r
+ @Inject\r
+ public BranchGraphServlet(\r
+ IRuntimeManager runtimeManager,\r
+ IRepositoryManager repositoryManager) {\r
+\r
super();\r
+ this.settings = runtimeManager.getSettings();\r
+ this.repositoryManager = repositoryManager;\r
\r
strokeCache = new Stroke[4];\r
for (int i = 1; i < strokeCache.length; i++)\r
protected long getLastModified(HttpServletRequest req) {\r
String repository = req.getParameter("r");\r
String objectId = req.getParameter("h");\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
Repository r = null;\r
try {\r
r = repositoryManager.getRepository(repository);\r
String objectId = request.getParameter("h");\r
String length = request.getParameter("l");\r
\r
- IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
-\r
r = repositoryManager.getRepository(repository);\r
\r
rw = new PlotWalk(r);\r
--- /dev/null
+/*
+ * Copyright 2013 gitblit.com.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gitblit;
+
+import javax.inject.Singleton;
+
+import org.apache.wicket.protocol.http.WebApplication;
+
+import com.gitblit.git.GitServlet;
+import com.gitblit.manager.IFederationManager;
+import com.gitblit.manager.IGitblitManager;
+import com.gitblit.manager.INotificationManager;
+import com.gitblit.manager.IProjectManager;
+import com.gitblit.manager.IRepositoryManager;
+import com.gitblit.manager.IRuntimeManager;
+import com.gitblit.manager.ISessionManager;
+import com.gitblit.manager.IUserManager;
+import com.gitblit.wicket.GitBlitWebApp;
+import com.gitblit.wicket.GitblitWicketFilter;
+
+import dagger.Module;
+import dagger.Provides;
+
+/**
+ * DaggerModule references all injectable objects.
+ *
+ * @author James Moger
+ *
+ */
+@Module(
+ injects = {
+ // core managers
+ IRuntimeManager.class,
+ INotificationManager.class,
+ IUserManager.class,
+ ISessionManager.class,
+ IRepositoryManager.class,
+ IProjectManager.class,
+ IGitblitManager.class,
+ IFederationManager.class,
+
+ // filters & servlets
+ GitServlet.class,
+ GitFilter.class,
+ PagesServlet.class,
+ PagesFilter.class,
+ RpcServlet.class,
+ RpcFilter.class,
+ DownloadZipServlet.class,
+ DownloadZipFilter.class,
+ SyndicationServlet.class,
+ SyndicationFilter.class,
+ FederationServlet.class,
+ SparkleShareInviteServlet.class,
+ BranchGraphServlet.class,
+ RobotsTxtServlet.class,
+ LogoServlet.class,
+ EnforceAuthenticationFilter.class,
+ GitblitWicketFilter.class
+ }
+)
+public class DaggerModule {
+
+ final GitBlit gitblit;
+
+ // HACK but necessary for now
+ public DaggerModule(GitBlit gitblit) {
+ this.gitblit = gitblit;
+ }
+
+ @Provides @Singleton IRuntimeManager provideRuntimeManager() {
+ return gitblit;
+ }
+
+ @Provides @Singleton INotificationManager provideNotificationManager() {
+ return gitblit;
+ }
+
+ @Provides @Singleton IUserManager provideUserManager() {
+ return gitblit;
+ }
+
+ @Provides @Singleton ISessionManager provideSessionManager() {
+ return gitblit;
+ }
+
+ @Provides @Singleton IRepositoryManager provideRepositoryManager() {
+ return gitblit;
+ }
+
+ @Provides @Singleton IProjectManager provideProjectManager() {
+ return gitblit;
+ }
+
+ @Provides @Singleton IGitblitManager provideGitblitManager() {
+ return gitblit;
+ }
+
+ @Provides @Singleton IFederationManager provideFederationManager() {
+ return gitblit;
+ }
+
+ @Provides @Singleton WebApplication provideWebApplication(
+ IRuntimeManager runtimeManager,
+ INotificationManager notificationManager,
+ IUserManager userManager,
+ ISessionManager sessionManager,
+ IRepositoryManager repositoryManager,
+ IProjectManager projectManager,
+ IGitblitManager gitblitManager,
+ IFederationManager federationManager) {
+
+ return new GitBlitWebApp(
+ runtimeManager,
+ notificationManager,
+ userManager,
+ sessionManager,
+ repositoryManager,
+ projectManager,
+ gitblitManager,
+ federationManager);
+ }
+}
\ No newline at end of file
*/\r
package com.gitblit;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
+\r
import com.gitblit.Constants.AccessRestrictionType;\r
+import com.gitblit.manager.IRepositoryManager;\r
+import com.gitblit.manager.IRuntimeManager;\r
+import com.gitblit.manager.ISessionManager;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class DownloadZipFilter extends AccessRestrictionFilter {\r
\r
- public DownloadZipFilter() {\r
+ @Inject\r
+ public DownloadZipFilter(\r
+ IRuntimeManager runtimeManager,\r
+ ISessionManager sessionManager,\r
+ IRepositoryManager repositoryManager) {\r
+\r
+ super(runtimeManager, sessionManager, repositoryManager);\r
}\r
\r
/**\r
import java.text.ParseException;\r
import java.util.Date;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServlet;\r
import javax.servlet.http.HttpServletResponse;\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class DownloadZipServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private transient Logger logger = LoggerFactory.getLogger(DownloadZipServlet.class);\r
\r
+ private final IStoredSettings settings;\r
+\r
+ private final IRepositoryManager repositoryManager;\r
+\r
public static enum Format {\r
zip(".zip"), tar(".tar"), gz(".tar.gz"), xz(".tar.xz"), bzip2(".tar.bzip2");\r
\r
}\r
}\r
\r
- public DownloadZipServlet() {\r
+ @Inject\r
+ public DownloadZipServlet(\r
+ IRuntimeManager runtimeManager,\r
+ IRepositoryManager repositoryManager) {\r
+\r
super();\r
+ this.settings = runtimeManager.getSettings();\r
+ this.repositoryManager = repositoryManager;\r
}\r
\r
/**\r
private void processRequest(javax.servlet.http.HttpServletRequest request,\r
javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException,\r
java.io.IOException {\r
- IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();\r
if (!settings.getBoolean(Keys.web.allowZipDownloads, true)) {\r
logger.warn("Zip downloads are disabled");\r
response.sendError(HttpServletResponse.SC_FORBIDDEN);\r
name += "-" + objectId;\r
}\r
\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
Repository r = repositoryManager.getRepository(repository);\r
if (r == null) {\r
if (repositoryManager.isCollectingGarbage(repository)) {\r
import java.io.IOException;
import java.text.MessageFormat;
+import javax.inject.Inject;
+import javax.inject.Singleton;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
* @author Laurens Vrijnsen
*
*/
+@Singleton
public class EnforceAuthenticationFilter implements Filter {
protected transient Logger logger = LoggerFactory.getLogger(getClass());
- public EnforceAuthenticationFilter() {
+ private final IStoredSettings settings;
+
+ private final ISessionManager sessionManager;
+
+ @Inject
+ public EnforceAuthenticationFilter(
+ IRuntimeManager runtimeManager,
+ ISessionManager sessionManager) {
+
+ super();
+ this.settings = runtimeManager.getSettings();
+ this.sessionManager = sessionManager;
}
/*
public void init(FilterConfig filterConfig) throws ServletException {
}
-
/*
* This does the actual filtering: is the user authenticated? If not, enforce HTTP authentication (401)
*
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
- IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();
- ISessionManager sessionManager = GitBlit.getManager(ISessionManager.class);
Boolean mustForceAuth = settings.getBoolean(Keys.web.authenticateViewPages, false)
&& settings.getBoolean(Keys.web.enforceHttpBasicAuthentication, false);
import java.util.Map;\r
import java.util.Set;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.http.HttpServletResponse;\r
\r
import com.gitblit.Constants.FederationRequest;\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class FederationServlet extends JsonServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
- public FederationServlet() {\r
+ private final IStoredSettings settings;\r
+\r
+ private final IUserManager userManager;\r
+\r
+ private final IRepositoryManager repositoryManager;\r
+\r
+ private final IFederationManager federationManager;\r
+\r
+ @Inject\r
+ public FederationServlet(\r
+ IRuntimeManager runtimeManager,\r
+ IUserManager userManager,\r
+ IRepositoryManager repositoryManager,\r
+ IFederationManager federationManager) {\r
+\r
super();\r
+ this.settings = runtimeManager.getSettings();\r
+ this.userManager = userManager;\r
+ this.repositoryManager = repositoryManager;\r
+ this.federationManager = federationManager;\r
}\r
\r
/**\r
javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException,\r
java.io.IOException {\r
\r
- IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();\r
- IUserManager userManager = GitBlit.getManager(IUserManager.class);\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
- IFederationManager federationManager = GitBlit.getManager(IFederationManager.class);\r
-\r
FederationRequest reqType = FederationRequest.fromName(request.getParameter("req"));\r
logger.info(MessageFormat.format("Federation {0} request from {1}", reqType,\r
request.getRemoteAddr()));\r
\r
private final IStoredSettings settings;\r
\r
+ private final IRepositoryManager repositoryManager;\r
+\r
private AtomicBoolean running = new AtomicBoolean(false);\r
\r
private AtomicBoolean forceClose = new AtomicBoolean(false);\r
\r
private final Map<String, GCStatus> gcCache = new ConcurrentHashMap<String, GCStatus>();\r
\r
- public GCExecutor(IStoredSettings settings) {\r
+ public GCExecutor(\r
+ IStoredSettings settings,\r
+ IRepositoryManager repositoryManager) {\r
+\r
this.settings = settings;\r
+ this.repositoryManager = repositoryManager;\r
}\r
\r
/**\r
running.set(true);\r
Date now = new Date();\r
\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
-\r
for (String repositoryName : repositoryManager.getRepositoryList()) {\r
if (forceClose.get()) {\r
break;\r
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.servlet.ServletContext;
-import javax.servlet.ServletContextEvent;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import com.gitblit.Constants.FederationToken;
import com.gitblit.Constants.PermissionType;
import com.gitblit.Constants.RegistrantType;
+import com.gitblit.dagger.DaggerContextListener;
import com.gitblit.fanout.FanoutNioService;
import com.gitblit.fanout.FanoutService;
import com.gitblit.fanout.FanoutSocketService;
*
*/
@WebListener
-public class GitBlit extends InjectionContextListener
+public class GitBlit extends DaggerContextListener
implements IRuntimeManager,
INotificationManager,
IUserManager,
// prepare service executors
mailExecutor = new MailExecutor(settings);
- luceneExecutor = new LuceneExecutor(settings, repositoriesFolder);
- gcExecutor = new GCExecutor(settings);
- mirrorExecutor = new MirrorExecutor(settings);
+ luceneExecutor = new LuceneExecutor(settings, getManager(IRepositoryManager.class));
+ gcExecutor = new GCExecutor(settings, getManager(IRepositoryManager.class));
+ mirrorExecutor = new MirrorExecutor(settings, getManager(IRepositoryManager.class));
// initialize utilities
String prefix = settings.getString(Keys.git.userRepositoryPrefix, "~");
String bindInterface = settings.getString(Keys.git.daemonBindInterface, "localhost");
if (port > 0) {
try {
- gitDaemon = new GitDaemon(bindInterface, port, getRepositoriesFolder());
+ gitDaemon = new GitDaemon(this, this, this, this);
gitDaemon.start();
} catch (IOException e) {
gitDaemon = null;
* shutting down or because the servlet container is re-deploying Gitblit.
*/
@Override
- public void contextDestroyed(ServletContextEvent contextEvent) {
+ protected void destroyContext(ServletContext context) {
logger.info("Gitblit context destroyed by servlet container.");
scheduledExecutor.shutdownNow();
luceneExecutor.close();
userService.logout(user);
}
+ @Override
+ protected Object [] getModules() {
+ return new Object [] { new DaggerModule(this) };
+ }
+
/**
* Instantiate and inject all filters and servlets into the container using
* the servlet 3 specification.
\r
import java.text.MessageFormat;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
+\r
import com.gitblit.Constants.AccessRestrictionType;\r
import com.gitblit.Constants.AuthorizationControl;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.manager.IRuntimeManager;\r
+import com.gitblit.manager.ISessionManager;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
import com.gitblit.utils.StringUtils;\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class GitFilter extends AccessRestrictionFilter {\r
\r
protected static final String gitReceivePack = "/git-receive-pack";\r
protected static final String[] suffixes = { gitReceivePack, gitUploadPack, "/info/refs", "/HEAD",\r
"/objects" };\r
\r
- public GitFilter() {\r
+ private final IStoredSettings settings;\r
+\r
+ @Inject\r
+ public GitFilter(\r
+ IRuntimeManager runtimeManager,\r
+ ISessionManager sessionManager,\r
+ IRepositoryManager repositoryManager) {\r
+\r
+ super(runtimeManager, sessionManager, repositoryManager);\r
+ this.settings = runtimeManager.getSettings();\r
}\r
\r
/**\r
*/\r
@Override\r
protected boolean isCreationAllowed() {\r
- IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();\r
return settings.getBoolean(Keys.git.allowCreateOnPush, true);\r
}\r
\r
\r
@Override\r
protected boolean requiresClientCertificate() {\r
- IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();\r
return settings.getBoolean(Keys.git.requiresClientCertificate, false);\r
}\r
\r
*/\r
@Override\r
protected boolean canAccess(RepositoryModel repository, UserModel user, String action) {\r
- IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();\r
if (!settings.getBoolean(Keys.git.enableGitServlet, true)) {\r
// Git Servlet disabled\r
return false;\r
model.accessRestriction = AccessRestrictionType.VIEW;\r
} else {\r
// common repository, user default server settings\r
- IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();\r
model.authorizationControl = AuthorizationControl.fromName(settings.getString(Keys.git.defaultAuthorizationControl, ""));\r
model.accessRestriction = AccessRestrictionType.fromName(settings.getString(Keys.git.defaultAccessRestriction, "PUSH"));\r
}\r
\r
// create the repository\r
try {\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
repositoryManager.updateRepositoryModel(model.name, model, true);\r
logger.info(MessageFormat.format("{0} created {1} ON-PUSH", user.username, model.name));\r
return repositoryManager.getRepositoryModel(model.name);\r
import java.io.InputStream;\r
import java.io.OutputStream;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.ServletContext;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServlet;\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class LogoServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private static final long lastModified = System.currentTimeMillis();\r
\r
- public LogoServlet() {\r
+ private final IRuntimeManager runtimeManager;\r
+\r
+ @Inject\r
+ public LogoServlet(IRuntimeManager runtimeManager) {\r
super();\r
+ this.runtimeManager = runtimeManager;\r
}\r
\r
@Override\r
protected long getLastModified(HttpServletRequest req) {\r
- IRuntimeManager runtimeManager = GitBlit.getManager(IRuntimeManager.class);\r
File file = runtimeManager.getFileOrFolder(Keys.web.headerLogo, "${baseFolder}/logo.png");\r
if (file.exists()) {\r
return Math.max(lastModified, file.lastModified());\r
InputStream is = null;\r
try {\r
String contentType = null;\r
- IRuntimeManager runtimeManager = GitBlit.getManager(IRuntimeManager.class);\r
File file = runtimeManager.getFileOrFolder(Keys.web.headerLogo, "${baseFolder}/logo.png");\r
if (file.exists()) {\r
// custom logo\r
private final Logger logger = LoggerFactory.getLogger(LuceneExecutor.class);\r
\r
private final IStoredSettings storedSettings;\r
+ private final IRepositoryManager repositoryManager;\r
private final File repositoriesFolder;\r
\r
private final Map<String, IndexSearcher> searchers = new ConcurrentHashMap<String, IndexSearcher>();\r
private final String luceneIgnoreExtensions = "7z arc arj bin bmp dll doc docx exe gif gz jar jpg lib lzh odg odf odt pdf ppt png so swf xcf xls xlsx zip";\r
private Set<String> excludedExtensions;\r
\r
- public LuceneExecutor(IStoredSettings settings, File repositoriesFolder) {\r
+ public LuceneExecutor(\r
+ IStoredSettings settings,\r
+ IRepositoryManager repositoryManager) {\r
+\r
this.storedSettings = settings;\r
- this.repositoriesFolder = repositoriesFolder;\r
+ this.repositoryManager = repositoryManager;\r
+ this.repositoriesFolder = repositoryManager.getRepositoriesFolder();\r
String exts = luceneIgnoreExtensions;\r
if (settings != null) {\r
exts = settings.getString(Keys.web.luceneIgnoreExtensions, exts);\r
String exts = storedSettings.getString(Keys.web.luceneIgnoreExtensions, luceneIgnoreExtensions);\r
excludedExtensions = new TreeSet<String>(StringUtils.getStringsFromValue(exts));\r
\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
if (repositoryManager.isCollectingGarbage()) {\r
// busy collecting garbage, try again later\r
return;\r
\r
private final IStoredSettings settings;\r
\r
+ private final IRepositoryManager repositoryManager;\r
+\r
private AtomicBoolean running = new AtomicBoolean(false);\r
\r
private AtomicBoolean forceClose = new AtomicBoolean(false);\r
\r
private final UserModel gitblitUser;\r
\r
- public MirrorExecutor(IStoredSettings settings) {\r
+ public MirrorExecutor(\r
+ IStoredSettings settings,\r
+ IRepositoryManager repositoryManager) {\r
+\r
this.settings = settings;\r
+ this.repositoryManager = repositoryManager;\r
this.gitblitUser = new UserModel("gitblit");\r
this.gitblitUser.displayName = "Gitblit";\r
}\r
\r
running.set(true);\r
\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
-\r
for (String repositoryName : repositoryManager.getRepositoryList()) {\r
if (forceClose.get()) {\r
break;\r
*/\r
package com.gitblit;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
+\r
import org.eclipse.jgit.lib.Repository;\r
\r
import com.gitblit.Constants.AccessRestrictionType;\r
import com.gitblit.manager.IRepositoryManager;\r
+import com.gitblit.manager.IRuntimeManager;\r
+import com.gitblit.manager.ISessionManager;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class PagesFilter extends AccessRestrictionFilter {\r
\r
- public PagesFilter() {\r
+ @Inject\r
+ public PagesFilter(IRuntimeManager runtimeManager,\r
+ ISessionManager sessionManager,\r
+ IRepositoryManager repositoryManager) {\r
+\r
+ super(runtimeManager, sessionManager, repositoryManager);\r
}\r
\r
/**\r
} else {\r
repository = url.substring(0, slash);\r
}\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
r = repositoryManager.getRepository(repository, false);\r
if (r == null) {\r
// try again\r
import java.util.Set;\r
import java.util.TreeSet;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.ServletContext;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServlet;\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class PagesServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private transient Logger logger = LoggerFactory.getLogger(PagesServlet.class);\r
\r
- public PagesServlet() {\r
+ private final IStoredSettings settings;\r
+\r
+ private final IRepositoryManager repositoryManager;\r
+\r
+ @Inject\r
+ public PagesServlet(\r
+ IRuntimeManager runtimeManager,\r
+ IRepositoryManager repositoryManager) {\r
+\r
super();\r
+ this.settings = runtimeManager.getSettings();\r
+ this.repositoryManager = repositoryManager;\r
}\r
\r
/**\r
path = path.substring(1);\r
}\r
\r
- IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
-\r
// determine repository and resource from url\r
String repository = "";\r
String resource = "";\r
import java.io.File;\r
import java.io.IOException;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServlet;\r
import javax.servlet.http.HttpServletRequest;\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class RobotsTxtServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
- public RobotsTxtServlet() {\r
+ private final IRuntimeManager runtimeManager;\r
+\r
+ @Inject\r
+ public RobotsTxtServlet(IRuntimeManager runtimeManager) {\r
super();\r
+ this.runtimeManager = runtimeManager;\r
}\r
\r
@Override\r
protected void processRequest(javax.servlet.http.HttpServletRequest request,\r
javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException,\r
java.io.IOException {\r
- IRuntimeManager runtimeManager = GitBlit.getManager(IRuntimeManager.class);\r
File file = runtimeManager.getFileOrFolder(Keys.web.robots.txt, null);\r
String content = "";\r
if (file.exists()) {\r
import java.io.IOException;\r
import java.text.MessageFormat;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.FilterChain;\r
import javax.servlet.ServletException;\r
import javax.servlet.ServletRequest;\r
\r
import com.gitblit.Constants.RpcRequest;\r
import com.gitblit.manager.IRuntimeManager;\r
+import com.gitblit.manager.ISessionManager;\r
import com.gitblit.models.UserModel;\r
\r
/**\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class RpcFilter extends AuthenticationFilter {\r
\r
- public RpcFilter() {\r
+ private final IStoredSettings settings;\r
+\r
+ private final IRuntimeManager runtimeManager;\r
+\r
+ @Inject\r
+ public RpcFilter(\r
+ IRuntimeManager runtimeManager,\r
+ ISessionManager sessionManager) {\r
+\r
+ super(sessionManager);\r
+ this.settings = runtimeManager.getSettings();\r
+ this.runtimeManager = runtimeManager;\r
}\r
\r
/**\r
return;\r
}\r
\r
- IRuntimeManager runtimeManager = GitBlit.getManager(IRuntimeManager.class);\r
- IStoredSettings settings = runtimeManager.getSettings();\r
-\r
boolean adminRequest = requestType.exceeds(RpcRequest.LIST_SETTINGS);\r
\r
// conditionally reject all rpc requests\r
import java.util.List;\r
import java.util.Map;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServletRequest;\r
import javax.servlet.http.HttpServletResponse;\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class RpcServlet extends JsonServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
public static final int PROTOCOL_VERSION = 6;\r
\r
- public RpcServlet() {\r
+ private final IStoredSettings settings;\r
+\r
+ private final IRuntimeManager runtimeManager;\r
+\r
+ private final IUserManager userManager;\r
+\r
+ private final IRepositoryManager repositoryManager;\r
+\r
+ private final IFederationManager federationManager;\r
+\r
+ private final IGitblitManager gitblitManager;\r
+\r
+ @Inject\r
+ public RpcServlet(\r
+ IRuntimeManager runtimeManager,\r
+ IUserManager userManager,\r
+ IRepositoryManager repositoryManager,\r
+ IFederationManager federationManager,\r
+ IGitblitManager gitblitManager) {\r
+\r
super();\r
+\r
+ this.settings = runtimeManager.getSettings();\r
+ this.runtimeManager = runtimeManager;\r
+ this.userManager = userManager;\r
+ this.repositoryManager = repositoryManager;\r
+ this.federationManager = federationManager;\r
+ this.gitblitManager = gitblitManager;\r
}\r
\r
/**\r
logger.info(MessageFormat.format("Rpc {0} request from {1}", reqType,\r
request.getRemoteAddr()));\r
\r
- IRuntimeManager runtimeManager = GitBlit.getManager(IRuntimeManager.class);\r
- IUserManager userManager = GitBlit.getManager(IUserManager.class);\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
- IGitblitManager gitblitManager = GitBlit.getManager(IGitblitManager.class);\r
- IFederationManager federationManager = GitBlit.getManager(IFederationManager.class);\r
- IStoredSettings settings = runtimeManager.getSettings();\r
-\r
UserModel user = (UserModel) request.getUserPrincipal();\r
\r
boolean allowManagement = user != null && user.canAdmin()\r
import java.io.IOException;\r
import java.text.MessageFormat;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServlet;\r
import javax.servlet.http.HttpServletRequest;\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class SparkleShareInviteServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
- public SparkleShareInviteServlet() {\r
+ private final IStoredSettings settings;\r
+\r
+ private final IUserManager userManager;\r
+\r
+ private final ISessionManager sessionManager;\r
+\r
+ private final IRepositoryManager repositoryManager;\r
+\r
+ @Inject\r
+ public SparkleShareInviteServlet(\r
+ IRuntimeManager runtimeManager,\r
+ IUserManager userManager,\r
+ ISessionManager sessionManager,\r
+ IRepositoryManager repositoryManager) {\r
+\r
super();\r
+ this.settings = runtimeManager.getSettings();\r
+ this.userManager = userManager;\r
+ this.sessionManager = sessionManager;\r
+ this.repositoryManager = repositoryManager;\r
}\r
\r
@Override\r
javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException,\r
java.io.IOException {\r
\r
- IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();\r
- IUserManager userManager = GitBlit.getManager(IUserManager.class);\r
- ISessionManager sessionManager = GitBlit.getManager(ISessionManager.class);\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
-\r
// extract repo name from request\r
String repoUrl = request.getPathInfo().substring(1);\r
\r
import java.io.IOException;\r
import java.text.MessageFormat;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.FilterChain;\r
import javax.servlet.ServletException;\r
import javax.servlet.ServletRequest;\r
import com.gitblit.manager.IProjectManager;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.manager.IRuntimeManager;\r
+import com.gitblit.manager.ISessionManager;\r
import com.gitblit.models.ProjectModel;\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.models.UserModel;\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class SyndicationFilter extends AuthenticationFilter {\r
\r
- public SyndicationFilter() {\r
+ private final IRuntimeManager runtimeManager;\r
+ private final IRepositoryManager repositoryManager;\r
+ private final IProjectManager projectManager;\r
+\r
+ @Inject\r
+ public SyndicationFilter(\r
+ IRuntimeManager runtimeManager,\r
+ ISessionManager sessionManager,\r
+ IRepositoryManager repositoryManager,\r
+ IProjectManager projectManager) {\r
+\r
+ super(sessionManager);\r
+ this.runtimeManager = runtimeManager;\r
+ this.repositoryManager = repositoryManager;\r
+ this.projectManager = projectManager;\r
}\r
\r
/**\r
String fullUrl = getFullUrl(httpRequest);\r
String name = extractRequestedName(fullUrl);\r
\r
- IRuntimeManager runtimeManager = GitBlit.getManager(IRuntimeManager.class);\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
- IProjectManager projectManager = GitBlit.getManager(IProjectManager.class);\r
-\r
ProjectModel project = projectManager.getProjectModel(name);\r
RepositoryModel model = null;\r
\r
import java.util.List;\r
import java.util.Map;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.http.HttpServlet;\r
\r
import org.eclipse.jgit.lib.ObjectId;\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class SyndicationServlet extends HttpServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
private transient Logger logger = LoggerFactory.getLogger(SyndicationServlet.class);\r
\r
- public SyndicationServlet() {\r
+ private final IStoredSettings settings;\r
+\r
+ private final IRepositoryManager repositoryManager;\r
+\r
+ private final IProjectManager projectManager;\r
+\r
+ @Inject\r
+ public SyndicationServlet(\r
+ IRuntimeManager runtimeManager,\r
+ IRepositoryManager repositoryManager,\r
+ IProjectManager projectManager) {\r
+\r
+ super();\r
+ this.settings = runtimeManager.getSettings();\r
+ this.repositoryManager = repositoryManager;\r
+ this.projectManager = projectManager;\r
}\r
\r
/**\r
javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException,\r
java.io.IOException {\r
\r
- IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
- IProjectManager projectManager = GitBlit.getManager(IProjectManager.class);\r
-\r
String servletUrl = request.getContextPath() + request.getServletPath();\r
String url = request.getRequestURI().substring(servletUrl.length());\r
if (url.charAt(0) == '/' && url.length() > 1) {\r
--- /dev/null
+/*
+ * Copyright 2013 gitblit.com.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gitblit.dagger;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+
+import com.gitblit.InjectionContextListener;
+
+import dagger.ObjectGraph;
+
+/**
+ * Dagger servlet context listener is a context listener that uses Dagger to
+ * instantiate and inject servlets, filters, and anything else you might want.
+ *
+ * @author James Moger
+ *
+ */
+public abstract class DaggerContextListener extends InjectionContextListener {
+
+ protected static final String INJECTOR_NAME = ObjectGraph.class.getName();
+
+ protected abstract Object [] getModules();
+
+ protected abstract void destroyContext(ServletContext context);
+
+ protected ObjectGraph getInjector(ServletContext context) {
+ Object o = context.getAttribute(INJECTOR_NAME);
+ if (o == null) {
+ logger.debug("instantiating Dagger modules");
+ Object [] modules = getModules();
+ logger.debug("getting Dagger injector");
+ try {
+ o = ObjectGraph.create(modules);
+ logger.debug("setting Dagger injector into {} attribute", INJECTOR_NAME);
+ context.setAttribute(INJECTOR_NAME, o);
+ } catch (Throwable t) {
+ logger.error("an error occurred creating the Dagger injector", t);
+ }
+ }
+ return (ObjectGraph) o;
+ }
+
+ /**
+ * Instantiates an object.
+ *
+ * @param clazz
+ * @return the object
+ */
+ @Override
+ protected <X> X instantiate(ServletContext context, Class<X> clazz) {
+ try {
+ ObjectGraph injector = getInjector(context);
+ return injector.get(clazz);
+ } catch (Throwable t) {
+ logger.error(null, t);
+ }
+ return null;
+ }
+
+ @Override
+ public final void contextDestroyed(ServletContextEvent contextEvent) {
+ ServletContext context = contextEvent.getServletContext();
+ context.setAttribute(INJECTOR_NAME, null);
+ destroyContext(context);
+ }
+}
--- /dev/null
+/*
+ * Copyright 2013 gitblit.com.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gitblit.dagger;
+
+import groovy.lang.Singleton;
+
+import javax.inject.Inject;
+import javax.inject.Provider;
+
+import org.apache.wicket.protocol.http.IWebApplicationFactory;
+import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.protocol.http.WicketFilter;
+
+/**
+ *
+ * A Wicket filter that supports Dagger injection.
+ *
+ * @author James Moger
+ *
+ */
+@Singleton
+public class DaggerWicketFilter extends WicketFilter {
+
+ @Inject
+ Provider<WebApplication> webApplicationProvider;
+
+ @Inject
+ public DaggerWicketFilter() {
+ super();
+ }
+
+ @Override
+ protected IWebApplicationFactory getApplicationFactory() {
+ return new IWebApplicationFactory() {
+ @Override
+ public WebApplication createApplication(WicketFilter filter) {
+ return webApplicationProvider.get();
+ }
+ };
+ }
+}
*/\r
package com.gitblit.git;\r
\r
-import java.io.File;\r
import java.io.IOException;\r
import java.io.InputStream;\r
import java.io.InterruptedIOException;\r
import org.slf4j.Logger;\r
import org.slf4j.LoggerFactory;\r
\r
+import com.gitblit.IStoredSettings;\r
+import com.gitblit.Keys;\r
+import com.gitblit.manager.IRepositoryManager;\r
+import com.gitblit.manager.IRuntimeManager;\r
+import com.gitblit.manager.ISessionManager;\r
+import com.gitblit.manager.IUserManager;\r
import com.gitblit.utils.StringUtils;\r
\r
/**\r
\r
private ReceivePackFactory<GitDaemonClient> receivePackFactory;\r
\r
- /** Configure a daemon to listen on any available network port. */\r
- public GitDaemon() {\r
- this(null);\r
- }\r
+ public GitDaemon(\r
+ IRuntimeManager runtimeManager,\r
+ IUserManager userManager,\r
+ ISessionManager sessionManager,\r
+ IRepositoryManager repositoryManager) {\r
\r
- /**\r
- * Construct the Gitblit Git daemon.\r
- *\r
- * @param bindInterface\r
- * the ip address of the interface to bind\r
- * @param port\r
- * the port to serve on\r
- * @param folder\r
- * the folder to serve from\r
- */\r
- public GitDaemon(String bindInterface, int port, File folder) {\r
- this(StringUtils.isEmpty(bindInterface) ? new InetSocketAddress(port)\r
- : new InetSocketAddress(bindInterface, port));\r
+ IStoredSettings settings = runtimeManager.getSettings();\r
+ int port = settings.getInteger(Keys.git.daemonPort, 0);\r
+ String bindInterface = settings.getString(Keys.git.daemonBindInterface, "localhost");\r
\r
- // set the repository resolver and pack factories\r
- repositoryResolver = new RepositoryResolver<GitDaemonClient>(folder);\r
- }\r
+ if (StringUtils.isEmpty(bindInterface)) {\r
+ myAddress = new InetSocketAddress(port);\r
+ } else {\r
+ myAddress = new InetSocketAddress(bindInterface, port);\r
+ }\r
\r
- /**\r
- * Configure a new daemon for the specified network address.\r
- *\r
- * @param addr\r
- * address to listen for connections on. If null, any available\r
- * port will be chosen on all network interfaces.\r
- */\r
- public GitDaemon(final InetSocketAddress addr) {\r
- myAddress = addr;\r
- processors = new ThreadGroup("Git-Daemon");\r
+ repositoryResolver = new RepositoryResolver<GitDaemonClient>(sessionManager, repositoryManager);\r
+ uploadPackFactory = new GitblitUploadPackFactory<GitDaemonClient>(sessionManager);\r
+ receivePackFactory = new GitblitReceivePackFactory<GitDaemonClient>(runtimeManager, userManager, repositoryManager);\r
\r
run = new AtomicBoolean(false);\r
- repositoryResolver = null;\r
- uploadPackFactory = new GitblitUploadPackFactory<GitDaemonClient>();\r
- receivePackFactory = new GitblitReceivePackFactory<GitDaemonClient>();\r
-\r
+ processors = new ThreadGroup("Git-Daemon");\r
services = new GitDaemonService[] { new GitDaemonService("upload-pack", "uploadpack") {\r
{\r
setEnabled(true);\r
*/\r
package com.gitblit.git;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.ServletConfig;\r
import javax.servlet.ServletException;\r
import javax.servlet.http.HttpServletRequest;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.manager.IRepositoryManager;\r
+import com.gitblit.manager.IRuntimeManager;\r
+import com.gitblit.manager.ISessionManager;\r
+import com.gitblit.manager.IUserManager;\r
\r
/**\r
* The GitServlet provides http/https access to Git repositories.\r
* @author James Moger\r
*\r
*/\r
+@Singleton\r
public class GitServlet extends org.eclipse.jgit.http.server.GitServlet {\r
\r
private static final long serialVersionUID = 1L;\r
\r
- public GitServlet() {\r
+ private final IRuntimeManager runtimeManager;\r
+\r
+ private final IUserManager userManager;\r
+\r
+ private final ISessionManager sessionManager;\r
+\r
+ private final IRepositoryManager repositoryManager;\r
+\r
+ @Inject\r
+ public GitServlet(\r
+ IRuntimeManager runtimeManager,\r
+ IUserManager userManager,\r
+ ISessionManager sessionManager,\r
+ IRepositoryManager repositoryManager) {\r
+ super();\r
+ this.runtimeManager = runtimeManager;\r
+ this.userManager = userManager;\r
+ this.sessionManager = sessionManager;\r
+ this.repositoryManager = repositoryManager;\r
}\r
\r
@Override\r
public void init(ServletConfig config) throws ServletException {\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
- setRepositoryResolver(new RepositoryResolver<HttpServletRequest>(repositoryManager.getRepositoriesFolder()));\r
- setUploadPackFactory(new GitblitUploadPackFactory<HttpServletRequest>());\r
- setReceivePackFactory(new GitblitReceivePackFactory<HttpServletRequest>());\r
+ setRepositoryResolver(new RepositoryResolver<HttpServletRequest>(sessionManager, repositoryManager));\r
+ setUploadPackFactory(new GitblitUploadPackFactory<HttpServletRequest>(sessionManager));\r
+ setReceivePackFactory(new GitblitReceivePackFactory<HttpServletRequest>(runtimeManager, userManager, repositoryManager));\r
super.init(config);\r
}\r
}\r
\r
protected GroovyScriptEngine gse;\r
\r
- public GitblitReceivePack(Repository db, RepositoryModel repository, UserModel user) {\r
- super(db);\r
+ private final IStoredSettings settings;\r
+\r
+ private final IRepositoryManager repositoryManager;\r
\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
+ public GitblitReceivePack(\r
+ IRuntimeManager runtimeManager,\r
+ IRepositoryManager repositoryManager,\r
+ Repository db,\r
+ RepositoryModel repository,\r
+ UserModel user) {\r
\r
+ super(db);\r
+ this.settings = runtimeManager.getSettings();\r
+ this.repositoryManager = repositoryManager;\r
this.repository = repository;\r
this.user = user == null ? UserModel.ANONYMOUS : user;\r
this.groovyDir = repositoryManager.getHooksFolder();\r
}\r
}\r
\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
Set<String> scripts = new LinkedHashSet<String>();\r
scripts.addAll(repositoryManager.getPreReceiveScriptsInherited(repository));\r
if (!ArrayUtils.isEmpty(repository.preReceiveScripts)) {\r
return;\r
}\r
\r
- IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();\r
-\r
// log ref changes\r
for (ReceiveCommand cmd : commands) {\r
\r
LOGGER.error(MessageFormat.format("Failed to update {0} pushlog", repository.name), e);\r
}\r
\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
-\r
// run Groovy hook scripts\r
Set<String> scripts = new LinkedHashSet<String>();\r
scripts.addAll(repositoryManager.getPostReceiveScriptsInherited(repository));\r
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.gitblit.GitBlit;
import com.gitblit.IStoredSettings;
import com.gitblit.Keys;
import com.gitblit.manager.IRepositoryManager;
protected final Logger logger = LoggerFactory.getLogger(GitblitReceivePackFactory.class);
+ private final IStoredSettings settings;
+
+ private final IRuntimeManager runtimeManager;
+
+ private final IUserManager userManager;
+
+ private final IRepositoryManager repositoryManager;
+
+ public GitblitReceivePackFactory(
+ IRuntimeManager runtimeManager,
+ IUserManager userManager,
+ IRepositoryManager repositoryManager) {
+
+ super();
+ this.settings = runtimeManager.getSettings();
+ this.runtimeManager = runtimeManager;
+ this.userManager = userManager;
+ this.repositoryManager = repositoryManager;
+
+ }
+
@Override
public ReceivePack create(X req, Repository db)
throws ServiceNotEnabledException, ServiceNotAuthorizedException {
- IStoredSettings settings = GitBlit.getManager(IRuntimeManager.class).getSettings();
- IUserManager userManager = GitBlit.getManager(IUserManager.class);
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);
-
UserModel user = UserModel.ANONYMOUS;
String repositoryName = "";
String origin = "";
final RepositoryModel repository = repositoryManager.getRepositoryModel(repositoryName);
- final GitblitReceivePack rp = new GitblitReceivePack(db, repository, user);
+ final GitblitReceivePack rp = new GitblitReceivePack(runtimeManager, repositoryManager, db, repository, user);
rp.setGitblitUrl(gitblitUrl);
rp.setRepositoryUrl(repositoryUrl);
rp.setRefLogIdent(new PersonIdent(user.username, user.username + "@" + origin));
import org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;
import org.eclipse.jgit.transport.resolver.UploadPackFactory;
-import com.gitblit.GitBlit;
import com.gitblit.manager.ISessionManager;
import com.gitblit.models.UserModel;
*/
public class GitblitUploadPackFactory<X> implements UploadPackFactory<X> {
+ private final ISessionManager sessionManager;
+
+ public GitblitUploadPackFactory(ISessionManager sessionManager) {
+ this.sessionManager = sessionManager;
+ }
+
@Override
public UploadPack create(X req, Repository db)
throws ServiceNotEnabledException, ServiceNotAuthorizedException {
- ISessionManager sessionManager = GitBlit.getManager(ISessionManager.class);
UserModel user = UserModel.ANONYMOUS;
int timeout = 0;
*/
package com.gitblit.git;
-import java.io.File;
import java.io.IOException;
import java.text.MessageFormat;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.gitblit.GitBlit;
import com.gitblit.manager.IRepositoryManager;
import com.gitblit.manager.ISessionManager;
import com.gitblit.models.RepositoryModel;
private final Logger logger = LoggerFactory.getLogger(RepositoryResolver.class);
- public RepositoryResolver(File repositoriesFolder) {
- super(repositoriesFolder, true);
+ private final ISessionManager sessionManager;
+
+ private final IRepositoryManager repositoryManager;
+
+ public RepositoryResolver(
+ ISessionManager sessionManager,
+ IRepositoryManager repositoryManager) {
+
+ super(repositoryManager.getRepositoriesFolder(), true);
+ this.sessionManager = sessionManager;
+ this.repositoryManager = repositoryManager;
}
/**
*/
@Override
protected boolean isExportOk(X req, String repositoryName, Repository db) throws IOException {
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);
- ISessionManager sessionManager = GitBlit.getManager(ISessionManager.class);
RepositoryModel model = repositoryManager.getRepositoryModel(repositoryName);
String scheme = null;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.protocol.http.WebApplication;
-import com.gitblit.GitBlit;
import com.gitblit.IStoredSettings;
import com.gitblit.Keys;
import com.gitblit.manager.IFederationManager;
private final Map<String, CacheControl> cacheablePages = new HashMap<String, CacheControl>();
- private IStoredSettings settings;
+ private final IStoredSettings settings;
+
+ private final IRuntimeManager runtimeManager;
+
+ private final INotificationManager notificationManager;
+
+ private final IUserManager userManager;
+
+ private final ISessionManager sessionManager;
+
+ private final IRepositoryManager repositoryManager;
+
+ private final IProjectManager projectManager;
+
+ private final IGitblitManager gitblitManager;
+
+ private final IFederationManager federationManager;
+
+ public GitBlitWebApp(
+ IRuntimeManager runtimeManager,
+ INotificationManager notificationManager,
+ IUserManager userManager,
+ ISessionManager sessionManager,
+ IRepositoryManager repositoryManager,
+ IProjectManager projectManager,
+ IGitblitManager gitblitManager,
+ IFederationManager federationManager) {
+
+ super();
+ this.settings = runtimeManager.getSettings();
+ this.runtimeManager = runtimeManager;
+ this.notificationManager = notificationManager;
+ this.userManager = userManager;
+ this.sessionManager = sessionManager;
+ this.repositoryManager = repositoryManager;
+ this.projectManager = projectManager;
+ this.gitblitManager = gitblitManager;
+ this.federationManager = federationManager;
+ }
@Override
public void init() {
super.init();
- settings = runtime().getSettings();
-
// Setup page authorization mechanism
boolean useAuthentication = settings.getBoolean(Keys.web.authenticateViewPages, false)
|| settings.getBoolean(Keys.web.authenticateAdminPages, false);
* @return true if Gitblit is running in debug mode
*/
public boolean isDebugMode() {
- return runtime().isDebugMode();
+ return runtimeManager.isDebugMode();
}
/*
* step towards modularization across multiple commits.
*/
public Date getBootDate() {
- return runtime().getBootDate();
+ return runtimeManager.getBootDate();
}
public Date getLastActivityDate() {
- return repositories().getLastActivityDate();
+ return repositoryManager.getLastActivityDate();
}
public IRuntimeManager runtime() {
- return GitBlit.getManager(IRuntimeManager.class);
+ return runtimeManager;
}
public INotificationManager notifier() {
- return GitBlit.getManager(INotificationManager.class);
+ return notificationManager;
}
public IUserManager users() {
- return GitBlit.getManager(IUserManager.class);
+ return userManager;
}
public ISessionManager session() {
- return GitBlit.getManager(ISessionManager.class);
+ return sessionManager;
}
public IRepositoryManager repositories() {
- return GitBlit.getManager(IRepositoryManager.class);
+ return repositoryManager;
}
public IProjectManager projects() {
- return GitBlit.getManager(IProjectManager.class);
+ return projectManager;
}
public IFederationManager federation() {
- return GitBlit.getManager(IFederationManager.class);
+ return federationManager;
}
public IGitblitManager gitblit() {
- return GitBlit.getManager(IGitblitManager.class);
+ return gitblitManager;
}
public TimeZone getTimezone() {
- return runtime().getTimezone();
+ return runtimeManager.getTimezone();
}
@Override
public final String getConfigurationType() {
- if (isDebugMode()) {
+ if (runtimeManager.isDebugMode()) {
return Application.DEVELOPMENT;
}
return Application.DEPLOYMENT;
\r
import java.util.Date;\r
\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
import javax.servlet.http.HttpServletRequest;\r
\r
-import org.apache.wicket.protocol.http.IWebApplicationFactory;\r
-import org.apache.wicket.protocol.http.WebApplication;\r
-import org.apache.wicket.protocol.http.WicketFilter;\r
import org.apache.wicket.util.string.Strings;\r
import org.eclipse.jgit.lib.Repository;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
-import com.gitblit.GitBlit;\r
import com.gitblit.IStoredSettings;\r
import com.gitblit.Keys;\r
+import com.gitblit.dagger.DaggerWicketFilter;\r
import com.gitblit.manager.IProjectManager;\r
import com.gitblit.manager.IRepositoryManager;\r
import com.gitblit.manager.IRuntimeManager;\r
* @author James Moger\r
*\r
*/\r
-public class GitblitWicketFilter extends WicketFilter {\r
+@Singleton\r
+public class GitblitWicketFilter extends DaggerWicketFilter {\r
\r
- public GitblitWicketFilter() {\r
- }\r
+ private final IStoredSettings settings;\r
\r
- @Override\r
- protected IWebApplicationFactory getApplicationFactory() {\r
- return new IWebApplicationFactory() {\r
- @Override\r
- public WebApplication createApplication(WicketFilter filter) {\r
- return new GitBlitWebApp();\r
- }\r
- };\r
+ private final IRuntimeManager runtimeManager;\r
+\r
+ private final IRepositoryManager repositoryManager;\r
+\r
+ private final IProjectManager projectManager;\r
+\r
+ @Inject\r
+ public GitblitWicketFilter(\r
+ IRuntimeManager runtimeManager,\r
+ IRepositoryManager repositoryManager,\r
+ IProjectManager projectManager) {\r
+\r
+ super();\r
+ this.settings = runtimeManager.getSettings();\r
+ this.runtimeManager = runtimeManager;\r
+ this.repositoryManager = repositoryManager;\r
+ this.projectManager = projectManager;\r
}\r
\r
/**\r
commitId = servletRequest.getParameter("h");\r
}\r
\r
- IRuntimeManager runtimeManager = GitBlit.getManager(IRuntimeManager.class);\r
- IStoredSettings settings = runtimeManager.getSettings();\r
- IRepositoryManager repositoryManager = GitBlit.getManager(IRepositoryManager.class);\r
- IProjectManager projectManager = GitBlit.getManager(IProjectManager.class);\r
-\r
repo = repo.replace("%2f", "/").replace("%2F", "/").replace(settings.getChar(Keys.web.forwardSlashCharacter, '/'), '/');\r
\r
GitBlitWebApp app = (GitBlitWebApp) getWebApplication();\r
+++ /dev/null
-/*
- * Copyright 2013 gitblit.com.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gitblit.tests;
-
-import org.junit.Test;
-
-import com.gitblit.git.GitDaemon;
-
-public class GitDaemonStopTest extends GitblitUnitTest {
-
- @Test
- public void testGitDaemonStop() throws Exception {
- GitDaemon daemon = new GitDaemon("localhost", GitDaemon.DEFAULT_PORT + 1, GitBlitSuite.REPOSITORIES);
- daemon.setTimeout(5);
- daemon.start();
- Thread.sleep(5000);
- daemon.stop();
- }
-}
package com.gitblit.tests;\r
\r
import java.util.ArrayList;\r
-import java.util.HashMap;\r
import java.util.List;\r
-import java.util.Map;\r
\r
import org.eclipse.jgit.lib.Repository;\r
import org.junit.After;\r
import org.junit.Before;\r
import org.junit.Test;\r
\r
+import com.gitblit.GitBlit;\r
+import com.gitblit.Keys;\r
import com.gitblit.LuceneExecutor;\r
import com.gitblit.models.RefModel;\r
import com.gitblit.models.RepositoryModel;\r
LuceneExecutor lucene;\r
\r
private LuceneExecutor newLuceneExecutor() {\r
- Map<String, Object> map = new HashMap<String, Object>();\r
- MemorySettings settings = new MemorySettings(map);\r
- return new LuceneExecutor(settings, GitBlitSuite.REPOSITORIES);\r
+ MemorySettings settings = new MemorySettings();\r
+ settings.put(Keys.git.repositoriesFolder, GitBlitSuite.REPOSITORIES);\r
+ GitBlit gitblit = new GitBlit(settings, GitBlitSuite.REPOSITORIES);\r
+ return new LuceneExecutor(settings, gitblit);\r
}\r
\r
private RepositoryModel newRepositoryModel(Repository repository) {\r
*/
package com.gitblit.tests.mock;
+import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
private Map<String, Object> backingMap;
+ public MemorySettings() {
+ this(new HashMap<String, Object>());
+ }
+
public MemorySettings(Map<String, Object> backingMap) {
super(MemorySettings.class);
this.backingMap = backingMap;
return props;
}
- public void put(Object key, Object value) {
- backingMap.put(key.toString(), value);
+ public void put(String key, Object value) {
+ backingMap.put(key, value);
}
@Override