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 org.apache.activemq.state.CommandVisitor;
020    
021    /**
022     * Used to start and stop transports as well as terminating clients.
023     * 
024     * @openwire:marshaller code="18"
025     * 
026     */
027    public class ConnectionControl extends BaseCommand {
028        public static final byte DATA_STRUCTURE_TYPE = CommandTypes.CONNECTION_CONTROL;
029        protected boolean suspend;
030        protected boolean resume;
031        protected boolean close;
032        protected boolean exit;
033        protected boolean faultTolerant;
034        protected String connectedBrokers="";
035        protected String reconnectTo = "";
036        protected byte[] token;
037        protected boolean rebalanceConnection;
038    
039        public byte getDataStructureType() {
040            return DATA_STRUCTURE_TYPE;
041        }
042    
043        public Response visit(CommandVisitor visitor) throws Exception {
044            return visitor.processConnectionControl(this);
045        }
046        @Override
047        public boolean isConnectionControl() {
048            return true;
049        }
050    
051        /**
052         * @openwire:property version=1
053         * @return Returns the close.
054         */
055        public boolean isClose() {
056            return close;
057        }
058    
059        /**
060         * @param close The close to set.
061         */
062        public void setClose(boolean close) {
063            this.close = close;
064        }
065    
066        /**
067         * @openwire:property version=1
068         * @return Returns the exit.
069         */
070        public boolean isExit() {
071            return exit;
072        }
073    
074        /**
075         * @param exit The exit to set.
076         */
077        public void setExit(boolean exit) {
078            this.exit = exit;
079        }
080    
081        /**
082         * @openwire:property version=1
083         * @return Returns the faultTolerant.
084         */
085        public boolean isFaultTolerant() {
086            return faultTolerant;
087        }
088    
089        /**
090         * @param faultTolerant The faultTolerant to set.
091         */
092        public void setFaultTolerant(boolean faultTolerant) {
093            this.faultTolerant = faultTolerant;
094        }
095    
096        /**
097         * @openwire:property version=1
098         * @return Returns the resume.
099         */
100        public boolean isResume() {
101            return resume;
102        }
103    
104        /**
105         * @param resume The resume to set.
106         */
107        public void setResume(boolean resume) {
108            this.resume = resume;
109        }
110    
111        /**
112         * @openwire:property version=1
113         * @return Returns the suspend.
114         */
115        public boolean isSuspend() {
116            return suspend;
117        }
118    
119        /**
120         * @param suspend The suspend to set.
121         */
122        public void setSuspend(boolean suspend) {
123            this.suspend = suspend;
124        }
125    
126        /**
127         * @openwire:property version=6 cache=false
128         * @return connected brokers.
129         */
130        public String getConnectedBrokers() {
131            return this.connectedBrokers;
132        }
133    
134        /**
135         * @param connectedBrokers the connectedBrokers to set
136         */
137        public void setConnectedBrokers(String connectedBrokers) {
138            this.connectedBrokers = connectedBrokers;
139        }
140    
141        /**
142         *  @openwire:property version=6 cache=false
143         * @return the reconnectTo
144         */
145        public String getReconnectTo() {
146            return this.reconnectTo;
147        }
148    
149        /**
150         * @param reconnectTo the reconnectTo to set
151         */
152        public void setReconnectTo(String reconnectTo) {
153            this.reconnectTo = reconnectTo;
154        }
155    
156        /**
157         * @return the rebalanceConnection
158         *  @openwire:property version=6 cache=false
159         */
160        public boolean isRebalanceConnection() {
161            return this.rebalanceConnection;
162        }
163    
164        /**
165         * @param rebalanceConnection the rebalanceConnection to set
166         */
167        public void setRebalanceConnection(boolean rebalanceConnection) {
168            this.rebalanceConnection = rebalanceConnection;
169        }
170    
171        /**
172         * @openwire:property version=8
173         * @return the token
174         */
175        public byte[] getToken() {
176            return this.token;
177        }
178    
179        /**
180         * @param token the token to set
181         */
182        public void setToken(byte[] token) {
183            this.token = token;
184        }
185    }