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.broker;
018    
019    import java.net.URI;
020    import java.util.Collections;
021    import java.util.Map;
022    import java.util.Set;
023    import org.apache.activemq.broker.region.Destination;
024    import org.apache.activemq.broker.region.MessageReference;
025    import org.apache.activemq.broker.region.Subscription;
026    import org.apache.activemq.command.ActiveMQDestination;
027    import org.apache.activemq.command.BrokerId;
028    import org.apache.activemq.command.BrokerInfo;
029    import org.apache.activemq.command.ConnectionInfo;
030    import org.apache.activemq.command.ConsumerInfo;
031    import org.apache.activemq.command.DestinationInfo;
032    import org.apache.activemq.command.Message;
033    import org.apache.activemq.command.MessageAck;
034    import org.apache.activemq.command.MessageDispatch;
035    import org.apache.activemq.command.MessageDispatchNotification;
036    import org.apache.activemq.command.MessagePull;
037    import org.apache.activemq.command.ProducerInfo;
038    import org.apache.activemq.command.RemoveSubscriptionInfo;
039    import org.apache.activemq.command.Response;
040    import org.apache.activemq.command.SessionInfo;
041    import org.apache.activemq.command.TransactionId;
042    import org.apache.activemq.kaha.Store;
043    import org.apache.activemq.usage.Usage;
044    
045    /**
046     * Dumb implementation - used to be overriden by listeners
047     * 
048     * @version $Revision$
049     */
050    public class EmptyBroker implements Broker {
051    
052        public BrokerId getBrokerId() {
053            return null;
054        }
055    
056        public String getBrokerName() {
057            return null;
058        }
059    
060        public Broker getAdaptor(Class type) {
061            if (type.isInstance(this)) {
062                return this;
063            }
064            return null;
065        }
066    
067        @SuppressWarnings("unchecked")
068        public Map<ActiveMQDestination, Destination> getDestinationMap() {
069            return Collections.EMPTY_MAP;
070        }
071    
072        public Set getDestinations(ActiveMQDestination destination) {
073            return Collections.EMPTY_SET;
074        }
075    
076        public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
077    
078        }
079    
080        public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception {
081    
082        }
083    
084        public void addSession(ConnectionContext context, SessionInfo info) throws Exception {
085    
086        }
087    
088        public void removeSession(ConnectionContext context, SessionInfo info) throws Exception {
089    
090        }
091    
092        public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception {
093    
094        }
095    
096        public void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception {
097    
098        }
099    
100        public Connection[] getClients() throws Exception {
101    
102            return null;
103        }
104    
105        public ActiveMQDestination[] getDestinations() throws Exception {
106    
107            return null;
108        }
109    
110        public TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception {
111    
112            return null;
113        }
114    
115        public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception {
116    
117        }
118    
119        public int prepareTransaction(ConnectionContext context, TransactionId xid) throws Exception {
120    
121            return 0;
122        }
123    
124        public void rollbackTransaction(ConnectionContext context, TransactionId xid) throws Exception {
125    
126        }
127    
128        public void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase) throws Exception {
129    
130        }
131    
132        public void forgetTransaction(ConnectionContext context, TransactionId transactionId) throws Exception {
133    
134        }
135    
136        public Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception {
137    
138            return null;
139        }
140    
141        public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception {
142    
143        }
144    
145        public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
146            return null;
147        }
148    
149        public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
150    
151        }
152    
153        public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception {
154    
155        }
156    
157        public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception {
158    
159        }
160    
161        public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception {
162    
163        }
164    
165        public void gc() {
166    
167        }
168    
169        public void start() throws Exception {
170    
171        }
172    
173        public void stop() throws Exception {
174    
175        }
176    
177        public void addBroker(Connection connection, BrokerInfo info) {
178    
179        }
180    
181        public void removeBroker(Connection connection, BrokerInfo info) {
182    
183        }
184    
185        public BrokerInfo[] getPeerBrokerInfos() {
186            return null;
187        }
188    
189        public void preProcessDispatch(MessageDispatch messageDispatch) {
190        }
191    
192        public void postProcessDispatch(MessageDispatch messageDispatch) {
193        }
194    
195        public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception {
196    
197        }
198    
199        public boolean isStopped() {
200            return false;
201        }
202    
203        public Set<ActiveMQDestination> getDurableDestinations() {
204            return null;
205        }
206    
207        public void addDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception {
208        }
209    
210        public void removeDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception {
211        }
212    
213        public boolean isFaultTolerantConfiguration() {
214            return false;
215        }
216    
217        public ConnectionContext getAdminConnectionContext() {
218            return null;
219        }
220    
221        public void setAdminConnectionContext(ConnectionContext adminConnectionContext) {
222        }
223    
224        public Response messagePull(ConnectionContext context, MessagePull pull) throws Exception {
225            return null;
226        }
227    
228        public Store getTempDataStore() {
229            return null;
230        }
231    
232        public URI getVmConnectorURI() {
233            return null;
234        }
235    
236        public void brokerServiceStarted() {
237        }
238    
239        public BrokerService getBrokerService() {
240            return null;
241        }
242    
243        public boolean isExpired(MessageReference messageReference) {
244            return false;
245        }
246    
247        public void messageExpired(ConnectionContext context, MessageReference message) {
248        }
249    
250        public void sendToDeadLetterQueue(ConnectionContext context, MessageReference messageReference) {
251        }
252    
253        public Broker getRoot() {
254            return null;
255        }
256        
257        public long getBrokerSequenceId() {
258            return -1l;
259        }
260        
261        public void fastProducer(ConnectionContext context,ProducerInfo producerInfo) {
262        }
263    
264        public void isFull(ConnectionContext context, Destination destination,Usage usage) {
265        }
266    
267        public void messageConsumed(ConnectionContext context,MessageReference messageReference) {
268        }
269    
270        public void messageDelivered(ConnectionContext context,MessageReference messageReference) {
271        }
272    
273        public void messageDiscarded(ConnectionContext context,MessageReference messageReference) {
274        }
275    
276        public void slowConsumer(ConnectionContext context,Destination destination, Subscription subs) {
277        }
278    
279        public void nowMasterBroker() {        
280        }
281    }