activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r783335 - in /activemq/sandbox/activemq-flow/activemq-jmx: ./ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/activemq/ src/main/java/org/apache/activemq/broker/ src/main/java/org/apache/activemq/broker/jmx/
Date Wed, 10 Jun 2009 12:54:37 GMT
Author: chirino
Date: Wed Jun 10 12:54:36 2009
New Revision: 783335

URL: http://svn.apache.org/viewvc?rev=783335&view=rev
Log:
Adding the MBean interfaces from 5.x

Added:
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java   (with props)
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/CompositeDataConstants.java
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/CompositeDataHelper.java
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java   (with props)
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java   (with props)
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java   (with props)
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/FTConnectorViewMBean.java
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/JmsConnectorViewMBean.java
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/NetworkBridgeViewMBean.java
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/NetworkConnectorViewMBean.java
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ProxyConnectorViewMBean.java
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java   (with props)
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/TopicSubscriptionViewMBean.java
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/TopicViewMBean.java   (with props)
    activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/package.html   (with props)
Modified:
    activemq/sandbox/activemq-flow/activemq-jmx/   (props changed)

Propchange: activemq/sandbox/activemq-flow/activemq-jmx/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jun 10 12:54:36 2009
@@ -0,0 +1,9 @@
+.project
+.classpath
+.settings
+.wtpmodules
+*.iml
+junit*.properties
+eclipse-classes
+target
+

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,185 @@
+/**
+ * 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.broker.jmx;
+
+import javax.management.ObjectName;
+
+import org.apache.activemq.Service;
+
+
+/**
+ * @author David Martin Clavo david(dot)martin(dot)clavo(at)gmail.com (for the reloadLog4jProperties method)
+ * @version $Revision$
+ */
+public interface BrokerViewMBean extends Service {
+
+    /**
+     * @return The unique id of the broker.
+     */
+    String getBrokerId();
+    
+    /**
+     * @return The name of the broker.
+     */
+    String getBrokerName();    
+
+    /**
+     * The Broker will fush it's caches so that the garbage collector can
+     * recalaim more memory.
+     * 
+     * @throws Exception
+     */
+    void gc() throws Exception;
+
+    void resetStatistics();
+
+    void enableStatistics();
+
+    void disableStatistics();
+
+    boolean isStatisticsEnabled();
+
+    long getTotalEnqueueCount();
+
+    long getTotalDequeueCount();
+
+    long getTotalConsumerCount();
+
+    long getTotalMessageCount();
+
+    int getMemoryPercentUsage();
+
+    long getMemoryLimit();
+
+    void setMemoryLimit(long limit);
+        
+    int getStorePercentUsage();
+
+    long getStoreLimit();
+
+    void setStoreLimit(long limit);
+    
+    int getTempPercentUsage();
+
+    long getTempLimit();
+
+    void setTempLimit(long limit);
+    
+    boolean isPersistent();
+    
+    boolean isSlave();
+
+    /**
+     * Shuts down the JVM.
+     * 
+     * @param exitCode the exit code that will be reported by the JVM process
+     *                when it exits.
+     */
+    void terminateJVM(int exitCode);
+
+    /**
+     * Stop the broker and all it's components.
+     */
+    void stop() throws Exception;
+
+    ObjectName[] getTopics();
+
+    ObjectName[] getQueues();
+
+    ObjectName[] getTemporaryTopics();
+
+    ObjectName[] getTemporaryQueues();
+
+    ObjectName[] getTopicSubscribers();
+
+    ObjectName[] getDurableTopicSubscribers();
+
+    ObjectName[] getInactiveDurableTopicSubscribers();
+
+    ObjectName[] getQueueSubscribers();
+
+    ObjectName[] getTemporaryTopicSubscribers();
+
+    ObjectName[] getTemporaryQueueSubscribers();
+
+    String addConnector(String discoveryAddress) throws Exception;
+
+    String addNetworkConnector(String discoveryAddress) throws Exception;
+
+    boolean removeConnector(String connectorName) throws Exception;
+
+    boolean removeNetworkConnector(String connectorName) throws Exception;
+
+    /**
+     * Adds a Topic destination to the broker.
+     * 
+     * @param name The name of the Topic
+     * @throws Exception
+     */
+    void addTopic(String name) throws Exception;
+
+    /**
+     * Adds a Queue destination to the broker.
+     * 
+     * @param name The name of the Queue
+     * @throws Exception
+     */
+    void addQueue(String name) throws Exception;
+
+    /**
+     * Removes a Topic destination from the broker.
+     * 
+     * @param name The name of the Topic
+     * @throws Exception
+     */
+    void removeTopic(String name) throws Exception;
+
+    /**
+     * Removes a Queue destination from the broker.
+     * 
+     * @param name The name of the Queue
+     * @throws Exception
+     */
+    void removeQueue(String name) throws Exception;
+
+    /**
+     * Creates a new durable topic subscriber
+     * 
+     * @param clientId the JMS client ID
+     * @param subscriberName the durable subscriber name
+     * @param topicName the name of the topic to subscribe to
+     * @param selector a selector or null
+     * @return the object name of the MBean registered in JMX
+     */
+    ObjectName createDurableSubscriber(String clientId, String subscriberName, String topicName, String selector) throws Exception;
+
+    /**
+     * Destroys a durable subscriber
+     * 
+     * @param clientId the JMS client ID
+     * @param subscriberName the durable subscriber name
+     */
+    void destroyDurableSubscriber(String clientId, String subscriberName) throws Exception;
+
+    /**
+     * Reloads log4j.properties from the classpath.
+     * This methods calls org.apache.activemq.transport.TransportLoggerControl.reloadLog4jProperties
+     * @throws Throwable 
+     */
+    public void reloadLog4jProperties() throws Throwable;
+    
+}

