ManagedExchange.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 java.io.IOException;
24 
25 import javax.management.JMException;
26 import javax.management.MBeanOperationInfo;
27 import javax.management.openmbean.TabularData;
28 
29 import org.apache.qpid.server.management.MBeanAttribute;
30 import org.apache.qpid.server.management.MBeanOperation;
31 import org.apache.qpid.server.management.MBeanOperationParameter;
32 import org.apache.qpid.server.queue.ManagedQueue;
33 
34 /**
35  * The management interface exposed to allow management of an Exchange.
36  @author  Robert J. Greig
37  @author  Bhupendra Bhardwaj
38  @version 0.1
39  */
40 public interface ManagedExchange
41 {
42     static final String TYPE = "Exchange";
43 
44     /**
45      * Returns the name of the managed exchange.
46      @return the name of the exchange.
47      @throws IOException
48      */
49     @MBeanAttribute(name="Name", description=TYPE + " Name")
50     String getName() throws IOException;
51 
52     @MBeanAttribute(name="ExchangeType", description="Exchange Type")
53     String getExchangeType() throws IOException;
54 
55     @MBeanAttribute(name="TicketNo", description="Exchange Ticket No")
56     Integer getTicketNo() throws IOException;
57 
58     /**
59      * Tells if the exchange is durable or not.
60      @return true if the exchange is durable.
61      @throws IOException
62      */
63     @MBeanAttribute(name="Durable", description="true if Exchange is durable")
64     boolean isDurable() throws IOException;
65 
66     /**
67      * Tells if the exchange is set for autodelete or not.
68      @return true if the exchange is set as autodelete.
69      @throws IOException
70      */
71     @MBeanAttribute(name="AutoDelete", description="true if Exchange is AutoDelete")
72     boolean isAutoDelete() throws IOException;
73 
74     // Operations
75 
76     /**
77      * Returns all the bindings this exchange has with the queues.
78      @return  the bindings with the exchange.
79      @throws IOException
80      @throws JMException
81      */
82     @MBeanOperation(name="bindings", description="view the queue bindings for this exchange")
83     TabularData bindings() throws IOException, JMException;
84 
85     /**
86      * Creates new binding with the given queue and binding.
87      @param queueName
88      @param binding
89      @throws JMException
90      */
91     @MBeanOperation(name="createNewBinding",
92                     description="create a new binding with this exchange",
93                     impact= MBeanOperationInfo.ACTION)
94     void createNewBinding(@MBeanOperationParameter(name= ManagedQueue.TYPE, description="Queue name"String queueName,
95                           @MBeanOperationParameter(name="Binding", description="New binding")String binding)
96         throws JMException;
97 
98 }