private void setPolicy(String[] params) throws Exception {
    String command = "setPolicy";
    try {
      // setPolicy -path <path> [-policy <policyName>]
      Options setPolicyOptions = new Options();

      String pathOptionName = "path";
      Option pathOption = OptionBuilder.hasArg()
          .isRequired()
          .withLongOpt(pathOptionName)
          .withDescription("Path to set policy on")
          .create();
      setPolicyOptions.addOption(pathOption);

      String policyOptionName = "policy";
      Option policyOption = OptionBuilder.hasArg()
          .withLongOpt(policyOptionName)
          .withDescription("Policy to set")
          .create();
      setPolicyOptions.addOption(policyOption);

      CommandLine args = parseCommandArgs(setPolicyOptions, params);
      String path = args.getOptionValue(pathOptionName);
      String policy = args.getOptionValue(policyOptionName);

      erasureCodingShim.setErasureCodingPolicy(new Path(path), policy);
      writeTestOutput("Set EC policy' " + policy);
    } catch (ParseException pe) {
      writeTestOutput("Error parsing options for " + command + " " + pe.getMessage());
    } catch (Exception e) {
      writeTestOutput("Caught exception running " + command + ": " + e.getMessage());
      throw new Exception("Cannot run " + command + ": " + e.getMessage());
    }
  }
Sets an erasure coding policy on a directory at the specified path.
@param params Parameters passed to the command.
@throws Exception If command failed.
ql/src/java/org/apache/hadoop/hive/ql/processors/ErasureProcessor.java