Propchange: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/BrokerViewMBean.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/CompositeDataConstants.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/CompositeDataConstants.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/CompositeDataConstants.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/CompositeDataConstants.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,42 @@
+/**
+ *
+ * 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.broker.jmx;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public interface CompositeDataConstants {
+    String PROPERTIES = "PropertiesText";
+    String JMSXGROUP_SEQ = "JMSXGroupSeq";
+    String JMSXGROUP_ID = "JMSXGroupID";
+    String BODY_LENGTH = "BodyLength";
+    String BODY_PREVIEW = "BodyPreview";
+    String CONTENT_MAP = "ContentMap";
+    String MESSAGE_TEXT = "Text";
+    String ORIGINAL_DESTINATION = "OriginalDestination";
+
+    // User properties
+    String STRING_PROPERTIES = "StringProperties";
+    String BOOLEAN_PROPERTIES = "BooleanProperties";
+    String BYTE_PROPERTIES = "ByteProperties";
+    String SHORT_PROPERTIES = "ShortProperties";
+    String INT_PROPERTIES = "IntProperties";
+    String LONG_PROPERTIES = "LongProperties";
+    String FLOAT_PROPERTIES = "FloatProperties";
+    String DOUBLE_PROPERTIES = "DoubleProperties";
+}

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/CompositeDataHelper.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/CompositeDataHelper.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/CompositeDataHelper.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/CompositeDataHelper.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,73 @@
+/**
+ *
+ * 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.broker.jmx;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularData;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @version $Revision: 1.1 $
+ */
+public class CompositeDataHelper {
+
+    /**
+     * Extracts the named TabularData field from the CompositeData and converts it to a Map
+     * which is the method used to get the typesafe user properties.
+     */
+    public static Map getTabularMap(CompositeData cdata, String fieldName) {
+        Map map = new HashMap();
+        appendTabularMap(map, cdata, fieldName);
+        return map;
+    }
+
+    public static void appendTabularMap(Map map, CompositeData cdata, String fieldName) {
+        Object tabularObject = cdata.get(fieldName);
+        if (tabularObject instanceof TabularData) {
+            TabularData tabularData = (TabularData) tabularObject;
+            Collection<CompositeData> values = (Collection<CompositeData>) tabularData.values();
+            for (CompositeData compositeData : values) {
+                Object key = compositeData.get("key");
+                Object value = compositeData.get("value");
+                map.put(key, value);
+            }
+        }
+    }
+
+    /**
+     * Returns a map of all the user properties in the given message {@link javax.management.openmbean.CompositeData}
+     * object
+     *
+     * @param cdata
+     * @return
+     */
+    public static Map getMessageUserProperties(CompositeData cdata) {
+        Map map = new HashMap();
+        appendTabularMap(map, cdata, CompositeDataConstants.STRING_PROPERTIES);
+        appendTabularMap(map, cdata, CompositeDataConstants.BOOLEAN_PROPERTIES);
+        appendTabularMap(map, cdata, CompositeDataConstants.BYTE_PROPERTIES);
+        appendTabularMap(map, cdata, CompositeDataConstants.SHORT_PROPERTIES);
+        appendTabularMap(map, cdata, CompositeDataConstants.INT_PROPERTIES);
+        appendTabularMap(map, cdata, CompositeDataConstants.LONG_PROPERTIES);
+        appendTabularMap(map, cdata, CompositeDataConstants.FLOAT_PROPERTIES);
+        appendTabularMap(map, cdata, CompositeDataConstants.DOUBLE_PROPERTIES);
+        return map;
+    }
+}

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,73 @@
+/**
+ * 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.broker.jmx;
+
+import org.apache.activemq.Service;
+
+public interface ConnectionViewMBean extends Service {
+    /**
+     * @return true if the Connection is slow
+     */
+    boolean isSlow();
+
+    /**
+     * @return if after being marked, the Connection is still writing
+     */
+    boolean isBlocked();
+
+    /**
+     * @return true if the Connection is connected
+     */
+    boolean isConnected();
+
+    /**
+     * @return true if the Connection is active
+     */
+    boolean isActive();
+
+    /**
+     * Returns the number of messages to be dispatched to this connection
+     */
+    int getDispatchQueueSize();
+    
+    /**
+     * Resets the statistics
+     */
+    void resetStatistics();
+
+    /**
+     * Returns the number of messages enqueued on this connection
+     * 
+     * @return the number of messages enqueued on this connection
+     */
+    long getEnqueueCount();
+
+    /**
+     * Returns the number of messages dequeued on this connection
+     * 
+     * @return the number of messages dequeued on this connection
+     */
+    long getDequeueCount();
+    
+    /**
+     * Returns the source address for this connection
+     * 
+     * @return the souce address for this connection
+     */
+    String getRemoteAddress();
+
+}

Propchange: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,59 @@
+/**
+ * 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.broker.jmx;
+
+import org.apache.activemq.Service;
+
+public interface ConnectorViewMBean extends Service {
+    
+    /**
+     * Resets the statistics
+     */
+    void resetStatistics();
+    
+    /**
+     * enable statistics gathering
+     */   
+    void enableStatistics();
+
+    /**
+     * disable statistics gathering
+     */  
+    void disableStatistics();
+    
+    /**
+     * Returns true if statistics is enabled
+     * 
+     * @return true if statistics is enabled
+     */  
+    boolean isStatisticsEnabled();
+
+    /**
+     * Returns the number of messages enqueued on this connector
+     * 
+     * @return the number of messages enqueued on this connector
+     */
+    long getEnqueueCount();
+
+    /**
+     * Returns the number of messages dequeued on this connector
+     * 
+     * @return the number of messages dequeued on this connector
+     */
+    long getDequeueCount();
+
+}

