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 */ 017package org.apache.activemq.web; 018 019import java.util.Collection; 020 021import org.apache.activemq.broker.jmx.*; 022import 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 */ 030public 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 * All active producers to a queue. 077 * 078 * @param queueName 079 * the name of the queue, not <code>null</code> 080 * @return not <code>null</code> 081 * @throws Exception 082 */ 083 Collection<ProducerViewMBean> getQueueProducers(String queueName) 084 throws Exception; 085 086 /** 087 * All active producers to a topic. 088 * 089 * @param queueName 090 * the name of the topic, not <code>null</code> 091 * @return not <code>null</code> 092 * @throws Exception 093 */ 094 Collection<ProducerViewMBean> getTopicProducers(String queueName) 095 throws Exception; 096 097 /** 098 * All active non-durable subscribers to a topic. 099 * 100 * @param queueName 101 * the name of the topic, not <code>null</code> 102 * @return not <code>null</code> 103 * @throws Exception 104 */ 105 public Collection<SubscriptionViewMBean> getTopicSubscribers(String topicName) 106 throws Exception; 107 108 /** 109 * All active non-durable subscribers to a topic. 110 * 111 * @param queueName 112 * the name of the topic, not <code>null</code> 113 * @return not <code>null</code> 114 * @throws Exception 115 */ 116 public Collection<SubscriptionViewMBean> getNonDurableTopicSubscribers() 117 throws Exception; 118 119 /** 120 * Active durable subscribers to topics of the broker. 121 * 122 * @return not <code>null</code> 123 * @throws Exception 124 */ 125 Collection<DurableSubscriptionViewMBean> getDurableTopicSubscribers() 126 throws Exception; 127 128 129 /** 130 * Inactive durable subscribers to topics of the broker. 131 * 132 * @return not <code>null</code> 133 * @throws Exception 134 */ 135 Collection<DurableSubscriptionViewMBean> getInactiveDurableTopicSubscribers() 136 throws Exception; 137 138 /** 139 * The names of all transport connectors of the broker (f.e. openwire, ssl) 140 * 141 * @return not <code>null</code> 142 * @throws Exception 143 */ 144 Collection<String> getConnectors() throws Exception; 145 146 /** 147 * A transport connectors. 148 * 149 * @param name 150 * name of the connector (f.e. openwire) 151 * @return <code>null</code> if not found 152 * @throws Exception 153 */ 154 ConnectorViewMBean getConnector(String name) throws Exception; 155 156 /** 157 * All connections to all transport connectors of the broker. 158 * 159 * @return not <code>null</code> 160 * @throws Exception 161 */ 162 Collection<ConnectionViewMBean> getConnections() throws Exception; 163 164 /** 165 * The names of all connections to a specific transport connectors of the 166 * broker. 167 * 168 * @see #getConnection(String) 169 * @param connectorName 170 * not <code>null</code> 171 * @return not <code>null</code> 172 * @throws Exception 173 */ 174 Collection<String> getConnections(String connectorName) throws Exception; 175 176 /** 177 * A specific connection to the broker. 178 * 179 * @param connectionName 180 * the name of the connection, not <code>null</code> 181 * @return not <code>null</code> 182 * @throws Exception 183 */ 184 ConnectionViewMBean getConnection(String connectionName) throws Exception; 185 /** 186 * Returns all consumers of a connection. 187 * 188 * @param connectionName 189 * the name of the connection, not <code>null</code> 190 * @return not <code>null</code> 191 * @throws Exception 192 */ 193 Collection<SubscriptionViewMBean> getConsumersOnConnection( 194 String connectionName) throws Exception; 195 /** 196 * The brokers network connectors. 197 * 198 * @return not <code>null</code> 199 * @throws Exception 200 */ 201 Collection<NetworkConnectorViewMBean> getNetworkConnectors() 202 throws Exception; 203 204 205 /** 206 * The brokers network bridges. 207 * 208 * @return not <code>null</code> 209 * @throws Exception 210 */ 211 Collection<NetworkBridgeViewMBean> getNetworkBridges() 212 throws Exception; 213 214 /** 215 * Purges the given destination 216 * 217 * @param destination 218 * @throws Exception 219 */ 220 void purgeQueue(ActiveMQDestination destination) throws Exception; 221 /** 222 * Get the view of the queue with the specified name. 223 * 224 * @param name 225 * not <code>null</code> 226 * @return <code>null</code> if no queue with this name exists 227 * @throws Exception 228 */ 229 QueueViewMBean getQueue(String name) throws Exception; 230 /** 231 * Get the view of the topic with the specified name. 232 * 233 * @param name 234 * not <code>null</code> 235 * @return <code>null</code> if no topic with this name exists 236 * @throws Exception 237 */ 238 TopicViewMBean getTopic(String name) throws Exception; 239 240 /** 241 * Get the JobScheduler MBean 242 * @return the jobScheduler or null if not configured 243 * @throws Exception 244 */ 245 JobSchedulerViewMBean getJobScheduler() throws Exception; 246 247 /** 248 * Get the JobScheduler MBean 249 * @return the jobScheduler or null if not configured 250 * @throws Exception 251 */ 252 Collection<JobFacade> getScheduledJobs() throws Exception; 253 254 boolean isJobSchedulerStarted(); 255 256}