Merge "VES Heartbeat and Software Management Feature"
[oam/tr069-adapter.git] / ves-agent / src / main / java / org / commscope / tr069adapter / vesagent / exception / VesAgentException.java
diff --git a/ves-agent/src/main/java/org/commscope/tr069adapter/vesagent/exception/VesAgentException.java b/ves-agent/src/main/java/org/commscope/tr069adapter/vesagent/exception/VesAgentException.java
new file mode 100644 (file)
index 0000000..d51efdf
--- /dev/null
@@ -0,0 +1,81 @@
+package org.commscope.tr069adapter.vesagent.exception;\r
+\r
+/**\r
+ * \r
+ * @version 1.0\r
+ * @since May 21, 2020\r
+ * @author Prashant\r
+ */\r
+public class VesAgentException extends Exception {\r
+  private static final long serialVersionUID = -3742697051389101875L;\r
+\r
+  private static final String ERRORMSG_PREFIX = "ves-agent";\r
+\r
+  private String[] arguments;\r
+\r
+  private String errorCode;\r
+  private String message;\r
+\r
+  // index of the error occurred in the given list or in the given file\r
+  protected int errorIndex = -1;\r
+\r
+\r
+  /**\r
+   * Constructs a <code>VesOperationException</code> with no detail message.\r
+   * \r
+   */\r
+  public VesAgentException() {\r
+    super();\r
+  }\r
+\r
+  /**\r
+   * Constructs a <code>VesOperationException</code> with the specified detail message.\r
+   * \r
+   * @param s as the details message\r
+   */\r
+  public VesAgentException(String s) {\r
+    super(s);\r
+  }\r
+\r
+  public VesAgentException(String... args) {\r
+    super();\r
+    arguments = args;\r
+    setErrorMessage(getErrorMessage());\r
+  }\r
+\r
+  public VesAgentException(String errorCode, String errorMsg) {\r
+    super();\r
+    this.errorCode = errorCode;\r
+    setErrorMessage(getErrorMessage());\r
+  }\r
+\r
+  public int getErrorIndex() {\r
+    return errorIndex;\r
+  }\r
+\r
+  public void setErrorIndex(int errorIndex) {\r
+    this.errorIndex = errorIndex;\r
+  }\r
+\r
+\r
+  public String getMessage() {\r
+    return message;\r
+  }\r
+\r
+  private String getErrorMessage() {\r
+    String key = ERRORMSG_PREFIX + ".";\r
+    return key;\r
+  }\r
+\r
+  private void setErrorMessage(String message) {\r
+    this.message = message;\r
+  }\r
+\r
+  public String getErrorCode() {\r
+    return errorCode;\r
+  }\r
+\r
+  public void setErrorCode(String errorCode) {\r
+    this.errorCode = errorCode;\r
+  }\r
+}\r