001    /** 
002     * 
003     * Copyright 2004 Protique Ltd
004     * 
005     * Licensed under the Apache License, Version 2.0 (the "License"); 
006     * you may not use this file except in compliance with the License. 
007     * You may obtain a copy of the License at 
008     * 
009     * http://www.apache.org/licenses/LICENSE-2.0
010     * 
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS, 
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
014     * See the License for the specific language governing permissions and 
015     * limitations under the License. 
016     * 
017     **/
018    
019    package org.activemq.message;
020    
021    /**
022     * Infomation about the Capacity for more messages for a Connection/Broker
023     * @version $Revision: 1.1.1.1 $
024     */
025    
026    public class CapacityInfo extends AbstractPacket {
027    
028        private String resourceName;
029        private short correlationId;
030        private int capacity = 100;
031        private long flowControlTimeout;
032        /**
033         * @return the PacketType
034         */
035        public int getPacketType() {
036            return Packet.CAPACITY_INFO;
037        }
038    
039    
040        /**
041         * @return Returns the capacity.
042         */
043        public int getCapacity() {
044            return capacity;
045        }
046        /**
047         * @param capacity The capacity to set.
048         */
049        public void setCapacity(int capacity) {
050            this.capacity = capacity;
051        }
052        /**
053         * @return Returns the resourceName.
054         */
055        public String getResourceName() {
056            return resourceName;
057        }
058        /**
059         * @param resourceName The resourceName to set.
060         */
061        public void setResourceName(String resourceName) {
062            this.resourceName = resourceName;
063        }
064        /**
065         * @return Returns the correlationId.
066         */
067        public short getCorrelationId() {
068            return correlationId;
069        }
070        /**
071         * @param correlationId The correlationId to set.
072         */
073        public void setCorrelationId(short correlationId) {
074            this.correlationId = correlationId;
075        }
076        /**
077         * @return Returns the flowControlTimeout (ms)
078         */
079        public long getFlowControlTimeout() {
080            return flowControlTimeout;
081        }
082        /**
083         * @param flowControlTimeout The flowControlTimeout to set(ms).
084         */
085        public void setFlowControlTimeout(long flowControlTimeout) {
086            this.flowControlTimeout = flowControlTimeout;
087        }
088        
089        /**
090         * @return a pretty print
091         */
092        public String toString() {
093            return super.toString() + " CapacityInfo{ " +
094                    "capacity = " + capacity +
095                    ", resourceName = '" + resourceName + "' " +
096                    ", correlationId = '" + correlationId + "' " +
097                    ", flowControlTimeout = " + flowControlTimeout +
098                    " }";
099        }
100    }