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 RemoveInfo extends BaseCommand { 31 32 public static final byte DATA_STRUCTURE_TYPE=CommandTypes.REMOVE_INFO; 33 34 protected DataStructure objectId; 35 36 public byte getDataStructureType() { 37 return DATA_STRUCTURE_TYPE; 38 } 39 40 public RemoveInfo() { 41 } 42 public RemoveInfo(DataStructure objectId) { 43 this.objectId=objectId; 44 } 45 46 49 public DataStructure getObjectId() { 50 return objectId; 51 } 52 53 public void setObjectId(DataStructure objectId) { 54 this.objectId = objectId; 55 } 56 57 public Response visit(CommandVisitor visitor) throws Exception { 58 switch (objectId.getDataStructureType()) { 59 case ConnectionId.DATA_STRUCTURE_TYPE: 60 return visitor.processRemoveConnection((ConnectionId) objectId); 61 case SessionId.DATA_STRUCTURE_TYPE: 62 return visitor.processRemoveSession((SessionId) objectId); 63 case ConsumerId.DATA_STRUCTURE_TYPE: 64 return visitor.processRemoveConsumer((ConsumerId) objectId); 65 case ProducerId.DATA_STRUCTURE_TYPE: 66 return visitor.processRemoveProducer((ProducerId) objectId); 67 default: 68 throw new IOException ("Unknown remove command type: "+ objectId.getDataStructureType()); 69 } 70 } 71 72 75 public boolean isConnectionRemove() { 76 return objectId.getDataStructureType() == ConnectionId.DATA_STRUCTURE_TYPE; 77 } 78 79 82 public boolean isSessionRemove() { 83 return objectId.getDataStructureType() == SessionId.DATA_STRUCTURE_TYPE; 84 } 85 86 89 public boolean isConsumerRemove() { 90 return objectId.getDataStructureType() == ConsumerId.DATA_STRUCTURE_TYPE; 91 } 92 93 96 public boolean isProducerRemove() { 97 return objectId.getDataStructureType() == ProducerId.DATA_STRUCTURE_TYPE; 98 } 99 100 } 101 | Popular Tags |