KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > broker > StubBroker


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19 package org.apache.activemq.broker;
20
21 import org.apache.activemq.broker.region.Destination;
22 import org.apache.activemq.broker.region.Subscription;
23 import org.apache.activemq.broker.region.policy.PendingDurableSubscriberMessageStoragePolicy;
24 import org.apache.activemq.command.ActiveMQDestination;
25 import org.apache.activemq.command.BrokerId;
26 import org.apache.activemq.command.BrokerInfo;
27 import org.apache.activemq.command.ConnectionInfo;
28 import org.apache.activemq.command.ConsumerInfo;
29 import org.apache.activemq.command.DestinationInfo;
30 import org.apache.activemq.command.Message;
31 import org.apache.activemq.command.MessageAck;
32 import org.apache.activemq.command.MessageDispatch;
33 import org.apache.activemq.command.MessageDispatchNotification;
34 import org.apache.activemq.command.MessagePull;
35 import org.apache.activemq.command.ProducerInfo;
36 import org.apache.activemq.command.RemoveSubscriptionInfo;
37 import org.apache.activemq.command.Response;
38 import org.apache.activemq.command.SessionInfo;
39 import org.apache.activemq.command.TransactionId;
40 import org.apache.activemq.kaha.Store;
41
42 import java.net.URI JavaDoc;
43 import java.util.LinkedList JavaDoc;
44 import java.util.Map JavaDoc;
45 import java.util.Set JavaDoc;
46
47 public class StubBroker implements Broker {
48     public LinkedList JavaDoc addConnectionData = new LinkedList JavaDoc();
49     public LinkedList JavaDoc removeConnectionData = new LinkedList JavaDoc();
50
51     public class AddConnectionData {
52         public final ConnectionContext connectionContext;
53         public final ConnectionInfo connectionInfo;
54         
55         public AddConnectionData(ConnectionContext context, ConnectionInfo info) {
56             connectionContext = context;
57             connectionInfo = info;
58         }
59     }
60     
61     public class RemoveConnectionData {
62         public final ConnectionContext connectionContext;
63         public final ConnectionInfo connectionInfo;
64         public final Throwable JavaDoc error;
65         
66         public RemoveConnectionData(ConnectionContext context, ConnectionInfo info, Throwable JavaDoc error) {
67             connectionContext = context;
68             connectionInfo = info;
69             this.error = error;
70         }
71     }
72     
73     public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception JavaDoc {
74         addConnectionData.add(new AddConnectionData(context, info));
75     }
76     
77     public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable JavaDoc error) throws Exception JavaDoc {
78         removeConnectionData.add(new RemoveConnectionData(context, info, error));
79     }
80
81     
82     // --- Blank Methods, fill in as needed ---
83
public void addBroker(Connection connection, BrokerInfo info) {
84     }
85
86     public void addDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception JavaDoc {
87     }
88
89     public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception JavaDoc {
90     }
91
92     public void addSession(ConnectionContext context, SessionInfo info) throws Exception JavaDoc {
93     }
94
95     public void beginTransaction(ConnectionContext context, TransactionId xid) throws Exception JavaDoc {
96     }
97
98     public void commitTransaction(ConnectionContext context, TransactionId xid, boolean onePhase) throws Exception JavaDoc {
99     }
100
101     public void forgetTransaction(ConnectionContext context, TransactionId transactionId) throws Exception JavaDoc {
102     }
103
104     public Broker getAdaptor(Class JavaDoc type) {
105         return null;
106     }
107
108     public ConnectionContext getAdminConnectionContext() {
109         return null;
110     }
111
112     public BrokerId getBrokerId() {
113         return null;
114     }
115
116     public String JavaDoc getBrokerName() {
117         return null;
118     }
119
120     public Connection[] getClients() throws Exception JavaDoc {
121         return null;
122     }
123
124     public ActiveMQDestination[] getDestinations() throws Exception JavaDoc {
125         return null;
126     }
127
128     public Set JavaDoc getDurableDestinations() {
129         return null;
130     }
131
132     public BrokerInfo[] getPeerBrokerInfos() {
133         return null;
134     }
135
136     public TransactionId[] getPreparedTransactions(ConnectionContext context) throws Exception JavaDoc {
137         return null;
138     }
139
140     public boolean isFaultTolerantConfiguration() {
141         return false;
142     }
143
144     public boolean isSlaveBroker() {
145         return false;
146     }
147
148     public boolean isStopped() {
149         return false;
150     }
151
152     public int prepareTransaction(ConnectionContext context, TransactionId xid) throws Exception JavaDoc {
153         return 0;
154     }
155
156     public void processDispatch(MessageDispatch messageDispatch) {
157     }
158
159     public void removeBroker(Connection connection, BrokerInfo info) {
160     }
161
162     public void removeDestinationInfo(ConnectionContext context, DestinationInfo info) throws Exception JavaDoc {
163     }
164
165     public void removeProducer(ConnectionContext context, ProducerInfo info) throws Exception JavaDoc {
166     }
167
168     public void removeSession(ConnectionContext context, SessionInfo info) throws Exception JavaDoc {
169     }
170
171     public void rollbackTransaction(ConnectionContext context, TransactionId xid) throws Exception JavaDoc {
172     }
173
174     public void setAdminConnectionContext(ConnectionContext adminConnectionContext) {
175     }
176
177     public void acknowledge(ConsumerBrokerExchange consumerExchange, MessageAck ack) throws Exception JavaDoc {
178     }
179
180     public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception JavaDoc {
181         return null;
182     }
183
184     public Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception JavaDoc {
185         return null;
186     }
187
188     public void gc() {
189     }
190
191     public Map JavaDoc getDestinationMap() {
192         return null;
193     }
194
195     public Set JavaDoc getDestinations(ActiveMQDestination destination) {
196         return null;
197     }
198
199     public Response messagePull(ConnectionContext context, MessagePull pull) throws Exception JavaDoc {
200         return null;
201     }
202
203     public void processDispatchNotification(MessageDispatchNotification messageDispatchNotification) throws Exception JavaDoc {
204     }
205
206     public void removeConsumer(ConnectionContext context, ConsumerInfo info) throws Exception JavaDoc {
207     }
208
209     public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout)
210         throws Exception JavaDoc {
211     }
212
213     public void removeSubscription(ConnectionContext context, RemoveSubscriptionInfo info) throws Exception JavaDoc {
214     }
215
216     public void send(ProducerBrokerExchange producerExchange, Message message) throws Exception JavaDoc {
217     }
218
219     public void start() throws Exception JavaDoc {
220     }
221
222     public void stop() throws Exception JavaDoc {
223     }
224     
225     public PendingDurableSubscriberMessageStoragePolicy getPendingDurableSubscriberPolicy() {
226         return null;
227     }
228   
229     public void setPendingDurableSubscriberPolicy(PendingDurableSubscriberMessageStoragePolicy pendingDurableSubscriberPolicy) {
230     }
231
232     public Store getTempDataStore() {
233         return null;
234     }
235     
236     public URI JavaDoc getVmConnectorURI(){
237         return null;
238     }
239 }
240
Popular Tags