/** @throws CommandExecutionException */
  private void updateDefaultVersion(String key) throws CommandExecutionException {
    final PropertiesConfiguration properties = globalConfig.getProperties();
    properties.setProperty(mapping.get(type).getName(), key);
    try {
      properties.save();
      SignatureFileInfo sigFileInfo = signatureManager.getDefaultSignatures().get(type);
      printWriter.println(
          I18N.getResource(
              I18N.CONFIGURE_SIGNATURE_FILE_VERSION_SUCCESS,
              sigFileInfo.getVersion(),
              sigFileInfo.getFile().getName()));

    } catch (ConfigurationException e) {
      throw new CommandExecutionException(e);
    } catch (SignatureFileException e) {
      throw new CommandExecutionException(e);
    }
  };
  /** {@inheritDoc} */
  @Override
  public void execute() throws CommandExecutionException {

    boolean validVersion = false;
    Map<SignatureType, SortedMap<String, SignatureFileInfo>> sigFileInfos =
        signatureManager.getAvailableSignatureFiles();

    Map<String, SignatureFileInfo> sigFileInfoForType = sigFileInfos.get(type);

    for (Map.Entry<String, SignatureFileInfo> entry : sigFileInfoForType.entrySet()) {
      String key = entry.getKey();
      SignatureFileInfo info = entry.getValue();
      if (info.getVersion() == signatureFileVersion) {
        validVersion = true;
        updateDefaultVersion(key);
        break;
      }
    }

    if (!validVersion) {
      throw new CommandExecutionException(
          I18N.getResource(I18N.CONFIGURE_SIGNATURE_FILE_VERSION_INVALID, signatureFileVersion));
    }
  }