RoutingTable.java
001 /*
002  *
003  * Licensed to the Apache Software Foundation (ASF) under one
004  * or more contributor license agreements.  See the NOTICE file
005  * distributed with this work for additional information
006  * regarding copyright ownership.  The ASF licenses this file
007  * to you under the Apache License, Version 2.0 (the
008  * "License"); you may not use this file except in compliance
009  * with the License.  You may obtain a copy of the License at
010  *
011  *   http://www.apache.org/licenses/LICENSE-2.0
012  *
013  * Unless required by applicable law or agreed to in writing,
014  * software distributed under the License is distributed on an
015  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016  * KIND, either express or implied.  See the License for the
017  * specific language governing permissions and limitations
018  * under the License.
019  *
020  */
021 package org.apache.qpid.server.routing;
022 
023 import org.apache.qpid.AMQException;
024 import org.apache.qpid.framing.AMQShortString;
025 import org.apache.qpid.framing.FieldTable;
026 import org.apache.qpid.server.configuration.VirtualHostConfiguration;
027 import org.apache.qpid.server.exchange.Exchange;
028 import org.apache.qpid.server.queue.AMQQueue;
029 import org.apache.qpid.server.virtualhost.VirtualHost;
030 import org.apache.commons.configuration.Configuration;
031 
032 public interface RoutingTable
033 {        
034     /**
035      * Called after instantiation in order to configure the message store. A particular implementation can define
036      * whatever parameters it wants.
037      *
038      @param virtualHost The virtual host using by this store
039      @param base        The base element identifier from which all configuration items are relative. For example, if
040      *                    the base element is "store", the all elements used by concrete classes will be "store.foo" etc.
041      @param config      The apache commons configuration object.
042      *
043      @throws Exception If any error occurs that means the store is unable to configure itself.
044      */
045     void configure(VirtualHost virtualHost, String base, VirtualHostConfiguration configthrows Exception;
046 
047     /**
048      * Called to close and cleanup any resources used by the message store.
049      *
050      @throws Exception If the close fails.
051      */
052     void close() throws Exception;
053 
054 
055     /**
056      * Makes the specified exchange persistent.
057      *
058      @param exchange The exchange to persist.
059      *
060      @throws org.apache.qpid.AMQException If the operation fails for any reason.
061      */
062     void createExchange(Exchange exchangethrows AMQException;
063 
064     /**
065      * Removes the specified persistent exchange.
066      *
067      @param exchange The exchange to remove.
068      *
069      @throws AMQException If the operation fails for any reason.
070      */
071     void removeExchange(Exchange exchangethrows AMQException;
072 
073     /**
074      * Binds the specified queue to an exchange with a routing key.
075      *
076      @param exchange   The exchange to bind to.
077      @param routingKey The routing key to bind by.
078      @param queue      The queue to bind.
079      @param args       Additional parameters.
080      *
081      @throws AMQException If the operation fails for any reason.
082      */
083     void bindQueue(Exchange exchange, AMQShortString routingKey, AMQQueue queue, FieldTable argsthrows AMQException;
084 
085     /**
086      * Unbinds the specified from an exchange under a particular routing key.
087      *
088      @param exchange   The exchange to unbind from.
089      @param routingKey The routing key to unbind.
090      @param queue      The queue to unbind.
091      @param args       Additonal parameters.
092      *
093      @throws AMQException If the operation fails for any reason.
094      */
095     void unbindQueue(Exchange exchange, AMQShortString routingKey, AMQQueue queue, FieldTable argsthrows AMQException;
096 
097     /**
098      * Makes the specified queue persistent.
099      *
100      @param queue The queue to store.
101      *
102      @throws AMQException If the operation fails for any reason.
103      */
104     void createQueue(AMQQueue queuethrows AMQException;
105 
106     /**
107      * Makes the specified queue persistent.
108      *
109      @param queue     The queue to store.
110      @param arguments The additional arguments to the binding
111      *
112      @throws AMQException If the operation fails for any reason.
113      */
114     void createQueue(AMQQueue queue, FieldTable argumentsthrows AMQException;
115 
116     /**
117      * Removes the specified queue from the persistent store.
118      *
119      @param queue The queue to remove.
120      *
121      @throws AMQException If the operation fails for any reason.
122      */
123     void removeQueue(final AMQQueue queuethrows AMQException;
124 }