Merge of new rebased code
[appc.git] / appc-adapters / appc-dmaap-adapter / appc-message-adapter-factory / src / main / java / org / openecomp / appc / adapter / factory / MessageService.java
  * ============LICENSE_END=========================================================
  */
 
-package org.openecomp.appc.listener.CL.model;
+package org.openecomp.appc.adapter.factory;
+/**
+ * The message service types that are available. Only DMaaP available
+ **/
+public enum MessageService {
+    DMaaP("dmaap");
 
-public enum Action {
-    Restart("Restart"), Rebuild("Rebuild"), Migrate("Migrate"), Evacuate("Evacuate");
+    private String val;
+
+    private MessageService(String val) {
+        this.val = val;
+    }
+
+    public String getValue() {
+        return val;
+    }
 
     /**
-     * Converts the string to an Action
-     * 
-     * @param value
-     *            The string to try and convert. Is case insensitive
-     * @return The action matching the string or null if no match was found.
+     * Tries to match a string to a MessageService. If no match is found, returns the default (DMaaP)
+     *
+     * @param input
+     *            the string to try and match
+     * @return A MessasgeService
      */
-    public static Action toAction(String value) {
-        if (value != null) {
-            for (Action e : values()) {
-                if (e.getValue().toUpperCase().equals(value.toUpperCase())) {
-                    return e;
+    public static MessageService parse(String input) {
+        if (input != null) {
+            for (MessageService ms : MessageService.values()) {
+                if (ms.getValue().equals(input.toLowerCase())) {
+                    return ms;
                 }
             }
         }
-
-        return null;
-    }
-
-    private String value;
-
-    private Action(String valueToUse) {
-        value = valueToUse;
-    }
-
-    public final String getValue() {
-        return value;
+        return MessageService.DMaaP; // Default
     }
 }