Add stub interface
This commit is contained in:
parent
e29f08c4f9
commit
1b2d540078
9 changed files with 160 additions and 0 deletions
13
src/main/java/net/kemitix/gitdb/Author.java
Normal file
13
src/main/java/net/kemitix/gitdb/Author.java
Normal file
|
@ -0,0 +1,13 @@
|
|||
package net.kemitix.gitdb;
|
||||
|
||||
import net.kemitix.mon.TypeAlias;
|
||||
|
||||
public class Author extends TypeAlias<String> {
|
||||
protected Author(String value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
public static Author name(final String name) {
|
||||
return new Author(name);
|
||||
}
|
||||
}
|
13
src/main/java/net/kemitix/gitdb/Branch.java
Normal file
13
src/main/java/net/kemitix/gitdb/Branch.java
Normal file
|
@ -0,0 +1,13 @@
|
|||
package net.kemitix.gitdb;
|
||||
|
||||
import net.kemitix.mon.TypeAlias;
|
||||
|
||||
public class Branch extends TypeAlias<String> {
|
||||
protected Branch(final String value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
static Branch name(final String name) {
|
||||
return new Branch(name);
|
||||
}
|
||||
}
|
18
src/main/java/net/kemitix/gitdb/Document.java
Normal file
18
src/main/java/net/kemitix/gitdb/Document.java
Normal file
|
@ -0,0 +1,18 @@
|
|||
package net.kemitix.gitdb;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class Document<T> {
|
||||
|
||||
public static <T> Document<T> create(Key key, T value) {
|
||||
return new Document<>(key, value);
|
||||
}
|
||||
|
||||
@Getter
|
||||
private final Key key;
|
||||
|
||||
@Getter
|
||||
private final T value;
|
||||
}
|
|
@ -4,6 +4,7 @@ import org.eclipse.jgit.api.errors.GitAPIException;
|
|||
import org.eclipse.jgit.lib.Repository;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public interface GitDB {
|
||||
|
||||
|
@ -16,4 +17,24 @@ public interface GitDB {
|
|||
Repository getRepository();
|
||||
|
||||
Path getGitDir();
|
||||
|
||||
String get(Branch branch, Key key);
|
||||
|
||||
<T> T get(Branch branch, Key key, Class<T> type);
|
||||
|
||||
Stream<String> getFiles(Branch branch, Key key);
|
||||
|
||||
<T> Stream<T> getFiles(Branch branch, Key key, Class<T> type);
|
||||
|
||||
<T> T save(Branch branch, Message message, Document<T> document, Author author);
|
||||
|
||||
String delete(Branch branch, Key key, Message message, Author author);
|
||||
|
||||
void tag(Reference reference);
|
||||
|
||||
void createBranch(Reference reference);
|
||||
|
||||
Stream<String> getAllBranches();
|
||||
|
||||
Transaction createTransaction(Branch branch);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.eclipse.jgit.api.errors.GitAPIException;
|
|||
import org.eclipse.jgit.lib.Repository;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class GitDBLocal implements GitDB {
|
||||
|
||||
|
@ -29,4 +30,55 @@ class GitDBLocal implements GitDB {
|
|||
public void close() {
|
||||
repository.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get(Branch branch, Key key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T get(Branch branch, Key key, Class<T> type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> getFiles(Branch branch, Key key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Stream<T> getFiles(Branch branch, Key key, Class<T> type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T save(Branch branch, Message message, Document<T> document, Author author) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String delete(Branch branch, Key key, Message message, Author author) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tag(Reference reference) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createBranch(Reference reference) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<String> getAllBranches() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transaction createTransaction(Branch branch) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
13
src/main/java/net/kemitix/gitdb/Key.java
Normal file
13
src/main/java/net/kemitix/gitdb/Key.java
Normal file
|
@ -0,0 +1,13 @@
|
|||
package net.kemitix.gitdb;
|
||||
|
||||
import net.kemitix.mon.TypeAlias;
|
||||
|
||||
public class Key extends TypeAlias<String> {
|
||||
protected Key(final String value) {
|
||||
super(value);
|
||||
}
|
||||
|
||||
public static Key name(final String name) {
|
||||
return new Key(name);
|
||||
}
|
||||
}
|
12
src/main/java/net/kemitix/gitdb/Message.java
Normal file
12
src/main/java/net/kemitix/gitdb/Message.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
package net.kemitix.gitdb;
|
||||
|
||||
import net.kemitix.mon.TypeAlias;
|
||||
|
||||
public class Message extends TypeAlias<String> {
|
||||
protected Message(final String value) {
|
||||
super(value);
|
||||
}
|
||||
public static Message message(final String message) {
|
||||
return new Message(message);
|
||||
}
|
||||
}
|
9
src/main/java/net/kemitix/gitdb/Reference.java
Normal file
9
src/main/java/net/kemitix/gitdb/Reference.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
package net.kemitix.gitdb;
|
||||
|
||||
import net.kemitix.mon.TypeAlias;
|
||||
|
||||
public class Reference extends TypeAlias<String> {
|
||||
protected Reference(String value) {
|
||||
super(value);
|
||||
}
|
||||
}
|
9
src/main/java/net/kemitix/gitdb/Transaction.java
Normal file
9
src/main/java/net/kemitix/gitdb/Transaction.java
Normal file
|
@ -0,0 +1,9 @@
|
|||
package net.kemitix.gitdb;
|
||||
|
||||
import net.kemitix.mon.TypeAlias;
|
||||
|
||||
public class Transaction extends TypeAlias<String> {
|
||||
protected Transaction(String value) {
|
||||
super(value);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue