本文整理了Java中brooklyn.util.net.Networking.checkPortValid()
方法的一些代码示例,展示了Networking.checkPortValid()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Networking.checkPortValid()
方法的具体详情如下:
包路径:brooklyn.util.net.Networking
类名称:Networking
方法名:checkPortValid
暂无
代码示例来源:origin: io.brooklyn/brooklyn-utils-common
public static void checkPortsValid(@SuppressWarnings("rawtypes") Map ports) {
for (Object ppo : ports.entrySet()) {
Map.Entry<?,?> pp = (Map.Entry<?,?>)ppo;
Object val = pp.getValue();
if(val == null){
throw new IllegalArgumentException("port for "+pp.getKey()+" is null");
}else if (!(val instanceof Integer)) {
throw new IllegalArgumentException("port "+val+" for "+pp.getKey()+" is not an integer ("+val.getClass()+")");
}
checkPortValid((Integer)val, ""+pp.getKey());
}
}
代码示例来源:origin: io.brooklyn/brooklyn-core
protected SshAbstractTool(AbstractSshToolBuilder<?,?> builder) {
super(builder.localTempDir);
host = checkNotNull(builder.host, "host");
port = builder.port;
user = builder.user;
password = builder.password;
strictHostKeyChecking = builder.strictHostKeyChecking;
allocatePTY = builder.allocatePTY;
privateKeyPassphrase = builder.privateKeyPassphrase;
privateKeyData = builder.privateKeyData;
if (builder.privateKeyFiles.size() > 1) {
throw new IllegalArgumentException("sshj supports only a single private key-file; " +
"for defaults of ~/.ssh/id_rsa and ~/.ssh/id_dsa leave blank");
} else if (builder.privateKeyFiles.size() == 1) {
String privateKeyFileStr = Iterables.get(builder.privateKeyFiles, 0);
String amendedKeyFile = privateKeyFileStr.startsWith("~") ? (System.getProperty("user.home")+privateKeyFileStr.substring(1)) : privateKeyFileStr;
privateKeyFile = new File(amendedKeyFile);
} else {
privateKeyFile = null;
}
checkArgument(host.length() > 0, "host value must not be an empty string");
checkPortValid(port, "ssh port");
toString = String.format("%s@%s:%d", user, host, port);
}
内容来源于网络,如有侵权,请联系作者删除!