mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 10:16:16 +01:00
Add independent classes from ssh plugin
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
package sonia.scm.protocolcommand;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CommandContext {
|
||||||
|
|
||||||
|
private String command;
|
||||||
|
private String[] args;
|
||||||
|
|
||||||
|
private InputStream inputStream;
|
||||||
|
private OutputStream outputStream;
|
||||||
|
private OutputStream errorStream;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package sonia.scm.protocolcommand;
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface CommandParser {
|
||||||
|
|
||||||
|
String[] parse(String command);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package sonia.scm.protocolcommand;
|
||||||
|
|
||||||
|
import sonia.scm.repository.Repository;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public class RepositoryContext {
|
||||||
|
private Repository repository;
|
||||||
|
private Path directory;
|
||||||
|
|
||||||
|
public RepositoryContext(Repository repository, Path directory) {
|
||||||
|
this.repository = repository;
|
||||||
|
this.directory = directory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Repository getRepository() {
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Path getDirectory() {
|
||||||
|
return directory;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package sonia.scm.protocolcommand;
|
||||||
|
|
||||||
|
import sonia.scm.plugin.ExtensionPoint;
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
@ExtensionPoint
|
||||||
|
public interface RepositoryContextResolver {
|
||||||
|
|
||||||
|
RepositoryContext resolve(String[] args);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package sonia.scm.protocolcommand;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public interface ScmSshProtocol {
|
||||||
|
|
||||||
|
void handle(CommandContext context, RepositoryContext repositoryContext) throws IOException;
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user