import java.util.List;
import java.util.Set;
-import com.google.inject.Inject;
-
import com.gitblit.manager.GitblitManager;
import com.gitblit.manager.IAuthenticationManager;
import com.gitblit.manager.IFederationManager;
import com.gitblit.utils.StringUtils;
import com.google.inject.AbstractModule;
import com.google.inject.Guice;
+import com.google.inject.Inject;
import com.google.inject.Injector;
+import com.google.inject.Singleton;
/**
* GitBlit is the aggregate manager for the Gitblit webapp. It provides all
* @author James Moger
*
*/
+@Singleton
public class GitBlit extends GitblitManager {
private final Injector injector;
*/
package com.gitblit.guice;
-import com.google.inject.Singleton;
-
import com.gitblit.FileSettings;
import com.gitblit.GitBlit;
import com.gitblit.IStoredSettings;
bind(WorkQueue.class).toProvider(WorkQueueProvider.class);
// core managers
- bind(IRuntimeManager.class).to(RuntimeManager.class).in(Singleton.class);
- bind(IPluginManager.class).to(PluginManager.class).in(Singleton.class);
- bind(INotificationManager.class).to(NotificationManager.class).in(Singleton.class);
- bind(IUserManager.class).to(UserManager.class).in(Singleton.class);
- bind(IAuthenticationManager.class).to(AuthenticationManager.class).in(Singleton.class);
- bind(IRepositoryManager.class).to(RepositoryManager.class).in(Singleton.class);
- bind(IProjectManager.class).to(ProjectManager.class).in(Singleton.class);
- bind(IFederationManager.class).to(FederationManager.class).in(Singleton.class);
+ bind(IRuntimeManager.class).to(RuntimeManager.class);
+ bind(IPluginManager.class).to(PluginManager.class);
+ bind(INotificationManager.class).to(NotificationManager.class);
+ bind(IUserManager.class).to(UserManager.class);
+ bind(IAuthenticationManager.class).to(AuthenticationManager.class);
+ bind(IRepositoryManager.class).to(RepositoryManager.class);
+ bind(IProjectManager.class).to(ProjectManager.class);
+ bind(IFederationManager.class).to(FederationManager.class);
// the monolithic manager
- bind(IGitblit.class).to(GitBlit.class).in(Singleton.class);
+ bind(IGitblit.class).to(GitBlit.class);
// manager for long-running daemons and services
bind(IServicesManager.class).to(ServicesManager.class);
import java.util.Map;
import java.util.concurrent.TimeUnit;
-import com.google.inject.Inject;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.gitblit.utils.StringUtils;
import com.gitblit.utils.X509Utils.X509Metadata;
import com.gitblit.wicket.GitBlitWebSession;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
/**
* The authentication manager handles user login & logout.
* @author James Moger
*
*/
+@Singleton
public class AuthenticationManager implements IAuthenticationManager {
private final Logger logger = LoggerFactory.getLogger(getClass());
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import com.google.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import com.gitblit.utils.FederationUtils;
import com.gitblit.utils.JsonUtils;
import com.gitblit.utils.StringUtils;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
/**
* Federation manager controls all aspects of handling federation sets, tokens,
* @author James Moger
*
*/
+@Singleton
public class FederationManager implements IFederationManager {
private final Logger logger = LoggerFactory.getLogger(getClass());
import com.google.gson.JsonIOException;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
+import com.google.inject.Inject;
import com.google.inject.Injector;
+import com.google.inject.Singleton;
/**
* GitblitManager is an aggregate interface delegate. It implements all the manager
* @author James Moger
*
*/
+@Singleton
public class GitblitManager implements IGitblit {
protected final Logger logger = LoggerFactory.getLogger(getClass());
protected final IFederationManager federationManager;
+ @Inject
public GitblitManager(
IRuntimeManager runtimeManager,
IPluginManager pluginManager,
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import com.google.inject.Inject;
import javax.mail.Message;
import org.slf4j.Logger;
import com.gitblit.Keys;
import com.gitblit.models.Mailing;
import com.gitblit.service.MailService;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
/**
* The notification manager dispatches notifications. Currently, email is the
* @author James Moger
*
*/
+@Singleton
public class NotificationManager implements INotificationManager {
private final Logger logger = LoggerFactory.getLogger(getClass());
import java.util.Map;
import java.util.TreeMap;
-import com.google.inject.Inject;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.gitblit.utils.StringUtils;
import com.google.common.io.Files;
import com.google.common.io.InputSupplier;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
/**
* The plugin manager maintains the lifecycle of plugins. It is exposed as
* @author James Moger
*
*/
+@Singleton
public class PluginManager implements IPluginManager, PluginStateListener {
private final Logger logger = LoggerFactory.getLogger(getClass());
import java.util.TreeMap;
import java.util.concurrent.ConcurrentHashMap;
-import com.google.inject.Inject;
-
import org.eclipse.jgit.storage.file.FileBasedConfig;
import org.eclipse.jgit.util.FS;
import org.slf4j.Logger;
import com.gitblit.utils.ModelUtils;
import com.gitblit.utils.ObjectCache;
import com.gitblit.utils.StringUtils;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
/**
* Project manager handles project-related functions.
* @author James Moger
*
*/
+@Singleton
public class ProjectManager implements IProjectManager {
private final Logger logger = LoggerFactory.getLogger(getClass());
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
-import com.google.inject.Inject;
-
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryCache;
import org.eclipse.jgit.lib.RepositoryCache.FileKey;
import com.gitblit.utils.ObjectCache;
import com.gitblit.utils.StringUtils;
import com.gitblit.utils.TimeUtils;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
/**
* Repository manager creates, updates, deletes and caches git repositories. It
* @author James Moger
*
*/
+@Singleton
public class RepositoryManager implements IRepositoryManager {
private final Logger logger = LoggerFactory.getLogger(getClass());
import java.util.List;
import java.util.Map;
-import com.google.inject.Inject;
-
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.gitblit.models.TeamModel;
import com.gitblit.models.UserModel;
import com.gitblit.utils.StringUtils;
+import com.google.inject.Inject;
+import com.google.inject.Singleton;
/**
* The user manager manages persistence and retrieval of users and teams.
* @author James Moger
*
*/
+@Singleton
public class UserManager implements IUserManager {
private final Logger logger = LoggerFactory.getLogger(getClass());