Last active
March 27, 2017 19:42
-
-
Save noorulhaq/5cdf958c129fa42049c8f5afb12abb14 to your computer and use it in GitHub Desktop.
Unified VCS API for different version control systems.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package crossover; | |
import java.io.Serializable; | |
import java.util.Collection; | |
import java.util.Date; | |
import java.util.List; | |
import java.util.concurrent.Future; | |
/** | |
* Created by Noor on 3/26/17. | |
*/ | |
/** | |
* Unified VCS API | |
*/ | |
public interface VCService<R extends Serializable> { | |
public Future<Void> checkout(String location, String url, String username, String password); | |
public Collection<CommitLogEntry<R>> logs(String repo, int pageSize); | |
public Collection<CommitLogEntry<R>> logs(String repo, R fromRevision, int pageSize); | |
public Collection<CommitLogEntry<R>> logs(String repo, R fromRevision, R toRevision, int pageSize); | |
public Collection<CommitLogEntry<R>> logs(String repo, R fromRevision, String branch, int pageSize); | |
public Collection<CommitLogEntry<R>> logs(String repo, R fromRevision, R toRevision, String branch, int pageSize); | |
public CommitLogEntry show(String repo, R revision); | |
public List<DiffEntry> diffs(String repo,R fromRevision, R toRevision); | |
public DiffEntry diff(String repo,R fromRevision, R toRevision,String file); | |
public Future<byte[]> download(String repo, String filePath,R revision); | |
} | |
/** | |
* GIT Implementation draft | |
*/ | |
class GitVCService implements VCService<String> { | |
@Override | |
public Future<Void> checkout(String location, String url, String username, String password) { | |
return null; | |
} | |
@Override | |
public Collection<CommitLogEntry<String>> logs(String repo, int pageSize) { | |
return null; | |
} | |
@Override | |
public Collection<CommitLogEntry<String>> logs(String repo, String fromRevision, int pageSize) { | |
return null; | |
} | |
@Override | |
public Collection<CommitLogEntry<String>> logs(String repo, String fromRevision, String toRevision, int pageSize) { | |
return null; | |
} | |
@Override | |
public Collection<CommitLogEntry<String>> logs(String repo, String fromRevision, String toRevision, String branch, int pageSize) { | |
return null; | |
} | |
@Override | |
public CommitLogEntry show(String repo, String revision) { | |
return null; | |
} | |
@Override | |
public List<DiffEntry> diffs(String repo, String fromRevision, String toRevision) { | |
return null; | |
} | |
@Override | |
public DiffEntry diff(String repo, String fromRevision, String toRevision, String file) { | |
return null; | |
} | |
@Override | |
public Future<byte[]> download(String repo, String filePath, String revision) { | |
return null; | |
} | |
} | |
/** | |
* SVN Implementation draft | |
*/ | |
class SvnVCService implements VCService<Long> { | |
@Override | |
public Future<Void> checkout(String location, String url, String username, String password) { | |
throw new UnsupportedOperationException("As all enquiries for SVN are against remote repository. This operation is not supported for SVN."); | |
} | |
@Override | |
public Collection<CommitLogEntry<Long>> logs(String repo, int pageSize) { | |
return null; | |
} | |
@Override | |
public Collection<CommitLogEntry<Long>> logs(String repo, Long fromRevision, int pageSize) { | |
return null; | |
} | |
@Override | |
public Collection<CommitLogEntry<Long>> logs(String repo, Long fromRevision, Long toRevision, int pageSize) { | |
return null; | |
} | |
@Override | |
public Collection<CommitLogEntry<Long>> logs(String repo, Long fromRevision, String branch, int pageSize) { | |
return null; | |
} | |
@Override | |
public Collection<CommitLogEntry<Long>> logs(String repo, Long fromRevision, Long toRevision, String branch, int pageSize) { | |
return null; | |
} | |
@Override | |
public CommitLogEntry show(String repo, Long revision) { | |
return null; | |
} | |
@Override | |
public List<DiffEntry> diffs(String repo, Long fromRevision, Long toRevision) { | |
return null; | |
} | |
@Override | |
public DiffEntry diff(String repo, Long fromRevision, Long toRevision, String file) { | |
return null; | |
} | |
@Override | |
public Future<byte[]> download(String repo, String filePath, Long revision) { | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment