package water.api;

import water.Key;
import water.ValueArray;

import com.google.gson.JsonObject;

public class SetColumnNames extends Request {
  protected final H2OHexKey _tgtKey = new H2OHexKey("target");
  protected final H2OHexKey _srcKey = new H2OHexKey("source");
  @Override protected Response serve() {
    ValueArray tgt = _tgtKey.value();
    tgt.setColumnNames(_srcKey.value().colNames());
    return Inspect.redirect(new JsonObject(), tgt._key);
  }
  public static String link(Key k, String s){
    return "<a href='SetColumnNames.query?target="+k+"'>" + s + "</a>";
  }
}

@@ -139,16 +139,18 @@
 quest %7B%0A
+%0A%0A
   protec
@@ -208,71 +208,443 @@
 %22);%0A
+%0A
   pr
-otected final H2OHexKey _srcKey = new H2OHexKey(%22source%22
+ivate class HeaderKey extends H2OHexKey %7B%0A    public HeaderKey()%7Bsuper(%22source%22);%7D%0A    @Override protected ValueArray parse(String input) throws IllegalArgumentException %7B%0A      ValueArray res = super.parse(input);%0A      if(res.numCols() != _tgtKey.value().numCols())%0A        throw new IllegalArgumentException(%22number of columns don't match!%22);%0A      return res;%0A    %7D%0A  %7D%0A  protected final HeaderKey _srcKey = new HeaderKey(
 );%0A
+%0A
   @O

update set column names functionality to throw an error if number of columns in source and target do not match.