You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by an...@apache.org on 2016/11/07 12:37:56 UTC

[2/3] activemq-artemis git commit: remove JMS JMX Objects and add new Address JMX objects

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSTopicControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSTopicControlImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSTopicControlImpl.java
deleted file mode 100644
index f60f526..0000000
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSTopicControlImpl.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.jms.management.impl;
-
-import javax.json.JsonArrayBuilder;
-import javax.json.JsonObject;
-import javax.management.MBeanInfo;
-import javax.management.StandardMBean;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.activemq.artemis.api.core.ActiveMQException;
-import org.apache.activemq.artemis.api.core.Pair;
-import org.apache.activemq.artemis.api.core.management.ActiveMQServerControl;
-import org.apache.activemq.artemis.api.core.management.AddressControl;
-import org.apache.activemq.artemis.api.core.management.QueueControl;
-import org.apache.activemq.artemis.api.core.management.ResourceNames;
-import org.apache.activemq.artemis.api.jms.management.TopicControl;
-import org.apache.activemq.artemis.core.management.impl.MBeanInfoHelper;
-import org.apache.activemq.artemis.core.server.management.ManagementService;
-import org.apache.activemq.artemis.jms.client.ActiveMQDestination;
-import org.apache.activemq.artemis.jms.client.ActiveMQMessage;
-import org.apache.activemq.artemis.jms.server.JMSServerManager;
-import org.apache.activemq.artemis.utils.JsonLoader;
-import org.apache.activemq.artemis.utils.SelectorTranslator;
-
-import static org.apache.activemq.artemis.api.core.JsonUtil.nullSafe;
-
-public class JMSTopicControlImpl extends StandardMBean implements TopicControl {
-
-   private final ActiveMQDestination managedTopic;
-
-   private final AddressControl addressControl;
-
-   private final ManagementService managementService;
-
-   private final JMSServerManager jmsServerManager;
-
-   // Static --------------------------------------------------------
-
-   public static String createFilterFromJMSSelector(final String selectorStr) throws ActiveMQException {
-      return selectorStr == null || selectorStr.trim().length() == 0 ? null : SelectorTranslator.convertToActiveMQFilterString(selectorStr);
-   }
-
-   // Constructors --------------------------------------------------
-
-   public JMSTopicControlImpl(final ActiveMQDestination topic,
-                              final JMSServerManager jmsServerManager,
-                              final AddressControl addressControl,
-                              final ManagementService managementService) throws Exception {
-      super(TopicControl.class);
-      this.jmsServerManager = jmsServerManager;
-      managedTopic = topic;
-      this.addressControl = addressControl;
-      this.managementService = managementService;
-   }
-
-   // TopicControlMBean implementation ------------------------------
-
-   @Override
-   public void addBinding(String binding) throws Exception {
-      jmsServerManager.addTopicToBindingRegistry(managedTopic.getName(), binding);
-   }
-
-   @Override
-   public String[] getRegistryBindings() {
-      return jmsServerManager.getBindingsOnTopic(managedTopic.getName());
-   }
-
-   @Override
-   public String getName() {
-      return managedTopic.getName();
-   }
-
-   @Override
-   public boolean isTemporary() {
-      return managedTopic.isTemporary();
-   }
-
-   @Override
-   public String getAddress() {
-      return managedTopic.getAddress();
-   }
-
-   @Override
-   public long getMessageCount() {
-      return getMessageCount(DurabilityType.ALL);
-   }
-
-   @Override
-   public int getDeliveringCount() {
-      List<QueueControl> queues = getQueues(DurabilityType.ALL);
-      int count = 0;
-      for (QueueControl queue : queues) {
-         count += queue.getDeliveringCount();
-      }
-      return count;
-   }
-
-   @Override
-   public long getMessagesAdded() {
-      List<QueueControl> queues = getQueues(DurabilityType.ALL);
-      int count = 0;
-      for (QueueControl queue : queues) {
-         count += queue.getMessagesAdded();
-      }
-      return count;
-   }
-
-   @Override
-   public int getDurableMessageCount() {
-      return getMessageCount(DurabilityType.DURABLE);
-   }
-
-   @Override
-   public int getNonDurableMessageCount() {
-      return getMessageCount(DurabilityType.NON_DURABLE);
-   }
-
-   @Override
-   public int getSubscriptionCount() {
-      return getQueues(DurabilityType.ALL).size();
-   }
-
-   @Override
-   public int getDurableSubscriptionCount() {
-      return getQueues(DurabilityType.DURABLE).size();
-   }
-
-   @Override
-   public int getNonDurableSubscriptionCount() {
-      return getQueues(DurabilityType.NON_DURABLE).size();
-   }
-
-   @Override
-   public Object[] listAllSubscriptions() {
-      return listSubscribersInfos(DurabilityType.ALL);
-   }
-
-   @Override
-   public String listAllSubscriptionsAsJSON() throws Exception {
-      return listSubscribersInfosAsJSON(DurabilityType.ALL);
-   }
-
-   @Override
-   public Object[] listDurableSubscriptions() {
-      return listSubscribersInfos(DurabilityType.DURABLE);
-   }
-
-   @Override
-   public String listDurableSubscriptionsAsJSON() throws Exception {
-      return listSubscribersInfosAsJSON(DurabilityType.DURABLE);
-   }
-
-   @Override
-   public Object[] listNonDurableSubscriptions() {
-      return listSubscribersInfos(DurabilityType.NON_DURABLE);
-   }
-
-   @Override
-   public String listNonDurableSubscriptionsAsJSON() throws Exception {
-      return listSubscribersInfosAsJSON(DurabilityType.NON_DURABLE);
-   }
-
-   @Override
-   public Map<String, Object>[] listMessagesForSubscription(final String queueName) throws Exception {
-      QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queueName);
-      if (coreQueueControl == null) {
-         throw new IllegalArgumentException("No subscriptions with name " + queueName);
-      }
-
-      Map<String, Object>[] coreMessages = coreQueueControl.listMessages(null);
-
-      Map<String, Object>[] jmsMessages = new Map[coreMessages.length];
-
-      int i = 0;
-
-      for (Map<String, Object> coreMessage : coreMessages) {
-         jmsMessages[i++] = ActiveMQMessage.coreMaptoJMSMap(coreMessage);
-      }
-      return jmsMessages;
-   }
-
-   @Override
-   public String listMessagesForSubscriptionAsJSON(final String queueName) throws Exception {
-      return JMSQueueControlImpl.toJSON(listMessagesForSubscription(queueName));
-   }
-
-   @Override
-   public int countMessagesForSubscription(final String clientID,
-                                           final String subscriptionName,
-                                           final String filterStr) throws Exception {
-      String queueName = ActiveMQDestination.createQueueNameForDurableSubscription(true, clientID, subscriptionName);
-      QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queueName);
-      if (coreQueueControl == null) {
-         throw new IllegalArgumentException("No subscriptions with name " + queueName + " for clientID " + clientID);
-      }
-      String filter = JMSTopicControlImpl.createFilterFromJMSSelector(filterStr);
-      return coreQueueControl.listMessages(filter).length;
-   }
-
-   @Override
-   public int removeMessages(final String filterStr) throws Exception {
-      String filter = JMSTopicControlImpl.createFilterFromJMSSelector(filterStr);
-      int count = 0;
-      String[] queues = addressControl.getQueueNames();
-      for (String queue : queues) {
-         QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queue);
-         if (coreQueueControl != null) {
-            count += coreQueueControl.removeMessages(filter);
-         }
-      }
-
-      return count;
-   }
-
-   @Override
-   public void dropDurableSubscription(final String clientID, final String subscriptionName) throws Exception {
-      String queueName = ActiveMQDestination.createQueueNameForDurableSubscription(true, clientID, subscriptionName);
-      QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queueName);
-      if (coreQueueControl == null) {
-         throw new IllegalArgumentException("No subscriptions with name " + queueName + " for clientID " + clientID);
-      }
-      ActiveMQServerControl serverControl = (ActiveMQServerControl) managementService.getResource(ResourceNames.CORE_SERVER);
-      serverControl.destroyQueue(queueName, true);
-   }
-
-   @Override
-   public void dropAllSubscriptions() throws Exception {
-      ActiveMQServerControl serverControl = (ActiveMQServerControl) managementService.getResource(ResourceNames.CORE_SERVER);
-      String[] queues = addressControl.getQueueNames();
-      for (String queue : queues) {
-         // Drop all subscription shouldn't delete the dummy queue used to identify if the topic exists on the core queues.
-         // we will just ignore this queue
-         if (!queue.equals(managedTopic.getAddress())) {
-            serverControl.destroyQueue(queue);
-         }
-      }
-   }
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   private Object[] listSubscribersInfos(final DurabilityType durability) {
-      List<QueueControl> queues = getQueues(durability);
-      List<Object[]> subInfos = new ArrayList<>(queues.size());
-
-      for (QueueControl queue : queues) {
-         String clientID = null;
-         String subName = null;
-
-         if (queue.isDurable()) {
-            Pair<String, String> pair = ActiveMQDestination.decomposeQueueNameForDurableSubscription(queue.getName());
-            clientID = pair.getA();
-            subName = pair.getB();
-         }
-
-         String filter = queue.getFilter() != null ? queue.getFilter() : null;
-
-         Object[] subscriptionInfo = new Object[6];
-         subscriptionInfo[0] = queue.getName();
-         subscriptionInfo[1] = clientID;
-         subscriptionInfo[2] = subName;
-         subscriptionInfo[3] = queue.isDurable();
-         subscriptionInfo[4] = queue.getMessageCount();
-         subscriptionInfo[5] = filter;
-         subInfos.add(subscriptionInfo);
-      }
-      return subInfos.toArray(new Object[subInfos.size()]);
-   }
-
-   private String listSubscribersInfosAsJSON(final DurabilityType durability) throws Exception {
-      try {
-         List<QueueControl> queues = getQueues(durability);
-         JsonArrayBuilder array = JsonLoader.createArrayBuilder();
-
-         for (QueueControl queue : queues) {
-            String clientID = null;
-            String subName = null;
-
-            if (queue.isDurable()) {
-               Pair<String, String> pair = ActiveMQDestination.decomposeQueueNameForDurableSubscription(queue.getName());
-               clientID = pair.getA();
-               subName = pair.getB();
-            } else {
-               // in the case of heirarchical topics the queue name will not follow the <part>.<part> pattern of normal
-               // durable subscribers so skip decomposing the name for the client ID and subscription name and just
-               // hard-code it
-               clientID = "";
-               subName = "";
-            }
-
-            String filter = queue.getFilter() != null ? queue.getFilter() : null;
-
-            JsonObject info = JsonLoader.createObjectBuilder().add("queueName", queue.getName()).add("clientID", nullSafe(clientID)).add("selector", nullSafe(filter)).add("name", nullSafe(subName)).add("durable", queue.isDurable()).add("messageCount", queue.getMessageCount()).add("deliveringCount", queue.getDeliveringCount()).add("consumers", queue.listConsumersAsJSON()).build();
-
-            array.add(info);
-         }
-
-         return array.build().toString();
-      } catch (Exception e) {
-         e.printStackTrace();
-         return e.toString();
-      }
-   }
-
-   private int getMessageCount(final DurabilityType durability) {
-      List<QueueControl> queues = getQueues(durability);
-      int count = 0;
-      for (QueueControl queue : queues) {
-         count += queue.getMessageCount();
-      }
-      return count;
-   }
-
-   private List<QueueControl> getQueues(final DurabilityType durability) {
-      try {
-         List<QueueControl> matchingQueues = new ArrayList<>();
-         String[] queues = addressControl.getQueueNames();
-         for (String queue : queues) {
-            QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queue);
-
-            // Ignore the "special" subscription
-            if (coreQueueControl != null && !coreQueueControl.getName().equals(addressControl.getAddress())) {
-               if (durability == DurabilityType.ALL || durability == DurabilityType.DURABLE && coreQueueControl.isDurable() ||
-                  durability == DurabilityType.NON_DURABLE && !coreQueueControl.isDurable()) {
-                  matchingQueues.add(coreQueueControl);
-               }
-            }
-         }
-         return matchingQueues;
-      } catch (Exception e) {
-         return Collections.emptyList();
-      }
-   }
-
-   @Override
-   public MBeanInfo getMBeanInfo() {
-      MBeanInfo info = super.getMBeanInfo();
-      return new MBeanInfo(info.getClassName(), info.getDescription(), MBeanInfoHelper.getMBeanAttributesInfo(TopicControl.class), info.getConstructors(), MBeanInfoHelper.getMBeanOperationsInfo(TopicControl.class), info.getNotifications());
-   }
-
-   // Inner classes -------------------------------------------------
-
-   private enum DurabilityType {
-      ALL, DURABLE, NON_DURABLE
-   }
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/openmbean/JMSCompositeDataConstants.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/openmbean/JMSCompositeDataConstants.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/openmbean/JMSCompositeDataConstants.java
deleted file mode 100644
index dc5b33b..0000000
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/openmbean/JMSCompositeDataConstants.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.jms.management.impl.openmbean;
-
-public interface JMSCompositeDataConstants {
-
-   String JMS_DESTINATION = "JMSDestination";
-   String JMS_MESSAGE_ID = "JMSMessageID";
-   String JMS_TYPE = "JMSType";
-   String JMS_DELIVERY_MODE = "JMSDeliveryMode";
-   String JMS_EXPIRATION = "JMSExpiration";
-   String JMS_PRIORITY = "JMSPriority";
-   String JMS_REDELIVERED = "JMSRedelivered";
-   String JMS_TIMESTAMP = "JMSTimestamp";
-   String JMSXGROUP_SEQ = "JMSXGroupSeq";
-   String JMSXGROUP_ID = "JMSXGroupID";
-   String JMSXUSER_ID = "JMSXUserID";
-   String JMS_CORRELATION_ID = "JMSCorrelationID";
-   String ORIGINAL_DESTINATION = "OriginalDestination";
-   String JMS_REPLY_TO = "JMSReplyTo";
-
-   String JMS_DESTINATION_DESCRIPTION = "The message destination";
-   String JMS_MESSAGE_ID_DESCRIPTION = "The message ID";
-   String JMS_TYPE_DESCRIPTION = "The message type";
-   String JMS_DELIVERY_MODE_DESCRIPTION = "The message delivery mode";
-   String JMS_EXPIRATION_DESCRIPTION = "The message expiration";
-   String JMS_PRIORITY_DESCRIPTION = "The message priority";
-   String JMS_REDELIVERED_DESCRIPTION = "Is the message redelivered";
-   String JMS_TIMESTAMP_DESCRIPTION = "The message timestamp";
-   String JMSXGROUP_SEQ_DESCRIPTION = "The message group sequence number";
-   String JMSXGROUP_ID_DESCRIPTION = "The message group ID";
-   String JMSXUSER_ID_DESCRIPTION = "The user that sent the message";
-   String JMS_CORRELATION_ID_DESCRIPTION = "The message correlation ID";
-   String ORIGINAL_DESTINATION_DESCRIPTION = "Original Destination Before Senting To DLQ";
-   String JMS_REPLY_TO_DESCRIPTION = "The reply to address";
-
-   String BODY_LENGTH = "BodyLength";
-   String BODY_PREVIEW = "BodyPreview";
-   String CONTENT_MAP = "ContentMap";
-   String MESSAGE_TEXT = "Text";
-   String MESSAGE_URL = "Url";
-
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/openmbean/JMSOpenTypeSupport.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/openmbean/JMSOpenTypeSupport.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/openmbean/JMSOpenTypeSupport.java
deleted file mode 100644
index 285657d..0000000
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/openmbean/JMSOpenTypeSupport.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * <p/>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p/>
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.jms.management.impl.openmbean;
-
-import javax.management.openmbean.ArrayType;
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.SimpleType;
-import javax.management.openmbean.TabularDataSupport;
-import javax.management.openmbean.TabularType;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.activemq.artemis.api.core.ActiveMQBuffer;
-import org.apache.activemq.artemis.api.core.ActiveMQBuffers;
-import org.apache.activemq.artemis.api.core.Message;
-import org.apache.activemq.artemis.api.core.SimpleString;
-import org.apache.activemq.artemis.core.management.impl.openmbean.CompositeDataConstants;
-import org.apache.activemq.artemis.reader.MapMessageUtil;
-import org.apache.activemq.artemis.utils.TypedProperties;
-
-public final class JMSOpenTypeSupport {
-
-   public interface OpenTypeFactory {
-
-      CompositeType getCompositeType() throws OpenDataException;
-
-      Map<String, Object> getFields(CompositeDataSupport data) throws OpenDataException;
-   }
-
-   private static final Map<Byte, AbstractOpenTypeFactory> OPEN_TYPE_FACTORIES = new HashMap<>();
-
-   public abstract static class AbstractOpenTypeFactory implements OpenTypeFactory {
-
-      private CompositeType compositeType;
-      private final List<String> itemNamesList = new ArrayList<>();
-      private final List<String> itemDescriptionsList = new ArrayList<>();
-      private final List<OpenType> itemTypesList = new ArrayList<>();
-
-      @Override
-      public CompositeType getCompositeType() throws OpenDataException {
-         if (compositeType == null) {
-            init();
-            compositeType = createCompositeType();
-         }
-         return compositeType;
-      }
-
-      protected void init() throws OpenDataException {
-      }
-
-      protected CompositeType createCompositeType() throws OpenDataException {
-         String[] itemNames = itemNamesList.toArray(new String[itemNamesList.size()]);
-         String[] itemDescriptions = itemDescriptionsList.toArray(new String[itemDescriptionsList.size()]);
-         OpenType[] itemTypes = itemTypesList.toArray(new OpenType[itemTypesList.size()]);
-         return new CompositeType(getTypeName(), getDescription(), itemNames, itemDescriptions, itemTypes);
-      }
-
-      protected abstract String getTypeName();
-
-      protected void addItem(String name, String description, OpenType type) {
-         itemNamesList.add(name);
-         itemDescriptionsList.add(description);
-         itemTypesList.add(type);
-      }
-
-      protected String getDescription() {
-         return getTypeName();
-      }
-
-      @Override
-      public Map<String, Object> getFields(CompositeDataSupport data) throws OpenDataException {
-         Map<String, Object> rc = new HashMap<>();
-         return rc;
-      }
-   }
-
-   static class MessageOpenTypeFactory extends AbstractOpenTypeFactory {
-
-      protected TabularType stringPropertyTabularType;
-      protected TabularType booleanPropertyTabularType;
-      protected TabularType bytePropertyTabularType;
-      protected TabularType shortPropertyTabularType;
-      protected TabularType intPropertyTabularType;
-      protected TabularType longPropertyTabularType;
-      protected TabularType floatPropertyTabularType;
-      protected TabularType doublePropertyTabularType;
-
-      protected ArrayType body;
-
-      @Override
-      protected String getTypeName() {
-         return Message.class.getName();
-      }
-
-      @Override
-      protected void init() throws OpenDataException {
-         super.init();
-
-         addItem(JMSCompositeDataConstants.JMS_DESTINATION, JMSCompositeDataConstants.JMS_DESTINATION_DESCRIPTION, SimpleType.STRING);
-         addItem(JMSCompositeDataConstants.JMS_MESSAGE_ID, JMSCompositeDataConstants.JMS_MESSAGE_ID_DESCRIPTION, SimpleType.STRING);
-         addItem(JMSCompositeDataConstants.JMS_CORRELATION_ID, JMSCompositeDataConstants.JMS_CORRELATION_ID_DESCRIPTION, SimpleType.STRING);
-         addItem(JMSCompositeDataConstants.JMS_TYPE, JMSCompositeDataConstants.JMS_TYPE_DESCRIPTION, SimpleType.STRING);
-         addItem(JMSCompositeDataConstants.JMS_DELIVERY_MODE, JMSCompositeDataConstants.JMS_DELIVERY_MODE_DESCRIPTION, SimpleType.STRING);
-         addItem(JMSCompositeDataConstants.JMS_EXPIRATION, JMSCompositeDataConstants.JMS_EXPIRATION_DESCRIPTION, SimpleType.LONG);
-         addItem(JMSCompositeDataConstants.JMS_PRIORITY, JMSCompositeDataConstants.JMS_PRIORITY_DESCRIPTION, SimpleType.INTEGER);
-         addItem(JMSCompositeDataConstants.JMS_REDELIVERED, JMSCompositeDataConstants.JMS_REDELIVERED_DESCRIPTION, SimpleType.BOOLEAN);
-         addItem(JMSCompositeDataConstants.JMS_TIMESTAMP, JMSCompositeDataConstants.JMS_TIMESTAMP_DESCRIPTION, SimpleType.DATE);
-         addItem(JMSCompositeDataConstants.JMSXGROUP_ID, JMSCompositeDataConstants.JMSXGROUP_ID_DESCRIPTION, SimpleType.STRING);
-         addItem(JMSCompositeDataConstants.JMSXGROUP_SEQ, JMSCompositeDataConstants.JMSXGROUP_SEQ_DESCRIPTION, SimpleType.INTEGER);
-         addItem(JMSCompositeDataConstants.JMSXUSER_ID, JMSCompositeDataConstants.JMSXUSER_ID_DESCRIPTION, SimpleType.STRING);
-         addItem(JMSCompositeDataConstants.JMS_REPLY_TO, JMSCompositeDataConstants.JMS_REPLY_TO_DESCRIPTION, SimpleType.STRING);
-         addItem(JMSCompositeDataConstants.ORIGINAL_DESTINATION, JMSCompositeDataConstants.ORIGINAL_DESTINATION_DESCRIPTION, SimpleType.STRING);
-         addItem(CompositeDataConstants.PROPERTIES, CompositeDataConstants.PROPERTIES_DESCRIPTION, SimpleType.STRING);
-
-         // now lets expose the type safe properties
-         stringPropertyTabularType = createTabularType(String.class, SimpleType.STRING);
-         booleanPropertyTabularType = createTabularType(Boolean.class, SimpleType.BOOLEAN);
-         bytePropertyTabularType = createTabularType(Byte.class, SimpleType.BYTE);
-         shortPropertyTabularType = createTabularType(Short.class, SimpleType.SHORT);
-         intPropertyTabularType = createTabularType(Integer.class, SimpleType.INTEGER);
-         longPropertyTabularType = createTabularType(Long.class, SimpleType.LONG);
-         floatPropertyTabularType = createTabularType(Float.class, SimpleType.FLOAT);
-         doublePropertyTabularType = createTabularType(Double.class, SimpleType.DOUBLE);
-
-         addItem(CompositeDataConstants.STRING_PROPERTIES, CompositeDataConstants.STRING_PROPERTIES_DESCRIPTION, stringPropertyTabularType);
-         addItem(CompositeDataConstants.BOOLEAN_PROPERTIES, CompositeDataConstants.BOOLEAN_PROPERTIES_DESCRIPTION, booleanPropertyTabularType);
-         addItem(CompositeDataConstants.BYTE_PROPERTIES, CompositeDataConstants.BYTE_PROPERTIES_DESCRIPTION, bytePropertyTabularType);
-         addItem(CompositeDataConstants.SHORT_PROPERTIES, CompositeDataConstants.SHORT_PROPERTIES_DESCRIPTION, shortPropertyTabularType);
-         addItem(CompositeDataConstants.INT_PROPERTIES, CompositeDataConstants.INT_PROPERTIES_DESCRIPTION, intPropertyTabularType);
-         addItem(CompositeDataConstants.LONG_PROPERTIES, CompositeDataConstants.LONG_PROPERTIES_DESCRIPTION, longPropertyTabularType);
-         addItem(CompositeDataConstants.FLOAT_PROPERTIES, CompositeDataConstants.FLOAT_PROPERTIES_DESCRIPTION, floatPropertyTabularType);
-         addItem(CompositeDataConstants.DOUBLE_PROPERTIES, CompositeDataConstants.DOUBLE_PROPERTIES_DESCRIPTION, doublePropertyTabularType);
-      }
-
-      @Override
-      public Map<String, Object> getFields(CompositeDataSupport data) throws OpenDataException {
-         Map<String, Object> rc = super.getFields(data);
-         putString(rc, data, JMSCompositeDataConstants.JMS_MESSAGE_ID, CompositeDataConstants.USER_ID);
-         putString(rc, data, JMSCompositeDataConstants.JMS_DESTINATION, CompositeDataConstants.ADDRESS);
-         putStringProperty(rc, data, JMSCompositeDataConstants.JMS_REPLY_TO, "JMSReplyTo");
-         rc.put(JMSCompositeDataConstants.JMS_TYPE, getType());
-         rc.put(JMSCompositeDataConstants.JMS_DELIVERY_MODE, ((Boolean) data.get(CompositeDataConstants.DURABLE)) ? "PERSISTENT" : "NON-PERSISTENT");
-         rc.put(JMSCompositeDataConstants.JMS_EXPIRATION, data.get(CompositeDataConstants.EXPIRATION));
-         rc.put(JMSCompositeDataConstants.JMS_TIMESTAMP, new Date((Long) data.get(CompositeDataConstants.TIMESTAMP)));
-         rc.put(JMSCompositeDataConstants.JMS_PRIORITY, ((Byte) data.get(CompositeDataConstants.PRIORITY)).intValue());
-         putStringProperty(rc, data, JMSCompositeDataConstants.JMS_CORRELATION_ID, JMSCompositeDataConstants.JMS_CORRELATION_ID);
-         rc.put(JMSCompositeDataConstants.JMS_REDELIVERED, data.get(CompositeDataConstants.REDELIVERED));
-         putStringProperty(rc, data, JMSCompositeDataConstants.JMSXGROUP_ID, Message.HDR_GROUP_ID.toString());
-         putIntProperty(rc, data, JMSCompositeDataConstants.JMSXGROUP_SEQ, JMSCompositeDataConstants.JMSXGROUP_SEQ);
-         putStringProperty(rc, data, JMSCompositeDataConstants.JMSXUSER_ID, Message.HDR_VALIDATED_USER.toString());
-         putStringProperty(rc, data, JMSCompositeDataConstants.ORIGINAL_DESTINATION, Message.HDR_ORIGINAL_ADDRESS.toString());
-
-         rc.put(CompositeDataConstants.PROPERTIES, "" + data.get(CompositeDataConstants.PROPERTIES));
-
-         rc.put(CompositeDataConstants.STRING_PROPERTIES, data.get(CompositeDataConstants.STRING_PROPERTIES));
-         rc.put(CompositeDataConstants.BOOLEAN_PROPERTIES, data.get(CompositeDataConstants.BOOLEAN_PROPERTIES));
-         rc.put(CompositeDataConstants.BYTE_PROPERTIES, data.get(CompositeDataConstants.BYTE_PROPERTIES));
-         rc.put(CompositeDataConstants.SHORT_PROPERTIES, data.get(CompositeDataConstants.SHORT_PROPERTIES));
-         rc.put(CompositeDataConstants.INT_PROPERTIES, data.get(CompositeDataConstants.INT_PROPERTIES));
-         rc.put(CompositeDataConstants.LONG_PROPERTIES, data.get(CompositeDataConstants.LONG_PROPERTIES));
-         rc.put(CompositeDataConstants.FLOAT_PROPERTIES, data.get(CompositeDataConstants.FLOAT_PROPERTIES));
-         rc.put(CompositeDataConstants.DOUBLE_PROPERTIES, data.get(CompositeDataConstants.DOUBLE_PROPERTIES));
-
-         return rc;
-      }
-
-      private void putString(Map<String, Object> rc, CompositeDataSupport data, String target, String source) {
-         String prop = (String) data.get(source);
-         if (prop != null) {
-            rc.put(target, prop);
-         } else {
-            rc.put(target, "");
-         }
-      }
-
-      private void putStringProperty(Map<String, Object> rc, CompositeDataSupport data, String target, String source) {
-         TabularDataSupport properties = (TabularDataSupport) data.get(CompositeDataConstants.STRING_PROPERTIES);
-         Object[] keys = new Object[]{source};
-         CompositeDataSupport cds = (CompositeDataSupport) properties.get(keys);
-         String prop = "";
-         if (cds != null && cds.get("value") != null) {
-            prop = (String) cds.get("value");
-         }
-         rc.put(target, prop);
-      }
-
-      private void putIntProperty(Map<String, Object> rc, CompositeDataSupport data, String target, String source) {
-         TabularDataSupport properties = (TabularDataSupport) data.get(CompositeDataConstants.INT_PROPERTIES);
-         Object[] keys = new Object[]{source};
-         CompositeDataSupport cds = (CompositeDataSupport) properties.get(keys);
-         Integer prop = 0;
-         if (cds != null && cds.get("value") != null) {
-            prop = (Integer) cds.get("value");
-         }
-         rc.put(target, prop);
-      }
-
-      private String getType() {
-         return "Message";
-      }
-
-      protected String toString(Object value) {
-         if (value == null) {
-            return null;
-         }
-         return value.toString();
-      }
-
-      protected <T> TabularType createTabularType(Class<T> type, OpenType openType) throws OpenDataException {
-         String typeName = "java.util.Map<java.lang.String, " + type.getName() + ">";
-         String[] keyValue = new String[]{"key", "value"};
-         OpenType[] openTypes = new OpenType[]{SimpleType.STRING, openType};
-         CompositeType rowType = new CompositeType(typeName, typeName, keyValue, keyValue, openTypes);
-         return new TabularType(typeName, typeName, rowType, new String[]{"key"});
-      }
-   }
-
-   static class ByteMessageOpenTypeFactory extends MessageOpenTypeFactory {
-
-      @Override
-      protected String getTypeName() {
-         return "BytesMessage";
-      }
-
-      @Override
-      protected void init() throws OpenDataException {
-         super.init();
-         addItem(JMSCompositeDataConstants.BODY_LENGTH, "Body length", SimpleType.LONG);
-         addItem(JMSCompositeDataConstants.BODY_PREVIEW, "Body preview", new ArrayType(SimpleType.BYTE, true));
-      }
-
-      @Override
-      public Map<String, Object> getFields(CompositeDataSupport data) throws OpenDataException {
-         Map<String, Object> rc = super.getFields(data);
-         ActiveMQBuffer buffer = ActiveMQBuffers.wrappedBuffer((byte[]) data.get("body"));
-         long length = 0;
-         length = buffer.readableBytes();
-         rc.put(JMSCompositeDataConstants.BODY_LENGTH, Long.valueOf(length));
-         byte[] preview = new byte[(int) Math.min(length, 255)];
-         buffer.readBytes(preview);
-         rc.put(JMSCompositeDataConstants.BODY_PREVIEW, preview);
-         return rc;
-      }
-   }
-
-   static class MapMessageOpenTypeFactory extends MessageOpenTypeFactory {
-
-      @Override
-      protected String getTypeName() {
-         return "MapMessage";
-      }
-
-      @Override
-      protected void init() throws OpenDataException {
-         super.init();
-         addItem(JMSCompositeDataConstants.CONTENT_MAP, "Content map", SimpleType.STRING);
-      }
-
-      @Override
-      public Map<String, Object> getFields(CompositeDataSupport data) throws OpenDataException {
-         Map<String, Object> rc = super.getFields(data);
-         ActiveMQBuffer buffer = ActiveMQBuffers.wrappedBuffer((byte[]) data.get("body"));
-         TypedProperties properties = new TypedProperties();
-         MapMessageUtil.readBodyMap(buffer, properties);
-         rc.put(JMSCompositeDataConstants.CONTENT_MAP, "" + properties.getMap());
-         return rc;
-      }
-   }
-
-   static class ObjectMessageOpenTypeFactory extends MessageOpenTypeFactory {
-
-      @Override
-      protected String getTypeName() {
-         return "ObjectMessage";
-      }
-   }
-
-   static class StreamMessageOpenTypeFactory extends MessageOpenTypeFactory {
-
-      @Override
-      protected String getTypeName() {
-         return "StreamMessage";
-      }
-   }
-
-   static class TextMessageOpenTypeFactory extends MessageOpenTypeFactory {
-
-      @Override
-      protected String getTypeName() {
-         return "TextMessage";
-      }
-
-      @Override
-      protected void init() throws OpenDataException {
-         super.init();
-         addItem(JMSCompositeDataConstants.MESSAGE_TEXT, JMSCompositeDataConstants.MESSAGE_TEXT, SimpleType.STRING);
-      }
-
-      @Override
-      public Map<String, Object> getFields(CompositeDataSupport data) throws OpenDataException {
-         Map<String, Object> rc = super.getFields(data);
-         ActiveMQBuffer buffer = ActiveMQBuffers.wrappedBuffer((byte[]) data.get("body"));
-         SimpleString value = buffer.readNullableSimpleString();
-         rc.put(JMSCompositeDataConstants.MESSAGE_TEXT, value != null ? value.toString() : "");
-         return rc;
-      }
-
-   }
-
-   static {
-      OPEN_TYPE_FACTORIES.put(Message.DEFAULT_TYPE, new MessageOpenTypeFactory());
-      OPEN_TYPE_FACTORIES.put(Message.TEXT_TYPE, new TextMessageOpenTypeFactory());
-      OPEN_TYPE_FACTORIES.put(Message.BYTES_TYPE, new ByteMessageOpenTypeFactory());
-      OPEN_TYPE_FACTORIES.put(Message.MAP_TYPE, new MapMessageOpenTypeFactory());
-      OPEN_TYPE_FACTORIES.put(Message.OBJECT_TYPE, new ObjectMessageOpenTypeFactory());
-      OPEN_TYPE_FACTORIES.put(Message.STREAM_TYPE, new StreamMessageOpenTypeFactory());
-   }
-
-   private JMSOpenTypeSupport() {
-   }
-
-   public static OpenTypeFactory getFactory(Byte type) throws OpenDataException {
-      return OPEN_TYPE_FACTORIES.get(type);
-   }
-
-   public static CompositeData convert(CompositeDataSupport data) throws OpenDataException {
-      OpenTypeFactory f = getFactory((Byte) data.get("type"));
-      if (f == null) {
-         throw new OpenDataException("Cannot create a CompositeData for type: " + data.get("type"));
-      }
-      CompositeType ct = f.getCompositeType();
-      Map<String, Object> fields = f.getFields(data);
-      return new CompositeDataSupport(ct, fields);
-   }
-
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
index f10962e..e879dbf 100644
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
+++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java
@@ -86,9 +86,7 @@ import org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration;
 import org.apache.activemq.artemis.jms.server.config.TopicConfiguration;
 import org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl;
 import org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration;
-import org.apache.activemq.artemis.jms.server.management.JMSManagementService;
 import org.apache.activemq.artemis.jms.server.management.JMSNotificationType;
-import org.apache.activemq.artemis.jms.server.management.impl.JMSManagementServiceImpl;
 import org.apache.activemq.artemis.jms.transaction.JMSTransactionDetail;
 import org.apache.activemq.artemis.spi.core.naming.BindingRegistry;
 import org.apache.activemq.artemis.utils.JsonLoader;
@@ -133,8 +131,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
 
    private final ActiveMQServer server;
 
-   private JMSManagementService jmsManagementService;
-
    private boolean startCalled;
 
    private boolean active;
@@ -191,10 +187,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
 
       try {
 
-         jmsManagementService = new JMSManagementServiceImpl(server.getManagementService(), server, this);
-
-         jmsManagementService.registerJMSServer(this);
-
          // Must be set to active before calling initJournal
          active = true;
 
@@ -249,15 +241,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
             topicBindings.clear();
             topics.clear();
 
-            // it could be null if a backup
-            if (jmsManagementService != null) {
-               jmsManagementService.unregisterJMSServer();
-
-               jmsManagementService.stop();
-            }
-
-            jmsManagementService = null;
-
             active = false;
          }
       } catch (Exception e) {
@@ -388,7 +371,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
 //      server.setJMSQueueCreator(new JMSDestinationCreator());
 //
 //      server.setJMSQueueDeleter(new JMSQueueDeleter());
-
       server.registerActivateCallback(this);
 
 //      server.registerPostQueueCreationCallback(new JMSPostQueueCreationCallback());
@@ -800,8 +782,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
          queues.remove(name);
          queueBindings.remove(name);
 
-         jmsManagementService.unregisterQueue(name);
-
          storage.deleteDestination(PersistedType.Queue, name);
 
          sendNotification(JMSNotificationType.QUEUE_DESTROYED, name);
@@ -840,8 +820,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
             topics.remove(name);
             topicBindings.remove(name);
 
-            jmsManagementService.unregisterTopic(name);
-
             storage.deleteDestination(PersistedType.Topic, name);
 
             sendNotification(JMSNotificationType.TOPIC_DESTROYED, name);
@@ -1097,8 +1075,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
 
          this.recoverregistryBindings(queueName, PersistedType.Queue);
 
-         jmsManagementService.registerQueue(activeMQQueue, queue);
-
          return true;
       }
    }
