]> source.dussan.org Git - gitblit.git/commitdiff
Embrace @Inject for Managers, Servlets, and Filters
authorJames Moger <james.moger@gitblit.com>
Fri, 16 May 2014 17:50:59 +0000 (13:50 -0400)
committerJames Moger <james.moger@gitblit.com>
Thu, 3 Jul 2014 20:20:37 +0000 (16:20 -0400)
36 files changed:
src/main/java/com/gitblit/DaggerModule.java
src/main/java/com/gitblit/GitBlit.java
src/main/java/com/gitblit/dagger/DaggerWicketFilter.java [deleted file]
src/main/java/com/gitblit/manager/AuthenticationManager.java
src/main/java/com/gitblit/manager/FederationManager.java
src/main/java/com/gitblit/manager/NotificationManager.java
src/main/java/com/gitblit/manager/PluginManager.java
src/main/java/com/gitblit/manager/ProjectManager.java
src/main/java/com/gitblit/manager/RepositoryManager.java
src/main/java/com/gitblit/manager/RuntimeManager.java
src/main/java/com/gitblit/manager/UserManager.java
src/main/java/com/gitblit/servlet/AccessRestrictionFilter.java
src/main/java/com/gitblit/servlet/AuthenticationFilter.java
src/main/java/com/gitblit/servlet/BranchGraphServlet.java
src/main/java/com/gitblit/servlet/DownloadZipFilter.java
src/main/java/com/gitblit/servlet/DownloadZipServlet.java
src/main/java/com/gitblit/servlet/EnforceAuthenticationFilter.java
src/main/java/com/gitblit/servlet/FederationServlet.java
src/main/java/com/gitblit/servlet/GitFilter.java
src/main/java/com/gitblit/servlet/GitServlet.java
src/main/java/com/gitblit/servlet/JsonServlet.java
src/main/java/com/gitblit/servlet/LogoServlet.java
src/main/java/com/gitblit/servlet/PagesFilter.java
src/main/java/com/gitblit/servlet/PagesServlet.java
src/main/java/com/gitblit/servlet/ProxyFilter.java
src/main/java/com/gitblit/servlet/PtServlet.java
src/main/java/com/gitblit/servlet/RawFilter.java
src/main/java/com/gitblit/servlet/RawServlet.java
src/main/java/com/gitblit/servlet/RobotsTxtServlet.java
src/main/java/com/gitblit/servlet/RpcFilter.java
src/main/java/com/gitblit/servlet/RpcServlet.java
src/main/java/com/gitblit/servlet/SparkleShareInviteServlet.java
src/main/java/com/gitblit/servlet/SyndicationFilter.java
src/main/java/com/gitblit/servlet/SyndicationServlet.java
src/main/java/com/gitblit/wicket/GitBlitWebApp.java
src/main/java/com/gitblit/wicket/GitblitWicketFilter.java