Propchange: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ConnectorViewMBean.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/DestinationViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,273 @@
+/**
+ * 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.broker.jmx;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.TabularData;
+
+import org.apache.activemq.filter.FilterException;
+
+public interface DestinationViewMBean {
+
+    /**
+     * Returns the name of this destination
+     */
+    String getName();
+
+    /**
+     * Resets the managment counters.
+     */
+    void resetStatistics();
+
+    /**
+     * Returns the number of messages that have been sent to the destination.
+     * 
+     * @return The number of messages that have been sent to the destination.
+     */
+    long getEnqueueCount();
+
+    /**
+     * Returns the number of messages that have been delivered (potentially not
+     * acknowledged) to consumers.
+     * 
+     * @return The number of messages that have been delivered (potentially not
+     *         acknowledged) to consumers.
+     */
+    long getDispatchCount();
+
+    /**
+     * Returns the number of messages that have been acknowledged from the
+     * destination.
+     * 
+     * @return The number of messages that have been acknowledged from the
+     *         destination.
+     */
+    long getDequeueCount();
+    
+    /**
+     * Returns the number of messages that have been dispatched but not
+     * acknowledged
+     * 
+     * @return The number of messages that have been dispatched but not
+     * acknowledged
+     */
+    long getInFlightCount();
+
+    /**
+     * Returns the number of consumers subscribed this destination.
+     * 
+     * @return The number of consumers subscribed this destination.
+     */
+    long getConsumerCount();
+    
+    /**
+     * @return the number of producers publishing to the destination
+     */
+    long getProducerCount();
+
+    /**
+     * Returns the number of messages in this destination which are yet to be
+     * consumed
+     * 
+     * @return Returns the number of messages in this destination which are yet
+     *         to be consumed
+     */
+    long getQueueSize();
+
+    /**
+     * @return An array of all the messages in the destination's queue.
+     */
+    CompositeData[] browse() throws OpenDataException;
+
+    /**
+     * @return A list of all the messages in the destination's queue.
+     */
+    TabularData browseAsTable() throws OpenDataException;
+
+    /**
+     * @return An array of all the messages in the destination's queue.
+     * @throws InvalidSelectorException
+     */
+    CompositeData[] browse(String selector) throws OpenDataException, FilterException;
+
+    /**
+     * @return A list of all the messages in the destination's queue.
+     * @throws InvalidSelectorException
+     */
+    TabularData browseAsTable(String selector) throws OpenDataException, FilterException;
+
+    /**
+     * Sends a TextMesage to the destination.
+     * 
+     * @param body the text to send
+     * @return the message id of the message sent.
+     * @throws Exception
+     */
+    String sendTextMessage(String body) throws Exception;
+
+    /**
+     * Sends a TextMesage to the destination.
+     * 
+     * @param headers the message headers and properties to set. Can only
+     *                container Strings maped to primitive types.
+     * @param body the text to send
+     * @return the message id of the message sent.
+     * @throws Exception
+     */
+    String sendTextMessage(Map headers, String body) throws Exception;
+
+    /**
+     * Sends a TextMesage to the destination.
+     * @param body the text to send
+     * @param user
+     * @param password
+     * @return
+     * @throws Exception
+     */
+    String sendTextMessage(String body, String user, String password) throws Exception;
+    
+    /**
+     * 
+     * @param headers the message headers and properties to set. Can only
+     *                container Strings maped to primitive types.
+     * @param body the text to send
+     * @param user
+     * @param password
+     * @return
+     * @throws Exception
+     */
+    String sendTextMessage(Map headers, String body, String user, String password) throws Exception;
+    /**
+     * @return the percentage of amount of memory used
+     */
+    int getMemoryPercentUsage();
+
+    /**
+     * @return the amount of memory allocated to this destination
+     */
+    long getMemoryLimit();
+
+    /**
+     * set the amount of memory allocated to this destination
+     * @param limit
+     */
+    void setMemoryLimit(long limit);
+    
+    /**
+     * @return the portion of memory from the broker memory limit for this destination
+     */
+    float getMemoryUsagePortion();
+    
+    /**
+     * set the portion of memory from the broker memory limit for this destination
+     * @param value
+     */
+    void setMemoryUsagePortion(float value);
+
+    /**
+     * Browses the current destination returning a list of messages
+     */
+    List browseMessages() throws FilterException;
+
+    /**
+     * Browses the current destination with the given selector returning a list
+     * of messages
+     */
+    List browseMessages(String selector) throws FilterException;
+
+    /**
+     * @return longest time a message is held by a destination
+     */
+    long getMaxEnqueueTime();
+
+    /**
+     * @return shortest time a message is held by a destination
+     */
+    long getMinEnqueueTime();
+
+    /**
+     * @return average time a message is held by a destination
+     */
+    double getAverageEnqueueTime();
+    
+    /**
+     * @return the producerFlowControl
+     */
+    boolean isProducerFlowControl();
+    /**
+     * @param producerFlowControl the producerFlowControl to set
+     */
+    public void setProducerFlowControl(boolean producerFlowControl);
+    
+    /**
+     * @return the maxProducersToAudit
+     */
+    public int getMaxProducersToAudit();
+    
+    /**
+     * @param maxProducersToAudit the maxProducersToAudit to set
+     */
+    public void setMaxProducersToAudit(int maxProducersToAudit);
+    
+    /**
+     * @return the maxAuditDepth
+     */
+    public int getMaxAuditDepth();
+    
+    /**
+     * @param maxAuditDepth the maxAuditDepth to set
+     */
+    public void setMaxAuditDepth(int maxAuditDepth);
+    
+    /**
+     * @return the maximum number of message to be paged into the 
+     * destination
+     */
+    public int getMaxPageSize();
+    
+    /**
+     * @param pageSize
+     * Set the maximum number of messages to page into the destination
+     */
+    public void setMaxPageSize(int pageSize);
+    
+    /**
+     * @return true if caching is enabled of for the destination
+     */
+    public boolean isUseCache();
+    
+    /**
+     * @param value
+     * enable/disable caching on the destination
+     */
+    public void setUseCache(boolean value);
+
+    /**
+     * Returns all the current subscription MBeans matching this destination
+     * 
+     * @return the names of the subscriptions for this destination
+     */
+    ObjectName[] getSubscriptions() throws IOException, MalformedObjectNameException;
+
+}

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,86 @@
+/**
+ * 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.broker.jmx;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.TabularData;
+
+/**
+ * @version $Revision: 1.5 $
+ */
+public interface DurableSubscriptionViewMBean extends SubscriptionViewMBean {
+    /**
+     * @return name of the durable subscription name
+     */
+    String getSubscriptionName();
+
+    /**
+     * Browse messages for this durable subscriber
+     * 
+     * @return messages
+     * @throws OpenDataException
+     */
+    CompositeData[] browse() throws OpenDataException;
+
+    /**
+     * Browse messages for this durable subscriber
+     * 
+     * @return messages
+     * @throws OpenDataException
+     */
+    TabularData browseAsTable() throws OpenDataException;
+
+    /**
+     * Destroys the durable subscription so that messages will no longer be
+     * stored for this subscription
+     */
+    void destroy() throws Exception;
+    
+    /**
+     * @return true if the message cursor has memory space available
+     * to page in more messages
+     */
+    public boolean doesCursorHaveSpace();
+    
+    /**
+     * @return true if the cursor has reached its memory limit for
+     * paged in messages
+     */
+    public boolean isCursorFull();
+    
+    /**
+     * @return true if the cursor has messages buffered to deliver
+     */
+    public boolean doesCursorHaveMessagesBuffered();
+    
+    /**
+     * @return the cursor memory usage in bytes
+     */
+    public long getCursorMemoryUsage();
+    
+    /**
+     * @return the cursor memory usage as a percentage
+     */
+    public int getCursorPercentUsage();
+    
+    /**
+     * @return the number of messages available to be paged in 
+     * by the cursor
+     */
+    public int cursorSize();
+}

