本文整理汇总了Java中org.eclipse.egit.github.core.service.DataService类的典型用法代码示例。如果您正苦于以下问题:Java DataService类的具体用法?Java DataService怎么用?Java DataService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DataService类属于org.eclipse.egit.github.core.service包,在下文中一共展示了DataService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}