First cut at REST errors

 - Added a new client-facing class to hold a formatted error
 - Renamed the existing RestError to be RestErrorCatalogEntry
 - Modified the Intent POST operation to return an actual error if the
   POST can't parse the inbound object

Change-Id: I05d8919626f1a9350262d4aee7919c0fc8a4fa09
diff --git a/src/main/java/net/onrc/onos/api/rest/RestErrorCatalogEntry.java b/src/main/java/net/onrc/onos/api/rest/RestErrorCatalogEntry.java
new file mode 100644
index 0000000..96b3eea
--- /dev/null
+++ b/src/main/java/net/onrc/onos/api/rest/RestErrorCatalogEntry.java
@@ -0,0 +1,60 @@
+package net.onrc.onos.api.rest;
+
+/**
+ * Describes a REST error.
+ * code is a unique identifier for the error.
+ * summary is indended to be a short description of what happened.
+ * descriptionFormatString is a long description of the problem, and can be formatted using
+ * variable replacement.  Variable placeholders are indicated with the string
+ * "{}" in the descriptionFormatString.
+ * Objects of this class are immutable.
+ */
+
+public final class RestErrorCatalogEntry {
+
+    private final RestErrorCodes.RestErrorCode code;
+    private final String summary;
+    private final String descriptionFormatString;
+
+    /**
+     * Constructs a new RestErrorCatalogEntry object from a code, summary and descriptionFormatString.
+     *
+     * @param newCode code for the new error
+     * @param newSummary short summary for the new error
+     * @param newDescriptionFormatString formatable description for the new error
+     */
+    public RestErrorCatalogEntry(final RestErrorCodes.RestErrorCode newCode,
+                                 final String newSummary,
+                                 final String newDescriptionFormatString) {
+        code = newCode;
+        summary = newSummary;
+        descriptionFormatString = newDescriptionFormatString;
+    }
+
+    /**
+     * Gets the summary of the error.
+     *
+     * @return string for the summary
+     */
+    public String getSummary() {
+        return summary;
+    }
+
+    /**
+     * Gets the unique code for this error.
+     *
+     * @return unique code
+     */
+    public RestErrorCodes.RestErrorCode getCode() {
+        return code;
+    }
+
+    /**
+     * Gets the unformatted description string for the error.
+     *
+     * @return the unformatted description string.
+     */
+    public String getDescriptionFormatString() {
+        return descriptionFormatString;
+    }
+}