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


Java CredentialItem.YesNoType方法代码示例

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


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

示例1: get

import org.eclipse.jgit.transport.CredentialItem; //导入方法依赖的package包/类
@Override
public boolean get(final URIish uri,
                   final CredentialItem... items) throws UnsupportedCredentialItem {
    try {
        return super.get(uri,
                         items);
    } catch (UnsupportedCredentialItem e) {
        for (CredentialItem i : items) {
            if (i instanceof CredentialItem.YesNoType) {
                ((CredentialItem.YesNoType) i).setValue(true);
                return true;
            } else {
                continue;
            }
        }
    }
    return false;
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:19,代码来源:UsernamePasswordCredentialsProvider.java

示例2: get

import org.eclipse.jgit.transport.CredentialItem; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public boolean get(final URIish uriish,
    final CredentialItem... items) {

    for (final CredentialItem item : items) {
        if (item instanceof CredentialItem.StringType) {
            ((CredentialItem.StringType) item).setValue(passphrase);
        }
        // This will automatically say "yes" to prompts
        // TODO make this explicit to just accept host
        // TODO make this configurable
        if (item instanceof CredentialItem.YesNoType) {
            ((CredentialItem.YesNoType) item).setValue(true);
        }
    }
    return true;
}
 
开发者ID:trajano,项目名称:wagon-git,代码行数:21,代码来源:PassphraseCredentialsProvider.java

示例3: get

import org.eclipse.jgit.transport.CredentialItem; //导入方法依赖的package包/类
@Override
public boolean get(URIish uri, CredentialItem... items)
        throws UnsupportedCredentialItem {
    for (CredentialItem item : items) {
        if (item instanceof CredentialItem.Username) {
            ((CredentialItem.Username) item).setValue(username);
        } else if (item instanceof CredentialItem.Password) {
            ((CredentialItem.Password) item).setValue(password.toCharArray());
        } else if (item instanceof CredentialItem.StringType) {
            ((CredentialItem.StringType) item).setValue(password);
        } else if (item instanceof CredentialItem.InformationalMessage) {
            throw new UnsupportedCredentialItem(uri, "Not supported");
        } else if (item instanceof CredentialItem.YesNoType) {
            // TODO handle strict host key checking here
            throw new UnsupportedCredentialItem(uri, "Not supported");
        } else {
            throw new UnsupportedCredentialItem(uri, "Not supported");
        }
    }
    return true;
}
 
开发者ID:hdweiss,项目名称:mOrgAnd,代码行数:22,代码来源:JGitCredentialsProvider.java

示例4: get

import org.eclipse.jgit.transport.CredentialItem; //导入方法依赖的package包/类
@Override
public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem {
	for(CredentialItem item : items){
		if(item instanceof CredentialItem.YesNoType){
			((CredentialItem.YesNoType) item).setValue(true);
			return true;
		}
	}
	return false;
}
 
开发者ID:coding-dream,项目名称:Notebook,代码行数:11,代码来源:AllowHostsCredentialsProvider.java

示例5: supports

import org.eclipse.jgit.transport.CredentialItem; //导入方法依赖的package包/类
@Override
public boolean supports(CredentialItem... items) {
	for(CredentialItem item : items){
		if(item instanceof CredentialItem.YesNoType){
			return true;
		}
	}
	return false;
}
 
开发者ID:coding-dream,项目名称:Notebook,代码行数:10,代码来源:AllowHostsCredentialsProvider.java

示例6: apply

import org.eclipse.jgit.transport.CredentialItem; //导入方法依赖的package包/类
@Override
public Boolean apply(CredentialItem credentialItem) {
	String input = readInput(credentialItem);
	CredentialItem.YesNoType casted = (CredentialItem.YesNoType) credentialItem;
	casted.setValue(input.toLowerCase().equals("y"));
	return true;
}
 
开发者ID:nyrkovalex,项目名称:get.me,代码行数:8,代码来源:CredentialHandlers.java

示例7: setUp

import org.eclipse.jgit.transport.CredentialItem; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
	MockitoAnnotations.initMocks(this);
	item = new CredentialItem.YesNoType("test");
	handlers.put(CredentialItem.YesNoType.class, function);
	provider = new GitCredentialsProvider(handlers);
}
 
开发者ID:nyrkovalex,项目名称:get.me,代码行数:8,代码来源:GitTest.java

示例8: get

import org.eclipse.jgit.transport.CredentialItem; //导入方法依赖的package包/类
@Override
public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem {
    for (CredentialItem ci : items) {
        if (ci instanceof CredentialItem.YesNoType) {
            handle((CredentialItem.YesNoType) ci);
        } else if (ci instanceof CredentialItem.StringType) {
            handle(uri, (CredentialItem.StringType) ci);
        } else if (ci instanceof CredentialItem.CharArrayType) {
            handle(uri, (CredentialItem.CharArrayType) ci);
        } else {
            return false;
        }
    }
    return true;
}
 
开发者ID:m4rzEE1,项目名称:ninja_chic-,代码行数:16,代码来源:GUICredentialsProvider.java

示例9: testThrowsUnsupportedCredentialException

