public int getSshPort() { String sshPort = amiType.isUnix() ? ((UnixData) amiType).getSshPort() : "22"; if (sshPort == null || sshPort.length() == 0) return 22; int port = 0; try { port = Integer.parseInt(sshPort); } catch (Exception e) { } return port != 0 ? port : 22; }
public int getSshPort() { try { String sshPort = ""; if (amiType.isUnix()) { sshPort = ((UnixData) amiType).getSshPort(); } return Integer.parseInt(sshPort); } catch (NumberFormatException e) { return 22; } }
public String getRootCommandPrefix() { return amiType.isUnix() ? ((UnixData) amiType).getRootCommandPrefix() : ""; }
public boolean isUseHTTPS() { return amiType.isWindows() && ((WindowsData) amiType).isUseHTTPS(); }
public Secret getAdminPassword() { return amiType.isWindows() ? ((WindowsData) amiType).getPassword() : Secret.fromString(""); }
public boolean isUnixSlave() { return amiType.isUnix(); }
public boolean isWindowsSlave() { return amiType.isWindows(); }
public int getBootDelay() { return amiType.isWindows() ? ((WindowsData) amiType).getBootDelayInMillis() : 0; }
public boolean isUseHTTPS() { return amiType.isWindows() ? ((WindowsData) amiType).isUseHTTPS() : false; }
public String getAdminPassword() { return amiType.isWindows() ? ((WindowsData) amiType).getPassword() : ""; }
String getRootCommandPrefix() { String commandPrefix = amiType.isUnix() ? ((UnixData) amiType).getRootCommandPrefix() : ""; if (commandPrefix == null || commandPrefix.length() == 0) return ""; return commandPrefix + " "; }
String getRemoteAdmin() { if (remoteAdmin == null || remoteAdmin.length() == 0) return amiType.isWindows() ? "Administrator" : "root"; return remoteAdmin; }