diff options
author | James Moger <james.moger@gitblit.com> | 2013-04-02 10:43:52 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-04-02 10:43:52 -0400 |
commit | b9afce4d3db8dec34b22b07c952df814efc7335f (patch) | |
tree | cfbaa4692a9a1365f1528ae2b7b66c0df8fedb44 | |
parent | 0f47b2f605ed4119a6042b72d3499b223f40ec90 (diff) | |
download | gitblit-b9afce4d3db8dec34b22b07c952df814efc7335f.tar.gz gitblit-b9afce4d3db8dec34b22b07c952df814efc7335f.zip |
Simplify resource loading
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | build.xml | 44 | ||||
-rw-r--r-- | src/main/java/com/gitblit/GitBlit.java | 11 | ||||
-rw-r--r-- | src/main/java/login.mkd (renamed from src/main/resources/login.mkd) | 0 | ||||
-rw-r--r-- | src/main/java/login_es.mkd (renamed from src/main/resources/login_es.mkd) | 0 | ||||
-rw-r--r-- | src/main/java/login_ko.mkd (renamed from src/main/resources/login_ko.mkd) | 0 | ||||
-rw-r--r-- | src/main/java/login_nl.mkd (renamed from src/main/resources/login_nl.mkd) | 0 | ||||
-rw-r--r-- | src/main/java/login_pl.mkd (renamed from src/main/resources/login_pl.mkd) | 0 | ||||
-rw-r--r-- | src/main/java/login_pt_br.mkd (renamed from src/main/resources/login_pt_br.mkd) | 0 | ||||
-rw-r--r-- | src/main/java/login_zh_CN.mkd (renamed from src/main/resources/login_zh_CN.mkd) | 0 | ||||
-rw-r--r-- | src/main/java/welcome.mkd (renamed from src/main/resources/welcome.mkd) | 0 | ||||
-rw-r--r-- | src/main/java/welcome_es.mkd (renamed from src/main/resources/welcome_es.mkd) | 0 | ||||
-rw-r--r-- | src/main/java/welcome_ko.mkd (renamed from src/main/resources/welcome_ko.mkd) | 0 | ||||
-rw-r--r-- | src/main/java/welcome_nl.mkd (renamed from src/main/resources/welcome_nl.mkd) | 0 | ||||
-rw-r--r-- | src/main/java/welcome_pl.mkd (renamed from src/main/resources/welcome_pl.mkd) | 0 | ||||
-rw-r--r-- | src/main/java/welcome_pt_br.mkd (renamed from src/main/resources/welcome_pt_br.mkd) | 0 | ||||
-rw-r--r-- | src/main/java/welcome_zh_CN.mkd (renamed from src/main/resources/welcome_zh_CN.mkd) | 0 |
17 files changed, 31 insertions, 26 deletions
@@ -7,7 +7,9 @@ /build.properties
/federation.properties
/mailtest.properties
+/test-users.conf
/.settings/
+/src/main/java/reference.properties
/src/main/java/WEB-INF/reference.properties
/bin/
/build-demo.xml
@@ -93,9 +93,9 @@ <fileset dir="${project.distrib.dir}/data" />
</copy>
- <!-- copy gitblit.properties to the WEB-INF directory.
+ <!-- copy gitblit.properties to the source directory.
this file is only used for parsing setting descriptions. -->
- <copy tofile="${project.src.dir}/WEB-INF/reference.properties" overwrite="true"
+ <copy tofile="${project.src.dir}/reference.properties" overwrite="true"
file="${project.distrib.dir}/data/gitblit.properties" />
<!--
@@ -265,6 +265,26 @@ <!-- Build the WAR web.xml from the prototype web.xml -->
<mx:webxml sourcefile="${project.src.dir}/WEB-INF/web.xml" destfile="${webinf}/web.xml" />
+ <!-- Gitblit jar -->
+ <mx:genjar destfile="${webinf}/lib/gitblit.jar" includeresources="false" excludeclasspathjars="true">
+ <!-- Specify all web.xml servlets and filters -->
+ <class name="com.gitblit.GitBlit" />
+ <class name="com.gitblit.DownloadZipFilter" />
+ <class name="com.gitblit.DownloadZipServlet" />
+ <class name="com.gitblit.EnforceAuthenticationFilter" />
+ <class name="com.gitblit.FederationServlet" />
+ <class name="com.gitblit.GitFilter" />
+ <class name="com.gitblit.GitServlet" />
+ <class name="com.gitblit.PagesFilter" />
+ <class name="com.gitblit.PagesServlet" />
+ <class name="com.gitblit.RobotsTxtServlet" />
+ <class name="com.gitblit.RpcFilter" />
+ <class name="com.gitblit.RpcServlet" />
+ <class name="com.gitblit.SyndicationFilter" />
+ <class name="com.gitblit.SyndicationServlet" />
+ <class name="com.gitblit.wicket.GitBlitWebApp" />
+ </mx:genjar>
+
<!-- Build the WAR file -->
<mx:zip basedir="${war.dir}" destfile="${project.targetDirectory}/${distribution.warfile}" compress="true" >
<!-- Resources in root -->
@@ -273,20 +293,11 @@ <exclude name="*.mkd" />
</fileset>
<!-- WEB-INF directory -->
- <zipfileset fullpath="WEB-INF/reference.properties"
- file="${project.distrib.dir}/data/gitblit.properties" />
<zipfileset prefix="WEB-INF" dir="${basedir}" >
<include name="LICENSE" />
<include name="NOTICE" />
</zipfileset>
<zipfileset prefix="WEB-INF" file="${project.compileOutputDirectory}/WEB-INF/weblogic.xml" />
- <!-- Classes and classpath resources -->
- <zipfileset prefix="WEB-INF/classes" dir="${project.compileOutputDirectory}">
- <include name="**/*.class" />
- <include name="**/*.properties" />
- <include name="**/*.mkd" />
- <exclude name="WEB-INF" />
- </zipfileset>
<!-- include "war" tagged dependencies -->
<dependencies prefix="WEB-INF/lib" tag="war" />
</mx:zip>
@@ -303,7 +314,7 @@ <!-- generate jar by traversing the class hierarchy of the specified
classes, exclude any classes in classpath jars -->
- <mx:genjar tag="" excludeClasspathJars="true"
+ <mx:genjar tag="" includeresources="false" excludeClasspathJars="true"
destfile="${project.targetDirectory}/fedclient.jar">
<mainclass name="com.gitblit.FederationClient" />
<launcher paths="ext" />
@@ -363,7 +374,7 @@ skip="server.*" />
<!-- Gitblit classes -->
- <mx:genjar destfile="${webinf}/lib/gitblit.jar" excludeclasspathjars="true">
+ <mx:genjar destfile="${webinf}/lib/gitblit.jar" includeresources="false" excludeclasspathjars="true">
<!-- Specify all web.xml servlets and filters -->
<class name="com.gitblit.GitBlit" />
<class name="com.gitblit.DownloadZipFilter" />
@@ -395,9 +406,6 @@ <exclude name="thumbs.db" />
<exclude name="*.mkd" />
</zipfileset>
- <!-- reference.properties -->
- <zipfileset fullpath="deployments/ROOT.war/WEB-INF/reference.properties"
- file="${project.distrib.dir}/data/gitblit.properties" />
<!-- include "war" tagged dependencies -->
<dependencies prefix="deployments/ROOT.war/WEB-INF/lib" tag="war" />
</mx:zip>
@@ -415,7 +423,7 @@ <!-- generate jar by traversing the class hierarchy of the specified
classes, exclude any classes in classpath jars -->
- <mx:genjar tag="" excludeClasspathJars="true"
+ <mx:genjar tag="" includeResources="false" excludeClasspathJars="true"
destfile="${project.targetDirectory}/manager.jar">
<resource file="${project.src.dir}/com/gitblit/client/splash.png" />
<resource file="${project.resources.dir}/gitblt-favicon.png" />
@@ -553,7 +561,7 @@ <delete dir="${javadoc.dir}" />
<!-- Build API Library jar -->
- <mx:genjar tag="" excludeClasspathJars="true"
+ <mx:genjar tag="" includeResources="false" excludeClasspathJars="true"
destfile="${project.targetDirectory}/gbapi-${project.version}.jar">
<class name="com.gitblit.Keys" />
<class name="com.gitblit.client.GitblitClient" />
diff --git a/src/main/java/com/gitblit/GitBlit.java b/src/main/java/com/gitblit/GitBlit.java index 1a817ab7..566a917e 100644 --- a/src/main/java/com/gitblit/GitBlit.java +++ b/src/main/java/com/gitblit/GitBlit.java @@ -2997,11 +2997,10 @@ public class GitBlit implements ServletContextListener { * Parse the properties file and aggregate all the comments by the setting
* key. A setting model tracks the current value, the default value, the
* description of the setting and and directives about the setting.
- * @param referencePropertiesInputStream
*
* @return Map<String, SettingModel>
*/
- private ServerSettings loadSettingModels(InputStream referencePropertiesInputStream) {
+ private ServerSettings loadSettingModels() {
ServerSettings settingsModel = new ServerSettings();
settingsModel.supportsCredentialChanges = userService.supportsCredentialChanges();
settingsModel.supportsDisplayNameChanges = userService.supportsDisplayNameChanges();
@@ -3011,7 +3010,7 @@ public class GitBlit implements ServletContextListener { // Read bundled Gitblit properties to extract setting descriptions.
// This copy is pristine and only used for populating the setting
// models map.
- InputStream is = referencePropertiesInputStream;
+ InputStream is = getClass().getResourceAsStream("/reference.properties");
BufferedReader propertiesReader = new BufferedReader(new InputStreamReader(is));
StringBuilder description = new StringBuilder();
SettingModel setting = new SettingModel();
@@ -3239,10 +3238,6 @@ public class GitBlit implements ServletContextListener { */
@Override
public void contextInitialized(ServletContextEvent contextEvent) {
- contextInitialized(contextEvent, contextEvent.getServletContext().getResourceAsStream("/WEB-INF/reference.properties"));
- }
-
- public void contextInitialized(ServletContextEvent contextEvent, InputStream referencePropertiesInputStream) {
servletContext = contextEvent.getServletContext();
if (settings == null) {
// Gitblit is running in a servlet container
@@ -3307,7 +3302,7 @@ public class GitBlit implements ServletContextListener { }
}
- settingsModel = loadSettingModels(referencePropertiesInputStream);
+ settingsModel = loadSettingModels();
serverStatus.servletContainer = servletContext.getServerInfo();
}
diff --git a/src/main/resources/login.mkd b/src/main/java/login.mkd index 51a4cf71..51a4cf71 100644 --- a/src/main/resources/login.mkd +++ b/src/main/java/login.mkd diff --git a/src/main/resources/login_es.mkd b/src/main/java/login_es.mkd index 700d63f4..700d63f4 100644 --- a/src/main/resources/login_es.mkd +++ b/src/main/java/login_es.mkd diff --git a/src/main/resources/login_ko.mkd b/src/main/java/login_ko.mkd index a48099c1..a48099c1 100644 --- a/src/main/resources/login_ko.mkd +++ b/src/main/java/login_ko.mkd diff --git a/src/main/resources/login_nl.mkd b/src/main/java/login_nl.mkd index 38224c96..38224c96 100644 --- a/src/main/resources/login_nl.mkd +++ b/src/main/java/login_nl.mkd diff --git a/src/main/resources/login_pl.mkd b/src/main/java/login_pl.mkd index cc7978b4..cc7978b4 100644 --- a/src/main/resources/login_pl.mkd +++ b/src/main/java/login_pl.mkd diff --git a/src/main/resources/login_pt_br.mkd b/src/main/java/login_pt_br.mkd index 6a4a8570..6a4a8570 100644 --- a/src/main/resources/login_pt_br.mkd +++ b/src/main/java/login_pt_br.mkd diff --git a/src/main/resources/login_zh_CN.mkd b/src/main/java/login_zh_CN.mkd index 09046231..09046231 100644 --- a/src/main/resources/login_zh_CN.mkd +++ b/src/main/java/login_zh_CN.mkd diff --git a/src/main/resources/welcome.mkd b/src/main/java/welcome.mkd index 130cd8ac..130cd8ac 100644 --- a/src/main/resources/welcome.mkd +++ b/src/main/java/welcome.mkd diff --git a/src/main/resources/welcome_es.mkd b/src/main/java/welcome_es.mkd index 52f290e3..52f290e3 100644 --- a/src/main/resources/welcome_es.mkd +++ b/src/main/java/welcome_es.mkd diff --git a/src/main/resources/welcome_ko.mkd b/src/main/java/welcome_ko.mkd index 27cd65da..27cd65da 100644 --- a/src/main/resources/welcome_ko.mkd +++ b/src/main/java/welcome_ko.mkd diff --git a/src/main/resources/welcome_nl.mkd b/src/main/java/welcome_nl.mkd index 406ca1e0..406ca1e0 100644 --- a/src/main/resources/welcome_nl.mkd +++ b/src/main/java/welcome_nl.mkd diff --git a/src/main/resources/welcome_pl.mkd b/src/main/java/welcome_pl.mkd index bc60770a..bc60770a 100644 --- a/src/main/resources/welcome_pl.mkd +++ b/src/main/java/welcome_pl.mkd diff --git a/src/main/resources/welcome_pt_br.mkd b/src/main/java/welcome_pt_br.mkd index 6b30bbcd..6b30bbcd 100644 --- a/src/main/resources/welcome_pt_br.mkd +++ b/src/main/java/welcome_pt_br.mkd diff --git a/src/main/resources/welcome_zh_CN.mkd b/src/main/java/welcome_zh_CN.mkd index f4a651ef..f4a651ef 100644 --- a/src/main/resources/welcome_zh_CN.mkd +++ b/src/main/java/welcome_zh_CN.mkd |