001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.activemq.web;
018    
019    import java.util.Collection;
020    
021    import org.apache.activemq.broker.jmx.BrokerViewMBean;
022    import org.apache.activemq.broker.jmx.ConnectionViewMBean;
023    import org.apache.activemq.broker.jmx.ConnectorViewMBean;
024    import org.apache.activemq.broker.jmx.DurableSubscriptionViewMBean;
025    import org.apache.activemq.broker.jmx.NetworkConnectorViewMBean;
026    import org.apache.activemq.broker.jmx.QueueViewMBean;
027    import org.apache.activemq.broker.jmx.SubscriptionViewMBean;
028    import org.apache.activemq.broker.jmx.TopicViewMBean;
029    import org.apache.activemq.command.ActiveMQDestination;
030    
031    /**
032     * A facade for either a local in JVM broker or a remote broker over JMX
033     *
034     * 
035     * @version $Revision: 751656 $
036     */
037    public interface BrokerFacade {
038    
039            /**
040             * The name of the active broker (f.e. 'localhost' or 'my broker').
041             * 
042             * @return not <code>null</code>
043             * @throws Exception
044             */
045            String getBrokerName() throws Exception;
046    
047            /**
048             * Admin view of the broker.
049             * 
050             * @return not <code>null</code>
051             * @throws Exception
052             */
053            BrokerViewMBean getBrokerAdmin() throws Exception;
054    
055            /**
056             * All queues known to the broker.
057             * 
058             * @return not <code>null</code>
059             * @throws Exception
060             */
061            Collection<QueueViewMBean> getQueues() throws Exception;
062    
063            /**
064             * All topics known to the broker.
065             * 
066             * @return not <code>null</code>
067             * @throws Exception
068             */
069            Collection<TopicViewMBean> getTopics() throws Exception;
070    
071            /**
072             * All active consumers of a queue.
073             * 
074             * @param queueName
075             *            the name of the queue, not <code>null</code>
076             * @return not <code>null</code>
077             * @throws Exception
078             */
079            Collection<SubscriptionViewMBean> getQueueConsumers(String queueName)
080                            throws Exception;
081    
082            /**
083             * All durable subscribers to topics of the broker.
084             * 
085             * @return not <code>null</code>
086             * @throws Exception
087             */
088            Collection<DurableSubscriptionViewMBean> getDurableTopicSubscribers()
089                            throws Exception;
090    
091            /**
092             * The names of all transport connectors of the broker (f.e. openwire, ssl)
093             * 
094             * @return not <code>null</code>
095             * @throws Exception
096             */
097            Collection<String> getConnectors() throws Exception;
098    
099            /**
100             * A transport connectors.
101             * 
102             * @param name
103             *            name of the connector (f.e. openwire)
104             * @return <code>null</code> if not found
105             * @throws Exception
106             */
107            ConnectorViewMBean getConnector(String name) throws Exception;
108    
109            /**
110             * All connections to all transport connectors of the broker.
111             * 
112             * @return not <code>null</code>
113             * @throws Exception
114             */
115            Collection<ConnectionViewMBean> getConnections() throws Exception;
116    
117            /**
118             * The names of all connections to a specific transport connectors of the
119             * broker.
120             * 
121             * @see #getConnection(String)
122             * @param connectorName
123             *            not <code>null</code>
124             * @return not <code>null</code>
125             * @throws Exception
126             */
127            Collection<String> getConnections(String connectorName) throws Exception;
128    
129            /**
130             * A specific connection to the broker.
131             * 
132             * @param connectionName
133             *            the name of the connection, not <code>null</code>
134             * @return not <code>null</code>
135             * @throws Exception
136             */
137            ConnectionViewMBean getConnection(String connectionName) throws Exception;
138            /**
139             * Returns all consumers of a connection.
140             * 
141             * @param connectionName
142             *            the name of the connection, not <code>null</code>
143             * @return not <code>null</code>
144             * @throws Exception
145             */
146            Collection<SubscriptionViewMBean> getConsumersOnConnection(
147                            String connectionName) throws Exception;
148            /**
149             * The brokers network connectors.
150             * 
151             * @return not <code>null</code>
152             * @throws Exception
153             */
154            Collection<NetworkConnectorViewMBean> getNetworkConnectors()
155                            throws Exception;
156            /**
157             * Purges the given destination
158             * 
159             * @param destination
160             * @throws Exception
161             */
162            void purgeQueue(ActiveMQDestination destination) throws Exception;
163            /**
164             * Get the view of the queue with the specified name.
165             * 
166             * @param name
167             *            not <code>null</code>
168             * @return <code>null</code> if no queue with this name exists
169             * @throws Exception
170             */
171            QueueViewMBean getQueue(String name) throws Exception;
172            /**
173             * Get the view of the topic with the specified name.
174             * 
175             * @param name
176             *            not <code>null</code>
177             * @return <code>null</code> if no topic with this name exists
178             * @throws Exception
179             */
180            TopicViewMBean getTopic(String name) throws Exception;
181    }