當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。