Replace ControlResponse with one provided by jndn:0.10+

Change-Id: Ie914067da0faea5e2c188c59688b785d548310db
diff --git a/src/main/java/com/intel/jndn/management/ManagementException.java b/src/main/java/com/intel/jndn/management/ManagementException.java
index 69e209a..89a0b25 100644
--- a/src/main/java/com/intel/jndn/management/ManagementException.java
+++ b/src/main/java/com/intel/jndn/management/ManagementException.java
@@ -14,7 +14,8 @@
 
 package com.intel.jndn.management;
 
-import com.intel.jndn.management.types.ControlResponse;
+import net.named_data.jndn.ControlResponse;
+
 
 /**
  * Represent a failure to correctly manage the NDN Forwarding Daemon (NFD).
diff --git a/src/main/java/com/intel/jndn/management/Nfdc.java b/src/main/java/com/intel/jndn/management/Nfdc.java
index ae94417..ca1a52b 100644
--- a/src/main/java/com/intel/jndn/management/Nfdc.java
+++ b/src/main/java/com/intel/jndn/management/Nfdc.java
@@ -17,7 +17,6 @@
 import com.intel.jndn.management.helpers.FetchHelper;
 import com.intel.jndn.management.helpers.StatusDatasetHelper;
 import net.named_data.jndn.*;
-import com.intel.jndn.management.types.ControlResponse;
 import com.intel.jndn.management.types.FaceStatus;
 import com.intel.jndn.management.types.FibEntry;
 import com.intel.jndn.management.types.ForwarderStatus;
@@ -191,7 +190,7 @@
       ControlResponse response = sendCommand(face, command);
 
       // return
-      return response.getBody().get(0).getFaceId();
+      return response.getBodyAsControlParameters().getFaceId();
     }
     catch (IOException|EncodingException e) {
       throw new ManagementException(e.getMessage(), e);
diff --git a/src/main/java/com/intel/jndn/management/types/ControlResponse.java b/src/main/java/com/intel/jndn/management/types/ControlResponse.java
deleted file mode 100644
index 0d8404f..0000000
--- a/src/main/java/com/intel/jndn/management/types/ControlResponse.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * jndn-management
- * Copyright (c) 2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU Lesser General Public License,
- * version 3, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
- * more details.
- */
-package com.intel.jndn.management.types;
-
-import com.intel.jndn.management.helpers.EncodingHelper;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.List;
-import net.named_data.jndn.ControlParameters;
-import net.named_data.jndn.encoding.EncodingException;
-import net.named_data.jndn.encoding.tlv.Tlv;
-import net.named_data.jndn.encoding.tlv.TlvDecoder;
-import net.named_data.jndn.encoding.tlv.TlvEncoder;
-import net.named_data.jndn.util.Blob;
-
-/**
- * Represent a ControlResponse, a Data packet sent in response to a
- * ControlCommand to the NFD, see
- * <a href="http://redmine.named-data.net/projects/nfd/wiki/ControlCommand">http://redmine.named-data.net/projects/nfd/wiki/ControlCommand</a>
- *
- * @author Andrew Brown <andrew.brown@intel.com>
- */
-public class ControlResponse {
-
-  /**
-   * Use TLV codes from jndn.encoding.tlv.Tlv.java See
-   * <a href="http://redmine.named-data.net/projects/nfd/wiki/ControlCommand">http://redmine.named-data.net/projects/nfd/wiki/ControlCommand</a>
-   */
-  public final static int TLV_CONTROL_RESPONSE = 101;
-  public final static int TLV_CONTROL_RESPONSE_STATUS_CODE = 102;
-  public final static int TLV_CONTROL_RESPONSE_STATUS_TEXT = 103;
-
-  /**
-   * Encode using a new TLV encoder.
-   *
-   * @return The encoded buffer.
-   */
-  public final Blob wireEncode() {
-    TlvEncoder encoder = new TlvEncoder();
-    wireEncode(encoder);
-    return new Blob(encoder.getOutput(), false);
-  }
-
-  /**
-   * Encode as part of an existing encode context.
-   *
-   * @param encoder
-   */
-  public final void wireEncode(TlvEncoder encoder) {
-    int saveLength = encoder.getLength();
-    for (ControlParameters parameters : body) {
-      EncodingHelper.encodeControlParameters(parameters, encoder);
-    }
-    encoder.writeBlobTlv(TLV_CONTROL_RESPONSE_STATUS_TEXT, new Blob(statusText).buf());
-    encoder.writeNonNegativeIntegerTlv(TLV_CONTROL_RESPONSE_STATUS_CODE, statusCode);
-    encoder.writeTypeAndLength(TLV_CONTROL_RESPONSE, encoder.getLength() - saveLength);
-  }
-
-  /**
-   * Decode the input from its TLV format.
-   *
-   * @param input The input buffer to decode. This reads from position() to
-   * limit(), but does not change the position.
-   * @throws net.named_data.jndn.encoding.EncodingException
-   */
-  public final void wireDecode(ByteBuffer input) throws EncodingException {
-    TlvDecoder decoder = new TlvDecoder(input);
-    wireDecode(decoder, input);
-  }
-
-  /**
-   * Decode as part of an existing decode context.
-   *
-   * @param decoder
-   * @param input the WireFormat version that decodes ControlParameters does not
-   * allow passing a TlvDecoder, so we must pass the buffer itself
-   * @throws EncodingException
-   */
-  public void wireDecode(TlvDecoder decoder, ByteBuffer input) throws EncodingException {
-    int endOffset = decoder.readNestedTlvsStart(TLV_CONTROL_RESPONSE);
-
-    // parse known TLVs
-    this.statusCode = (int) decoder.readNonNegativeIntegerTlv(TLV_CONTROL_RESPONSE_STATUS_CODE);
-    Blob statusText_ = new Blob(decoder.readBlobTlv(TLV_CONTROL_RESPONSE_STATUS_TEXT), true); // copy because buffer is immutable
-    this.statusText = statusText_.toString();
-
-    // use the already-written decoder for ControlParameters (but we have to copy the buffer)
-    while (decoder.peekType(Tlv.ControlParameters_ControlParameters, endOffset)) {
-      ByteBuffer copyInput = input.duplicate();
-      copyInput.position(decoder.getOffset());
-      int internalEndOffset = decoder.readNestedTlvsStart(Tlv.ControlParameters_ControlParameters);
-      ControlParameters copyParameters = new ControlParameters();
-      copyParameters.wireDecode(copyInput);
-      this.body.add(copyParameters);
-      decoder.seek(internalEndOffset);
-      decoder.finishNestedTlvs(internalEndOffset);
-    }
-
-    decoder.finishNestedTlvs(endOffset);
-  }
-
-  /**
-   * Get status code
-   *
-   * @return
-   */
-  public int getStatusCode() {
-    return statusCode;
-  }
-
-  /**
-   * Set status code
-   *
-   * @param statusCode
-   */
-  public void setStatusCode(int statusCode) {
-    this.statusCode = statusCode;
-  }
-
-  /**
-   * Get status text
-   *
-   * @return
-   */
-  public String getStatusText() {
-    return statusText;
-  }
-
-  /**
-   * Set status text
-   *
-   * @param statusText
-   */
-  public void setStatusText(String statusText) {
-    this.statusText = statusText;
-  }
-
-  /**
-   * Get body
-   *
-   * @return
-   */
-  public List<ControlParameters> getBody() {
-    return body;
-  }
-
-  /**
-   * Set body
-   *
-   * @param body
-   */
-  public void setBody(List<ControlParameters> body) {
-    this.body = body;
-  }
-
-  private int statusCode = -1;
-  private String statusText = "";
-  private List<ControlParameters> body = new ArrayList<>();
-}