当前位置: 首页>>代码示例>>Java>>正文


Java URIish.getUser方法代码示例

本文整理汇总了Java中org.eclipse.jgit.transport.URIish.getUser方法的典型用法代码示例。如果您正苦于以下问题:Java URIish.getUser方法的具体用法?Java URIish.getUser怎么用?Java URIish.getUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jgit.transport.URIish的用法示例。


在下文中一共展示了URIish.getUser方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUsernamePassword

import org.eclipse.jgit.transport.URIish; //导入方法依赖的package包/类
public UsernamePassword getUsernamePassword(URIish uri) {
  addDefaultCredentials(credentials);

  String username = uri.getUser();
  String password = uri.getPass();

  CredentialItem.Username u = new CredentialItem.Username();
  CredentialItem.Password p = new CredentialItem.Password();

  if (supports(u, p) && get(uri, u, p)) {
    username = u.getValue();
    char[] v = p.getValue();
    password = (v == null) ? null : new String(p.getValue());
    p.clear();
  }

  return new UsernamePassword(username, password);
}
 
开发者ID:GerritForge,项目名称:gerrit-plugin,代码行数:19,代码来源:UsernamePasswordCredentialsProvider.java

示例2: get

import org.eclipse.jgit.transport.URIish; //导入方法依赖的package包/类
@Override
public boolean get (URIish uriish, CredentialItem... items) throws UnsupportedCredentialItem {
    String user = uriish.getUser();
    if (user == null) {
        user = "";
    }
    String password = uriish.getPass();
    if (password == null) {
        password = "";
    }
    for (CredentialItem i : items) {
        if (i instanceof CredentialItem.Username) {
            ((CredentialItem.Username) i).setValue(user);
            continue;
        }
        if (i instanceof CredentialItem.Password) {
            ((CredentialItem.Password) i).setValue(password.toCharArray());
            continue;
        }
        if (i instanceof CredentialItem.StringType) {
            if (i.getPromptText().equals("Password: ")) { //NOI18N
                ((CredentialItem.StringType) i).setValue(password);
                continue;
            }
        }
        throw new UnsupportedCredentialItem(uriish, i.getClass().getName()
                + ":" + i.getPromptText()); //NOI18N
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:TransportCommand.java

示例3: get

import org.eclipse.jgit.transport.URIish; //导入方法依赖的package包/类
@Override
public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem {
  String username = uri.getUser();
  if (username == null) {
    username = cfgUser;
  }
  if (username == null) {
    return false;
  }

  String password = uri.getPass();
  if (password == null) {
    password = cfgPass;
  }
  if (password == null) {
    return false;
  }

  for (CredentialItem i : items) {
    if (i instanceof CredentialItem.Username) {
      ((CredentialItem.Username) i).setValue(username);
    } else if (i instanceof CredentialItem.Password) {
      ((CredentialItem.Password) i).setValue(password.toCharArray());
    } else {
      throw new UnsupportedCredentialItem(uri, i.getPromptText());
    }
  }
  return true;
}
 
开发者ID:GerritCodeReview,项目名称:plugins_replication,代码行数:30,代码来源:SecureCredentialsProvider.java

示例4: getRepoUrl

import org.eclipse.jgit.transport.URIish; //导入方法依赖的package包/类
private String getRepoUrl(Repository repository) {
	try {
		RemoteConfig config = new RemoteConfig(repository.getConfig(), "origin"); //$NON-NLS-1$
		for (URIish uri: config.getURIs()) {
			if (uri.getUser() != null) {
				return uri.setUser("user-name").toASCIIString(); //$NON-NLS-1$
			}
			return uri.toASCIIString();
		}
	} catch (Exception e) {
		GerritToolsPlugin.getDefault().log(e);
	}
	return null;
}
 
开发者ID:Genuitec,项目名称:gerrit-tools,代码行数:15,代码来源:GpsGitRepositoriesConfig.java

示例5: handle

import org.eclipse.jgit.transport.URIish; //导入方法依赖的package包/类
private void handle(URIish uri, CredentialItem.StringType ci) {
    if (ci instanceof CredentialItem.Username && uri.getUser() != null) {
        ci.setValue(uri.getUser());
    } else {
        ci.setValue(blockingPrompt.request(prompt(String.class, uiNotificationFor(ci))));
    }
}
 
开发者ID:m4rzEE1,项目名称:ninja_chic-,代码行数:8,代码来源:GUICredentialsProvider.java

示例6: JGitWrapper

import org.eclipse.jgit.transport.URIish; //导入方法依赖的package包/类
public JGitWrapper(SharedPreferences preferences) throws Exception {
    localPath = preferences.getString("git_local_path", "");
    if (TextUtils.isEmpty(localPath))
        throw new IllegalArgumentException("Must specify local git path");

    String url = preferences.getString("git_url", "");
    if (TextUtils.isEmpty(url))
        throw new IllegalArgumentException("Must specify remote git url");
    try {
        URIish urIish = new URIish(url);
        if (urIish.getUser() == null) {
            String username = preferences.getString("git_username", "");
            urIish = urIish.setUser(username);
        }
        remotePath = urIish.toString();
    } catch (URISyntaxException e) {
        throw new IllegalArgumentException("Invalid remote git url");
    }

    branch = preferences.getString("git_branch", "master");
    if (branch.isEmpty())
        throw new IllegalArgumentException("Must specify a git branch");

    commitAuthor = preferences.getString("git_commit_author", "");
    commitEmail = preferences.getString("git_commit_email", "");

    String mergeStrategyString = preferences.getString("git_merge_strategy", "theirs");
    mergeStrategy = MergeStrategy.get(mergeStrategyString);
    if (mergeStrategy == null)
        throw new IllegalArgumentException("Invalid merge strategy: " + mergeStrategyString);

    setupJGitAuthentication(preferences);
}
 
开发者ID:hdweiss,项目名称:mOrgAnd,代码行数:34,代码来源:JGitWrapper.java

示例7: GitRepository

import org.eclipse.jgit.transport.URIish; //导入方法依赖的package包/类
private GitRepository(URIish uri) throws RotationLoadException, IOException {
    super(Cardinal.getNewRepoPath(DigestUtils.md5Hex(format(uri))));
    this.gitUrl = uri;
    if (uri.getUser() != null && uri.getPass() != null)
        this.credentials = new UsernamePasswordCredentialsProvider(uri.getUser(), uri.getPass());
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:7,代码来源:GitRepository.java


注:本文中的org.eclipse.jgit.transport.URIish.getUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。