@@ -1133,8 +1109,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
 
          this.recoverregistryBindings(topicName, PersistedType.Topic);
 
-         jmsManagementService.registerTopic(activeMQTopic);
-
          return true;
       }
    }
@@ -1154,8 +1128,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
 
       connectionFactories.put(cfConfig.getName(), cf);
 
-      jmsManagementService.registerConnectionFactory(cfConfig.getName(), cfConfig, cf);
-
       return cf;
    }
 
@@ -1281,8 +1253,6 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback
       connectionFactoryBindings.remove(name);
       connectionFactories.remove(name);
 
-      jmsManagementService.unregisterConnectionFactory(name);
-
       return true;
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/management/JMSManagementService.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/management/JMSManagementService.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/management/JMSManagementService.java
deleted file mode 100644
index ff6c240..0000000
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/management/JMSManagementService.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.jms.server.management;
-
-import org.apache.activemq.artemis.api.jms.management.JMSServerControl;
-import org.apache.activemq.artemis.core.server.Queue;
-import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
-import org.apache.activemq.artemis.jms.client.ActiveMQQueue;
-import org.apache.activemq.artemis.jms.client.ActiveMQTopic;
-import org.apache.activemq.artemis.jms.server.JMSServerManager;
-import org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration;
-
-public interface JMSManagementService {
-
-   JMSServerControl registerJMSServer(JMSServerManager server) throws Exception;
-
-   void unregisterJMSServer() throws Exception;
-
-   void registerQueue(ActiveMQQueue queue, Queue serverQueue) throws Exception;
-
-   void unregisterQueue(String name) throws Exception;
-
-   void registerTopic(ActiveMQTopic topic) throws Exception;
-
-   void unregisterTopic(String name) throws Exception;
-
-   void registerConnectionFactory(String name,
-                                  ConnectionFactoryConfiguration config,
-                                  ActiveMQConnectionFactory connectionFactory) throws Exception;
-
-   void unregisterConnectionFactory(String name) throws Exception;
-
-   void stop() throws Exception;
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/management/impl/JMSManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/management/impl/JMSManagementServiceImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/management/impl/JMSManagementServiceImpl.java
deleted file mode 100644
index 2b3f7a2..0000000
--- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/management/impl/JMSManagementServiceImpl.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.activemq.artemis.jms.server.management.impl;
-
-import javax.management.ObjectName;
-
-import org.apache.activemq.artemis.api.core.management.AddressControl;
-import org.apache.activemq.artemis.api.core.management.QueueControl;
-import org.apache.activemq.artemis.api.core.management.ResourceNames;
-import org.apache.activemq.artemis.api.jms.management.ConnectionFactoryControl;
-import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
-import org.apache.activemq.artemis.api.jms.management.JMSServerControl;
-import org.apache.activemq.artemis.api.jms.management.TopicControl;
-import org.apache.activemq.artemis.core.messagecounter.MessageCounter;
-import org.apache.activemq.artemis.core.messagecounter.MessageCounterManager;
-import org.apache.activemq.artemis.core.server.ActiveMQServer;
-import org.apache.activemq.artemis.core.server.Queue;
-import org.apache.activemq.artemis.core.server.management.ManagementService;
-import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;
-import org.apache.activemq.artemis.jms.client.ActiveMQQueue;
-import org.apache.activemq.artemis.jms.client.ActiveMQTopic;
-import org.apache.activemq.artemis.jms.management.impl.JMSConnectionFactoryControlImpl;
-import org.apache.activemq.artemis.jms.management.impl.JMSQueueControlImpl;
-import org.apache.activemq.artemis.jms.management.impl.JMSServerControlImpl;
-import org.apache.activemq.artemis.jms.management.impl.JMSTopicControlImpl;
-import org.apache.activemq.artemis.jms.server.JMSServerManager;
-import org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration;
-import org.apache.activemq.artemis.jms.server.management.JMSManagementService;
-
-public class JMSManagementServiceImpl implements JMSManagementService {
-
-   // Constants -----------------------------------------------------
-
-   // Attributes ----------------------------------------------------
-
-   private final ManagementService managementService;
-
-   private final JMSServerManager jmsServerManager;
-
-   // Static --------------------------------------------------------
-
-   public JMSManagementServiceImpl(final ManagementService managementService,
-                                   final ActiveMQServer server,
-                                   final JMSServerManager jmsServerManager) {
-      this.managementService = managementService;
-      this.jmsServerManager = jmsServerManager;
-   }
-
-   // Public --------------------------------------------------------
-
-   // JMSManagementRegistration implementation ----------------------
-
-   @Override
-   public synchronized JMSServerControl registerJMSServer(final JMSServerManager server) throws Exception {
-      ObjectName objectName = managementService.getObjectNameBuilder().getJMSServerObjectName();
-      JMSServerControlImpl control = new JMSServerControlImpl(server);
-      managementService.registerInJMX(objectName, control);
-      managementService.registerInRegistry(ResourceNames.JMS_SERVER, control);
-      return control;
-   }
-
-   @Override
-   public synchronized void unregisterJMSServer() throws Exception {
-      ObjectName objectName = managementService.getObjectNameBuilder().getJMSServerObjectName();
-      managementService.unregisterFromJMX(objectName);
-      managementService.unregisterFromRegistry(ResourceNames.JMS_SERVER);
-   }
-
-   @Override
-   public synchronized void registerQueue(final ActiveMQQueue queue, final Queue serverQueue) throws Exception {
-      QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queue.getAddress());
-      MessageCounterManager messageCounterManager = managementService.getMessageCounterManager();
-      MessageCounter counter = new MessageCounter(queue.getName(), null, serverQueue, false, coreQueueControl.isDurable(), messageCounterManager.getMaxDayCount());
-      messageCounterManager.registerMessageCounter(queue.getName(), counter);
-      ObjectName objectName = managementService.getObjectNameBuilder().getJMSQueueObjectName(queue.getQueueName());
-      JMSQueueControlImpl control = new JMSQueueControlImpl(queue, coreQueueControl, jmsServerManager, counter);
-      managementService.registerInJMX(objectName, control);
-      managementService.registerInRegistry(queue.getQueueName(), control);
-   }
-
-   @Override
-   public synchronized void unregisterQueue(final String name) throws Exception {
-      ObjectName objectName = managementService.getObjectNameBuilder().getJMSQueueObjectName(name);
-      managementService.unregisterFromJMX(objectName);
-      managementService.unregisterFromRegistry(name);
-   }
-
-   @Override
-   public synchronized void registerTopic(final ActiveMQTopic topic) throws Exception {
-      ObjectName objectName = managementService.getObjectNameBuilder().getJMSTopicObjectName(topic.getTopicName());
-      AddressControl addressControl = (AddressControl) managementService.getResource(ResourceNames.CORE_ADDRESS + topic.getAddress());
-      JMSTopicControlImpl control = new JMSTopicControlImpl(topic, jmsServerManager, addressControl, managementService);
-      managementService.registerInJMX(objectName, control);
-      managementService.registerInRegistry(topic.getTopicName(), control);
-   }
-
-   @Override
-   public synchronized void unregisterTopic(final String name) throws Exception {
-      ObjectName objectName = managementService.getObjectNameBuilder().getJMSTopicObjectName(name);
-      managementService.unregisterFromJMX(objectName);
-      managementService.unregisterFromRegistry(name);
-   }
-
-   @Override
-   public synchronized void registerConnectionFactory(final String name,
-                                                      final ConnectionFactoryConfiguration cfConfig,
-                                                      final ActiveMQConnectionFactory connectionFactory) throws Exception {
-      ObjectName objectName = managementService.getObjectNameBuilder().getConnectionFactoryObjectName(name);
-      JMSConnectionFactoryControlImpl control = new JMSConnectionFactoryControlImpl(cfConfig, connectionFactory, jmsServerManager, name);
-      managementService.registerInJMX(objectName, control);
-      managementService.registerInRegistry(ResourceNames.JMS_CONNECTION_FACTORY + name, control);
-   }
-
-   @Override
-   public synchronized void unregisterConnectionFactory(final String name) throws Exception {
-      ObjectName objectName = managementService.getObjectNameBuilder().getConnectionFactoryObjectName(name);
-      managementService.unregisterFromJMX(objectName);
-      managementService.unregisterFromRegistry(ResourceNames.JMS_CONNECTION_FACTORY + name);
-   }
-
-   @Override
-   public void stop() throws Exception {
-      for (Object resource : managementService.getResources(ConnectionFactoryControl.class)) {
-         unregisterConnectionFactory(((ConnectionFactoryControl) resource).getName());
-      }
-      for (Object resource : managementService.getResources(JMSQueueControl.class)) {
-         unregisterQueue(((JMSQueueControl) resource).getName());
-      }
-      for (Object resource : managementService.getResources(TopicControl.class)) {
-         unregisterTopic(((TopicControl) resource).getName());
-      }
-   }
-
-   // Package protected ---------------------------------------------
-
-   // Protected -----------------------------------------------------
-
-   // Private -------------------------------------------------------
-
-   // Inner classes -------------------------------------------------
-}

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
index 9140fe4..fa26c4d 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java
@@ -80,6 +80,7 @@ import org.apache.activemq.artemis.core.server.cluster.ha.LiveOnlyPolicy;
 import org.apache.activemq.artemis.core.server.cluster.ha.ScaleDownPolicy;
 import org.apache.activemq.artemis.core.server.cluster.ha.SharedStoreSlavePolicy;
 import org.apache.activemq.artemis.core.server.group.GroupingHandler;
