本文整理汇总了Java中org.eclipse.egit.github.core.service.DataService类的典型用法代码示例。如果您正苦于以下问题:Java DataService类的具体用法?Java DataService怎么用?Java DataService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataService类属于org.eclipse.egit.github.core.service包,在下文中一共展示了DataService类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createBlob
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
protected static String createBlob(DataService service, RepositoryId repository, String prefix, String path)
throws Exception {
File file = new File(prefix, path);
final long length = file.length();
final int size = length > Integer.MAX_VALUE ? Integer.MAX_VALUE : (int) length;
ByteArrayOutputStream output = new ByteArrayOutputStream(size);
FileInputStream stream = new FileInputStream(file);
try {
final byte[] buffer = new byte[8192];
int read;
while ((read = stream.read(buffer)) != -1)
output.write(buffer, 0, read);
Blob blob = new Blob().setEncoding(Blob.ENCODING_BASE64);
String encoded = EncodingUtils.toBase64(output.toByteArray());
blob.setContent(encoded);
return service.createBlob(repository, blob);
} finally {
stream.close();
}
}
开发者ID:OnPositive,项目名称:aml,代码行数:22,代码来源:PublishHelper.java
示例2: onPreExecute
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
@Override
protected void onPreExecute() {
context = fragment.getContentView().getContext();
flag = fragment.getFlag();
adapter = fragment.getContentItemAdapter();
list = fragment.getContentItemList();
bookmark = fragment.getBookmark();
GitHubClient client = fragment.getClient();
dataService = new DataService(client);
owner = fragment.getOwner();
name = fragment.getName();
root = fragment.getRoot();
entry = fragment.getEntry();
if (flag == Flag.STAR_CONTENT_FIRST || flag == Flag.STAR_CONTENT_REFRESH) {
fragment.setContentEmpty(false);
fragment.setContentShown(false);
bookmark.setVisible(false);
}
}
开发者ID:mthli,项目名称:Bitocle,代码行数:23,代码来源:StarContentTask.java
示例3: onPreExecute
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
@Override
protected void onPreExecute() {
context = fragment.getContentView().getContext();
flag = fragment.getFlag();
adapter = fragment.getContentItemAdapter();
list = fragment.getContentItemList();
bookmark = fragment.getBookmark();
GitHubClient client = fragment.getClient();
dataService = new DataService(client);
owner = fragment.getOwner();
name = fragment.getName();
root = fragment.getRoot();
entry = fragment.getEntry();
if (flag == Flag.REPO_CONTENT_FIRST || flag == Flag.REPO_CONTENT_REFRESH) {
fragment.setContentEmpty(false);
fragment.setContentShown(false);
bookmark.setVisible(false);
}
}
开发者ID:mthli,项目名称:Bitocle,代码行数:23,代码来源:RepoContentTask.java
示例4: createTree
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
private Tree createTree(DataService service, RepositoryId repository, Reference ref, List<TreeEntry> entries) throws GitHubException {
try {
int size = entries.size();
log.info(String.format("Creating tree with %s blob entries", size));
String baseTree = null;
if (merge && ref != null) {
Tree currentTree = service.getCommit(repository, ref.getObject().getSha()).getTree();
if (currentTree != null){
baseTree = currentTree.getSha();
}
log.info(MessageFormat.format("Merging with tree {0}", baseTree));
}
return service.createTree(repository, entries, baseTree);
} catch (IOException e) {
throw new GitHubException("Error creating tree: " + e.getMessage(), e);
}
}
开发者ID:opoo,项目名称:opoopress,代码行数:20,代码来源:GitHub.java
示例5: createBlob
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
private String createBlob(DataService service, RepositoryId repository, File outputDirectory, String path) throws GitHubException {
try {
Blob blob = new Blob().setEncoding(ENCODING_BASE64);
if(NO_JEKYLL_FILE.equals(path)){
blob.setContent("");
//log.debug("Creating blob from " + NO_JEKYLL_FILE);
}else{
File file = new File(outputDirectory, path);
byte[] bytes = FileUtils.readFileToByteArray(file);
String encoded = EncodingUtils.toBase64(bytes);
blob.setContent(encoded);
//log.debug("Creating blob from " + file.getAbsolutePath());
}
if(log.isDebugEnabled()){
log.debug("Creating blob from " + path);
}
return service.createBlob(repository, blob);
} catch (IOException e) {
throw new GitHubException("Error creating blob from '" + path + "': " + e.getMessage(), e);
}
}
开发者ID:opoo,项目名称:opoopress,代码行数:22,代码来源:GitHub.java
示例6: getRepositoryRefs
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
private List<Reference> getRepositoryRefs(Repository repo,String accessToken) throws Exception
{
DataService dService=new DataService();
dService.getClient().setOAuth2Token(accessToken);
try
{
return dService.getReferences(repo);
}
catch(IOException e)
{
if(e.getMessage().contains("409"))
{
return new ArrayList<Reference>();
}
else
{
throw e;
}
}
}
开发者ID:GitHubPager,项目名称:GitHubPager,代码行数:21,代码来源:PageManager.java
示例7: GitHubBuilder
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
public GitHubBuilder(String token) {
this.githubClient = new GitHubClient();
githubClient.setOAuth2Token(token);
uService = new UserService(githubClient);
oService = new OrganizationService(githubClient);
service = new RepositoryService(githubClient);
cService = new ContentsService(githubClient);
dService = new DataService(githubClient);
commitService = new CommitService(githubClient);
}
开发者ID:dockstore,项目名称:write_api_service,代码行数:12,代码来源:GitHubBuilder.java
示例8: PublishHelper
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
public PublishHelper(CommitterInfo parameterObject,String commitMessage, RepositoryId id) {
cl = new GitHubClient();
cl.setCredentials(parameterObject.login, parameterObject.password);
rs = new RepositoryService(cl);
service = new DataService(cl);
this.email=parameterObject.email;
this.name=parameterObject.name;
this.commitMessage=commitMessage;
this.id=id;
}
开发者ID:OnPositive,项目名称:aml,代码行数:11,代码来源:PublishHelper.java
示例9: createTree
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
public static TreeEntry createTree(String prefix, String out, String path, DataService serv, RepositoryId id)
throws Exception {
TreeEntry entry = new TreeEntry();
entry.setPath(prefix + path);
entry.setType(TreeEntry.TYPE_BLOB);
entry.setMode(TreeEntry.MODE_BLOB);
entry.setSha(createBlob(serv, id, out, path));
return entry;
}
开发者ID:OnPositive,项目名称:aml,代码行数:10,代码来源:PublishHelper.java
示例10: createTreeFromString
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
public static TreeEntry createTreeFromString(String prefix, String name, String content, DataService serv, RepositoryId id)
throws Exception {
TreeEntry entry = new TreeEntry();
entry.setPath(prefix + name);
entry.setType(TreeEntry.TYPE_BLOB);
entry.setMode(TreeEntry.MODE_BLOB);
Blob blob = new Blob().setEncoding(Blob.ENCODING_UTF8);
blob.setContent(content);
entry.setSha(serv.createBlob(id, blob));
return entry;
}
开发者ID:OnPositive,项目名称:aml,代码行数:12,代码来源:PublishHelper.java
示例11: GitHubApi
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
public GitHubApi(GitHubProjectConfig config) {
GitHubCredentials gitHubCredentials = config.getGitHubCredentials();
GitHubUser gitHubUser = config.getGitHubUser();
gitHubClient = new GitHubClient();
gitHubClient.setCredentials(gitHubCredentials.getUsername(), gitHubCredentials.getPassword());
this.gitHubCommitUser = getGitHubCommitUser(gitHubUser.getName(), gitHubUser.getEmail());
repositoryService = new RepositoryService(gitHubClient);
dataService = new DataService(gitHubClient);
}
开发者ID:drifted-in,项目名称:txgh,代码行数:12,代码来源:GitHubApi.java
示例12: RefDialog
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
/**
* Create dialog helper to display refs
*
* @param activity
* @param requestCode
* @param repository
* @param service
*/
public RefDialog(final DialogFragmentActivity activity,
final int requestCode, final IRepositoryIdProvider repository,
final DataService service) {
this.activity = activity;
this.requestCode = requestCode;
this.repository = repository;
this.service = service;
}
开发者ID:huibinfeng0810,项目名称:github-v2,代码行数:17,代码来源:RefDialog.java
示例13: createEntries
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
private List<TreeEntry> createEntries(List<TreeEntry> entries, final String prefix, final String[] paths,
final DataService service, final RepositoryId repository, final File outputDirectory) throws GitHubException{
for (String path : paths) {
TreeEntry entry = createEntry(prefix, path, service, repository, outputDirectory);
entries.add(entry);
}
return entries;
}
开发者ID:opoo,项目名称:opoopress,代码行数:9,代码来源:GitHub.java
示例14: createEntry
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
private TreeEntry createEntry(String prefix, String path, DataService service, RepositoryId repository, File outputDirectory) throws GitHubException {
TreeEntry entry = new TreeEntry();
entry.setPath(prefix + path);
entry.setType(TYPE_BLOB);
entry.setMode(MODE_BLOB);
if(!dryRun){
entry.setSha(createBlob(service, repository, outputDirectory, path));
log.info("" + path + " -> " + entry.getSha());
}
return entry;
}
开发者ID:opoo,项目名称:opoopress,代码行数:12,代码来源:GitHub.java
示例15: createRepositoryBranch
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
private void createRepositoryBranch(Repository repo,String refString,String accessToken) throws Exception
{
DataService dService=new DataService();
dService.getClient().setOAuth2Token(accessToken);
List<Reference> refList=dService.getReferences(repo);
Reference ref=refList.get(0);
ref.setRef(refString);
logger.info("Try to create branch {}",refString);
dService.createReference(repo, ref);
}
开发者ID:GitHubPager,项目名称:GitHubPager,代码行数:11,代码来源:PageManager.java
示例16: commitFileToRepository
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
private void commitFileToRepository(File commitDirectory, Repository repo,String refString,String accessToken) throws Exception
{
DataService dService=new DataService();
dService.getClient().setOAuth2Token(accessToken);
Reference ref=dService.getReference(repo, refString);
String lastCommitSHA=ref.getObject().getSha();
List<TreeEntry> treeArray=new ArrayList<TreeEntry>();
for(File f:commitDirectory.listFiles())
buildTreeRecusive(f,repo,dService,treeArray);
Tree tree=dService.createTree(repo, treeArray);
logger.info("Try to make up commit");
Commit parentCommit=new Commit();
parentCommit.setSha(lastCommitSHA);
List<Commit> parentCommitList=new ArrayList<Commit>();
parentCommitList.add(parentCommit);
Commit commit=new Commit();
commit.setTree(tree);
commit.setParents(parentCommitList);
commit.setMessage(generateCommitMessage());
commit=dService.createCommit(repo, commit);
logger.info("Try to edit reference");
ref.setRef(refString);
TypedResource res=new TypedResource();
res.setSha(commit.getSha());
res.setType(TypedResource.TYPE_COMMIT);
res.setUrl(commit.getUrl());
ref.setObject(res);
dService.editReference(repo, ref);
}
开发者ID:GitHubPager,项目名称:GitHubPager,代码行数:30,代码来源:PageManager.java
示例17: createPullRequest
import org.eclipse.egit.github.core.service.DataService; //导入依赖的package包/类
/**
* @return the HTML link of the Pull Request
* @throws InterruptedException
*/
private static String createPullRequest(User user, int count) throws IOException, InterruptedException {
GitHubClient client = createClient(user.getGitHubAccessToken());
PullRequestService pulls = new PullRequestService(client);
RestTemplate rest = new RestTemplate();
// get sha for master
DataService references = new DataService(client);
RepositoryId forkRepositoryId = RepositoryId.create(user.getGitHubUsername(), "cla-test");
Reference forked = references.getReference(forkRepositoryId, "heads/master");
// create a branch for our Pull Request
Reference createPullRequestBranch = new Reference();
createPullRequestBranch.setRef("refs/heads/pull-" + count);
createPullRequestBranch.setObject(forked.getObject());
references.createReference(forkRepositoryId, createPullRequestBranch);
// create a file for our Pull Request
Map<String,String> content = new HashMap<>();
content.put("message", "We added some content for "+ count);
content.put("content", "bXkgbmV3IGZpbGUgY29udGVudHM=");
content.put("branch", "pull-"+count);
rest.put("https://api.github.com/repos/{owner}/{repo}/contents/forPullRequest?access_token={token}", content, user.getGitHubUsername(), "cla-test", user.getGitHubAccessToken());
PullRequest request = new PullRequest();
request.setTitle("Please merge");
request.setBody("Please merge");
PullRequestMarker head = new PullRequestMarker();
head.setLabel(signUser.getGitHubUsername() + ":pull-" + count);
request.setHead(head);
PullRequestMarker base = new PullRequestMarker();
base.setLabel("master");
request.setBase(base);
Thread.sleep(TimeUnit.SECONDS.toMillis(1));
PullRequest newPull = pulls.createPullRequest(RepositoryId.createFromId(linkUser.getGitHubUsername() + "/" + "cla-test"), request );
Thread.sleep(TimeUnit.SECONDS.toMillis(1));
return newPull.getHtmlUrl();
}
开发者ID:pivotalsoftware,项目名称:pivotal-cla,代码行数:45,代码来源:SmokeTests.java
注:本文中的org.eclipse.egit.github.core.service.DataService类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论