| | |
| | | import com.gitblit.manager.RepositoryManager; |
| | | import com.gitblit.manager.RuntimeManager; |
| | | import com.gitblit.manager.UserManager; |
| | | import com.gitblit.transport.ssh.FileKeyManager; |
| | | import com.gitblit.transport.ssh.IPublicKeyManager; |
| | | import com.gitblit.transport.ssh.MemoryKeyManager; |
| | | import com.gitblit.transport.ssh.NullKeyManager; |
| | | import com.gitblit.utils.StringUtils; |
| | | import com.gitblit.wicket.GitBlitWebApp; |
| | | |
| | | import dagger.Module; |
| | |
| | | INotificationManager.class, |
| | | IUserManager.class, |
| | | IAuthenticationManager.class, |
| | | IPublicKeyManager.class, |
| | | IRepositoryManager.class, |
| | | IProjectManager.class, |
| | | IFederationManager.class, |
| | |
| | | |
| | | // the Gitblit Wicket app |
| | | GitBlitWebApp.class |
| | | } |
| | | } |
| | | ) |
| | | public class DaggerModule { |
| | | |
| | |
| | | return new AuthenticationManager( |
| | | runtimeManager, |
| | | userManager); |
| | | } |
| | | |
| | | @Provides @Singleton IPublicKeyManager providePublicKeyManager( |
| | | IStoredSettings settings, |
| | | IRuntimeManager runtimeManager) { |
| | | |
| | | String clazz = settings.getString(Keys.git.sshKeysManager, FileKeyManager.class.getName()); |
| | | if (StringUtils.isEmpty(clazz)) { |
| | | clazz = FileKeyManager.class.getName(); |
| | | } |
| | | if (FileKeyManager.class.getName().equals(clazz)) { |
| | | return new FileKeyManager(runtimeManager); |
| | | } else if (NullKeyManager.class.getName().equals(clazz)) { |
| | | return new NullKeyManager(); |
| | | } else if (MemoryKeyManager.class.getName().equals(clazz)) { |
| | | return new MemoryKeyManager(); |
| | | } else { |
| | | try { |
| | | Class<?> mgrClass = Class.forName(clazz); |
| | | return (IPublicKeyManager) mgrClass.newInstance(); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @Provides @Singleton IRepositoryManager provideRepositoryManager( |
| | |
| | | INotificationManager notificationManager, |
| | | IUserManager userManager, |
| | | IAuthenticationManager authenticationManager, |
| | | IPublicKeyManager publicKeyManager, |
| | | IRepositoryManager repositoryManager, |
| | | IProjectManager projectManager, |
| | | IFederationManager federationManager) { |
| | |
| | | notificationManager, |
| | | userManager, |
| | | authenticationManager, |
| | | publicKeyManager, |
| | | repositoryManager, |
| | | projectManager, |
| | | federationManager); |
| | |
| | | INotificationManager notificationManager, |
| | | IUserManager userManager, |
| | | IAuthenticationManager authenticationManager, |
| | | IPublicKeyManager publicKeyManager, |
| | | IRepositoryManager repositoryManager, |
| | | IProjectManager projectManager, |
| | | IFederationManager federationManager, |
| | |
| | | notificationManager, |
| | | userManager, |
| | | authenticationManager, |
| | | publicKeyManager, |
| | | repositoryManager, |
| | | projectManager, |
| | | federationManager, |