package org.jboss.as.messaging;

import java.util.HashMap;
import java.util.Map;

/**
 *
 */
public enum Attribute {
   UNKNOWN(null),
   /* Messaging 1.0 attributes, in alpha order */
   NAME("name"),
   KEY("key"),
   VALUE("value"),
   TYPE_ATTR_NAME("type"),
   ROLES_ATTR_NAME("roles"),
   CREATEDURABLEQUEUE_NAME("createDurableQueue"),
   DELETEDURABLEQUEUE_NAME("deleteDurableQueue"),
   CREATE_NON_DURABLE_QUEUE_NAME("createNonDurableQueue"),
   DELETE_NON_DURABLE_QUEUE_NAME("deleteNonDurableQueue"),
   // HORNETQ-309 we keep supporting these attribute names for compatibility
   CREATETEMPQUEUE_NAME("createTempQueue"),
   DELETETEMPQUEUE_NAME("deleteTempQueue"),
   SEND_NAME("send"),
   CONSUME_NAME("consume"),
   MANAGE_NAME("manage"),
   ;
   private final String name;

   Attribute(final String name) {
      this.name = name;
   }

   /**
    * Get the local name of this element.
    *
    * @return the local name
    */
   public String getLocalName() {
      return name;
   }

   private static final Map<String, Attribute> MAP;

   static {
      final Map<String, Attribute> map = new HashMap<String, Attribute>();
      for (Attribute element : values()) {
         final String name = element.getLocalName();
         if (name != null) map.put(name, element);
      }
      MAP = map;
   }

   public static Attribute forName(String localName) {
      final Attribute element = MAP.get(localName);
      return element == null ? UNKNOWN : element;
   }

   public String toString() {
      return getLocalName();
   }
}

@@ -185,194 +185,65 @@
 %0A   
-NAME(%22name%22),%0A   KEY(%22key%22),%0A   VALUE(%22value%22),%0A   TYPE_ATTR_NAME(%22type%22),%0A   ROLES_ATTR_NAME(%22roles%22),%0A   CREATEDURABLEQUEUE_NAME(%22createDurableQueue%22),%0A   DELETEDURABLEQUEUE_NAME(%22dele
+CONSUME_NAME(%22consume%22),%0A   CREATEDURABLEQUEUE_NAME(%22crea
 teDu
@@ -307,32 +307,76 @@
 DurableQueue%22),%0A
+   CREATETEMPQUEUE_NAME(%22createTempQueue%22),%0A
    DELETE_NON_DU
@@ -425,241 +425,249 @@
 %0A   
-// HORNETQ-309 we keep supporting these attribute names for compatibility%0A   CREATETEMPQUEUE_NAME(%22createTempQueue%22),%0A   DELETETEMPQUEUE_NAME(%22deleteTempQueue%22),%0A   SEND_NAME(%22send%22),%0A   CONSUME_NAME(%22consume%22),%0A   MANAGE_NAME(%22manag
+DELETEDURABLEQUEUE_NAME(%22deleteDurableQueue%22),%0A   DELETETEMPQUEUE_NAME(%22deleteTempQueue%22),%0A   KEY(%22key%22),%0A   MANAGE_NAME(%22manage%22),%0A   NAME(%22name%22),%0A   ROLES_ATTR_NAME(%22roles%22),%0A   SEND_NAME(%22send%22),%0A   TYPE_ATTR_NAME(%22type%22),%0A   VALUE(%22valu
 e%22),

Alphabetize the attributes