From 9bc44161b6985c2f39cc86bf989351cb4281919f Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Thu, 03 Jul 2014 16:59:08 -0400 Subject: [PATCH] Removed beans.xml --- src/main/java/com/gitblit/manager/RuntimeManager.java | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gitblit/manager/RuntimeManager.java b/src/main/java/com/gitblit/manager/RuntimeManager.java index 52f4d67..383b1dc 100644 --- a/src/main/java/com/gitblit/manager/RuntimeManager.java +++ b/src/main/java/com/gitblit/manager/RuntimeManager.java @@ -22,6 +22,8 @@ import java.util.Map; import java.util.TimeZone; +import com.google.inject.Inject; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,6 +34,7 @@ import com.gitblit.models.ServerStatus; import com.gitblit.models.SettingModel; import com.gitblit.utils.StringUtils; +import com.google.inject.Injector; public class RuntimeManager implements IRuntimeManager { @@ -47,6 +50,10 @@ private TimeZone timezone; + @Inject + private Injector injector; + + @Inject public RuntimeManager(IStoredSettings settings) { this(settings, null); } @@ -72,6 +79,11 @@ @Override public RuntimeManager stop() { return this; + } + + @Override + public Injector getInjector() { + return injector; } @Override @@ -119,9 +131,42 @@ */ @Override public boolean isServingRepositories() { - return settings.getBoolean(Keys.git.enableGitServlet, true) - || (settings.getInteger(Keys.git.daemonPort, 0) > 0) - || (settings.getInteger(Keys.git.sshPort, 0) > 0); + return isServingHTTP() + || isServingGIT() + || isServingSSH(); + } + + /** + * Determine if this Gitblit instance is actively serving git repositories + * over the HTTP protocol. + * + * @return true if Gitblit is serving repositories over the HTTP protocol + */ + @Override + public boolean isServingHTTP() { + return settings.getBoolean(Keys.git.enableGitServlet, true); + } + + /** + * Determine if this Gitblit instance is actively serving git repositories + * over the Git Daemon protocol. + * + * @return true if Gitblit is serving repositories over the Git Daemon protocol + */ + @Override + public boolean isServingGIT() { + return settings.getInteger(Keys.git.daemonPort, 0) > 0; + } + + /** + * Determine if this Gitblit instance is actively serving git repositories + * over the SSH protocol. + * + * @return true if Gitblit is serving repositories over the SSH protocol + */ + @Override + public boolean isServingSSH() { + return settings.getInteger(Keys.git.sshPort, 0) > 0; } /** -- Gitblit v1.9.1