summaryrefslogtreecommitdiffstats
path: root/src/main/java/com/gitblit/manager/ServicesManager.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-02-22 16:19:03 -0500
committerJames Moger <james.moger@gitblit.com>2014-04-10 18:58:07 -0400
commit924c9b28edfda6582a5480a7c1a2dd5b3ce89d92 (patch)
treec7320fcbe678a622aeca0047135f5faca58ea093 /src/main/java/com/gitblit/manager/ServicesManager.java
parentaf816d3fdd18d6d7d1b2c854b70eb30be789d466 (diff)
downloadgitblit-924c9b28edfda6582a5480a7c1a2dd5b3ce89d92.tar.gz
gitblit-924c9b28edfda6582a5480a7c1a2dd5b3ce89d92.zip
Eliminate use of Dagger and do not create inner classes
This change outlines somethings I'd like to see in your latest code. 1. Elimination of Dagger 2. Less noise from inner class instantiation 3. Formalizing filesystem location for keys instead of Unix-y /tmp/ 4. Password authentication as alternative to Key authentication Change-Id: I7a76e1811ad7cd545444fd8b59bbe8c4f45ccfec
Diffstat (limited to 'src/main/java/com/gitblit/manager/ServicesManager.java')
-rw-r--r--src/main/java/com/gitblit/manager/ServicesManager.java57
1 files changed, 4 insertions, 53 deletions
diff --git a/src/main/java/com/gitblit/manager/ServicesManager.java b/src/main/java/com/gitblit/manager/ServicesManager.java
index 219e4ea5..df8918ed 100644
--- a/src/main/java/com/gitblit/manager/ServicesManager.java
+++ b/src/main/java/com/gitblit/manager/ServicesManager.java
@@ -24,13 +24,8 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
-import javax.inject.Named;
-import javax.inject.Singleton;
import javax.servlet.http.HttpServletRequest;
-import org.apache.sshd.server.Command;
-import org.eclipse.jgit.transport.resolver.ReceivePackFactory;
-import org.eclipse.jgit.transport.resolver.UploadPackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -43,26 +38,15 @@ import com.gitblit.fanout.FanoutNioService;
import com.gitblit.fanout.FanoutService;
import com.gitblit.fanout.FanoutSocketService;
import com.gitblit.git.GitDaemon;
-import com.gitblit.git.GitblitReceivePackFactory;
-import com.gitblit.git.GitblitUploadPackFactory;
-import com.gitblit.git.RepositoryResolver;
import com.gitblit.models.FederationModel;
import com.gitblit.models.RepositoryModel;
import com.gitblit.models.UserModel;
import com.gitblit.service.FederationPullService;
-import com.gitblit.transport.ssh.SshCommandFactory;
import com.gitblit.transport.ssh.SshDaemon;
-import com.gitblit.transport.ssh.SshSession;
-import com.gitblit.transport.ssh.commands.CreateRepository;
-import com.gitblit.transport.ssh.commands.VersionCommand;
import com.gitblit.utils.IdGenerator;
import com.gitblit.utils.StringUtils;
import com.gitblit.utils.TimeUtils;
-import dagger.Module;
-import dagger.ObjectGraph;
-import dagger.Provides;
-
/**
* Services manager manages long-running services/processes that either have no
* direct relation to other managers OR require really high-level manager
@@ -111,6 +95,9 @@ public class ServicesManager implements IManager {
if (gitDaemon != null) {
gitDaemon.stop();
}
+ if (sshDaemon != null) {
+ sshDaemon.stop();
+ }
return this;
}
@@ -164,7 +151,7 @@ public class ServicesManager implements IManager {
String bindInterface = settings.getString(Keys.git.sshBindInterface, "localhost");
if (port > 0) {
try {
- sshDaemon = ObjectGraph.create(new SshModule()).get(SshDaemon.class);
+ sshDaemon = new SshDaemon(gitblit, new IdGenerator());
sshDaemon.start();
} catch (IOException e) {
sshDaemon = null;
@@ -262,40 +249,4 @@ public class ServicesManager implements IManager {
}
}
-
- @Module(library = true,
- injects = {
- IGitblit.class,
- SshCommandFactory.class,
- SshDaemon.class,
- })
- public class SshModule {
- @Provides @Named("create-repository") Command provideCreateRepository() {
- return new CreateRepository();
- }
-
- @Provides @Named("version") Command provideVersion() {
- return new VersionCommand();
- }
-
- @Provides @Singleton IdGenerator provideIdGenerator() {
- return new IdGenerator();
- }
-
- @Provides @Singleton RepositoryResolver<SshSession> provideRepositoryResolver() {
- return new RepositoryResolver<SshSession>(provideGitblit());
- }
-
- @Provides @Singleton UploadPackFactory<SshSession> provideUploadPackFactory() {
- return new GitblitUploadPackFactory<SshSession>(provideGitblit());
- }
-
- @Provides @Singleton ReceivePackFactory<SshSession> provideReceivePackFactory() {
- return new GitblitReceivePackFactory<SshSession>(provideGitblit());
- }
-
- @Provides @Singleton IGitblit provideGitblit() {
- return ServicesManager.this.gitblit;
- }
- }
}