diff options
author | James Moger <james.moger@gitblit.com> | 2014-03-18 17:21:47 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-04-10 18:58:09 -0400 |
commit | 41a7e46579d12e36c583aa8c2418e49c3f4c29a4 (patch) | |
tree | bb96e0b1cf6e1fd4b8d42b5536d68f9aafcbd9fa | |
parent | 821eb4bbe1a4fac8d17b4df96ab6441985df58d7 (diff) | |
download | gitblit-41a7e46579d12e36c583aa8c2418e49c3f4c29a4.tar.gz gitblit-41a7e46579d12e36c583aa8c2418e49c3f4c29a4.zip |
Style: changed manager order to reflect dependency chain
Managers are mostly declared in dependency order. Managers with fewer dependencies are first. They are likely to be components of other managers. Also eliminated import artifacts from the cherry-pick.
-rw-r--r-- | src/main/java/com/gitblit/DaggerModule.java | 22 | ||||
-rw-r--r-- | src/main/java/com/gitblit/FederationClient.java | 2 | ||||
-rw-r--r-- | src/main/java/com/gitblit/GitBlit.java | 8 | ||||
-rw-r--r-- | src/main/java/com/gitblit/dagger/DaggerFilter.java | 2 | ||||
-rw-r--r-- | src/main/java/com/gitblit/manager/GitblitManager.java | 10 | ||||
-rw-r--r-- | src/main/java/com/gitblit/manager/IGitblit.java | 4 | ||||
-rw-r--r-- | src/main/java/com/gitblit/servlet/GitblitContext.java | 4 | ||||
-rw-r--r-- | src/main/java/com/gitblit/servlet/SyndicationFilter.java | 1 |
8 files changed, 26 insertions, 27 deletions
diff --git a/src/main/java/com/gitblit/DaggerModule.java b/src/main/java/com/gitblit/DaggerModule.java index 1805c4ec..e448867a 100644 --- a/src/main/java/com/gitblit/DaggerModule.java +++ b/src/main/java/com/gitblit/DaggerModule.java @@ -19,17 +19,17 @@ import javax.inject.Singleton; import com.gitblit.manager.AuthenticationManager; import com.gitblit.manager.FederationManager; -import com.gitblit.manager.PluginManager; import com.gitblit.manager.IAuthenticationManager; import com.gitblit.manager.IFederationManager; import com.gitblit.manager.IGitblit; -import com.gitblit.manager.IPluginManager; import com.gitblit.manager.INotificationManager; +import com.gitblit.manager.IPluginManager; import com.gitblit.manager.IProjectManager; import com.gitblit.manager.IRepositoryManager; import com.gitblit.manager.IRuntimeManager; import com.gitblit.manager.IUserManager; import com.gitblit.manager.NotificationManager; +import com.gitblit.manager.PluginManager; import com.gitblit.manager.ProjectManager; import com.gitblit.manager.RepositoryManager; import com.gitblit.manager.RuntimeManager; @@ -57,6 +57,7 @@ import dagger.Provides; // core managers IRuntimeManager.class, + IPluginManager.class, INotificationManager.class, IUserManager.class, IAuthenticationManager.class, @@ -64,7 +65,6 @@ import dagger.Provides; IRepositoryManager.class, IProjectManager.class, IFederationManager.class, - IPluginManager.class, // the monolithic manager IGitblit.class, @@ -83,6 +83,10 @@ public class DaggerModule { return new RuntimeManager(settings); } + @Provides @Singleton IPluginManager providePluginManager(IRuntimeManager runtimeManager) { + return new PluginManager(runtimeManager); + } + @Provides @Singleton INotificationManager provideNotificationManager(IStoredSettings settings) { return new NotificationManager(settings); } @@ -91,10 +95,6 @@ public class DaggerModule { return new UserManager(runtimeManager); } - @Provides @Singleton IPluginManager providePluginManager(IRuntimeManager runtimeManager) { - return new PluginManager(runtimeManager); - } - @Provides @Singleton IAuthenticationManager provideAuthenticationManager( IRuntimeManager runtimeManager, IUserManager userManager) { @@ -162,25 +162,25 @@ public class DaggerModule { @Provides @Singleton IGitblit provideGitblit( IRuntimeManager runtimeManager, + IPluginManager pluginManager, INotificationManager notificationManager, IUserManager userManager, IAuthenticationManager authenticationManager, IPublicKeyManager publicKeyManager, IRepositoryManager repositoryManager, IProjectManager projectManager, - IFederationManager federationManager, - IPluginManager pluginManager) { + IFederationManager federationManager) { return new GitBlit( runtimeManager, + pluginManager, notificationManager, userManager, authenticationManager, publicKeyManager, repositoryManager, projectManager, - federationManager, - pluginManager); + federationManager); } @Provides @Singleton GitBlitWebApp provideWebApplication( diff --git a/src/main/java/com/gitblit/FederationClient.java b/src/main/java/com/gitblit/FederationClient.java index 67a68654..c3dcd9da 100644 --- a/src/main/java/com/gitblit/FederationClient.java +++ b/src/main/java/com/gitblit/FederationClient.java @@ -97,7 +97,7 @@ public class FederationClient { UserManager users = new UserManager(runtime).start();
RepositoryManager repositories = new RepositoryManager(runtime, users).start();
FederationManager federation = new FederationManager(runtime, notifications, repositories).start();
- IGitblit gitblit = new GitblitManager(runtime, notifications, users, null, null, repositories, null, federation, null);
+ IGitblit gitblit = new GitblitManager(runtime, null, notifications, users, null, null, repositories, null, federation);
FederationPullService puller = new FederationPullService(gitblit, federation.getFederationRegistrations()) {
@Override
diff --git a/src/main/java/com/gitblit/GitBlit.java b/src/main/java/com/gitblit/GitBlit.java index 147b2e16..fa681ac1 100644 --- a/src/main/java/com/gitblit/GitBlit.java +++ b/src/main/java/com/gitblit/GitBlit.java @@ -66,24 +66,24 @@ public class GitBlit extends GitblitManager { public GitBlit( IRuntimeManager runtimeManager, + IPluginManager pluginManager, INotificationManager notificationManager, IUserManager userManager, IAuthenticationManager authenticationManager, IPublicKeyManager publicKeyManager, IRepositoryManager repositoryManager, IProjectManager projectManager, - IFederationManager federationManager, - IPluginManager pluginManager) { + IFederationManager federationManager) { super(runtimeManager, + pluginManager, notificationManager, userManager, authenticationManager, publicKeyManager, repositoryManager, projectManager, - federationManager, - pluginManager); + federationManager); this.injector = ObjectGraph.create(getModules()); diff --git a/src/main/java/com/gitblit/dagger/DaggerFilter.java b/src/main/java/com/gitblit/dagger/DaggerFilter.java index 68fe6058..1c73d4b7 100644 --- a/src/main/java/com/gitblit/dagger/DaggerFilter.java +++ b/src/main/java/com/gitblit/dagger/DaggerFilter.java @@ -39,7 +39,7 @@ public abstract class DaggerFilter implements Filter { inject(objectGraph);
}
- protected abstract void inject(ObjectGraph dagger) throws ServletException;
+ protected abstract void inject(ObjectGraph dagger);
@Override
public void destroy() {
diff --git a/src/main/java/com/gitblit/manager/GitblitManager.java b/src/main/java/com/gitblit/manager/GitblitManager.java index 34c101e2..cc670ea6 100644 --- a/src/main/java/com/gitblit/manager/GitblitManager.java +++ b/src/main/java/com/gitblit/manager/GitblitManager.java @@ -104,6 +104,8 @@ public class GitblitManager implements IGitblit { protected final IRuntimeManager runtimeManager; + protected final IPluginManager pluginManager; + protected final INotificationManager notificationManager; protected final IUserManager userManager; @@ -118,21 +120,20 @@ public class GitblitManager implements IGitblit { protected final IFederationManager federationManager; - protected final IPluginManager pluginManager; - public GitblitManager( IRuntimeManager runtimeManager, + IPluginManager pluginManager, INotificationManager notificationManager, IUserManager userManager, IAuthenticationManager authenticationManager, IPublicKeyManager publicKeyManager, IRepositoryManager repositoryManager, IProjectManager projectManager, - IFederationManager federationManager, - IPluginManager pluginManager) { + IFederationManager federationManager) { this.settings = runtimeManager.getSettings(); this.runtimeManager = runtimeManager; + this.pluginManager = pluginManager; this.notificationManager = notificationManager; this.userManager = userManager; this.authenticationManager = authenticationManager; @@ -140,7 +141,6 @@ public class GitblitManager implements IGitblit { this.repositoryManager = repositoryManager; this.projectManager = projectManager; this.federationManager = federationManager; - this.pluginManager = pluginManager; } @Override diff --git a/src/main/java/com/gitblit/manager/IGitblit.java b/src/main/java/com/gitblit/manager/IGitblit.java index 7961a06b..f3202c01 100644 --- a/src/main/java/com/gitblit/manager/IGitblit.java +++ b/src/main/java/com/gitblit/manager/IGitblit.java @@ -31,13 +31,13 @@ import com.gitblit.transport.ssh.IPublicKeyManager; public interface IGitblit extends IManager, IRuntimeManager, + IPluginManager, INotificationManager, IUserManager, IAuthenticationManager, IRepositoryManager, IProjectManager, - IFederationManager, - IPluginManager { + IFederationManager { /** * Returns a list of repository URLs and the user access permission. diff --git a/src/main/java/com/gitblit/servlet/GitblitContext.java b/src/main/java/com/gitblit/servlet/GitblitContext.java index a98fe192..553651da 100644 --- a/src/main/java/com/gitblit/servlet/GitblitContext.java +++ b/src/main/java/com/gitblit/servlet/GitblitContext.java @@ -41,9 +41,9 @@ import com.gitblit.dagger.DaggerContext; import com.gitblit.manager.IAuthenticationManager; import com.gitblit.manager.IFederationManager; import com.gitblit.manager.IGitblit; -import com.gitblit.manager.IPluginManager; import com.gitblit.manager.IManager; import com.gitblit.manager.INotificationManager; +import com.gitblit.manager.IPluginManager; import com.gitblit.manager.IProjectManager; import com.gitblit.manager.IRepositoryManager; import com.gitblit.manager.IRuntimeManager; @@ -177,6 +177,7 @@ public class GitblitContext extends DaggerContext { managers.add(runtime); // start all other managers + startManager(injector, IPluginManager.class); startManager(injector, INotificationManager.class); startManager(injector, IUserManager.class); startManager(injector, IAuthenticationManager.class); @@ -185,7 +186,6 @@ public class GitblitContext extends DaggerContext { startManager(injector, IProjectManager.class); startManager(injector, IFederationManager.class); startManager(injector, IGitblit.class); - startManager(injector, IPluginManager.class); logger.info(""); logger.info("All managers started."); diff --git a/src/main/java/com/gitblit/servlet/SyndicationFilter.java b/src/main/java/com/gitblit/servlet/SyndicationFilter.java index b399588b..67a845ea 100644 --- a/src/main/java/com/gitblit/servlet/SyndicationFilter.java +++ b/src/main/java/com/gitblit/servlet/SyndicationFilter.java @@ -19,7 +19,6 @@ import java.io.IOException; import java.text.MessageFormat;
import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
|