+import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy;
@@ -552,6 +553,18 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
    }
 
    @Override
+   public void createAddress(String name, int routingType,  boolean defaultDeleteOnNoConsumers, int defaultMaxConsumers) throws Exception {
+      checkStarted();
+
+      clearIO();
+      try {
+         server.createOrUpdateAddressInfo(new AddressInfo(new SimpleString(name), AddressInfo.RoutingType.getType((byte)routingType), defaultDeleteOnNoConsumers, defaultMaxConsumers));
+      } finally {
+         blockOnIO();
+      }
+   }
+
+   @Override
    public void deployQueue(final String address, final String name, final String filterString) throws Exception {
       checkStarted();
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
index bc07973..c627e7e 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java
@@ -21,6 +21,7 @@ import javax.management.MBeanAttributeInfo;
 import javax.management.MBeanOperationInfo;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.apache.activemq.artemis.api.core.SimpleString;
@@ -34,7 +35,13 @@ import org.apache.activemq.artemis.core.postoffice.PostOffice;
 import org.apache.activemq.artemis.core.postoffice.QueueBinding;
 import org.apache.activemq.artemis.core.security.CheckType;
 import org.apache.activemq.artemis.core.security.Role;
+import org.apache.activemq.artemis.core.security.SecurityAuth;
+import org.apache.activemq.artemis.core.security.SecurityStore;
+import org.apache.activemq.artemis.core.server.impl.AddressInfo;
+import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl;
 import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
+import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
+import org.apache.activemq.artemis.utils.Base64;
 import org.apache.activemq.artemis.utils.JsonLoader;
 
 public class AddressControlImpl extends AbstractControl implements AddressControl {
@@ -43,7 +50,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
 
    // Attributes ----------------------------------------------------
 
-   private final SimpleString address;
+   private AddressInfo addressInfo;
 
    private final PostOffice postOffice;
 
@@ -51,20 +58,24 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
 
    private final HierarchicalRepository<Set<Role>> securityRepository;
 
+   private final SecurityStore securityStore;
+
    // Static --------------------------------------------------------
 
    // Constructors --------------------------------------------------
 
-   public AddressControlImpl(final SimpleString address,
+   public AddressControlImpl(AddressInfo addressInfo,
                              final PostOffice postOffice,
                              final PagingManager pagingManager,
                              final StorageManager storageManager,
-                             final HierarchicalRepository<Set<Role>> securityRepository) throws Exception {
+                             final HierarchicalRepository<Set<Role>> securityRepository,
+                             final SecurityStore securityStore)throws Exception {
       super(AddressControl.class, storageManager);
-      this.address = address;
+      this.addressInfo = addressInfo;
       this.postOffice = postOffice;
       this.pagingManager = pagingManager;
       this.securityRepository = securityRepository;
+      this.securityStore = securityStore;
    }
 
    // Public --------------------------------------------------------
@@ -73,14 +84,19 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
 
    @Override
    public String getAddress() {
-      return address.toString();
+      return addressInfo.getName().toString();
+   }
+
+   @Override
+   public String getRoutingType() {
+      return addressInfo.getRoutingType().toString();
    }
 
    @Override
    public String[] getQueueNames() throws Exception {
       clearIO();
       try {
-         Bindings bindings = postOffice.getBindingsForAddress(address);
+         Bindings bindings = postOffice.getBindingsForAddress(addressInfo.getName());
          List<String> queueNames = new ArrayList<>();
          for (Binding binding : bindings.getBindings()) {
             if (binding instanceof QueueBinding) {
@@ -99,7 +115,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
    public String[] getBindingNames() throws Exception {
       clearIO();
       try {
-         Bindings bindings = postOffice.getBindingsForAddress(address);
+         Bindings bindings = postOffice.getBindingsForAddress(addressInfo.getName());
          String[] bindingNames = new String[bindings.getBindings().size()];
          int i = 0;
          for (Binding binding : bindings.getBindings()) {
@@ -117,7 +133,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
    public Object[] getRoles() throws Exception {
       clearIO();
       try {
-         Set<Role> roles = securityRepository.getMatch(address.toString());
+         Set<Role> roles = securityRepository.getMatch(addressInfo.getName().toString());
 
          Object[] objRoles = new Object[roles.size()];
 
@@ -136,7 +152,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
       clearIO();
       try {
          JsonArrayBuilder json = JsonLoader.createArrayBuilder();
-         Set<Role> roles = securityRepository.getMatch(address.toString());
+         Set<Role> roles = securityRepository.getMatch(addressInfo.getName().toString());
 
          for (Role role : roles) {
             json.add(role.toJson());
@@ -151,7 +167,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
    public long getNumberOfBytesPerPage() throws Exception {
       clearIO();
       try {
-         return pagingManager.getPageStore(address).getPageSizeBytes();
+         return pagingManager.getPageStore(addressInfo.getName()).getPageSizeBytes();
       } finally {
          blockOnIO();
       }
@@ -161,7 +177,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
    public long getAddressSize() throws Exception {
       clearIO();
       try {
-         return pagingManager.getPageStore(address).getAddressSize();
+         return pagingManager.getPageStore(addressInfo.getName()).getAddressSize();
       } finally {
          blockOnIO();
       }
@@ -172,7 +188,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
       clearIO();
       long totalMsgs = 0;
       try {
-         Bindings bindings = postOffice.getBindingsForAddress(address);
+         Bindings bindings = postOffice.getBindingsForAddress(addressInfo.getName());
          for (Binding binding : bindings.getBindings()) {
             if (binding instanceof QueueBinding) {
                totalMsgs += ((QueueBinding) binding).getQueue().getMessageCount();
@@ -190,7 +206,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
    public boolean isPaging() throws Exception {
       clearIO();
       try {
-         return pagingManager.getPageStore(address).isPaging();
+         return pagingManager.getPageStore(addressInfo.getName()).isPaging();
       } finally {
          blockOnIO();
       }
@@ -200,18 +216,77 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
    public int getNumberOfPages() throws Exception {
       clearIO();
       try {
-         PagingStore pageStore = pagingManager.getPageStore(address);
+         PagingStore pageStore = pagingManager.getPageStore(addressInfo.getName());
 
          if (!pageStore.isPaging()) {
             return 0;
          } else {
-            return pagingManager.getPageStore(address).getNumberOfPages();
+            return pagingManager.getPageStore(addressInfo.getName()).getNumberOfPages();
          }
       } finally {
          blockOnIO();
       }
    }
 
+  /* @Override
+      public String sendTextMessage(Map<String, String> headers,
+                                    String body,
+                                    String user,
+                                    String password) throws Exception {
+         boolean durable = false;
+         if (headers.containsKey("JMSDeliveryMode")) {
+            String jmsDeliveryMode = headers.remove("JMSDeliveryMode");
+            if (jmsDeliveryMode != null && (jmsDeliveryMode.equals("2") || jmsDeliveryMode.equalsIgnoreCase("PERSISTENT"))) {
+               durable = true;
+            }
+         }
+         String userID = UUIDGenerator.getInstance().generateStringUUID();
+         ActiveMQBuffer buffer = ActiveMQBuffers.dynamicBuffer(56);
+         buffer.writeNullableSimpleString(new SimpleString(body));
+         byte[] bytes = new byte[buffer.readableBytes()];
+         buffer.readBytes(bytes);
+         coreQueueControl.sendMessage(headers, Message.TEXT_TYPE, Base64.encodeBytes(bytes), userID, durable, user, password);
+         return userID;
+      }*/
+
+   @Override
+   public String sendMessage(final Map<String, String> headers,
+                             final int type,
+                             final String body,
+                             boolean durable,
+                             final String user,
+                             final String password) throws Exception {
+      securityStore.check(addressInfo.getName(), CheckType.SEND, new SecurityAuth() {
+         @Override
+         public String getUsername() {
+            return user;
+         }
+
+         @Override
+         public String getPassword() {
+            return password;
+         }
+
+         @Override
+         public RemotingConnection getRemotingConnection() {
+            return null;
+         }
+      });
+      ServerMessageImpl message = new ServerMessageImpl(storageManager.generateID(), 50);
+      for (String header : headers.keySet()) {
+         message.putStringProperty(new SimpleString(header), new SimpleString(headers.get(header)));
+      }
+      message.setType((byte) type);
+      message.setDurable(durable);
+      message.setTimestamp(System.currentTimeMillis());
+      if (body != null) {
+         message.getBodyBuffer().writeBytes(Base64.decode(body));
+      }
+      message.setAddress(addressInfo.getName());
+      postOffice.route(message, null, true);
+      return "" + message.getMessageID();
+   }
+
    @Override
    protected MBeanOperationInfo[] fillMBeanOperationInfo() {
       return MBeanInfoHelper.getMBeanOperationsInfo(AddressControl.class);

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
index 85bad25..7a1bb26 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java
@@ -22,6 +22,7 @@ import javax.json.JsonObjectBuilder;
 import javax.management.MBeanAttributeInfo;
 import javax.management.MBeanOperationInfo;
 import javax.management.openmbean.CompositeData;
+import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Date;
@@ -38,6 +39,7 @@ import org.apache.activemq.artemis.api.core.management.QueueControl;
 import org.apache.activemq.artemis.core.filter.Filter;
 import org.apache.activemq.artemis.core.filter.impl.FilterImpl;
 import org.apache.activemq.artemis.core.management.impl.openmbean.OpenTypeSupport;
+import org.apache.activemq.artemis.core.message.impl.MessageImpl;
 import org.apache.activemq.artemis.core.messagecounter.MessageCounter;
 import org.apache.activemq.artemis.core.messagecounter.impl.MessageCounterHelper;
 import org.apache.activemq.artemis.core.persistence.StorageManager;
@@ -59,7 +61,6 @@ import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
 import org.apache.activemq.artemis.utils.Base64;
 import org.apache.activemq.artemis.utils.JsonLoader;
 import org.apache.activemq.artemis.utils.LinkedListIterator;
-import org.apache.activemq.artemis.utils.UUID;
 
 public class QueueControlImpl extends AbstractControl implements QueueControl {
 
@@ -694,7 +695,6 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
    public String sendMessage(final Map<String, String> headers,
                              final int type,
                              final String body,
-                             final String userID,
                              boolean durable,
                              final String user,
                              final String password) throws Exception {
@@ -721,11 +721,13 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
       message.setType((byte) type);
       message.setDurable(durable);
       message.setTimestamp(System.currentTimeMillis());
-      message.setUserID(new UUID(UUID.TYPE_TIME_BASED, UUID.stringToBytes(userID)));
       if (body != null) {
          message.getBodyBuffer().writeBytes(Base64.decode(body));
       }
       message.setAddress(queue.getAddress());
+      ByteBuffer buffer = ByteBuffer.allocate(8);
+      buffer.putLong(queue.getID());
+      message.putBytesProperty(MessageImpl.HDR_ROUTE_TO_IDS, buffer.array());
       postOffice.route(message, null, true);
       return "" + message.getMessageID();
    }
@@ -885,6 +887,10 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
    }
 
    @Override
+   public CompositeData[] browse() throws Exception {
+      return browse(null);
+   }
+   @Override
    public CompositeData[] browse(String filterStr) throws Exception {
       checkStarted();
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
index 4c51373..1b6dc42 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java
@@ -422,7 +422,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
    @Override
    public AddressInfo addAddressInfo(AddressInfo addressInfo) {
       try {
-         getServer().getManagementService().registerAddress(addressInfo.getName());
+         managementService.registerAddress(addressInfo);
       } catch (Exception e) {
          e.printStackTrace();
       }
@@ -432,7 +432,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
    @Override
    public AddressInfo addOrUpdateAddressInfo(AddressInfo addressInfo) {
       try {
-         getServer().getManagementService().registerAddress(addressInfo.getName());
+         managementService.registerAddress(addressInfo);
       } catch (Exception e) {
          e.printStackTrace();
       }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
index d62598e..58d8ff2 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java
@@ -2424,9 +2424,6 @@ public class ActiveMQServerImpl implements ActiveMQServer {
          throw e;
       }
 
-      if (!addressAlreadyExists) {
-         managementService.registerAddress(queue.getAddress());
-      }
       managementService.registerQueue(queue, queue.getAddress(), storageManager);
 
       callPostQueueCreationCallbacks(queue.getName());

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
index 488c4b2..708aeda 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AddressInfo.java
@@ -33,6 +33,13 @@ public class AddressInfo {
       this.name = name;
    }
 
+   public AddressInfo(SimpleString name, RoutingType routingType,  boolean defaultDeleteOnNoConsumers, int defaultMaxConsumers) {
+      this(name);
+      this.routingType = routingType;
+      this.defaultDeleteOnNoConsumers = defaultDeleteOnNoConsumers;
+      this.defaultMaxQueueConsumers = defaultMaxConsumers;
+   }
+
    public RoutingType getRoutingType() {
       return routingType;
    }

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java
index dc64ddd..76fc69b 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java
@@ -166,7 +166,7 @@ public class PostOfficeJournalLoader implements JournalLoader {
 
          queues.put(queue.getID(), queue);
          postOffice.addBinding(binding);
-         managementService.registerAddress(queue.getAddress());
+         //managementService.registerAddress(queue.getAddress());
          managementService.registerQueue(queue, queue.getAddress(), storageManager);
 
       }
@@ -184,7 +184,7 @@ public class PostOfficeJournalLoader implements JournalLoader {
             .setDefaultMaxQueueConsumers(addressBindingInfo.getDefaultMaxConsumers());
 
          postOffice.addAddressInfo(addressInfo);
-         managementService.registerAddress(addressInfo.getName());
+         managementService.registerAddress(addressInfo);
       }
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementService.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementService.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementService.java
index 5f40c53..7da756c 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementService.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/ManagementService.java
@@ -45,6 +45,7 @@ import org.apache.activemq.artemis.core.server.ServerMessage;
 import org.apache.activemq.artemis.core.server.cluster.Bridge;
 import org.apache.activemq.artemis.core.server.cluster.BroadcastGroup;
 import org.apache.activemq.artemis.core.server.cluster.ClusterConnection;
+import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.core.settings.HierarchicalRepository;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.core.transaction.ResourceManager;
@@ -89,7 +90,7 @@ public interface ManagementService extends NotificationService, ActiveMQComponen
 
    void unregisterFromRegistry(final String resourceName);
 
-   void registerAddress(SimpleString address) throws Exception;
+   void registerAddress(AddressInfo addressInfo) throws Exception;
 
    void unregisterAddress(SimpleString address) throws Exception;
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
index ac1ab1a..6490b0f 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java
@@ -75,6 +75,7 @@ import org.apache.activemq.artemis.core.server.ServerMessage;
 import org.apache.activemq.artemis.core.server.cluster.Bridge;
 import org.apache.activemq.artemis.core.server.cluster.BroadcastGroup;
 import org.apache.activemq.artemis.core.server.cluster.ClusterConnection;
+import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl;
 import org.apache.activemq.artemis.core.server.management.ManagementService;
 import org.apache.activemq.artemis.core.server.management.Notification;
@@ -210,13 +211,13 @@ public class ManagementServiceImpl implements ManagementService {
    }
 
    @Override
-   public synchronized void registerAddress(final SimpleString address) throws Exception {
-      ObjectName objectName = objectNameBuilder.getAddressObjectName(address);
-      AddressControlImpl addressControl = new AddressControlImpl(address, postOffice, pagingManager, storageManager, securityRepository);
+   public void registerAddress(AddressInfo addressInfo) throws Exception {
+      ObjectName objectName = objectNameBuilder.getAddressObjectName(addressInfo.getName());
+      AddressControlImpl addressControl = new AddressControlImpl(addressInfo, postOffice, pagingManager, storageManager, securityRepository, securityStore);
 
       registerInJMX(objectName, addressControl);
 
-      registerInRegistry(ResourceNames.CORE_ADDRESS + address, addressControl);
+      registerInRegistry(ResourceNames.ADDRESS + addressInfo.getName(), addressControl);
 
       if (logger.isDebugEnabled()) {
          logger.debug("registered address " + objectName);
@@ -230,7 +231,6 @@ public class ManagementServiceImpl implements ManagementService {
       unregisterFromJMX(objectName);
       unregisterFromRegistry(ResourceNames.CORE_ADDRESS + address);
    }
-
    @Override
    public synchronized void registerQueue(final Queue queue,
                                           final SimpleString address,
@@ -260,7 +260,7 @@ public class ManagementServiceImpl implements ManagementService {
 
    @Override
    public synchronized void registerDivert(final Divert divert, final DivertConfiguration config) throws Exception {
-      ObjectName objectName = objectNameBuilder.getDivertObjectName(divert.getUniqueName().toString());
+      ObjectName objectName = objectNameBuilder.getDivertObjectName(divert.getUniqueName().toString(), config.getAddress());
       DivertControl divertControl = new DivertControlImpl(divert, storageManager, config);
       registerInJMX(objectName, divertControl);
       registerInRegistry(ResourceNames.CORE_DIVERT + config.getName(), divertControl);
@@ -272,7 +272,7 @@ public class ManagementServiceImpl implements ManagementService {
 
    @Override
    public synchronized void unregisterDivert(final SimpleString name) throws Exception {
-      ObjectName objectName = objectNameBuilder.getDivertObjectName(name.toString());
+      ObjectName objectName = objectNameBuilder.getDivertObjectName(name.toString(), null);
       unregisterFromJMX(objectName);
       unregisterFromRegistry(ResourceNames.CORE_DIVERT + name);
    }
@@ -470,7 +470,6 @@ public class ManagementServiceImpl implements ManagementService {
 
    @Override
    public synchronized void unregisterFromRegistry(final String resourceName) {
-      ActiveMQServerLogger.LOGGER.info("Unregistering: " + resourceName, new Exception());
       registry.remove(resourceName);
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java
index 1211dee..e79a3c7 100644
--- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java
+++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java
@@ -47,6 +47,7 @@ import org.apache.activemq.artemis.core.server.ServerMessage;
 import org.apache.activemq.artemis.core.server.cluster.Bridge;
 import org.apache.activemq.artemis.core.server.cluster.BroadcastGroup;
 import org.apache.activemq.artemis.core.server.cluster.ClusterConnection;
+import org.apache.activemq.artemis.core.server.impl.AddressInfo;
 import org.apache.activemq.artemis.core.server.management.ManagementService;
 import org.apache.activemq.artemis.core.server.management.Notification;
 import org.apache.activemq.artemis.core.server.management.NotificationListener;
@@ -245,7 +246,7 @@ public class ClusteredResetMockTest extends ActiveMQTestBase {
       }
 
       @Override
-      public void registerAddress(SimpleString address) throws Exception {
+      public void registerAddress(AddressInfo addressInfo) throws Exception {
 
       }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java
----------------------------------------------------------------------
diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java
index a89edb8..e9815f7 100644
--- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java
+++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java
@@ -38,10 +38,10 @@ import com.arjuna.ats.arjuna.coordinator.TransactionReaper;
 import com.arjuna.ats.arjuna.coordinator.TxControl;
 import com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionManagerImple;
 import org.apache.activemq.artemis.api.core.TransportConfiguration;
+import org.apache.activemq.artemis.api.core.management.AddressControl;
 import org.apache.activemq.artemis.api.jms.ActiveMQJMSClient;
 import org.apache.activemq.artemis.api.jms.JMSFactoryType;
 import org.apache.activemq.artemis.api.jms.management.JMSQueueControl;
-import org.apache.activemq.artemis.api.jms.management.TopicControl;
 import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.registry.JndiBindingRegistry;
 import org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants;
@@ -504,8 +504,8 @@ public abstract class BridgeTestBase extends ActiveMQTestBase {
       if (index == 1) {
          managementService = server1.getManagementService();
       }
-      TopicControl topicControl = (TopicControl) managementService.getResource(topic.getTopicName());
-      Assert.assertEquals(0, topicControl.getSubscriptionCount());
+      AddressControl topicControl = (AddressControl) managementService.getResource("address." + topic.getTopicName());
+      Assert.assertEquals(0, topicControl.getQueueNames().length);
 
    }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToOpenwireTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToOpenwireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToOpenwireTest.java
index 0bc3e28..1a0a997 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToOpenwireTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/crossprotocol/AMQPToOpenwireTest.java
@@ -35,7 +35,6 @@ import org.apache.activemq.artemis.core.config.Configuration;
 import org.apache.activemq.artemis.core.server.ActiveMQServer;
 import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
 import org.apache.activemq.artemis.jms.server.JMSServerManager;
-import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
 import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
 import org.apache.qpid.jms.JmsConnectionFactory;
 import org.junit.After;

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/3858b1cf/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
index 3d0f00c..bac9671 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java
@@ -594,12 +594,12 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
 
       ActiveMQServerControl serverControl = createManagementControl();
 
-      checkNoResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(name));
+      checkNoResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(name, address));
       assertEquals(0, serverControl.getDivertNames().length);
 
       serverControl.createDivert(name.toString(), null, address, forwardingAddress, true, null, null);
 
-      checkResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(name));
+      checkResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(name, address));
    }
 
    @Test
@@ -611,13 +611,13 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
 
       ActiveMQServerControl serverControl = createManagementControl();
 
-      checkNoResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(name));
+      checkNoResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(name, address));
       assertEquals(0, serverControl.getDivertNames().length);
 
       serverControl.createDivert(name.toString(), routingName, address, forwardingAddress, true, null, null);
 
-      checkResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(name));
-      DivertControl divertControl = ManagementControlHelper.createDivertControl(name.toString(), mbeanServer);
+      checkResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(name, address));
+      DivertControl divertControl = ManagementControlHelper.createDivertControl(name.toString(), address, mbeanServer);
       assertEquals(name.toString(), divertControl.getUniqueName());
       assertEquals(address, divertControl.getAddress());
       assertEquals(forwardingAddress, divertControl.getForwardingAddress());
@@ -658,7 +658,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase {
 
       serverControl.destroyDivert(name.toString());
 
-      checkNoResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(name));
+      checkNoResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(name, address));
       assertEquals(0, serverControl.getDivertNames().length);
 
       // check that a message is no longer diverted