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    package org.activemq.message;
019    
020    /**
021     * Describes a Message consumer
022     *
023     * @version $Revision: 1.1.1.1 $
024     */
025    public class BrokerAdminCommand extends AbstractPacket {
026        
027        static final public String CREATE_DESTINATION="CREATE_DESTINATION";
028        static final public String DESTROY_DESTINATION="DESTROY_DESTINATION";
029        static final public String EMPTY_DESTINATION="EMPTY_DESTINATION";
030            static final public String SHUTDOWN_SERVER_VM="SHUTDOWN_BROKER_VM";
031        
032        private String command;
033        private ActiveMQDestination destination;
034    
035    
036        /**
037         * Return the type of Packet
038         *
039         * @return integer representation of the type of Packet
040         */
041        public int getPacketType() {
042            return BROKER_ADMIN_COMMAND;
043        }
044    
045        /**
046         * Test for equality
047         *
048         * @param obj object to test
049         * @return true if equivalent
050         */
051        public boolean equals(Object obj) {
052            boolean result = false;
053            if (obj != null && obj instanceof BrokerAdminCommand) {
054                BrokerAdminCommand that = (BrokerAdminCommand) obj;
055                result = this.destination.equals(that.destination);
056            }
057            return result;
058        }
059    
060        /**
061         * @return hash code for instance
062         */
063        public int hashCode() {
064            return this.destination.hashCode();
065        }
066    
067        /**
068         * @return Returns the destination.
069         */
070        public ActiveMQDestination getDestination() {
071            return this.destination;
072        }
073    
074        /**
075         * @param newDestination The destination to set.
076         */
077        public void setDestination(ActiveMQDestination newDestination) {
078            this.destination = newDestination;
079        }
080    
081        /**
082         * @return Returns the command.
083         */
084        public String getCommand() {
085            return command;
086        }
087        
088        /**
089         * @param command The command to set.
090         */
091        public void setCommand(String command) {
092            this.command = command;
093        }
094    
095        /**
096         * @return a pretty print
097         */
098        public String toString() {
099            return super.toString() + " BrokerAdminCommand { " +
100                        "command = " + command +
101                    ", destination = " + destination +
102                    " }";
103        }
104    }