Propchange: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/DurableSubscriptionViewMBean.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/FTConnectorViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/FTConnectorViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/FTConnectorViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/FTConnectorViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,23 @@
+/**
+ * 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.broker.jmx;
+
+import org.apache.activemq.Service;
+
+public interface FTConnectorViewMBean extends Service {
+
+}

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/JmsConnectorViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/JmsConnectorViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/JmsConnectorViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/JmsConnectorViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,23 @@
+/**
+ * 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.broker.jmx;
+
+import org.apache.activemq.Service;
+
+public interface JmsConnectorViewMBean extends Service {
+
+}

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ManagementContext.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,429 @@
+/**
+ * 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.broker.jmx;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.MalformedURLException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.management.Attribute;
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.management.remote.JMXConnectorServer;
+import javax.management.remote.JMXConnectorServerFactory;
+import javax.management.remote.JMXServiceURL;
+
+import org.apache.activemq.Service;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * A Flow provides different dispatch policies within the NMR
+ * 
+ * @org.apache.xbean.XBean
+ * @version $Revision$
+ */
+public class ManagementContext implements Service {
+    /**
+     * Default activemq domain
+     */
+    public static final String DEFAULT_DOMAIN = "org.apache.activemq";
+    private static final Log LOG = LogFactory.getLog(ManagementContext.class);
+    private MBeanServer beanServer;
+    private String jmxDomainName = DEFAULT_DOMAIN;
+    private boolean useMBeanServer = true;
+    private boolean createMBeanServer = true;
+    private boolean locallyCreateMBeanServer;
+    private boolean createConnector = true;
+    private boolean findTigerMbeanServer = true;
+    private int connectorPort = 1099;
+    private int rmiServerPort;
+    private String connectorPath = "/jmxrmi";
+    private AtomicBoolean started = new AtomicBoolean(false);
+    private JMXConnectorServer connectorServer;
+    private ObjectName namingServiceObjectName;
+    private Registry registry;
+
+    public ManagementContext() {
+        this(null);
+    }
+
+    public ManagementContext(MBeanServer server) {
+        this.beanServer = server;
+    }
+
+    public void start() throws IOException {
+        // lets force the MBeanServer to be created if needed
+        if (started.compareAndSet(false, true)) {
+            getMBeanServer();
+            if (connectorServer != null) {
+                try {
+                    getMBeanServer().invoke(namingServiceObjectName, "start", null, null);
+                } catch (Throwable ignore) {
+                }
+                Thread t = new Thread("JMX connector") {
+                    public void run() {
+                        try {
+                            JMXConnectorServer server = connectorServer;
+                            if (started.get() && server != null) {
+                                server.start();
+                                LOG.info("JMX consoles can connect to " + server.getAddress());
+                            }
+                        } catch (IOException e) {
+                            LOG.warn("Failed to start jmx connector: " + e.getMessage());
+                        }
+                    }
+                };
+                t.setDaemon(true);
+                t.start();
+            }
+        }
+    }
+
+    public void stop() throws IOException {
+        if (started.compareAndSet(true, false)) {
+            JMXConnectorServer server = connectorServer;
+            connectorServer = null;
+            if (server != null) {
+                try {
+                    server.stop();
+                } catch (IOException e) {
+                    LOG.warn("Failed to stop jmx connector: " + e.getMessage());
+                }
+                try {
+                    getMBeanServer().invoke(namingServiceObjectName, "stop", null, null);
+                } catch (Throwable ignore) {
+                }
+            }
+            if (locallyCreateMBeanServer && beanServer != null) {
+                // check to see if the factory knows about this server
+                List list = MBeanServerFactory.findMBeanServer(null);
+                if (list != null && !list.isEmpty() && list.contains(beanServer)) {
+                    MBeanServerFactory.releaseMBeanServer(beanServer);
+                }
+            }
+            beanServer = null;
+        }
+    }
+
+    /**
+     * @return Returns the jmxDomainName.
+     */
+    public String getJmxDomainName() {
+        return jmxDomainName;
+    }
+
+    /**
+     * @param jmxDomainName The jmxDomainName to set.
+     */
+    public void setJmxDomainName(String jmxDomainName) {
+        this.jmxDomainName = jmxDomainName;
+    }
+
+    /**
+     * Get the MBeanServer
+     * 
+     * @return the MBeanServer
+     */
+    public MBeanServer getMBeanServer() {
+        if (this.beanServer == null) {
+            this.beanServer = findMBeanServer();
+        }
+        return beanServer;
+    }
+
+    /**
+     * Set the MBeanServer
+     * 
+     * @param beanServer
+     */
+    public void setMBeanServer(MBeanServer beanServer) {
+        this.beanServer = beanServer;
+    }
+
+    /**
+     * @return Returns the useMBeanServer.
+     */
+    public boolean isUseMBeanServer() {
+        return useMBeanServer;
+    }
+
+    /**
+     * @param useMBeanServer The useMBeanServer to set.
+     */
+    public void setUseMBeanServer(boolean useMBeanServer) {
+        this.useMBeanServer = useMBeanServer;
+    }
+
+    /**
+     * @return Returns the createMBeanServer flag.
+     */
+    public boolean isCreateMBeanServer() {
+        return createMBeanServer;
+    }
+
+    /**
+     * @param enableJMX Set createMBeanServer.
+     */
+    public void setCreateMBeanServer(boolean enableJMX) {
+        this.createMBeanServer = enableJMX;
+    }
+
+    public boolean isFindTigerMbeanServer() {
+        return findTigerMbeanServer;
+    }
+
+    /**
+     * Enables/disables the searching for the Java 5 platform MBeanServer
+     */
+    public void setFindTigerMbeanServer(boolean findTigerMbeanServer) {
+        this.findTigerMbeanServer = findTigerMbeanServer;
+    }
+
+    /**
+     * Formulate and return the MBean ObjectName of a custom control MBean
+     * 
+     * @param type
+     * @param name
+     * @return the JMX ObjectName of the MBean, or <code>null</code> if
+     *         <code>customName</code> is invalid.
+     */
+    public ObjectName createCustomComponentMBeanName(String type, String name) {
+        ObjectName result = null;
+        String tmp = jmxDomainName + ":" + "type=" + sanitizeString(type) + ",name=" + sanitizeString(name);
+        try {
+            result = new ObjectName(tmp);
+        } catch (MalformedObjectNameException e) {
+            LOG.error("Couldn't create ObjectName from: " + type + " , " + name);
+        }
+        return result;
+    }
+
+    /**
+     * The ':' and '/' characters are reserved in ObjectNames
+     * 
+     * @param in
+     * @return sanitized String
+     */
+    private static String sanitizeString(String in) {
+        String result = null;
+        if (in != null) {
+            result = in.replace(':', '_');
+            result = result.replace('/', '_');
+            result = result.replace('\\', '_');
+        }
+        return result;
+    }
+
+    /**
+     * Retrive an System ObjectName
+     * 
+     * @param domainName
+     * @param containerName
+     * @param theClass
+     * @return the ObjectName
+     * @throws MalformedObjectNameException
+     */
+    public static ObjectName getSystemObjectName(String domainName, String containerName, Class theClass) throws MalformedObjectNameException, NullPointerException {
+        String tmp = domainName + ":" + "type=" + theClass.getName() + ",name=" + getRelativeName(containerName, theClass);
+        return new ObjectName(tmp);
+    }
+
+    private static String getRelativeName(String containerName, Class theClass) {
+        String name = theClass.getName();
+        int index = name.lastIndexOf(".");
+        if (index >= 0 && (index + 1) < name.length()) {
+            name = name.substring(index + 1);
+        }
+        return containerName + "." + name;
+    }
+
+    /**
+     * Unregister an MBean
+     * 
+     * @param name
+     * @throws JMException
+     */
+    public void unregisterMBean(ObjectName name) throws JMException {
+        if (beanServer != null && beanServer.isRegistered(name)) {
+            beanServer.unregisterMBean(name);
+        }
+    }
+
+    protected synchronized MBeanServer findMBeanServer() {
+        MBeanServer result = null;
+        // create the mbean server
+        try {
+            if (useMBeanServer) {
+                if (findTigerMbeanServer) {
+                    result = findTigerMBeanServer();
+                }
+                if (result == null) {
+                    // lets piggy back on another MBeanServer -
+                    // we could be in an appserver!
+                    List list = MBeanServerFactory.findMBeanServer(null);
+                    if (list != null && list.size() > 0) {
+                        result = (MBeanServer)list.get(0);
+                    }
+                }
+            }
+            if (result == null && createMBeanServer) {
+                result = createMBeanServer();
+            }
+        } catch (NoClassDefFoundError e) {
+            LOG.error("Could not load MBeanServer", e);
+        } catch (Throwable e) {
+            // probably don't have access to system properties
+            LOG.error("Failed to initialize MBeanServer", e);
+        }
+        return result;
+    }
+
+    public MBeanServer findTigerMBeanServer() {
+        String name = "java.lang.management.ManagementFactory";
+        Class type = loadClass(name, ManagementContext.class.getClassLoader());
+        if (type != null) {
+            try {
+                Method method = type.getMethod("getPlatformMBeanServer", new Class[0]);
+                if (method != null) {
+                    Object answer = method.invoke(null, new Object[0]);
+                    if (answer instanceof MBeanServer) {
+                    	if (createConnector) {
+                    		createConnector((MBeanServer)answer);
+                    	}
+                        return (MBeanServer)answer;
+                    } else {
+                        LOG.warn("Could not cast: " + answer + " into an MBeanServer. There must be some classloader strangeness in town");
+                    }
+                } else {
+                    LOG.warn("Method getPlatformMBeanServer() does not appear visible on type: " + type.getName());
+                }
+            } catch (Exception e) {
+                LOG.warn("Failed to call getPlatformMBeanServer() due to: " + e, e);
+            }
+        } else {
+            LOG.trace("Class not found: " + name + " so probably running on Java 1.4");
+        }
+        return null;
+    }
+
+    private static Class loadClass(String name, ClassLoader loader) {
+        try {
+            return loader.loadClass(name);
+        } catch (ClassNotFoundException e) {
+            try {
+                return Thread.currentThread().getContextClassLoader().loadClass(name);
+            } catch (ClassNotFoundException e1) {
+                return null;
+            }
+        }
+    }
+
+    /**
+     * @return
+     * @throws NullPointerException
+     * @throws MalformedObjectNameException
+     * @throws IOException
+     */
+    protected MBeanServer createMBeanServer() throws MalformedObjectNameException, IOException {
+        MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer(jmxDomainName);
+        locallyCreateMBeanServer = true;
+        if (createConnector) {
+            createConnector(mbeanServer);
+        }
+        return mbeanServer;
+    }
+
+    /**
+     * @param mbeanServer
+     * @throws MalformedObjectNameException
+     * @throws MalformedURLException
+     * @throws IOException
+     */
+    private void createConnector(MBeanServer mbeanServer) throws MalformedObjectNameException, MalformedURLException, IOException {
+        // Create the NamingService, needed by JSR 160
+        try {
+        	if (registry == null) {
+        		registry = LocateRegistry.createRegistry(connectorPort);
+        	}
+            namingServiceObjectName = ObjectName.getInstance("naming:type=rmiregistry");
+            // Do not use the createMBean as the mx4j jar may not be in the
+            // same class loader than the server
+            Class cl = Class.forName("mx4j.tools.naming.NamingService");
+            mbeanServer.registerMBean(cl.newInstance(), namingServiceObjectName);
+            // mbeanServer.createMBean("mx4j.tools.naming.NamingService",
+            // namingServiceObjectName, null);
+            // set the naming port
+            Attribute attr = new Attribute("Port", Integer.valueOf(connectorPort));
+            mbeanServer.setAttribute(namingServiceObjectName, attr);
+        } catch(ClassNotFoundException e) {
+            LOG.debug("Probably not using JRE 1.4: " + e.getLocalizedMessage());
+        }
+        catch (Throwable e) {
+            LOG.debug("Failed to create local registry", e);
+        }
+        // Create the JMXConnectorServer
+        String rmiServer = "";
+        if (rmiServerPort != 0) {
+            // This is handy to use if you have a firewall and need to
+            // force JMX to use fixed ports.
+            rmiServer = "localhost:" + rmiServerPort;
+        }
+        String serviceURL = "service:jmx:rmi://" + rmiServer + "/jndi/rmi://localhost:" + connectorPort + connectorPath;
+        JMXServiceURL url = new JMXServiceURL(serviceURL);
+        connectorServer = JMXConnectorServerFactory.newJMXConnectorServer(url, null, mbeanServer);
+    }
+
+    public String getConnectorPath() {
+        return connectorPath;
+    }
+
+    public void setConnectorPath(String connectorPath) {
+        this.connectorPath = connectorPath;
+    }
+
+    public int getConnectorPort() {
+        return connectorPort;
+    }
+
+    public void setConnectorPort(int connectorPort) {
+        this.connectorPort = connectorPort;
+    }
+
+    public int getRmiServerPort() {
+        return rmiServerPort;
+    }
+
+    public void setRmiServerPort(int rmiServerPort) {
+        this.rmiServerPort = rmiServerPort;
+    }
+
+    public boolean isCreateConnector() {
+        return createConnector;
+    }
+
+    public void setCreateConnector(boolean createConnector) {
+        this.createConnector = createConnector;
+    }
+}

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/NetworkBridgeViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/NetworkBridgeViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/NetworkBridgeViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/NetworkBridgeViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,35 @@
+/**
+ * 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.broker.jmx;
+
+import org.apache.activemq.Service;
+
+public interface NetworkBridgeViewMBean extends Service {
+
+    String getLocalAddress();
+
+    String getRemoteAddress();
+
+    String getRemoteBrokerName();
+
+    String getLocalBrokerName();
+
+    long getEnqueueCounter();
+
+    long getDequeueCounter();
+
+}

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/NetworkConnectorViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/NetworkConnectorViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/NetworkConnectorViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/NetworkConnectorViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,63 @@
+/**
+ * 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.broker.jmx;
+
+import org.apache.activemq.Service;
+
+public interface NetworkConnectorViewMBean extends Service {
+
+    String getName();
+
+    int getNetworkTTL();
+
+    int getPrefetchSize();
+
+    String getUserName();
+
+    boolean isBridgeTempDestinations();
+
+    boolean isConduitSubscriptions();
+
+    boolean isDecreaseNetworkConsumerPriority();
+
+    boolean isDispatchAsync();
+
+    boolean isDynamicOnly();
+    
+    boolean isDuplex();
+
+    void setBridgeTempDestinations(boolean bridgeTempDestinations);
+
+    void setConduitSubscriptions(boolean conduitSubscriptions);
+
+    void setDispatchAsync(boolean dispatchAsync);
+
+    void setDynamicOnly(boolean dynamicOnly);
+
+    void setNetworkTTL(int networkTTL);
+
+    void setPassword(String password);
+
+    void setPrefetchSize(int prefetchSize);
+
+    void setUserName(String userName);
+
+    String getPassword();
+
+    void setDecreaseNetworkConsumerPriority(boolean decreaseNetworkConsumerPriority);
+
+}

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ProxyConnectorViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ProxyConnectorViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ProxyConnectorViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/ProxyConnectorViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,23 @@
+/**
+ * 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.broker.jmx;
+
+import org.apache.activemq.Service;
+
+public interface ProxyConnectorViewMBean extends Service {
+
+}

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/QueueViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,154 @@
+/**
+ * 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.broker.jmx;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.OpenDataException;
+
+public interface QueueViewMBean extends DestinationViewMBean {
+
+    /**
+     * Retrieve a message from the destination's queue.
+     * 
+     * @param messageId the message id of the message to retrieve
+     * @return A CompositeData object which is a JMX version of the messages
+     * @throws OpenDataException
+     */
+    CompositeData getMessage(String messageId) throws OpenDataException;
+
+    /**
+     * Removes a message from the queue. If the message has already been
+     * dispatched to another consumer, the message cannot be deleted and this
+     * method will return false.
+     * 
+     * @param messageId
+     * @return true if the message was found and could be successfully deleted.
+     * @throws Exception
+     */
+    boolean removeMessage(String messageId) throws Exception;
+
+    /**
+     * Removes the messages matching the given selector
+     * 
+     * @return the number of messages removed
+     */
+    int removeMatchingMessages(String selector) throws Exception;
+
+    /**
+     * Removes the messages matching the given selector up to the maximum number
+     * of matched messages
+     * 
+     * @return the number of messages removed
+     */
+    int removeMatchingMessages(String selector, int maximumMessages) throws Exception;
+
+    /**
+     * Removes all of the messages in the queue.
+     * 
+     * @throws Exception
+     */
+    void purge() throws Exception;
+
+    /**
+     * Copies a given message to another destination.
+     * 
+     * @param messageId
+     * @param destinationName
+     * @return true if the message was found and was successfully copied to the
+     *         other destination.
+     * @throws Exception
+     */
+    boolean copyMessageTo(String messageId, String destinationName) throws Exception;
+
+    /**
+     * Copies the messages matching the given selector
+     * 
+     * @return the number of messages copied
+     */
+    int copyMatchingMessagesTo(String selector, String destinationName) throws Exception;
+
+    /**
+     * Copies the messages matching the given selector up to the maximum number
+     * of matched messages
+     * 
+     * @return the number of messages copied
+     */
+    int copyMatchingMessagesTo(String selector, String destinationName, int maximumMessages) throws Exception;
+
+    /**
+     * Moves the message to another destination.
+     * 
+     * @param messageId
+     * @param destinationName
+     * @return true if the message was found and was successfully copied to the
+     *         other destination.
+     * @throws Exception
+     */
+    boolean moveMessageTo(String messageId, String destinationName) throws Exception;
+
+    /**
+     * Moves a message back to its original destination
+     */
+    boolean retryMessage(String messageId) throws Exception;
+    
+    /**
+     * Moves the messages matching the given selector
+     * 
+     * @return the number of messages removed
+     */
+    int moveMatchingMessagesTo(String selector, String destinationName) throws Exception;
+
+    /**
+     * Moves the messages matching the given selector up to the maximum number
+     * of matched messages
+     */
+    int moveMatchingMessagesTo(String selector, String destinationName, int maximumMessages) throws Exception;
+    
+    /**
+     * @return true if the message cursor has memory space available
+     * to page in more messages
+     */
+    public boolean doesCursorHaveSpace();
+    
+    /**
+     * @return true if the cursor has reached its memory limit for
+     * paged in messages
+     */
+    public boolean isCursorFull();
+    
+    /**
+     * @return true if the cursor has messages buffered to deliver
+     */
+    public boolean doesCursorHaveMessagesBuffered();
+    
+    /**
+     * @return the cursor memory usage in bytes
+     */
+    public long getCursorMemoryUsage();
+    
+    /**
+     * @return the cursor memory usage as a percentage
+     */
+    public int getCursorPercentUsage();
+    
+    /**
+     * @return the number of messages available to be paged in 
+     * by the cursor
+     */
+    public int cursorSize();
+
+}

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,173 @@
+/**
+ * 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.broker.jmx;
+
+import org.apache.activemq.filter.FilterException;
+
+/**
+ * @version $Revision: 1.5 $
+ */
+public interface SubscriptionViewMBean {
+
+    /**
+     * @return the clientId of the Connection the Subscription is on
+     */
+    String getClientId();
+
+    /**
+     * @return the id of the Connection the Subscription is on
+     */
+    String getConnectionId();
+
+    /**
+     * @return the id of the Session the subscription is on
+     */
+    long getSessionId();
+
+    /**
+     * @return the id of the Subscription
+     */
+    long getSubcriptionId();
+
+    /**
+     * @return the destination name
+     */
+    String getDestinationName();
+
+    /**
+     * @return the JMS selector on the current subscription
+     */
+    String getSelector();
+
+    /**
+     * Attempts to change the current active selector on the subscription. This
+     * operation is not supported for persistent topics.
+     */
+    void setSelector(String selector) throws FilterException, UnsupportedOperationException;
+
+    /**
+     * @return true if the destination is a Queue
+     */
+    boolean isDestinationQueue();
+
+    /**
+     * @return true of the destination is a Topic
+     */
+    boolean isDestinationTopic();
+
+    /**
+     * @return true if the destination is temporary
+     */
+    boolean isDestinationTemporary();
+
+    /**
+     * @return true if the subscriber is active
+     */
+    boolean isActive();
+
+    /**
+     * @return number of messages pending delivery
+     */
+    int getPendingQueueSize();
+
+    /**
+     * @return number of messages dispatched
+     */
+    int getDispatchedQueueSize();
+    
+    /**
+     * The same as the number of messages dispatched - 
+     * making it explicit
+     * @return
+     */
+    int getMessageCountAwaitingAcknowledge();
+
+    /**
+     * @return number of messages that matched the subscription
+     */
+    long getDispachedCounter();
+
+    /**
+     * @return number of messages that matched the subscription
+     */
+    long getEnqueueCounter();
+
+    /**
+     * @return number of messages queued by the client
+     */
+    long getDequeueCounter();
+
+    /**
+     * @return the prefetch that has been configured for this subscriber
+     */
+    int getPrefetchSize();
+
+    /**
+     * @return whether or not the subscriber is retroactive or not
+     */
+    boolean isRetroactive();
+
+    /**
+     * @return whether or not the subscriber is an exclusive consumer
+     */
+    boolean isExclusive();
+
+    /**
+     * @return whether or not the subscriber is durable (persistent)
+     */
+    boolean isDurable();
+
+    /**
+     * @return whether or not the subscriber ignores local messages
+     */
+    boolean isNoLocal();
+
+    /**
+     * @return the maximum number of pending messages allowed in addition to the
+     *         prefetch size. If enabled to a non-zero value then this will
+     *         perform eviction of messages for slow consumers on non-durable
+     *         topics.
+     */
+    int getMaximumPendingMessageLimit();
+
+    /**
+     * @return the consumer priority
+     */
+    byte getPriority();
+
+    /**
+     * @return the name of the consumer which is only used for durable
+     *         consumers.
+     */
+    String getSubcriptionName();
+
+    /**
+     * Returns true if this subscription (which may be using wildcards) matches the given queue name
+     *
+     * @param queueName the JMS queue name to match against
+     * @return true if this subscription matches the given queue or false if not
+     */
+    boolean isMatchingQueue(String queueName);
+
+    /**
+     * Returns true if this subscription (which may be using wildcards) matches the given topic name
+     *
+     * @param topicName the JMS topic name to match against
+     * @return true if this subscription matches the given topic or false if not
+     */
+    boolean isMatchingTopic(String topicName);
+}

