本文整理汇总了Java中org.eclipse.jgit.transport.TransportProtocol类的典型用法代码示例。如果您正苦于以下问题:Java TransportProtocol类的具体用法?Java TransportProtocol怎么用?Java TransportProtocol使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TransportProtocol类属于org.eclipse.jgit.transport包,在下文中一共展示了TransportProtocol类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: openTransport
import org.eclipse.jgit.transport.TransportProtocol; //导入依赖的package包/类
protected Transport openTransport (boolean openPush) throws URISyntaxException, NotSupportedException, TransportException {
URIish uri = getUriWithUsername(openPush);
// WA for #200693, jgit fails to initialize ftp protocol
for (TransportProtocol proto : Transport.getTransportProtocols()) {
if (proto.getSchemes().contains("ftp")) { //NOI18N
Transport.unregister(proto);
}
}
try {
Transport transport = Transport.open(getRepository(), uri);
RemoteConfig config = getRemoteConfig();
if (config != null) {
transport.applyConfig(config);
}
if (transport.getTimeout() <= 0) {
transport.setTimeout(45);
}
transport.setCredentialsProvider(getCredentialsProvider());
return transport;
} catch (IllegalArgumentException ex) {
throw new TransportException(ex.getLocalizedMessage(), ex);
}
}
示例2: protocolFor
import org.eclipse.jgit.transport.TransportProtocol; //导入依赖的package包/类
public static TransportProtocol protocolFor(URIish uri) {
for (TransportProtocol p : getTransportProtocols()) {
if (p.canHandle(uri))
return p;
}
return null;
}
示例3: niceProtocolNameFor
import org.eclipse.jgit.transport.TransportProtocol; //导入依赖的package包/类
public static String niceProtocolNameFor(URIish uri) {
TransportProtocol p = protocolFor(uri);
if (p == null) {
return null;
}
if (p.getSchemes().contains("file")) {
return null;
}
String jGitProtocolName = p.getName();
if (jGitProtocolName.equals(JGitText.get().transportProtoGitAnon)) {
return "Git";
}
return jGitProtocolName;
}