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    
021    import org.apache.activemq.util.IntrospectionSupport;
022    
023    
024    /**
025     * 
026     * @openwire:marshaller
027     * @version $Revision: 1.11 $
028     */
029    public abstract class BaseCommand implements Command {
030    
031        protected int commandId;
032        protected boolean responseRequired;
033        
034        private transient Endpoint from;
035        private transient Endpoint to;
036        
037        public void copy(BaseCommand copy) {
038            copy.commandId = commandId;
039            copy.responseRequired = responseRequired;
040        }    
041    
042        /**
043         * @openwire:property version=1
044         */
045        public int getCommandId() {
046            return commandId;
047        }
048    
049        public void setCommandId(int commandId) {
050            this.commandId = commandId;
051        }
052    
053        /**
054         * @openwire:property version=1
055         */
056        public boolean isResponseRequired() {
057            return responseRequired;
058        }
059    
060        public void setResponseRequired(boolean responseRequired) {
061            this.responseRequired = responseRequired;
062        }
063    
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        /**
109         * The endpoint within the transport where this message came from.
110         */
111        public Endpoint getFrom() {
112            return from;
113        }
114    
115        public void setFrom(Endpoint from) {
116            this.from = from;
117        }
118    
119        /**
120         * The endpoint within the transport where this message is going to - null means all endpoints.
121         */
122        public Endpoint getTo() {
123            return to;
124        }
125    
126        public void setTo(Endpoint to) {
127            this.to = to;
128        }
129        
130        
131    }