/** 
 * 
 * Copyright 2004 Protique Ltd
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 * 
 **/
package org.codehaus.activemq.message;

/**
 * Describes a Message consumer
 *
 * @version $Revision: 1.1 $
 */
public class BrokerAdminCommand extends AbstractPacket {
    
    static final public String CREATE_DESTINATION="CREATE_DESTINATION";
    static final public String DESTROY_DESTINATION="DESTROY_DESTINATION";
    static final public String EMPTY_DESTINATION="EMPTY_DESTINATION";
    
    private String command;
    private ActiveMQDestination destination;


    /**
     * Return the type of Packet
     *
     * @return integer representation of the type of Packet
     */
    public int getPacketType() {
        return BROKER_ADMIN_COMMAND;
    }

    /**
     * Test for equality
     *
     * @param obj object to test
     * @return true if equivalent
     */
    public boolean equals(Object obj) {
        boolean result = false;
        if (obj != null && obj instanceof BrokerAdminCommand) {
            BrokerAdminCommand that = (BrokerAdminCommand) obj;
            result = this.destination.equals(that.destination);
        }
        return result;
    }

    /**
     * @return hash code for instance
     */
    public int hashCode() {
        return this.destination.hashCode();
    }

    /**
     * @return Returns the destination.
     */
    public ActiveMQDestination getDestination() {
        return this.destination;
    }

    /**
     * @param newDestination The destination to set.
     */
    public void setDestination(ActiveMQDestination newDestination) {
        this.destination = newDestination;
    }

    /**
     * @return Returns the command.
     */
    public String getCommand() {
        return command;
    }
    
    /**
     * @param command The command to set.
     */
    public void setCommand(String command) {
        this.command = command;
    }

    /**
     * @return a pretty print
     */
    public String toString() {
        return super.toString() + " BrokerAdminCommand { " +
        	    "command = " + command +
                ", destination = " + destination +
                " }";
    }
}
