From 269c5043ab8f66f67d5719ac5149a436ca1baa2b Mon Sep 17 00:00:00 2001
From: James Moger <james.moger@gitblit.com>
Date: Fri, 29 Nov 2013 11:05:51 -0500
Subject: [PATCH] Extract Federation, Gitblit and Services manager from GitBlit singleton

---
 src/main/java/com/gitblit/HtpasswdUserService.java |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/gitblit/HtpasswdUserService.java b/src/main/java/com/gitblit/HtpasswdUserService.java
index a98777b..ca5295c 100644
--- a/src/main/java/com/gitblit/HtpasswdUserService.java
+++ b/src/main/java/com/gitblit/HtpasswdUserService.java
@@ -80,6 +80,7 @@
 
     private final boolean SUPPORT_PLAINTEXT_PWD;
 
+    private IRuntimeManager runtimeManager;
     private IStoredSettings settings;
     private File htpasswdFile;
 
@@ -117,16 +118,16 @@
      * In addition the setup tries to read and parse the htpasswd file to be used
      * for authentication.
      *
-     * @param settings
-     * @since 0.7.0
+     * @param runtimeManager
+     * @since 1.4.0
      */
     @Override
-    public void setup(IStoredSettings settings)
+    public void setup(IRuntimeManager runtimeManager)
     {
-        this.settings = settings;
+    	this.runtimeManager = runtimeManager;
+        this.settings = runtimeManager.getSettings();
 
         // This is done in two steps in order to avoid calling GitBlit.getFileOrFolder(String, String) which will segfault for unit tests.
-        IRuntimeManager runtimeManager = GitBlit.getManager(IRuntimeManager.class);
         String file = settings.getString(KEY_BACKING_US, DEFAULT_BACKING_US);
         File realmFile = runtimeManager.getFileOrFolder(file);
         serviceImpl = createUserService(realmFile);
@@ -274,7 +275,7 @@
      * @return AccountType.HTPASSWD
      */
     @Override
-	protected AccountType getAccountType()
+	public AccountType getAccountType()
     {
         return AccountType.HTPASSWD;
     }
@@ -293,7 +294,6 @@
         if ( !file.equals(htpasswdFilePath) ) {
             // The htpasswd file setting changed. Rediscover the file.
             this.htpasswdFilePath = file;
-            IRuntimeManager runtimeManager = GitBlit.getManager(IRuntimeManager.class);
             this.htpasswdFile = runtimeManager.getFileOrFolder(file);
             this.htUsers.clear();
             this.forceReload = true;

--
Gitblit v1.9.1