Propchange: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/SubscriptionViewMBean.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/TopicSubscriptionViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/TopicSubscriptionViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/TopicSubscriptionViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/TopicSubscriptionViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,36 @@
+/**
+ * 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.broker.jmx;
+
+/**
+ *
+ * @version $Revision: 564271 $
+ */
+public interface TopicSubscriptionViewMBean extends SubscriptionViewMBean {
+
+    /**
+     * @return the number of messages discarded due to being a slow consumer
+     */
+    int getDiscardedCount();
+
+    /**
+     * @return the maximun number of messages that can be pending.
+     */
+    int getMaximumPendingQueueSize();
+    void setMaximumPendingQueueSize(int max);
+    
+}

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/TopicViewMBean.java
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/TopicViewMBean.java?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/TopicViewMBean.java (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/TopicViewMBean.java Wed Jun 10 12:54:36 2009
@@ -0,0 +1,20 @@
+/**
+ * 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.broker.jmx;
+
+public interface TopicViewMBean extends DestinationViewMBean {
+}

Propchange: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/TopicViewMBean.java
------------------------------------------------------------------------------
    svn:executable = *

Added: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/package.html
URL: http://svn.apache.org/viewvc/activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/package.html?rev=783335&view=auto
==============================================================================
--- activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/package.html (added)
+++ activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/package.html Wed Jun 10 12:54:36 2009
@@ -0,0 +1,25 @@
+<!--
+    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.
+-->
+<html>
+<head>
+</head>
+<body>
+
+JMX MBeans for the broker and its core connectors.
+
+</body>
+</html>

Propchange: activemq/sandbox/activemq-flow/activemq-jmx/src/main/java/org/apache/activemq/broker/jmx/package.html
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message