index aa10198cb2c2b2a9fe378a030ee4cae5558115ee..662ca0339d371de9de1286297e838aa767e3c874 100644 (file)
@@ -72,7 +72,6 @@ import dagger.Provides;
  *
  */
 @Module(
-       library = true,
        injects = {
                        IStoredSettings.class,
 
@@ -123,32 +122,24 @@ public class DaggerModule {
                return new FileSettings();
        }
 
-       @Provides @Singleton IRuntimeManager provideRuntimeManager(IStoredSettings settings) {
-               return new RuntimeManager(settings);
+       @Provides @Singleton IRuntimeManager provideRuntimeManager(RuntimeManager manager) {
+               return manager;
        }
 
-       @Provides @Singleton IPluginManager providePluginManager(IRuntimeManager runtimeManager) {
-               return new PluginManager(runtimeManager);
+       @Provides @Singleton IPluginManager providePluginManager(PluginManager manager) {
+               return manager;
        }
 
-       @Provides @Singleton INotificationManager provideNotificationManager(IStoredSettings settings) {
-               return new NotificationManager(settings);
+       @Provides @Singleton INotificationManager provideNotificationManager(NotificationManager manager) {
+               return manager;
        }
 
-       @Provides @Singleton IUserManager provideUserManager(
-                       IRuntimeManager runtimeManager,
-                       IPluginManager pluginManager) {
-
-               return new UserManager(runtimeManager, pluginManager);
+       @Provides @Singleton IUserManager provideUserManager(UserManager manager) {
+               return manager;
        }
 
-       @Provides @Singleton IAuthenticationManager provideAuthenticationManager(
-                       IRuntimeManager runtimeManager,
-                       IUserManager userManager) {
-
-               return new AuthenticationManager(
-                               runtimeManager,
-                               userManager);
+       @Provides @Singleton IAuthenticationManager provideAuthenticationManager(AuthenticationManager manager) {
+               return manager;
        }
 
        @Provides @Singleton IPublicKeyManager providePublicKeyManager(
@@ -176,369 +167,19 @@ public class DaggerModule {
                }
        }
 
-       @Provides @Singleton IRepositoryManager provideRepositoryManager(
-                       IRuntimeManager runtimeManager,
-                       IPluginManager pluginManager,
-                       IUserManager userManager) {
-
-               return new RepositoryManager(
-                               runtimeManager,
-                               pluginManager,
-                               userManager);
-       }
-
-       @Provides @Singleton IProjectManager provideProjectManager(
-                       IRuntimeManager runtimeManager,
-                       IUserManager userManager,
-                       IRepositoryManager repositoryManager) {
-
-               return new ProjectManager(
-                               runtimeManager,
-                               userManager,
-                               repositoryManager);
-       }
-
-       @Provides @Singleton IFederationManager provideFederationManager(
-                       IRuntimeManager runtimeManager,
-                       INotificationManager notificationManager,
-                       IRepositoryManager repositoryManager) {
-
-               return new FederationManager(
-                               runtimeManager,
-                               notificationManager,
-                               repositoryManager);
-       }
-
-       @Provides @Singleton IGitblit provideGitblit(
-                       IRuntimeManager runtimeManager,
-                       IPluginManager pluginManager,
-                       INotificationManager notificationManager,
-                       IUserManager userManager,
-                       IAuthenticationManager authenticationManager,
-                       IPublicKeyManager publicKeyManager,
-                       IRepositoryManager repositoryManager,
-                       IProjectManager projectManager,
-                       IFederationManager federationManager) {
-
-               return new GitBlit(
-                               runtimeManager,
-                               pluginManager,
-                               notificationManager,
-                               userManager,
-                               authenticationManager,
-                               publicKeyManager,
-                               repositoryManager,
-                               projectManager,
-                               federationManager);
-       }
-
-       @Provides @Singleton GitBlitWebApp provideWebApplication(
-                       IRuntimeManager runtimeManager,
-                       IPluginManager pluginManager,
-                       INotificationManager notificationManager,
-                       IUserManager userManager,
-                       IAuthenticationManager authenticationManager,
-                       IPublicKeyManager publicKeyManager,
-                       IRepositoryManager repositoryManager,
-                       IProjectManager projectManager,
-                       IFederationManager federationManager,
-                       IGitblit gitblit) {
-
-               return new GitBlitWebApp(
-                               runtimeManager,
-                               pluginManager,
-                               notificationManager,
-                               userManager,
-                               authenticationManager,
-                               publicKeyManager,
-                               repositoryManager,
-                               projectManager,
-                               federationManager,
-                               gitblit);
-       }
-//
-//     @Provides @Singleton GitblitWicketFilter provideGitblitWicketFilter(GitBlitWebApp webapp) {
-//             return new GitblitWicketFilter(webapp);
-//     }
-//
-//     @Provides GitServlet provideGitServlet(IGitblit gitblit) {
-//             return new GitServlet(gitblit);
-//     }
-//
-//     @Provides GitFilter provideGitFilter(
-//                     IRuntimeManager runtimeManager,
-//                     IUserManager userManager,
-//                     IAuthenticationManager authenticationManager,
-//                     IRepositoryManager repositoryManager,
-//                     IFederationManager federationManager) {
-//
-//             return new GitFilter(
-//                             runtimeManager,
-//                             userManager,
-//                             authenticationManager,
-//                             repositoryManager,
-//                             federationManager);
-//     }
-//
-//     @Provides @Singleton PagesServlet providePagesServlet(
-//                     IRuntimeManager runtimeManager,
-//                     IRepositoryManager repositoryManager) {
-//
-//             return new PagesServlet(runtimeManager, repositoryManager);
-//     }
-//
-//     @Provides @Singleton PagesFilter providePagesFilter(
-//                     IRuntimeManager runtimeManager,
-//                     IAuthenticationManager authenticationManager,
-//                     IRepositoryManager repositoryManager) {
-//
-//             return new PagesFilter(
-//                             runtimeManager,
-//                             authenticationManager,
-//                             repositoryManager);
-//     }
-//
-//     @Provides @Singleton RpcServlet provideRpcServlet(IGitblit gitblit) {
-//             return new RpcServlet(gitblit);
-//     }
-//
-//     @Provides @Singleton RpcFilter provideRpcFilter(
-//                     IRuntimeManager runtimeManager,
-//                     IAuthenticationManager authenticationManager) {
-//
-//             return new RpcFilter(runtimeManager, authenticationManager);
-//     }
-//
-//     @Provides @Singleton DownloadZipServlet provideDownloadZipServlet(
-//                     IRuntimeManager runtimeManager,
-//                     IRepositoryManager repositoryManager) {
-//
-//             return new DownloadZipServlet(runtimeManager, repositoryManager);
-//     }
-//
-//     @Provides @Singleton DownloadZipFilter provideDownloadZipFilter(
-//                     IRuntimeManager runtimeManager,
-//                     IAuthenticationManager authenticationManager,
-//                     IRepositoryManager repositoryManager) {
-//
-//             return new DownloadZipFilter(
-//                             runtimeManager,
-//                             authenticationManager,
-//                             repositoryManager);
-//     }
-//
-//     @Provides @Singleton SyndicationServlet provideSyndicationServlet(
-//                     IRuntimeManager runtimeManager,
-//                     IRepositoryManager repositoryManager,
-//                     IProjectManager projectManager) {
-//
-//             return new SyndicationServlet(
-//                             runtimeManager,
-//                             repositoryManager,
-//                             projectManager);
-//     }
-//
-//     @Provides @Singleton SyndicationFilter provideSyndicationFilter(
-//                     IRuntimeManager runtimeManager,
-//                     IAuthenticationManager authenticationManager,
-//                     IRepositoryManager repositoryManager,
-//                     IProjectManager projectManager) {
-//
-//             return new SyndicationFilter(
-//                             runtimeManager,
-//                             authenticationManager,
-//                             repositoryManager,
-//                             projectManager);
-//     }
-//
-//     @Provides @Singleton FederationServlet provideFederationServlet(
-//                     IRuntimeManager runtimeManager,
-//                     IUserManager userManager,
-//                     IRepositoryManager repositoryManager,
-//                     IFederationManager federationManager) {
-//
-//             return new FederationServlet(
-//                             runtimeManager,
-//                             userManager,
-//                             repositoryManager,
-//                             federationManager);
-//     }
-//
-//     @Provides @Singleton SparkleShareInviteServlet provideSparkleshareInviteServlet(
-//                     IRuntimeManager runtimeManager,
-//                     IUserManager userManager,
-//                     IAuthenticationManager authenticationManager,
-//                     IRepositoryManager repositoryManager) {
-//
-//             return new SparkleShareInviteServlet(
-//                             runtimeManager,
-//                             userManager,
-//                             authenticationManager,
-//                             repositoryManager);
-//     }
-//
-//     @Provides @Singleton BranchGraphServlet provideBranchGraphServlet(
-//                     IRuntimeManager runtimeManager,
-//                     IRepositoryManager repositoryManager) {
-//
-//             return new BranchGraphServlet(runtimeManager, repositoryManager);
-//     }
-//
-//     @Provides @Singleton RobotsTxtServlet provideRobotsTxtServlet(IRuntimeManager runtimeManager) {
-//             return new RobotsTxtServlet(runtimeManager);
-//     }
-//
-//     @Provides @Singleton LogoServlet provideLogoServlet(IRuntimeManager runtimeManager) {
-//             return new LogoServlet(runtimeManager);
-//     }
-//
-//     @Provides @Singleton EnforceAuthenticationFilter provideEnforceAuthenticationFilter(
-//                     IRuntimeManager runtimeManager,
-//                     IAuthenticationManager authenticationManager) {
-//
-//             return new EnforceAuthenticationFilter(runtimeManager, authenticationManager);
-//     }
-
-
-       @Provides @Singleton GitblitWicketFilter provideGitblitWicketFilter(GitBlitWebApp webapp) {
-               return new GitblitWicketFilter();
+       @Provides @Singleton IRepositoryManager provideRepositoryManager(RepositoryManager manager) {
+               return manager;
        }
 
-       @Provides GitServlet provideGitServlet(IGitblit gitblit) {
-               return new GitServlet();
+       @Provides @Singleton IProjectManager provideProjectManager(ProjectManager manager) {
+               return manager;
        }
 
-       @Provides GitFilter provideGitFilter(
-                       IRuntimeManager runtimeManager,
-                       IUserManager userManager,
-                       IAuthenticationManager authenticationManager,
-                       IRepositoryManager repositoryManager,
-                       IFederationManager federationManager) {
-
-               return new GitFilter();
-       }
-
-       @Provides @Singleton RawServlet provideRawServlet(
-                       IRuntimeManager runtimeManager,
-                       IRepositoryManager repositoryManager) {
-
-               return new RawServlet();
+       @Provides @Singleton IFederationManager provideFederationManager(FederationManager manager) {
+               return manager;
        }
 
-       @Provides @Singleton RawFilter provideRawFilter(
-                       IRuntimeManager runtimeManager,
-                       IAuthenticationManager authenticationManager,
-                       IRepositoryManager repositoryManager) {
-
-               return new RawFilter();
-       }
-
-       @Provides @Singleton PagesServlet providePagesServlet(
-                       IRuntimeManager runtimeManager,
-                       IRepositoryManager repositoryManager) {
-
-               return new PagesServlet();
-       }
-
-       @Provides @Singleton PagesFilter providePagesFilter(
-                       IRuntimeManager runtimeManager,
-                       IAuthenticationManager authenticationManager,
-                       IRepositoryManager repositoryManager) {
-
-               return new PagesFilter();
-       }
-
-       @Provides @Singleton RpcServlet provideRpcServlet(IGitblit gitblit) {
-               return new RpcServlet();
-       }
-
-       @Provides @Singleton RpcFilter provideRpcFilter(
-                       IRuntimeManager runtimeManager,
-                       IAuthenticationManager authenticationManager) {
-
-               return new RpcFilter();
-       }
-
-       @Provides @Singleton DownloadZipServlet provideDownloadZipServlet(
-                       IRuntimeManager runtimeManager,
-                       IRepositoryManager repositoryManager) {
-
-               return new DownloadZipServlet();
-       }
-
-       @Provides @Singleton DownloadZipFilter provideDownloadZipFilter(
-                       IRuntimeManager runtimeManager,
-                       IAuthenticationManager authenticationManager,
-                       IRepositoryManager repositoryManager) {
-
-               return new DownloadZipFilter();
-       }
-
-       @Provides @Singleton SyndicationServlet provideSyndicationServlet(
-                       IRuntimeManager runtimeManager,
-                       IRepositoryManager repositoryManager,
-                       IProjectManager projectManager) {
-
-               return new SyndicationServlet();
-       }
-
-       @Provides @Singleton SyndicationFilter provideSyndicationFilter(
-                       IRuntimeManager runtimeManager,
-                       IAuthenticationManager authenticationManager,
-                       IRepositoryManager repositoryManager,
-                       IProjectManager projectManager) {
-
-               return new SyndicationFilter();
-       }
-
-       @Provides @Singleton FederationServlet provideFederationServlet(
-                       IRuntimeManager runtimeManager,
-                       IUserManager userManager,
-                       IRepositoryManager repositoryManager,
-                       IFederationManager federationManager) {
-
-               return new FederationServlet();
-       }
-
-       @Provides @Singleton SparkleShareInviteServlet provideSparkleshareInviteServlet(
-                       IRuntimeManager runtimeManager,
-                       IUserManager userManager,
-                       IAuthenticationManager authenticationManager,
-                       IRepositoryManager repositoryManager) {
-
-               return new SparkleShareInviteServlet();
-       }
-
-       @Provides @Singleton BranchGraphServlet provideBranchGraphServlet(
-                       IRuntimeManager runtimeManager,
-                       IRepositoryManager repositoryManager) {
-
-               return new BranchGraphServlet();
-       }
-
-       @Provides @Singleton RobotsTxtServlet provideRobotsTxtServlet(IRuntimeManager runtimeManager) {
-               return new RobotsTxtServlet();
-       }
-
-       @Provides @Singleton LogoServlet provideLogoServlet(IRuntimeManager runtimeManager) {
-               return new LogoServlet();
-       }
-
-       @Provides @Singleton PtServlet providePtServlet(IRuntimeManager runtimeManager) {
-               return new PtServlet();
-       }
-
-       @Provides @Singleton ProxyFilter provideProxyFilter(
-                       IRuntimeManager runtimeManager,
-                       IAuthenticationManager authenticationManager) {
-
-               return new ProxyFilter();
-       }
-
-       @Provides @Singleton EnforceAuthenticationFilter provideEnforceAuthenticationFilter(
-                       IRuntimeManager runtimeManager,
-                       IAuthenticationManager authenticationManager) {
-
-               return new EnforceAuthenticationFilter();
+       @Provides @Singleton IGitblit provideGitblit(GitBlit gitblit) {
+               return gitblit;
        }
 }
\ No newline at end of file
index f9d9be9f3279efdb8dd6e30023d5b42a7baa9595..8bfa043a5848d051b0c4308d6b98d191071ece86 100644 (file)
@@ -24,6 +24,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
+import javax.inject.Inject;
 import javax.inject.Singleton;
 import javax.servlet.http.HttpServletRequest;
 
@@ -70,6 +71,7 @@ public class GitBlit extends GitblitManager {
 
        private ITicketService ticketService;
 
+       @Inject
        public GitBlit(
                        IRuntimeManager runtimeManager,
                        IPluginManager pluginManager,
diff --git a/src/main/java/com/gitblit/dagger/DaggerWicketFilter.java b/src/main/java/com/gitblit/dagger/DaggerWicketFilter.java
deleted file mode 100644 (file)
index c2fd4d6..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/*\r
- * Copyright 2013 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *     http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.dagger;\r
-\r
-import javax.servlet.FilterConfig;\r
-import javax.servlet.ServletContext;\r
-import javax.servlet.ServletException;\r
-\r
-import org.apache.wicket.protocol.http.WicketFilter;\r
-\r
-import dagger.ObjectGraph;\r
-\r
-/**\r
- * Uses Dagger to manually inject dependencies into a Wicket filter.\r
- * This class is useful for servlet containers that offer CDI and are\r
- * confused by Dagger.\r
- *\r
- * @author James Moger\r
- *\r
- */\r
-public abstract class DaggerWicketFilter extends WicketFilter {\r
-\r
-       @Override\r
-       public final void init(FilterConfig filterConfig) throws ServletException {\r
-               ServletContext context = filterConfig.getServletContext();\r
-               ObjectGraph objectGraph = (ObjectGraph) context.getAttribute(DaggerContext.INJECTOR_NAME);\r
-               inject(objectGraph);\r
-               super.init(filterConfig);\r
-       }\r
-\r
-       protected abstract void inject(ObjectGraph dagger);\r
-}\r
index d1b1af0ab06db1df3d5bcea29762fd29189c2d73..2aa2d197412d2c392d974c496bde09ec452d6588 100644 (file)
@@ -24,6 +24,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
+import javax.inject.Inject;
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -76,6 +77,7 @@ public class AuthenticationManager implements IAuthenticationManager {
 
        private final Map<String, String> legacyRedirects;
 
+       @Inject
        public AuthenticationManager(
                        IRuntimeManager runtimeManager,
                        IUserManager userManager) {
index 95d38af10bed735a086b5f283d7b03069900c536..32193525a800d4376f75ff6d349f6d171a1b9790 100644 (file)
@@ -26,6 +26,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
+import javax.inject.Inject;
 import javax.servlet.http.HttpServletRequest;
 
 import org.slf4j.Logger;
@@ -70,6 +71,7 @@ public class FederationManager implements IFederationManager {
 
        private final IRepositoryManager repositoryManager;
 
+       @Inject
        public FederationManager(
                        IRuntimeManager runtimeManager,
                        INotificationManager notificationManager,
index 69a611bbdc09c564fd7dae9dbb80955288d06fb8..63f064e50a4d484d501fd29b920131368bd561a4 100644 (file)
@@ -20,6 +20,7 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
+import javax.inject.Inject;
 import javax.mail.Message;
 
 import org.slf4j.Logger;
@@ -48,6 +49,7 @@ public class NotificationManager implements INotificationManager {
 
        private final MailService mailService;
 
+       @Inject
        public NotificationManager(IStoredSettings settings) {
                this.settings = settings;
                this.mailService = new MailService(settings);
index 2ee48558de010b703e96085617de6d5784e8d9e9..a0c873e89a4d8c1de647c75f02f49e6b9265ce3b 100644 (file)
@@ -34,6 +34,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 
+import javax.inject.Inject;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -81,6 +83,7 @@ public class PluginManager implements IPluginManager, PluginStateListener {
 
        private int readTimeout = 12800;
 
+       @Inject
        public PluginManager(IRuntimeManager runtimeManager) {
                File dir = runtimeManager.getFileOrFolder(Keys.plugins.folder, "${baseFolder}/plugins");
                dir.mkdirs();
index 666f521043533cd7607d0913819a6a3ff46ac248..4da7f801e9f45af6d9c4ed474bc9f8c6b1f3e877 100644 (file)
@@ -27,6 +27,8 @@ import java.util.Map;
 import java.util.TreeMap;
 import java.util.concurrent.ConcurrentHashMap;
 
+import javax.inject.Inject;
+
 import org.eclipse.jgit.storage.file.FileBasedConfig;
 import org.eclipse.jgit.util.FS;
 import org.slf4j.Logger;
@@ -68,6 +70,7 @@ public class ProjectManager implements IProjectManager {
 
        private FileBasedConfig projectConfigs;
 
+       @Inject
        public ProjectManager(
                        IRuntimeManager runtimeManager,
                        IUserManager userManager,
index 0160363e81793a18d0d389292103ce4707e294f8..a82cd016f977cfa160225ef163272aa5e352bc77 100644 (file)
@@ -44,6 +44,8 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
 
+import javax.inject.Inject;
+
 import org.eclipse.jgit.lib.Repository;
 import org.eclipse.jgit.lib.RepositoryCache;
 import org.eclipse.jgit.lib.RepositoryCache.FileKey;
@@ -127,6 +129,7 @@ public class RepositoryManager implements IRepositoryManager {
 
        private MirrorService mirrorExecutor;
 
+       @Inject
        public RepositoryManager(
                        IRuntimeManager runtimeManager,
                        IPluginManager pluginManager,
index 9cdc64ebac830a77708199dae0303a9670bb42b8..00fe1c91c05646f0434522a48c85a272eab6054e 100644 (file)
@@ -22,6 +22,8 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.TimeZone;
 
+import javax.inject.Inject;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -47,6 +49,7 @@ public class RuntimeManager implements IRuntimeManager {
 
        private TimeZone timezone;
 
+       @Inject
        public RuntimeManager(IStoredSettings settings) {
                this(settings, null);
        }
index 2b82ffb63e6c06d0790121174c05ac20f20e39c8..fe21b063f49abcbf2f1acad2ce3694c7dee5daea 100644 (file)
@@ -24,6 +24,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import javax.inject.Inject;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -57,6 +59,7 @@ public class UserManager implements IUserManager {
 
        private IUserService userService;
 
+       @Inject
        public UserManager(IRuntimeManager runtimeManager, IPluginManager pluginManager) {
                this.settings = runtimeManager.getSettings();
                this.runtimeManager = runtimeManager;
index 0e6d323d0762cc2e7ced65852914bbe482f6a0a4..6d2efa4fb5ce9468fb0441a1d48feef69ad27ea2 100644 (file)
@@ -19,21 +19,19 @@ import java.io.IOException;
 import java.text.MessageFormat;\r
 \r
 import javax.servlet.FilterChain;\r
-import javax.servlet.FilterConfig;\r
 import javax.servlet.ServletException;\r
 import javax.servlet.ServletRequest;\r
 import javax.servlet.ServletResponse;\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.servlet.http.HttpServletResponse;\r
 \r
+import com.gitblit.manager.IAuthenticationManager;\r
 import com.gitblit.manager.IRepositoryManager;\r
 import com.gitblit.manager.IRuntimeManager;\r
 import com.gitblit.models.RepositoryModel;\r
 import com.gitblit.models.UserModel;\r
 import com.gitblit.utils.StringUtils;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * The AccessRestrictionFilter is an AuthenticationFilter that confirms that the\r
  * requested repository can be accessed by the anonymous or named user.\r
@@ -54,11 +52,15 @@ public abstract class AccessRestrictionFilter extends AuthenticationFilter {
 \r
        protected IRepositoryManager repositoryManager;\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger, FilterConfig filterConfig) {\r
-               super.inject(dagger, filterConfig);\r
-               this.runtimeManager = dagger.get(IRuntimeManager.class);\r
-               this.repositoryManager = dagger.get(IRepositoryManager.class);\r
+       protected AccessRestrictionFilter(\r
+                       IRuntimeManager runtimeManager,\r
+                       IAuthenticationManager authenticationManager,\r
+                       IRepositoryManager repositoryManager) {\r
+\r
+               super(authenticationManager);\r
+\r
+               this.runtimeManager = runtimeManager;\r
+               this.repositoryManager = repositoryManager;\r
        }\r
 \r
        /**\r
index c21f86925bd7717a8fb05ce5c119328de8664a9c..6f13252a2365e3931e7a861d3eba576f8c1bdf22 100644 (file)
@@ -21,6 +21,7 @@ import java.util.Enumeration;
 import java.util.HashMap;\r
 import java.util.Map;\r
 \r
+import javax.servlet.Filter;\r
 import javax.servlet.FilterChain;\r
 import javax.servlet.FilterConfig;\r
 import javax.servlet.ServletException;\r
@@ -35,14 +36,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;\r
 \r
 import com.gitblit.Constants;\r
-import com.gitblit.dagger.DaggerFilter;\r
 import com.gitblit.manager.IAuthenticationManager;\r
 import com.gitblit.models.UserModel;\r
 import com.gitblit.utils.DeepCopier;\r
 import com.gitblit.utils.StringUtils;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * The AuthenticationFilter is a servlet filter that preprocesses requests that\r
  * match its url pattern definition in the web.xml file.\r
@@ -52,7 +50,7 @@ import dagger.ObjectGraph;
  * @author James Moger\r
  *\r
  */\r
-public abstract class AuthenticationFilter extends DaggerFilter {\r
+public abstract class AuthenticationFilter implements Filter {\r
 \r
        protected static final String CHALLENGE = "Basic realm=\"" + Constants.NAME + "\"";\r
 \r
@@ -62,9 +60,16 @@ public abstract class AuthenticationFilter extends DaggerFilter {
 \r
        protected IAuthenticationManager authenticationManager;\r
 \r
+       protected AuthenticationFilter(IAuthenticationManager authenticationManager) {\r
+               this.authenticationManager = authenticationManager;\r
+       }\r
+\r
+       @Override\r
+       public void init(FilterConfig filterConfig) throws ServletException {\r
+       }\r
+\r
        @Override\r
-       protected void inject(ObjectGraph dagger, FilterConfig filterConfig) {\r
-               this.authenticationManager = dagger.get(IAuthenticationManager.class);\r
+       public void destroy() {\r
        }\r
 \r
        /**\r
index 0abe347faa85ae16932ff0322ddd1039435ee095..c1ad08062253d4689c5e3d64e637c7614e787f5a 100644 (file)
@@ -36,7 +36,10 @@ import java.util.Set;
 import java.util.TreeSet;\r
 \r
 import javax.imageio.ImageIO;\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.ServletException;\r
+import javax.servlet.http.HttpServlet;\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.servlet.http.HttpServletResponse;\r
 \r
@@ -52,20 +55,18 @@ import org.eclipse.jgit.revwalk.RevCommit;
 import com.gitblit.Constants;\r
 import com.gitblit.IStoredSettings;\r
 import com.gitblit.Keys;\r
-import com.gitblit.dagger.DaggerServlet;\r
 import com.gitblit.manager.IRepositoryManager;\r
 import com.gitblit.utils.JGitUtils;\r
 import com.gitblit.utils.StringUtils;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * Handles requests for branch graphs\r
  *\r
  * @author James Moger\r
  *\r
  */\r
-public class BranchGraphServlet extends DaggerServlet {\r
+@Singleton\r
+public class BranchGraphServlet extends HttpServlet {\r
 \r
        private static final long serialVersionUID = 1L;\r
 \r
@@ -82,20 +83,20 @@ public class BranchGraphServlet extends DaggerServlet {
 \r
        private IRepositoryManager repositoryManager;\r
 \r
-       public BranchGraphServlet() {\r
-               super();\r
+       @Inject\r
+       public BranchGraphServlet(\r
+                       IStoredSettings settings,\r
+                       IRepositoryManager repositoryManager) {\r
+\r
+               this.settings = settings;\r
+               this.repositoryManager = repositoryManager;\r
+\r
                strokeCache = new Stroke[4];\r
                for (int i = 1; i < strokeCache.length; i++) {\r
                        strokeCache[i] = new BasicStroke(i);\r
                }\r
        }\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger) {\r
-               this.settings = dagger.get(IStoredSettings.class);\r
-               this.repositoryManager = dagger.get(IRepositoryManager.class);\r
-       }\r
-\r
        /**\r
         * Returns an url to this servlet for the specified parameters.\r
         *\r
index 0c7b3e56198fb8cbff87dee3ab28834f102ce438..3f20c2b71fc9dc446633ab34d7cd11484d1d13b5 100644 (file)
  */\r
 package com.gitblit.servlet;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
+\r
 import com.gitblit.Constants.AccessRestrictionType;\r
+import com.gitblit.manager.IAuthenticationManager;\r
+import com.gitblit.manager.IRepositoryManager;\r
+import com.gitblit.manager.IRuntimeManager;\r
 import com.gitblit.models.RepositoryModel;\r
 import com.gitblit.models.UserModel;\r
 \r
@@ -27,8 +33,18 @@ import com.gitblit.models.UserModel;
  * @author James Moger\r
  *\r
  */\r
+@Singleton\r
 public class DownloadZipFilter extends AccessRestrictionFilter {\r
 \r
+       @Inject\r
+       public DownloadZipFilter(\r
+                       IRuntimeManager runtimeManager,\r
+                       IAuthenticationManager authenticationManager,\r
+                       IRepositoryManager repositoryManager) {\r
+\r
+               super(runtimeManager, authenticationManager, repositoryManager);\r
+       }\r
+\r
        /**\r
         * Extract the repository name from the url.\r
         *\r
index 6a64778c67c7b2c291a6e199b69e62a8303c0fdd..4b0e3bf54a3e216b2c4e8475a6ec6cb4c738fe29 100644 (file)
@@ -20,7 +20,10 @@ import java.text.MessageFormat;
 import java.text.ParseException;\r
 import java.util.Date;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.ServletException;\r
+import javax.servlet.http.HttpServlet;\r
 import javax.servlet.http.HttpServletResponse;\r
 \r
 import org.eclipse.jgit.lib.Repository;\r
@@ -31,15 +34,12 @@ import org.slf4j.LoggerFactory;
 import com.gitblit.Constants;\r
 import com.gitblit.IStoredSettings;\r
 import com.gitblit.Keys;\r
-import com.gitblit.dagger.DaggerServlet;\r
 import com.gitblit.manager.IRepositoryManager;\r
 import com.gitblit.utils.CompressionUtils;\r
 import com.gitblit.utils.JGitUtils;\r
 import com.gitblit.utils.MarkdownUtils;\r
 import com.gitblit.utils.StringUtils;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * Streams out a zip file from the specified repository for any tree path at any\r
  * revision.\r
@@ -47,7 +47,8 @@ import dagger.ObjectGraph;
  * @author James Moger\r
  *\r
  */\r
-public class DownloadZipServlet extends DaggerServlet {\r
+@Singleton\r
+public class DownloadZipServlet extends HttpServlet {\r
 \r
        private static final long serialVersionUID = 1L;\r
 \r
@@ -76,10 +77,10 @@ public class DownloadZipServlet extends DaggerServlet {
                }\r
        }\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger) {\r
-               this.settings = dagger.get(IStoredSettings.class);\r
-               this.repositoryManager = dagger.get(IRepositoryManager.class);\r
+       @Inject\r
+       public DownloadZipServlet(IStoredSettings settings, IRepositoryManager repositoryManager) {\r
+               this.settings = settings;\r
+               this.repositoryManager = repositoryManager;\r
        }\r
 \r
        /**\r
index c015021d0877669cb0c65a08676b45f3d31ef7ad..a9e6554ee2e9c9d6f0c357c0b90b6c1f1d8d662e 100644 (file)
@@ -18,6 +18,9 @@
 import java.io.IOException;
 import java.text.MessageFormat;
 
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
 import javax.servlet.ServletException;
@@ -31,12 +34,9 @@ import org.slf4j.LoggerFactory;
 
 import com.gitblit.IStoredSettings;
 import com.gitblit.Keys;
-import com.gitblit.dagger.DaggerFilter;
 import com.gitblit.manager.IAuthenticationManager;
 import com.gitblit.models.UserModel;
 
-import dagger.ObjectGraph;
-
 /**
  * This filter enforces authentication via HTTP Basic Authentication, if the settings indicate so.
  * It looks at the settings "web.authenticateViewPages" and "web.enforceHttpBasicAuthentication"; if
@@ -45,7 +45,8 @@ import dagger.ObjectGraph;
  * @author Laurens Vrijnsen
  *
  */
-public class EnforceAuthenticationFilter extends DaggerFilter {
+@Singleton
+public class EnforceAuthenticationFilter implements Filter {
 
        protected transient Logger logger = LoggerFactory.getLogger(getClass());
 
@@ -53,10 +54,21 @@ public class EnforceAuthenticationFilter extends DaggerFilter {
 
        private IAuthenticationManager authenticationManager;
 
+       @Inject
+       public EnforceAuthenticationFilter(
+                       IStoredSettings settings,
+                       IAuthenticationManager authenticationManager) {
+
+               this.settings = settings;
+               this.authenticationManager = authenticationManager;
+       }
+
        @Override
-       protected void inject(ObjectGraph dagger, FilterConfig filterConfig) {
-               this.settings = dagger.get(IStoredSettings.class);
-               this.authenticationManager = dagger.get(IAuthenticationManager.class);
+       public void init(FilterConfig config) {
+       }
+
+       @Override
+       public void destroy() {
        }
 
        /*
@@ -87,12 +99,4 @@ public class EnforceAuthenticationFilter extends DaggerFilter {
                        chain.doFilter(request, response);
                }
        }
-
-
-       /*
-        * @see javax.servlet.Filter#destroy()
-        */
-       @Override
-       public void destroy() {
-       }
 }
index 8dbf0e1674045c2b50efa805879daeab4dd7ad5f..8a03f08927acb4d2a172c05dbd097843b8512ee0 100644 (file)
@@ -25,6 +25,8 @@ import java.util.List;
 import java.util.Map;\r
 import java.util.Set;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.http.HttpServletResponse;\r
 \r
 import com.gitblit.Constants.FederationRequest;\r
@@ -43,14 +45,13 @@ import com.gitblit.utils.HttpUtils;
 import com.gitblit.utils.StringUtils;\r
 import com.gitblit.utils.TimeUtils;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * Handles federation requests.\r
  *\r
  * @author James Moger\r
  *\r
  */\r
+@Singleton\r
 public class FederationServlet extends JsonServlet {\r
 \r
        private static final long serialVersionUID = 1L;\r
@@ -63,12 +64,17 @@ public class FederationServlet extends JsonServlet {
 \r
        private IFederationManager federationManager;\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger) {\r
-               this.settings = dagger.get(IStoredSettings.class);\r
-               this.userManager = dagger.get(IUserManager.class);\r
-               this.repositoryManager = dagger.get(IRepositoryManager.class);\r
-               this.federationManager = dagger.get(IFederationManager.class);\r
+       @Inject\r
+       public FederationServlet(\r
+                       IStoredSettings settings,\r
+                       IUserManager userManager,\r
+                       IRepositoryManager repositoryManager,\r
+                       IFederationManager federationManager) {\r
+\r
+               this.settings = settings;\r
+               this.userManager = userManager;\r
+               this.repositoryManager = repositoryManager;\r
+               this.federationManager = federationManager;\r
        }\r
 \r
        /**\r
index bb3d3216e9559260e8a5dce658fde612001b72c3..e2c458988478d0e335acd0ce7743938d23ef8704 100644 (file)
@@ -17,7 +17,8 @@ package com.gitblit.servlet;
 \r
 import java.text.MessageFormat;\r
 \r
-import javax.servlet.FilterConfig;\r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.http.HttpServletRequest;\r
 \r
 import com.gitblit.Constants.AccessRestrictionType;\r
@@ -25,13 +26,14 @@ import com.gitblit.Constants.AuthorizationControl;
 import com.gitblit.GitBlitException;\r
 import com.gitblit.IStoredSettings;\r
 import com.gitblit.Keys;\r
+import com.gitblit.manager.IAuthenticationManager;\r
 import com.gitblit.manager.IFederationManager;\r
+import com.gitblit.manager.IRepositoryManager;\r
+import com.gitblit.manager.IRuntimeManager;\r
 import com.gitblit.models.RepositoryModel;\r
 import com.gitblit.models.UserModel;\r
 import com.gitblit.utils.StringUtils;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * The GitFilter is an AccessRestrictionFilter which ensures that Git client\r
  * requests for push, clone, or view restricted repositories are authenticated\r
@@ -40,6 +42,7 @@ import dagger.ObjectGraph;
  * @author James Moger\r
  *\r
  */\r
+@Singleton\r
 public class GitFilter extends AccessRestrictionFilter {\r
 \r
        protected static final String gitReceivePack = "/git-receive-pack";\r
@@ -53,11 +56,18 @@ public class GitFilter extends AccessRestrictionFilter {
 \r
        private IFederationManager federationManager;\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger, FilterConfig filterConfig) {\r
-               super.inject(dagger, filterConfig);\r
-               this.settings = dagger.get(IStoredSettings.class);\r
-               this.federationManager = dagger.get(IFederationManager.class);\r
+       @Inject\r
+       public GitFilter(\r
+                       IStoredSettings settings,\r
+                       IRuntimeManager runtimeManager,\r
+                       IAuthenticationManager authenticationManager,\r
+                       IRepositoryManager repositoryManager,\r
+                       IFederationManager federationManager) {\r
+\r
+               super(runtimeManager, authenticationManager, repositoryManager);\r
+\r
+               this.settings = settings;\r
+               this.federationManager = federationManager;\r
        }\r
 \r
        /**\r
index 93fe31d0918f556886be029d79c581eca3974d84..e9c5242fbb439546d986b24457f9373c3c8e9045 100644 (file)
@@ -20,6 +20,8 @@ import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
 import java.io.IOException;\r
 import java.util.Enumeration;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.FilterChain;\r
 import javax.servlet.FilterConfig;\r
 import javax.servlet.ServletConfig;\r
@@ -33,14 +35,11 @@ import javax.servlet.http.HttpServletResponse;
 \r
 import org.eclipse.jgit.http.server.GitFilter;\r
 \r
-import com.gitblit.dagger.DaggerContext;\r
 import com.gitblit.git.GitblitReceivePackFactory;\r
 import com.gitblit.git.GitblitUploadPackFactory;\r
 import com.gitblit.git.RepositoryResolver;\r
 import com.gitblit.manager.IGitblit;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * The GitServlet provides http/https access to Git repositories.\r
  * Access to this servlet is protected by the GitFilter.\r
@@ -48,24 +47,23 @@ import dagger.ObjectGraph;
  * @author James Moger\r
  *\r
  */\r
+@Singleton\r
 public class GitServlet extends HttpServlet {\r
 \r
        private static final long serialVersionUID = 1L;\r
 \r
        private final GitFilter gitFilter;\r
 \r
-       public GitServlet() {\r
+       @Inject\r
+       public GitServlet(IGitblit gitblit) {\r
                gitFilter = new GitFilter();\r
+               gitFilter.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>(gitblit));\r
+               gitFilter.setUploadPackFactory(new GitblitUploadPackFactory<HttpServletRequest>(gitblit));\r
+               gitFilter.setReceivePackFactory(new GitblitReceivePackFactory<HttpServletRequest>(gitblit));\r
        }\r
 \r
        @Override\r
        public void init(final ServletConfig config) throws ServletException {\r
-               ServletContext context = config.getServletContext();\r
-               ObjectGraph dagger = (ObjectGraph) context.getAttribute(DaggerContext.INJECTOR_NAME);\r
-               IGitblit gitblit = dagger.get(IGitblit.class);\r
-               gitFilter.setRepositoryResolver(new RepositoryResolver<HttpServletRequest>(gitblit));\r
-               gitFilter.setUploadPackFactory(new GitblitUploadPackFactory<HttpServletRequest>(gitblit));\r
-               gitFilter.setReceivePackFactory(new GitblitReceivePackFactory<HttpServletRequest>(gitblit));\r
 \r
                gitFilter.init(new FilterConfig() {\r
                        @Override\r
index 4378c8a6f170083d07dec52a4bd23e2a9ce13322..abc0f29254cdcf71d1373f6cd358327a3333c5ae 100644 (file)
@@ -21,6 +21,7 @@ import java.lang.reflect.Type;
 import java.text.MessageFormat;\r
 \r
 import javax.servlet.ServletException;\r
+import javax.servlet.http.HttpServlet;\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.servlet.http.HttpServletResponse;\r
 \r
@@ -28,7 +29,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;\r
 \r
 import com.gitblit.Constants;\r
-import com.gitblit.dagger.DaggerServlet;\r
 import com.gitblit.utils.JsonUtils;\r
 import com.gitblit.utils.StringUtils;\r
 \r
@@ -38,7 +38,7 @@ import com.gitblit.utils.StringUtils;
  * @author James Moger\r
  *\r
  */\r
-public abstract class JsonServlet extends DaggerServlet {\r
+public abstract class JsonServlet extends HttpServlet {\r
 \r
        private static final long serialVersionUID = 1L;\r
 \r
index 96f34afd06a64c02ac8c0b2d5568ca4d777ef12f..489e98b24e470f9767ee9dc31d4e8e6aa5f9eda8 100644 (file)
@@ -21,24 +21,25 @@ import java.io.IOException;
 import java.io.InputStream;\r
 import java.io.OutputStream;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.ServletContext;\r
 import javax.servlet.ServletException;\r
+import javax.servlet.http.HttpServlet;\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.servlet.http.HttpServletResponse;\r
 \r
 import com.gitblit.Keys;\r
-import com.gitblit.dagger.DaggerServlet;\r
 import com.gitblit.manager.IRuntimeManager;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * Handles requests for logo.png\r
  *\r
  * @author James Moger\r
  *\r
  */\r
-public class LogoServlet extends DaggerServlet {\r
+@Singleton\r
+public class LogoServlet extends HttpServlet {\r
 \r
        private static final long serialVersionUID = 1L;\r
 \r
@@ -46,9 +47,9 @@ public class LogoServlet extends DaggerServlet {
 \r
        private IRuntimeManager runtimeManager;\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger) {\r
-               this.runtimeManager = dagger.get(IRuntimeManager.class);\r
+       @Inject\r
+       public LogoServlet(IRuntimeManager runtimeManager) {\r
+               this.runtimeManager = runtimeManager;\r
        }\r
 \r
        @Override\r
index e07d9b3b420ef35db77064de3ccbd52405c49446..fa8c9abe2b6f9c175eee941d86bc6856e0add455 100644 (file)
  */\r
 package com.gitblit.servlet;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
+\r
+import com.gitblit.manager.IAuthenticationManager;\r
+import com.gitblit.manager.IRepositoryManager;\r
+import com.gitblit.manager.IRuntimeManager;\r
+\r
 \r
 /**\r
  * The PagesFilter is an AccessRestrictionFilter which ensures the gh-pages\r
@@ -23,7 +30,17 @@ package com.gitblit.servlet;
  * @author James Moger\r
  *\r
  */\r
+\r
+@Singleton\r
 public class PagesFilter extends RawFilter {\r
 \r
+       @Inject\r
+       public PagesFilter(\r
+                       IRuntimeManager runtimeManager,\r
+                       IAuthenticationManager authenticationManager,\r
+                       IRepositoryManager repositoryManager) {\r
+\r
+               super(runtimeManager, authenticationManager, repositoryManager);\r
+       }\r
 \r
 }\r
index f578f86f59b1e703eaa5af11cb1cb74b60d1b2cd..4cf43024071f70892d3041ff07d963b442f6da8f 100644 (file)
  */\r
 package com.gitblit.servlet;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.servlet.http.HttpServletResponse;\r
 \r
 import com.gitblit.Constants;\r
+import com.gitblit.manager.IRepositoryManager;\r
+import com.gitblit.manager.IRuntimeManager;\r
 \r
 /**\r
  * Serves the content of a gh-pages branch.\r
@@ -26,6 +30,7 @@ import com.gitblit.Constants;
  * @author James Moger\r
  *\r
  */\r
+@Singleton\r
 public class PagesServlet extends RawServlet {\r
 \r
        private static final long serialVersionUID = 1L;\r
@@ -46,6 +51,14 @@ public class PagesServlet extends RawServlet {
                return baseURL + Constants.PAGES + repository + "/" + (path == null ? "" : ("/" + path));\r
        }\r
 \r
+       @Inject\r
+       public PagesServlet(\r
+                       IRuntimeManager runtimeManager,\r
+                       IRepositoryManager repositoryManager) {\r
+\r
+               super(runtimeManager, repositoryManager);\r
+       }\r
+\r
        @Override\r
        protected String getBranch(String repository, HttpServletRequest request) {\r
                return "gh-pages";\r
index 46f59de92fd40fe3e266ea82c74dde5a31345fe8..778c818732497284bd4454e9db3cad560f74ea00 100644 (file)
 package com.gitblit.servlet;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
 import javax.servlet.ServletException;
@@ -27,13 +31,10 @@ import javax.servlet.ServletResponse;
 
 import ro.fortsoft.pf4j.PluginWrapper;
 
-import com.gitblit.dagger.DaggerFilter;
 import com.gitblit.extensions.HttpRequestFilter;
 import com.gitblit.manager.IPluginManager;
 import com.gitblit.manager.IRuntimeManager;
 
-import dagger.ObjectGraph;
-
 /**
  * A request filter than allows registered extension request filters to access
  * request data.  The intended purpose is for server monitoring plugins.
@@ -41,15 +42,29 @@ import dagger.ObjectGraph;
  * @author David Ostrovsky
  * @since 1.6.0
  */
-public class ProxyFilter extends DaggerFilter {
-       private List<HttpRequestFilter> filters;
+@Singleton
+public class ProxyFilter implements Filter {
+       private final IRuntimeManager runtimeManager;
+
+       private final IPluginManager pluginManager;
+
+       private final List<HttpRequestFilter> filters;
+
+       @Inject
+       public ProxyFilter(
+                       IRuntimeManager runtimeManager,
+                       IPluginManager pluginManager) {
+
+               this.runtimeManager = runtimeManager;
+               this.pluginManager = pluginManager;
+               this.filters = new ArrayList<>();
+
+       }
 
        @Override
-       protected void inject(ObjectGraph dagger, FilterConfig filterConfig) throws ServletException {
-               IRuntimeManager runtimeManager = dagger.get(IRuntimeManager.class);
-               IPluginManager pluginManager = dagger.get(IPluginManager.class);
+       public void init(FilterConfig filterConfig) throws ServletException {
 
-               filters = pluginManager.getExtensions(HttpRequestFilter.class);
+               filters.addAll(pluginManager.getExtensions(HttpRequestFilter.class));
                for (HttpRequestFilter f : filters) {
                        // wrap the filter config for Gitblit settings retrieval
                        PluginWrapper pluginWrapper = pluginManager.whichPlugin(f.getClass());
index e9cbaa5beb6ac4fedb417ce196e8214df2ae0a8d..65d3de17aef64ea51823aa68570fa838416e33b6 100644 (file)
@@ -21,7 +21,10 @@ import java.io.IOException;
 import java.io.InputStream;\r
 import java.io.OutputStream;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.ServletException;\r
+import javax.servlet.http.HttpServlet;\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.servlet.http.HttpServletResponse;\r
 \r
@@ -34,11 +37,8 @@ import org.apache.commons.compress.compressors.CompressorStreamFactory;
 import org.apache.wicket.util.io.ByteArrayOutputStream;\r
 import org.eclipse.jgit.lib.FileMode;\r
 \r
-import com.gitblit.dagger.DaggerServlet;\r
 import com.gitblit.manager.IRuntimeManager;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * Handles requests for the Barnum pt (patchset tool).\r
  *\r
@@ -47,7 +47,8 @@ import dagger.ObjectGraph;
  * @author James Moger\r
  *\r
  */\r
-public class PtServlet extends DaggerServlet {\r
+@Singleton\r
+public class PtServlet extends HttpServlet {\r
 \r
        private static final long serialVersionUID = 1L;\r
 \r
@@ -55,9 +56,9 @@ public class PtServlet extends DaggerServlet {
 \r
        private IRuntimeManager runtimeManager;\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger) {\r
-               this.runtimeManager = dagger.get(IRuntimeManager.class);\r
+       @Inject\r
+       public PtServlet(IRuntimeManager runtimeManager) {\r
+               this.runtimeManager = runtimeManager;\r
        }\r
 \r
        @Override\r
index 34989c986d2496bc0392e3d111792f9b64e4da83..7dddd9b7d0e2c5719a02f9a48abdf7b871120096 100644 (file)
  */\r
 package com.gitblit.servlet;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
+\r
 import org.eclipse.jgit.lib.Repository;\r
 \r
 import com.gitblit.Constants.AccessRestrictionType;\r
+import com.gitblit.manager.IAuthenticationManager;\r
+import com.gitblit.manager.IRepositoryManager;\r
+import com.gitblit.manager.IRuntimeManager;\r
 import com.gitblit.models.RepositoryModel;\r
 import com.gitblit.models.UserModel;\r
 \r
@@ -28,8 +34,18 @@ import com.gitblit.models.UserModel;
  * @author James Moger\r
  *\r
  */\r
+@Singleton\r
 public class RawFilter extends AccessRestrictionFilter {\r
 \r
+       @Inject\r
+       public RawFilter(\r
+                       IRuntimeManager runtimeManager,\r
+                       IAuthenticationManager authenticationManager,\r
+                       IRepositoryManager repositoryManager) {\r
+\r
+               super(runtimeManager, authenticationManager, repositoryManager);\r
+       }\r
+\r
        /**\r
         * Extract the repository name from the url.\r
         *\r
index 0def062ab7942a33189fd975279cd7b08f72b9eb..d856ef89e1cc2265836367830dbc9421986b55fe 100644 (file)
@@ -28,8 +28,11 @@ import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -48,7 +51,6 @@ import org.slf4j.LoggerFactory;
 
 import com.gitblit.Constants;
 import com.gitblit.Keys;
-import com.gitblit.dagger.DaggerServlet;
 import com.gitblit.manager.IRepositoryManager;
 import com.gitblit.manager.IRuntimeManager;
 import com.gitblit.models.PathModel;
@@ -57,28 +59,30 @@ import com.gitblit.utils.JGitUtils;
 import com.gitblit.utils.MarkdownUtils;
 import com.gitblit.utils.StringUtils;
 
-import dagger.ObjectGraph;
-
 /**
  * Serves the content of a branch.
  *
  * @author James Moger
  *
  */
-public class RawServlet extends DaggerServlet {
+@Singleton
+public class RawServlet extends HttpServlet {
 
        private static final long serialVersionUID = 1L;
 
        private transient Logger logger = LoggerFactory.getLogger(RawServlet.class);
 
-       private IRuntimeManager runtimeManager;
+       private final IRuntimeManager runtimeManager;
 
-       private IRepositoryManager repositoryManager;
+       private final IRepositoryManager repositoryManager;
 
-       @Override
-       protected void inject(ObjectGraph dagger) {
-               this.runtimeManager = dagger.get(IRuntimeManager.class);
-               this.repositoryManager = dagger.get(IRepositoryManager.class);
+       @Inject
+       public RawServlet(
+                       IRuntimeManager runtimeManager,
+                       IRepositoryManager repositoryManager) {
+
+               this.runtimeManager = runtimeManager;
+               this.repositoryManager = repositoryManager;
        }
 
        /**
index 9bd3b3c39449793732378832ceab53f9b9a1f900..e08c6bbd987ac3cba50a304511bbc310ac493345 100644 (file)
@@ -18,32 +18,33 @@ package com.gitblit.servlet;
 import java.io.File;\r
 import java.io.IOException;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.ServletException;\r
+import javax.servlet.http.HttpServlet;\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.servlet.http.HttpServletResponse;\r
 \r
 import com.gitblit.Keys;\r
-import com.gitblit.dagger.DaggerServlet;\r
 import com.gitblit.manager.IRuntimeManager;\r
 import com.gitblit.utils.FileUtils;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * Handles requests for robots.txt\r
  *\r
  * @author James Moger\r
  *\r
  */\r
-public class RobotsTxtServlet extends DaggerServlet {\r
+@Singleton\r
+public class RobotsTxtServlet extends HttpServlet {\r
 \r
        private static final long serialVersionUID = 1L;\r
 \r
        private IRuntimeManager runtimeManager;\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger) {\r
-               this.runtimeManager = dagger.get(IRuntimeManager.class);\r
+       @Inject\r
+       public RobotsTxtServlet(IRuntimeManager runtimeManager) {\r
+               this.runtimeManager = runtimeManager;\r
        }\r
 \r
        @Override\r
index 23bf956e6fe9a37b95377a2d8901b619c556c4df..73f9dcb32b5aaf85531f8e3c86e37777e4bff3af 100644 (file)
@@ -18,8 +18,9 @@ package com.gitblit.servlet;
 import java.io.IOException;\r
 import java.text.MessageFormat;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.FilterChain;\r
-import javax.servlet.FilterConfig;\r
 import javax.servlet.ServletException;\r
 import javax.servlet.ServletRequest;\r
 import javax.servlet.ServletResponse;\r
@@ -29,11 +30,10 @@ import javax.servlet.http.HttpServletResponse;
 import com.gitblit.Constants.RpcRequest;\r
 import com.gitblit.IStoredSettings;\r
 import com.gitblit.Keys;\r
+import com.gitblit.manager.IAuthenticationManager;\r
 import com.gitblit.manager.IRuntimeManager;\r
 import com.gitblit.models.UserModel;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * The RpcFilter is a servlet filter that secures the RpcServlet.\r
  *\r
@@ -47,17 +47,23 @@ import dagger.ObjectGraph;
  * @author James Moger\r
  *\r
  */\r
+@Singleton\r
 public class RpcFilter extends AuthenticationFilter {\r
 \r
        private IStoredSettings settings;\r
 \r
        private IRuntimeManager runtimeManager;\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger, FilterConfig filterConfig) {\r
-               super.inject(dagger, filterConfig);\r
-               this.settings = dagger.get(IStoredSettings.class);\r
-               this.runtimeManager = dagger.get(IRuntimeManager.class);\r
+       @Inject\r
+       public RpcFilter(\r
+                       IStoredSettings settings,\r
+                       IRuntimeManager runtimeManager,\r
+                       IAuthenticationManager authenticationManager) {\r
+\r
+               super(authenticationManager);\r
+\r
+               this.settings = settings;\r
+               this.runtimeManager = runtimeManager;\r
        }\r
 \r
        /**\r
index b8cdfb04794adbb3874fb03fd67fafe8b021bf89..aaf7d5fb88c8d8109e7104f742bb485f17d8505e 100644 (file)
@@ -23,6 +23,8 @@ import java.util.HashMap;
 import java.util.List;\r
 import java.util.Map;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.ServletException;\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.servlet.http.HttpServletResponse;\r
@@ -47,13 +49,12 @@ import com.gitblit.utils.JGitUtils;
 import com.gitblit.utils.RpcUtils;\r
 import com.gitblit.utils.StringUtils;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * Handles remote procedure calls.\r
  *\r
  * @author James Moger\r
  */\r
+@Singleton\r
 public class RpcServlet extends JsonServlet {\r
 \r
        private static final long serialVersionUID = 1L;\r
@@ -64,10 +65,10 @@ public class RpcServlet extends JsonServlet {
 \r
        private IGitblit gitblit;\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger) {\r
-               this.settings = dagger.get(IStoredSettings.class);\r
-               this.gitblit = dagger.get(IGitblit.class);\r
+       @Inject\r
+       public RpcServlet(IStoredSettings settings, IGitblit gitblit) {\r
+               this.settings = settings;\r
+               this.gitblit = gitblit;\r
        }\r
 \r
        /**\r
index 150dd68a14cbe0695cd10304c04521f8ee2e01b4..e596cfd3d5e57275f3ab55b3aec989971629c762 100644 (file)
@@ -19,13 +19,15 @@ import java.io.IOException;
 import java.net.URL;\r
 import java.text.MessageFormat;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.ServletException;\r
+import javax.servlet.http.HttpServlet;\r
 import javax.servlet.http.HttpServletRequest;\r
 import javax.servlet.http.HttpServletResponse;\r
 \r
 import com.gitblit.IStoredSettings;\r
 import com.gitblit.Keys;\r
-import com.gitblit.dagger.DaggerServlet;\r
 import com.gitblit.manager.IAuthenticationManager;\r
 import com.gitblit.manager.IRepositoryManager;\r
 import com.gitblit.manager.IUserManager;\r
@@ -33,15 +35,14 @@ import com.gitblit.models.RepositoryModel;
 import com.gitblit.models.UserModel;\r
 import com.gitblit.utils.StringUtils;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * Handles requests for Sparkleshare Invites\r
  *\r
  * @author James Moger\r
  *\r
  */\r
-public class SparkleShareInviteServlet extends DaggerServlet {\r
+@Singleton\r
+public class SparkleShareInviteServlet extends HttpServlet {\r
 \r
        private static final long serialVersionUID = 1L;\r
 \r
@@ -53,12 +54,17 @@ public class SparkleShareInviteServlet extends DaggerServlet {
 \r
        private IRepositoryManager repositoryManager;\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger) {\r
-               this.settings = dagger.get(IStoredSettings.class);\r
-               this.userManager = dagger.get(IUserManager.class);\r
-               this.authenticationManager = dagger.get(IAuthenticationManager.class);\r
-               this.repositoryManager = dagger.get(IRepositoryManager.class);\r
+       @Inject\r
+       public SparkleShareInviteServlet(\r
+                       IStoredSettings settings,\r
+                       IUserManager userManager,\r
+                       IAuthenticationManager authenticationManager,\r
+                       IRepositoryManager repositoryManager) {\r
+\r
+               this.settings = settings;\r
+               this.userManager = userManager;\r
+               this.authenticationManager = authenticationManager;\r
+               this.repositoryManager = repositoryManager;\r
        }\r
 \r
        @Override\r
index 78da47e92a2a5d324c0eec8bc97c6b3d39164957..3b9753fa64a0885eb7e491903cbac9d8891b807a 100644 (file)
@@ -18,8 +18,9 @@ package com.gitblit.servlet;
 import java.io.IOException;\r
 import java.text.MessageFormat;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.FilterChain;\r
-import javax.servlet.FilterConfig;\r
 import javax.servlet.ServletException;\r
 import javax.servlet.ServletRequest;\r
 import javax.servlet.ServletResponse;\r
@@ -27,6 +28,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;\r
 \r
 import com.gitblit.Constants.AccessRestrictionType;\r
+import com.gitblit.manager.IAuthenticationManager;\r
 import com.gitblit.manager.IProjectManager;\r
 import com.gitblit.manager.IRepositoryManager;\r
 import com.gitblit.manager.IRuntimeManager;\r
@@ -34,8 +36,6 @@ import com.gitblit.models.ProjectModel;
 import com.gitblit.models.RepositoryModel;\r
 import com.gitblit.models.UserModel;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * The SyndicationFilter is an AuthenticationFilter which ensures that feed\r
  * requests for projects or view-restricted repositories have proper authentication\r
@@ -44,18 +44,24 @@ import dagger.ObjectGraph;
  * @author James Moger\r
  *\r
  */\r
+@Singleton\r
 public class SyndicationFilter extends AuthenticationFilter {\r
 \r
        private IRuntimeManager runtimeManager;\r
        private IRepositoryManager repositoryManager;\r
        private IProjectManager projectManager;\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger, FilterConfig filterConfig) {\r
-               super.inject(dagger, filterConfig);\r
-               this.runtimeManager = dagger.get(IRuntimeManager.class);\r
-               this.repositoryManager = dagger.get(IRepositoryManager.class);\r
-               this.projectManager = dagger.get(IProjectManager.class);\r
+       @Inject\r
+       public SyndicationFilter(\r
+                       IRuntimeManager runtimeManager,\r
+                       IAuthenticationManager authenticationManager,\r
+                       IRepositoryManager repositoryManager,\r
+                       IProjectManager projectManager) {\r
+               super(authenticationManager);\r
+\r
+               this.runtimeManager = runtimeManager;\r
+               this.repositoryManager = repositoryManager;\r
+               this.projectManager = projectManager;\r
        }\r
 \r
        /**\r
index 631df781584109ef5322e20013eecd404c63fa8b..c48f25f9a47b4bd59f98dbc0bf022ad6bc53e06a 100644 (file)
@@ -22,6 +22,10 @@ import java.util.Collections;
 import java.util.List;\r
 import java.util.Map;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
+import javax.servlet.http.HttpServlet;\r
+\r
 import org.eclipse.jgit.lib.ObjectId;\r
 import org.eclipse.jgit.lib.Repository;\r
 import org.eclipse.jgit.revwalk.RevCommit;\r
@@ -31,7 +35,6 @@ import org.slf4j.LoggerFactory;
 import com.gitblit.Constants;\r
 import com.gitblit.IStoredSettings;\r
 import com.gitblit.Keys;\r
-import com.gitblit.dagger.DaggerServlet;\r
 import com.gitblit.manager.IProjectManager;\r
 import com.gitblit.manager.IRepositoryManager;\r
 import com.gitblit.models.FeedEntryModel;\r
@@ -46,8 +49,6 @@ import com.gitblit.utils.JGitUtils;
 import com.gitblit.utils.StringUtils;\r
 import com.gitblit.utils.SyndicationUtils;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  * SyndicationServlet generates RSS 2.0 feeds and feed links.\r
  *\r
@@ -56,7 +57,8 @@ import dagger.ObjectGraph;
  * @author James Moger\r
  *\r
  */\r
-public class SyndicationServlet extends DaggerServlet {\r
+@Singleton\r
+public class SyndicationServlet extends HttpServlet {\r
 \r
        private static final long serialVersionUID = 1L;\r
 \r
@@ -68,11 +70,15 @@ public class SyndicationServlet extends DaggerServlet {
 \r
        private IProjectManager projectManager;\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger) {\r
-               this.settings = dagger.get(IStoredSettings.class);\r
-               this.repositoryManager = dagger.get(IRepositoryManager.class);\r
-               this.projectManager = dagger.get(IProjectManager.class);\r
+       @Inject\r
+       public SyndicationServlet(\r
+                       IStoredSettings settings,\r
+                       IRepositoryManager repositoryManager,\r
+                       IProjectManager projectManager) {\r
+\r
+               this.settings = settings;\r
+               this.repositoryManager = repositoryManager;\r
+               this.projectManager = projectManager;\r
        }\r
 \r
        /**\r
index f63ff3d9499d460aedeadda8eaaca9f4d8a7b32d..e5b6550858065b8998a3d519ce18934198cfeb6e 100644 (file)
@@ -21,6 +21,9 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.TimeZone;
 
+import javax.inject.Inject;
+import javax.inject.Singleton;
+
 import org.apache.wicket.Application;
 import org.apache.wicket.Request;
 import org.apache.wicket.Response;
@@ -90,6 +93,7 @@ import com.gitblit.wicket.pages.TreePage;
 import com.gitblit.wicket.pages.UserPage;
 import com.gitblit.wicket.pages.UsersPage;
 
+@Singleton
 public class GitBlitWebApp extends WebApplication implements GitblitWicketApp {
 
        private final Class<? extends WebPage> homePageClass = MyDashboardPage.class;
@@ -120,6 +124,7 @@ public class GitBlitWebApp extends WebApplication implements GitblitWicketApp {
 
        private final IGitblit gitblit;
 
+       @Inject
        public GitBlitWebApp(
                        IRuntimeManager runtimeManager,
                        IPluginManager pluginManager,
index 7865fb3b007679a21aed1b5505556b05da49227b..72adbf513091f59f69c7a4edcdd14c972597b873 100644 (file)
@@ -17,6 +17,8 @@ package com.gitblit.wicket;
 \r
 import java.util.Date;\r
 \r
+import javax.inject.Inject;\r
+import javax.inject.Singleton;\r
 import javax.servlet.http.HttpServletRequest;\r
 \r
 import org.apache.wicket.protocol.http.IWebApplicationFactory;\r
@@ -28,7 +30,6 @@ import org.eclipse.jgit.revwalk.RevCommit;
 \r
 import com.gitblit.IStoredSettings;\r
 import com.gitblit.Keys;\r
-import com.gitblit.dagger.DaggerWicketFilter;\r
 import com.gitblit.manager.IProjectManager;\r
 import com.gitblit.manager.IRepositoryManager;\r
 import com.gitblit.manager.IRuntimeManager;\r
@@ -37,8 +38,6 @@ import com.gitblit.models.RepositoryModel;
 import com.gitblit.utils.JGitUtils;\r
 import com.gitblit.utils.StringUtils;\r
 \r
-import dagger.ObjectGraph;\r
-\r
 /**\r
  *\r
  * Customization of the WicketFilter to allow smart browser-side caching of\r
@@ -47,7 +46,8 @@ import dagger.ObjectGraph;
  * @author James Moger\r
  *\r
  */\r
-public class GitblitWicketFilter extends DaggerWicketFilter {\r
+@Singleton\r
+public class GitblitWicketFilter extends WicketFilter {\r
 \r
        private IStoredSettings settings;\r
 \r
@@ -59,13 +59,19 @@ public class GitblitWicketFilter extends DaggerWicketFilter {
 \r
        private GitBlitWebApp webapp;\r
 \r
-       @Override\r
-       protected void inject(ObjectGraph dagger) {\r
-               this.settings = dagger.get(IStoredSettings.class);\r
-               this.runtimeManager = dagger.get(IRuntimeManager.class);\r
-               this.repositoryManager = dagger.get(IRepositoryManager.class);\r
-               this.projectManager = dagger.get(IProjectManager.class);\r
-               this.webapp = dagger.get(GitBlitWebApp.class);\r
+       @Inject\r
+       public GitblitWicketFilter(\r
+                       IStoredSettings settings,\r
+                       IRuntimeManager runtimeManager,\r
+                       IRepositoryManager repositoryManager,\r
+                       IProjectManager projectManager,\r
+                       GitBlitWebApp webapp) {\r
+\r
+               this.settings = settings;\r
+               this.runtimeManager = runtimeManager;\r
+               this.repositoryManager = repositoryManager;\r
+               this.projectManager = projectManager;\r
+               this.webapp = webapp;\r
        }\r
 \r
        @Override\r