mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-05 11:50:58 +01:00
Wrap parser and handler into interpreter
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
package sonia.scm.protocolcommand;
|
||||
|
||||
import sonia.scm.plugin.ExtensionPoint;
|
||||
|
||||
@ExtensionPoint
|
||||
public interface CommandInterpreter {
|
||||
|
||||
boolean canHandle(String command);
|
||||
|
||||
CommandParser getParser();
|
||||
|
||||
ScmCommandProtocol getProtocolHandler();
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package sonia.scm.protocolcommand;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface CommandParser {
|
||||
|
||||
String[] parse(String command);
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
package sonia.scm.protocolcommand;
|
||||
|
||||
import sonia.scm.plugin.ExtensionPoint;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ExtensionPoint
|
||||
public interface ScmCommandProtocol {
|
||||
|
||||
boolean canHandle(RepositoryContext repositoryContext);
|
||||
|
||||
void handle(CommandContext context, RepositoryContext repositoryContext) throws IOException;
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import sonia.scm.plugin.Extension;
|
||||
import sonia.scm.protocolcommand.CommandContext;
|
||||
import sonia.scm.protocolcommand.RepositoryContext;
|
||||
import sonia.scm.protocolcommand.ScmCommandProtocol;
|
||||
import sonia.scm.repository.GitRepositoryHandler;
|
||||
import sonia.scm.repository.RepositoryPermissions;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -34,11 +33,6 @@ public class GitCommandProtocol implements ScmCommandProtocol {
|
||||
this.receivePackFactory = receivePackFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(RepositoryContext repositoryContext) {
|
||||
return GitRepositoryHandler.TYPE_NAME.equals(repositoryContext.getRepository().getType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(CommandContext commandContext, RepositoryContext repositoryContext) throws IOException {
|
||||
String subCommand = commandContext.getArgs()[0];
|
||||
|
||||
Reference in New Issue
Block a user