diff options
author | James Moger <james.moger@gitblit.com> | 2011-09-28 18:55:34 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2011-09-28 18:55:34 -0400 |
commit | 63ee41d91854e1cf06d8d5cda30cdf7d8d38f3c5 (patch) | |
tree | 7fc1daecfd826e5325d6b668a5949adeaaee698f /src/com/gitblit | |
parent | e20f85719784691be473a99d728f321f370780ae (diff) | |
download | gitblit-63ee41d91854e1cf06d8d5cda30cdf7d8d38f3c5.tar.gz gitblit-63ee41d91854e1cf06d8d5cda30cdf7d8d38f3c5.zip |
Added IUserService.setup(IStoredSettings) for custom implementations.
This allows custom implementations to store their settings alongside the
Gitblit GO or WAR settings while remaining unit-testable.
Diffstat (limited to 'src/com/gitblit')
-rw-r--r-- | src/com/gitblit/FileUserService.java | 10 | ||||
-rw-r--r-- | src/com/gitblit/GitBlit.java | 1 | ||||
-rw-r--r-- | src/com/gitblit/IUserService.java | 10 |
3 files changed, 21 insertions, 0 deletions
diff --git a/src/com/gitblit/FileUserService.java b/src/com/gitblit/FileUserService.java index 9dc80087..cae0d791 100644 --- a/src/com/gitblit/FileUserService.java +++ b/src/com/gitblit/FileUserService.java @@ -53,6 +53,16 @@ public class FileUserService extends FileSettings implements IUserService { }
/**
+ * Setup the user service.
+ *
+ * @param settings
+ * @since 0.6.1
+ */
+ @Override
+ public void setup(IStoredSettings settings) {
+ }
+
+ /**
* Does the user service support cookie authentication?
*
* @return true or false
diff --git a/src/com/gitblit/GitBlit.java b/src/com/gitblit/GitBlit.java index f7c43a85..c35340ac 100644 --- a/src/com/gitblit/GitBlit.java +++ b/src/com/gitblit/GitBlit.java @@ -249,6 +249,7 @@ public class GitBlit implements ServletContextListener { public void setUserService(IUserService userService) {
logger.info("Setting up user service " + userService.toString());
this.userService = userService;
+ this.userService.setup(settings);
}
/**
diff --git a/src/com/gitblit/IUserService.java b/src/com/gitblit/IUserService.java index 426d38c0..a85c997f 100644 --- a/src/com/gitblit/IUserService.java +++ b/src/com/gitblit/IUserService.java @@ -29,6 +29,16 @@ import com.gitblit.models.UserModel; public interface IUserService {
/**
+ * Setup the user service. This method allows custom implementations to
+ * retrieve settings from gitblit.properties or the web.xml file without
+ * relying on the GitBlit static singleton.
+ *
+ * @param settings
+ * @since 0.6.1
+ */
+ void setup(IStoredSettings settings);
+
+ /**
* Does the user service support cookie authentication?
*
* @return true or false
|