Exemplo n.º 1
0
 public void selectProtocol(ConsoleProtocol protocol) throws IllegalArgumentException {
   if (!canSelectProtocol(protocol)) {
     throw new IllegalArgumentException(
         "Cannot select "
             + protocol.toString()
             + " protocol for vm "
             + getVm().getName()); // $NON-NLS-1$ $NON-NLS-2$
   }
   this.selectedProtocol = protocol;
 }
Exemplo n.º 2
0
  protected void setDefaultSelectedProtocol() {
    List<ConsoleProtocol> allProtocols = ConsoleProtocol.getProtocolsByPriority();
    Collections.reverse(allProtocols);

    if (selectedProtocol != null) { // if it's selected, it's prefered -> set it to the 1st position
      allProtocols.remove(selectedProtocol);
      allProtocols.add(0, selectedProtocol);
    }

    for (ConsoleProtocol protocol : allProtocols) {
      if (canSelectProtocol(protocol)) {
        selectProtocol(protocol);
        break;
      }
    }
  }