Exchange.java
01 /*
02  *
03  * Licensed to the Apache Software Foundation (ASF) under one
04  * or more contributor license agreements.  See the NOTICE file
05  * distributed with this work for additional information
06  * regarding copyright ownership.  The ASF licenses this file
07  * to you under the Apache License, Version 2.0 (the
08  * "License"); you may not use this file except in compliance
09  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 package org.apache.qpid.server.exchange;
22 
23 import org.apache.qpid.AMQException;
24 import org.apache.qpid.framing.AMQShortString;
25 import org.apache.qpid.framing.FieldTable;
26 
27 import org.apache.qpid.server.queue.IncomingMessage;
28 import org.apache.qpid.server.queue.AMQQueue;
29 import org.apache.qpid.server.virtualhost.VirtualHost;
30 
31 import java.util.List;
32 import java.util.Map;
33 
34 public interface Exchange
35 {
36     AMQShortString getName();
37 
38     AMQShortString getType();
39 
40     void initialise(VirtualHost host, AMQShortString name, boolean durable, int ticket, boolean autoDeletethrows AMQException;
41 
42     boolean isDurable();
43 
44     /**
45      @return true if the exchange will be deleted after all queues have been detached
46      */
47     boolean isAutoDelete();
48 
49     int getTicket();
50 
51     void close() throws AMQException;
52 
53     void registerQueue(AMQShortString routingKey, AMQQueue queue, FieldTable argsthrows AMQException;
54 
55     void deregisterQueue(AMQShortString routingKey, AMQQueue queue, FieldTable argsthrows AMQException;
56 
57     void route(IncomingMessage messagethrows AMQException;
58 
59 
60     /**
61      * Determines whether a message would be isBound to a particular queue using a specific routing key and arguments
62      @param routingKey
63      @param arguments
64      @param queue
65      @return
66      @throws AMQException
67      */
68     boolean isBound(AMQShortString routingKey, FieldTable arguments, AMQQueue queue);
69 
70     /**
71      * Determines whether a message would be isBound to a particular queue using a specific routing key
72      @param routingKey
73      @param queue
74      @return
75      @throws AMQException
76      */
77     boolean isBound(AMQShortString routingKey, AMQQueue queue);
78 
79     /**
80      * Determines whether a message is routing to any queue using a specific _routing key
81      @param routingKey
82      @return
83      @throws AMQException
84      */
85     boolean isBound(AMQShortString routingKey);
86 
87     boolean isBound(AMQQueue queue);
88 
89     /**
90      * Returns true if this exchange has at least one binding associated with it.
91      @return
92      @throws AMQException
93      */
94     boolean hasBindings();
95 
96     
97 
98 }