Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/activemq/broker/BrokerContainer.java


1   /** 
2    * 
3    * Copyright 2004 Protique Ltd
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License"); 
6    * you may not use this file except in compliance with the License. 
7    * You may obtain a copy of the License at 
8    * 
9    * http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS, 
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
14   * See the License for the specific language governing permissions and 
15   * limitations under the License. 
16   * 
17   **/
18  
19  package org.activemq.broker;
20  
21  import org.activemq.io.WireFormat;
22  import org.activemq.message.ActiveMQMessage;
23  import org.activemq.message.ActiveMQXid;
24  import org.activemq.message.ConnectionInfo;
25  import org.activemq.message.ConsumerInfo;
26  import org.activemq.message.DurableUnsubscribe;
27  import org.activemq.message.MessageAck;
28  import org.activemq.message.ProducerInfo;
29  import org.activemq.message.SessionInfo;
30  import org.activemq.security.SecurityAdapter;
31  import org.activemq.service.Service;
32  import org.activemq.store.PersistenceAdapter;
33  import org.activemq.transport.DiscoveryAgent;
34  import org.activemq.transport.NetworkConnector;
35  import org.activemq.transport.TransportServerChannel;
36  
37  import javax.jms.InvalidClientIDException;
38  import javax.jms.JMSException;
39  import javax.jms.JMSSecurityException;
40  import javax.transaction.xa.XAException;
41  import java.util.List;
42  
43  /**
44   * The ActiveMQ JMS Broker Container which contains a {@link Broker} and one or more
45   * {@ BrokerConnector} instances talking over some {@link org.activemq.transport.TransportChannel}
46   * <p/>
47   * <b>Note</b> that  once a broker container has been stopped it should be discarded and a new service
48   * instance created again. Calling start() on a stopped broker will not usually work.
49   *
50   * @version $Revision: 1.1.1.1 $
51   */
52  public interface BrokerContainer extends Service {
53  
54      /**
55       * registers a new Connection
56       *
57       * @param client
58       * @param info   infomation about the client-side Connection
59       * @throws InvalidClientIDException if the ClientID of the Connection is a duplicate
60       */
61      public void registerConnection(BrokerClient client, ConnectionInfo info) throws JMSException;
62  
63      /**
64       * un-registers a Connection
65       *
66       * @param client
67       * @param info   infomation about the client-side Connection
68       * @throws JMSException
69       */
70      public void deregisterConnection(BrokerClient client, ConnectionInfo info) throws JMSException;
71  
72      /**
73       * Registers a MessageConsumer
74       *
75       * @param client
76       * @param info
77       * @throws JMSException
78       * @throws JMSSecurityException if client authentication fails for the Destination the
79       *                              Consumer applies for
80       */
81      public void registerMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException;
82  
83      /**
84       * De-register a MessageConsumer from the Broker
85       *
86       * @param client
87       * @param info
88       * @throws JMSException
89       */
90      public void deregisterMessageConsumer(BrokerClient client, ConsumerInfo info) throws JMSException;
91  
92      /**
93       * Registers a MessageProducer
94       *
95       * @param client
96       * @param info
97       * @throws JMSException
98       * @throws JMSSecurityException if client authentication fails for the Destination the
99       *                              Consumer applies for
100      */
101 
102     public void registerMessageProducer(BrokerClient client, ProducerInfo info) throws JMSException;
103 
104     /**
105      * De-register a MessageProducer from the Broker
106      *
107      * @param client
108      * @param info
109      * @throws JMSException
110      */
111     public void deregisterMessageProducer(BrokerClient client, ProducerInfo info) throws JMSException;
112 
113     /**
114      * Register a client-side Session (used for Monitoring)
115      *
116      * @param client
117      * @param info
118      * @throws JMSException
119      */
120 
121     public void registerSession(BrokerClient client, SessionInfo info) throws JMSException;
122 
123     /**
124      * De-register a client-side Session from the Broker (used for monitoring)
125      *
126      * @param client
127      * @param info
128      * @throws JMSException
129      */
130     public void deregisterSession(BrokerClient client, SessionInfo info) throws JMSException;
131 
132     /**
133      * Start a transaction from the Client session
134      *
135      * @param client
136      * @param transactionId
137      * @throws JMSException
138      */
139     public void startTransaction(BrokerClient client, String transactionId) throws JMSException;
140 
141     /**
142      * Rollback a transacton
143      *
144      * @param client
145      * @param transactionId
146      * @throws JMSException
147      */
148     public void rollbackTransaction(BrokerClient client, String transactionId) throws JMSException;
149 
150     /**
151      * Commit a transaction
152      *
153      * @param client
154      * @param transactionId
155      * @throws JMSException
156      */
157     public void commitTransaction(BrokerClient client, String transactionId) throws JMSException;
158 
159     /**
160      * Send a non-transacted message to the Broker
161      *
162      * @param client
163      * @param message
164      * @throws JMSException
165      */
166 
167     public void sendMessage(BrokerClient client, ActiveMQMessage message) throws JMSException;
168 
169     /**
170      * Acknowledge reciept of a message
171      *
172      * @param client
173      * @param ack
174      * @throws JMSException
175      */
176     public void acknowledgeMessage(BrokerClient client, MessageAck ack) throws JMSException;
177 
178     /**
179      * Command to delete a durable topic subscription
180      *
181      * @param client
182      * @param ds
183      * @throws JMSException
184      */
185 
186     public void durableUnsubscribe(BrokerClient client, DurableUnsubscribe ds) throws JMSException;
187 
188     /**
189      * Start an XA transaction.
190      *
191      * @param client
192      * @param xid
193      */
194     public void startTransaction(BrokerClient client, ActiveMQXid xid) throws XAException;
195 
196     /**
197      * Gets the prepared XA transactions.
198      *
199      * @param client
200      * @return
201      */
202     public ActiveMQXid[] getPreparedTransactions(BrokerClient client) throws XAException;
203 
204     /**
205      * Prepare an XA transaction.
206      *
207      * @param client
208      * @param xid
209      */
210     public int prepareTransaction(BrokerClient client, ActiveMQXid xid) throws XAException;
211 
212     /**
213      * Rollback an XA transaction.
214      *
215      * @param client
216      * @param xid
217      */
218     public void rollbackTransaction(BrokerClient client, ActiveMQXid xid) throws XAException;
219 
220     /**
221      * Commit an XA transaction.
222      *
223      * @param client
224      * @param xid
225      * @param onePhase
226      */
227     public void commitTransaction(BrokerClient client, ActiveMQXid xid, boolean onePhase) throws XAException;
228 
229     /**
230      * Called when a new connector is added to this container
231      *
232      * @param connector
233      */
234     public void addConnector(BrokerConnector connector);
235 
236     /**
237      * Called when a connector is removed to this container
238      *
239      * @param connector
240      */
241     public void removeConnector(BrokerConnector connector);
242 
243 
244     /**
245      * @return the Broker for the Container
246      */
247     public Broker getBroker();
248 
249     /**
250      * Returns the transport connectors used to communicate with
251      * clients
252      */
253     public List getTransportConnectors();
254 
255     public void setTransportConnectors(List transportConnectors);
256 
257     /**
258      * Returns a list of {@link org.activemq.transport.NetworkConnector}
259      * instances used to communicate with the network of {@link Broker} instances
260      */
261     public List getNetworkConnectors();
262 
263     public void setNetworkConnectors(List networkConnectors);
264 
265 
266     /**
267      * Returns the persistence adapter
268      */
269     public PersistenceAdapter getPersistenceAdapter();
270 
271     public void setPersistenceAdapter(PersistenceAdapter persistenceAdapter);
272 
273     /**
274      * Returns the discovery agent if one is available or null if discovery is not
275      * enabled
276      */
277     public DiscoveryAgent getDiscoveryAgent();
278 
279     public void setDiscoveryAgent(DiscoveryAgent discoveryAgent);
280 
281     /**
282      * Returns the security adapter used to authenticate and authorize access to JMS resources
283      */
284     public SecurityAdapter getSecurityAdapter();
285 
286     /**
287      * Sets the security adapter used to authenticate and authorize access to JMS resources
288      */
289     public void setSecurityAdapter(SecurityAdapter securityAdapter);
290 
291     /**
292      * Adds a new network connector for the given URI
293      */
294     NetworkConnector addNetworkConnector(String uri) throws JMSException;
295 
296     /**
297      * Adds a new network connector
298      *
299      * @return the newly created network connector
300      */
301     NetworkConnector addNetworkConnector();
302 
303     /**
304      * Adds a new network connector
305      */
306     void addNetworkConnector(NetworkConnector connector);
307 
308     /**
309      * Removes the given network connector
310      */
311     void removeNetworkConnector(NetworkConnector connector);
312 
313     /**
314      * Adds a new transport connector for the given bind address
315      */
316     void addConnector(String bindAddress) throws JMSException;
317 
318     /**
319      * Adds a new transport connector for the given bind address and wire format
320      */
321     void addConnector(String bindAddress, WireFormat wireFormat) throws JMSException;
322 
323     /**
324      * Adds a new transport connector for the given transportConnector
325      */
326     void addConnector(TransportServerChannel transportConnector);
327     
328     /**
329      * register a remote clientID
330      * @param remoteClientID
331      */
332     
333     void registerRemoteClientID(String remoteClientID);
334     
335     /**
336      * deregister a remote clientID
337      * @param remoteClientID
338      */
339     void deregisterRemoteClientID(String remoteClientID);
340     
341 }