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.*;
022    import org.apache.activemq.command.ActiveMQDestination;
023    
024    /**
025     * A facade for either a local in JVM broker or a remote broker over JMX
026     *
027     * 
028     * 
029     */
030    public interface BrokerFacade {
031    
032            /**
033             * The name of the active broker (f.e. 'localhost' or 'my broker').
034             * 
035             * @return not <code>null</code>
036             * @throws Exception
037             */
038            String getBrokerName() throws Exception;
039    
040            /**
041             * Admin view of the broker.
042             * 
043             * @return not <code>null</code>
044             * @throws Exception
045             */
046            BrokerViewMBean getBrokerAdmin() throws Exception;
047    
048            /**
049             * All queues known to the broker.
050             * 
051             * @return not <code>null</code>
052             * @throws Exception
053             */
054            Collection<QueueViewMBean> getQueues() throws Exception;
055    
056            /**
057             * All topics known to the broker.
058             * 
059             * @return not <code>null</code>
060             * @throws Exception
061             */
062            Collection<TopicViewMBean> getTopics() throws Exception;
063    
064            /**
065             * All active consumers of a queue.
066             * 
067             * @param queueName
068             *            the name of the queue, not <code>null</code>
069             * @return not <code>null</code>
070             * @throws Exception
071             */
072            Collection<SubscriptionViewMBean> getQueueConsumers(String queueName)
073                            throws Exception;
074    
075            /**
076             * Active durable subscribers to topics of the broker.
077             * 
078             * @return not <code>null</code>
079             * @throws Exception
080             */
081            Collection<DurableSubscriptionViewMBean> getDurableTopicSubscribers()
082                            throws Exception;
083    
084    
085            /**
086             * Inactive durable subscribers to topics of the broker.
087             *
088             * @return not <code>null</code>
089             * @throws Exception
090             */
091            Collection<DurableSubscriptionViewMBean> getInactiveDurableTopicSubscribers()
092                            throws Exception;
093    
094            /**
095             * The names of all transport connectors of the broker (f.e. openwire, ssl)
096             * 
097             * @return not <code>null</code>
098             * @throws Exception
099             */
100            Collection<String> getConnectors() throws Exception;
101    
102            /**
103             * A transport connectors.
104             * 
105             * @param name
106             *            name of the connector (f.e. openwire)
107             * @return <code>null</code> if not found
108             * @throws Exception
109             */
110            ConnectorViewMBean getConnector(String name) throws Exception;
111    
112            /**
113             * All connections to all transport connectors of the broker.
114             * 
115             * @return not <code>null</code>
116             * @throws Exception
117             */
118            Collection<ConnectionViewMBean> getConnections() throws Exception;
119    
120            /**
121             * The names of all connections to a specific transport connectors of the
122             * broker.
123             * 
124             * @see #getConnection(String)
125             * @param connectorName
126             *            not <code>null</code>
127             * @return not <code>null</code>
128             * @throws Exception
129             */
130            Collection<String> getConnections(String connectorName) throws Exception;
131    
132            /**
133             * A specific connection to the broker.
134             * 
135             * @param connectionName
136             *            the name of the connection, not <code>null</code>
137             * @return not <code>null</code>
138             * @throws Exception
139             */
140            ConnectionViewMBean getConnection(String connectionName) throws Exception;
141            /**
142             * Returns all consumers of a connection.
143             * 
144             * @param connectionName
145             *            the name of the connection, not <code>null</code>
146             * @return not <code>null</code>
147             * @throws Exception
148             */
149            Collection<SubscriptionViewMBean> getConsumersOnConnection(
150                            String connectionName) throws Exception;
151            /**
152             * The brokers network connectors.
153             * 
154             * @return not <code>null</code>
155             * @throws Exception
156             */
157            Collection<NetworkConnectorViewMBean> getNetworkConnectors()
158                            throws Exception;
159    
160    
161            /**
162             * The brokers network bridges.
163             *
164             * @return not <code>null</code>
165             * @throws Exception
166             */
167        Collection<NetworkBridgeViewMBean> getNetworkBridges()
168                throws Exception;
169    
170        /**
171             * Purges the given destination
172             * 
173             * @param destination
174             * @throws Exception
175             */
176            void purgeQueue(ActiveMQDestination destination) throws Exception;
177            /**
178             * Get the view of the queue with the specified name.
179             * 
180             * @param name
181             *            not <code>null</code>
182             * @return <code>null</code> if no queue with this name exists
183             * @throws Exception
184             */
185            QueueViewMBean getQueue(String name) throws Exception;
186            /**
187             * Get the view of the topic with the specified name.
188             * 
189             * @param name
190             *            not <code>null</code>
191             * @return <code>null</code> if no topic with this name exists
192             * @throws Exception
193             */
194            TopicViewMBean getTopic(String name) throws Exception;
195            
196            /**
197             * Get the JobScheduler MBean
198             * @return the jobScheduler or null if not configured
199             * @throws Exception
200             */
201            JobSchedulerViewMBean getJobScheduler() throws Exception;
202            
203            /**
204         * Get the JobScheduler MBean
205         * @return the jobScheduler or null if not configured
206         * @throws Exception
207         */
208        Collection<JobFacade> getScheduledJobs() throws Exception;
209    
210        boolean isJobSchedulerStarted();
211    
212    }