import org.eclipse.jgit.transport.CredentialItem; //导入方法依赖的package包/类
@Test
public void testThrowsUnsupportedCredentialException() throws URISyntaxException {
	CredentialItem[] goodCredentialItems = makeCredentialItems();
	CredentialItem[] badCredentialItems = new CredentialItem[] {
			goodCredentialItems[0],
			goodCredentialItems[1],
			new CredentialItem.YesNoType("OK?")
	};
	try {
		provider.get(new URIish(AWS_REPO), badCredentialItems);
		fail("Expected UnsupportedCredentialItem exception");
	} catch (UnsupportedCredentialItem e) {
		assertNotNull(e.getMessage());
	}
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-config,代码行数:16,代码来源:AwsCodeCommitCredentialsProviderTests.java

示例10: supports

import org.eclipse.jgit.transport.CredentialItem; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @return <code>true</code> when items contains a {@link CredentialItem}
 *         .StringType or .YesNoType
 */
@Override
public boolean supports(final CredentialItem... items) {

    for (final CredentialItem item : items) {
        if (item instanceof CredentialItem.StringType) {
            return true;
        }
        if (item instanceof CredentialItem.YesNoType) {
            return true;
        }
    }
    return false;
}
 
开发者ID:trajano,项目名称:wagon-git,代码行数:20,代码来源:PassphraseCredentialsProvider.java

示例11: get

import org.eclipse.jgit.transport.CredentialItem; //导入方法依赖的package包/类
/**
 * @see org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider#get(org.eclipse.jgit.transport.URIish, org.eclipse.jgit.transport.CredentialItem[])
 */
@Override
public boolean get(URIish uri, CredentialItem... items) {
  if (logger.isDebugEnabled()) {
    logger.debug("Credential query, uri " + uri);
  }
  for (CredentialItem item : items) {
    // TODO Should handle item.isValueSecure()
    if (logger.isDebugEnabled()) {
      logger.debug(item.getClass() + ", secure value: " + item.isValueSecure());
      logger.debug("Message: |" + item.getPromptText() + "|");
    }

    if (item instanceof CredentialItem.StringType
        && item.getPromptText().startsWith("Passphrase")) {
      // A not so great method to check that the pass phrase is requested.
      passphaseRequested = true;

      ((CredentialItem.StringType) item).setValue(passphrase);
      // true tells the engine that we supplied the value.
      // The engine will look inside the given item for the response.
      return true;
    }

    if (item instanceof CredentialItem.YesNoType) {
      if (logger.isDebugEnabled()) {
        logger.debug("YesNoType");
      }

      // Present the question to the user.
      boolean userResponse = askUser(item.getPromptText());
      ((CredentialItem.YesNoType) item).setValue(userResponse);

      // true tells the engine that we supplied the value.
      // The engine will look inside the given item for the response.
      return true;
    }
  }
	
	return super.get(uri, items);
}
 
开发者ID:oxygenxml,项目名称:oxygen-git-plugin,代码行数:44,代码来源:SSHUserCredentialsProvider.java

示例12: get

import org.eclipse.jgit.transport.CredentialItem; //导入方法依赖的package包/类
@Override
public boolean get(URIish urIish, CredentialItem... credentialItems) throws UnsupportedCredentialItem {
    if (conversation == null) return false;
    for (CredentialItem credentialItem : credentialItems) {
        String message = ChatColor.GOLD + ">>> " + ChatColor.RESET + credentialItem.getPromptText();
        if (credentialItem instanceof CredentialItem.InformationalMessage){
            scheduler.runTask(plugin,new MessageSender(caller, message, callerWorkspaceName,0));
            continue;
        }
        boolean wrongInput = false;
        do {
            String inputMessage;
            synchronized (sync) {
                lastInputMessage = null;
                scheduler.runTask(plugin, new MessageSender(caller, message, callerWorkspaceName, 2));
                awaitInput = true;
                while (!finished && lastInputMessage == null) {
                    try {
                        sync.wait(1000);
                        if (conversation.getState().equals(ABANDONED)) {
                            finished = true;
                        }
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                awaitInput = false;
                if (finished) return false;
                inputMessage = lastInputMessage;
            }
            if (credentialItem instanceof CredentialItem.YesNoType) {
                if (inputMessage.matches("yes|true|1|on|y|\\+|valid|correct|right")) {
                    ((CredentialItem.YesNoType) credentialItem).setValue(true);
                } else if (inputMessage.matches("no|false|n|0|-|invalid|incorrect|wrong")) {
                    ((CredentialItem.YesNoType) credentialItem).setValue(false);
                } else {
                    wrongInput = true;
                }
            } else if (credentialItem instanceof CredentialItem.StringType) {
                ((CredentialItem.StringType) credentialItem).setValue(inputMessage);

            } else if (credentialItem instanceof CredentialItem.CharArrayType) {
                ((CredentialItem.CharArrayType) credentialItem).setValue(inputMessage.toCharArray());
            }
        } while (wrongInput);
    }
    return true;
}
 
开发者ID:DPOH-VAR,项目名称:VarScript,代码行数:49,代码来源:GitExecutor.java

示例13: handle

import org.eclipse.jgit.transport.CredentialItem; //导入方法依赖的package包/类
private void handle(CredentialItem.YesNoType ci) {
    ci.setValue(blockingPrompt.request(promptYesOrNo(uiNotificationFor(ci))));
}
 
开发者ID:m4rzEE1,项目名称:ninja_chic-,代码行数:4,代码来源:GUICredentialsProvider.java


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