]> source.dussan.org Git - gitblit.git/commitdiff
Do not use @Inject on the ticket service constructors
authorJames Moger <james.moger@gitblit.com>
Thu, 6 Mar 2014 23:02:42 +0000 (18:02 -0500)
committerJames Moger <james.moger@gitblit.com>
Thu, 6 Mar 2014 23:02:42 +0000 (18:02 -0500)
src/main/java/com/gitblit/GitBlit.java
src/main/java/com/gitblit/tickets/BranchTicketService.java
src/main/java/com/gitblit/tickets/FileTicketService.java
src/main/java/com/gitblit/tickets/NullTicketService.java
src/main/java/com/gitblit/tickets/RedisTicketService.java

index a1abfcd16dd33f5dad412b37cd4edb02dede1b5e..b706874ac9bd4a06675045a7d01d0c79871e658e 100644 (file)
@@ -205,7 +205,9 @@ public class GitBlit extends GitblitManager {
                try {
                        Class<? extends ITicketService> serviceClass = (Class<? extends ITicketService>) Class.forName(clazz);
                        ticketService = injector.get(serviceClass).start();
-                       if (ticketService.isReady()) {
+                       if (ticketService instanceof NullTicketService) {
+                               logger.warn("No ticket service configured.");
+                       } else if (ticketService.isReady()) {
                                logger.info("{} is ready.", ticketService);
                        } else {
                                logger.warn("{} is disabled.", ticketService);
@@ -284,5 +286,37 @@ public class GitBlit extends GitblitManager {
                @Provides @Singleton IGitblit provideGitblit() {
                        return GitBlit.this;
                }
+
+               @Provides @Singleton NullTicketService provideNullTicketService() {
+                       return new NullTicketService(
+                                       runtimeManager,
+                                       notificationManager,
+                                       userManager,
+                                       repositoryManager);
+               }
+
+               @Provides @Singleton FileTicketService provideFileTicketService() {
+                       return new FileTicketService(
+                                       runtimeManager,
+                                       notificationManager,
+                                       userManager,
+                                       repositoryManager);
+               }
+
+               @Provides @Singleton BranchTicketService provideBranchTicketService() {
+                       return new BranchTicketService(
+                                       runtimeManager,
+                                       notificationManager,
+                                       userManager,
+                                       repositoryManager);
+               }
+
+               @Provides @Singleton RedisTicketService provideRedisTicketService() {
+                       return new RedisTicketService(
+                                       runtimeManager,
+                                       notificationManager,
+                                       userManager,
+                                       repositoryManager);
+               }
        }
 }
index fc0bd8f07b3aec2c98cc8e35b4933900fa104b5f..a25dac843db643e8119b2303980a69aab40b0648 100644 (file)
@@ -30,8 +30,6 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
 
-import javax.inject.Inject;
-
 import org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;
 import org.eclipse.jgit.api.errors.JGitInternalException;
 import org.eclipse.jgit.dircache.DirCache;
@@ -90,7 +88,6 @@ public class BranchTicketService extends ITicketService implements RefsChangedLi
 
        private final Map<String, AtomicLong> lastAssignedId;
 
-       @Inject
        public BranchTicketService(
                        IRuntimeManager runtimeManager,
                        INotificationManager notificationManager,
index 8375a2badf865867d2c865030433c4cbfefc753b..003f86ca9b60aa00c9de77c15ce91ad066c20f10 100644 (file)
@@ -25,8 +25,6 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
 
-import javax.inject.Inject;
-
 import org.eclipse.jgit.lib.Repository;
 
 import com.gitblit.Constants;
@@ -58,7 +56,6 @@ public class FileTicketService extends ITicketService {
 
        private final Map<String, AtomicLong> lastAssignedId;
 
-       @Inject
        public FileTicketService(
                        IRuntimeManager runtimeManager,
                        INotificationManager notificationManager,
index cc893025bf6e61c824d1bc7aa792361f0a6fa7c8..0ff33176c997fad3291bae52c82f63ba78f6bd97 100644 (file)
@@ -18,8 +18,6 @@ package com.gitblit.tickets;
 import java.util.Collections;
 import java.util.List;
 
-import javax.inject.Inject;
-
 import com.gitblit.manager.INotificationManager;
 import com.gitblit.manager.IRepositoryManager;
 import com.gitblit.manager.IRuntimeManager;
@@ -37,7 +35,6 @@ import com.gitblit.models.TicketModel.Change;
  */
 public class NullTicketService extends ITicketService {
 
-       @Inject
        public NullTicketService(
                        IRuntimeManager runtimeManager,
                        INotificationManager notificationManager,
index 5653f6986a3182b2a00b5de1ece7602ae34467b4..bc639da71516cdc9313a7eb498ac1dc4ec71c9ee 100644 (file)
@@ -21,8 +21,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Set;
 
-import javax.inject.Inject;
-
 import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
 
 import redis.clients.jedis.Client;
@@ -61,7 +59,6 @@ public class RedisTicketService extends ITicketService {
                journal, ticket, counter
        }
 
-       @Inject
        public RedisTicketService(
                        IRuntimeManager runtimeManager,
                        INotificationManager notificationManager,