/src/com/gmail/ianspigeon/applauncher/launchers/ESXClientLauncher.java

https://bitbucket.org/ianspigeon/applauncher · Java · 34 lines · 21 code · 13 blank · 0 comment · 4 complexity · 055e8c35f3da503bc5ef9523d15e62da MD5 · raw file

  1. package com.gmail.ianspigeon.applauncher.launchers;
  2. public class ESXClientLauncher extends Launcher {
  3. public String launch(String hostname, String vm) {
  4. System.out.println("ESXClientLauncher call detected." );
  5. try {
  6. validateParameter("hostname", hostname, "^[\\w.\\-_]+$");
  7. validateParameter("vm", vm, "^[\\w.\\-_\\(\\)&/]+$");
  8. } catch (Exception e) {
  9. return e.getMessage();
  10. }
  11. if (isWindows()) {
  12. return executeWindowsCommand(new String[] {"C:\\Program Files\\Common Files\\VMware\\VMware VMRC Plug-in\\Internet Explorer\\vmware-vmrc.exe",
  13. "-h", hostname, vm});
  14. } else if (isLinux()) {
  15. return executeLinuxCommand(new String[] {"/usr/bin/vmplayer",
  16. "-h", hostname, vm});
  17. } else {
  18. return "Unsupported platform, requires Windows or Linux.";
  19. }
  20. }
  21. }