1 18 package org.apache.activemq.command; 19 20 import java.io.IOException ; 21 22 import org.apache.activemq.state.CommandVisitor; 23 24 30 public class DestinationInfo extends BaseCommand { 31 32 public static final byte DATA_STRUCTURE_TYPE=CommandTypes.DESTINATION_INFO; 33 34 public static final byte ADD_OPERATION_TYPE=0; 35 public static final byte REMOVE_OPERATION_TYPE=1; 36 37 protected ConnectionId connectionId; 38 protected ActiveMQDestination destination; 39 protected byte operationType; 40 protected long timeout; 41 protected BrokerId[] brokerPath; 42 43 public DestinationInfo() { 44 } 45 46 public DestinationInfo(ConnectionId connectionId, byte operationType, ActiveMQDestination destination) { 47 this.connectionId=connectionId; 48 this.operationType=operationType; 49 this.destination=destination; 50 } 51 52 public byte getDataStructureType() { 53 return DATA_STRUCTURE_TYPE; 54 } 55 56 public boolean isAddOperation() { 57 return operationType == ADD_OPERATION_TYPE; 58 } 59 60 public boolean isRemoveOperation() { 61 return operationType == REMOVE_OPERATION_TYPE; 62 } 63 64 67 public ConnectionId getConnectionId() { 68 return connectionId; 69 } 70 public void setConnectionId(ConnectionId connectionId) { 71 this.connectionId = connectionId; 72 } 73 74 77 public ActiveMQDestination getDestination() { 78 return destination; 79 } 80 81 public void setDestination(ActiveMQDestination destination) { 82 this.destination = destination; 83 } 84 85 88 public byte getOperationType() { 89 return operationType; 90 } 91 92 public void setOperationType(byte operationType) { 93 this.operationType = operationType; 94 } 95 96 99 public long getTimeout() { 100 return timeout; 101 } 102 103 public void setTimeout(long timeout) { 104 this.timeout = timeout; 105 } 106 107 112 public BrokerId[] getBrokerPath() { 113 return brokerPath; 114 } 115 public void setBrokerPath(BrokerId[] brokerPath) { 116 this.brokerPath = brokerPath; 117 } 118 119 public Response visit(CommandVisitor visitor) throws Exception { 120 if( isAddOperation() ) { 121 return visitor.processAddDestination( this ); 122 } else if( isRemoveOperation() ) { 123 return visitor.processRemoveDestination( this ); 124 } 125 throw new IOException ("Unknown operation type: "+getOperationType()); 126 } 127 128 } 129 | Popular Tags |