001 /** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. 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 package org.apache.activemq.command; 018 019 import java.util.Map; 020 import org.apache.activemq.util.IntrospectionSupport; 021 022 023 /** 024 * 025 * @openwire:marshaller 026 * 027 */ 028 public abstract class BaseCommand implements Command { 029 030 protected int commandId; 031 protected boolean responseRequired; 032 033 private transient Endpoint from; 034 private transient Endpoint to; 035 036 public void copy(BaseCommand copy) { 037 copy.commandId = commandId; 038 copy.responseRequired = responseRequired; 039 } 040 041 /** 042 * @openwire:property version=1 043 */ 044 public int getCommandId() { 045 return commandId; 046 } 047 048 public void setCommandId(int commandId) { 049 this.commandId = commandId; 050 } 051 052 /** 053 * @openwire:property version=1 054 */ 055 public boolean isResponseRequired() { 056 return responseRequired; 057 } 058 059 public void setResponseRequired(boolean responseRequired) { 060 this.responseRequired = responseRequired; 061 } 062 063 @Override 064 public String toString() { 065 return toString(null); 066 } 067 068 public String toString(Map<String, Object>overrideFields) { 069 return IntrospectionSupport.toString(this, BaseCommand.class, overrideFields); 070 } 071 072 public boolean isWireFormatInfo() { 073 return false; 074 } 075 076 public boolean isBrokerInfo() { 077 return false; 078 } 079 080 public boolean isResponse() { 081 return false; 082 } 083 084 public boolean isMessageDispatch() { 085 return false; 086 } 087 088 public boolean isMessage() { 089 return false; 090 } 091 092 public boolean isMarshallAware() { 093 return false; 094 } 095 096 public boolean isMessageAck() { 097 return false; 098 } 099 100 public boolean isMessageDispatchNotification() { 101 return false; 102 } 103 104 public boolean isShutdownInfo() { 105 return false; 106 } 107 108 public boolean isConnectionControl() { 109 return false; 110 } 111 112 /** 113 * The endpoint within the transport where this message came from. 114 */ 115 public Endpoint getFrom() { 116 return from; 117 } 118 119 public void setFrom(Endpoint from) { 120 this.from = from; 121 } 122 123 /** 124 * The endpoint within the transport where this message is going to - null means all endpoints. 125 */ 126 public Endpoint getTo() { 127 return to; 128 } 129 130 public void setTo(Endpoint to) { 131 this.to = to; 132 } 133 134 135 }