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 */
017package org.apache.activemq.command;
018
019import 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 */
027public 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 boolean rebalanceConnection;
037
038    public byte getDataStructureType() {
039        return DATA_STRUCTURE_TYPE;
040    }
041
042    public Response visit(CommandVisitor visitor) throws Exception {
043        return visitor.processConnectionControl(this);
044    }
045    @Override
046    public boolean isConnectionControl() {
047        return true;
048    }
049
050    /**
051     * @openwire:property version=1
052     * @return Returns the close.
053     */
054    public boolean isClose() {
055        return close;
056    }
057
058    /**
059     * @param close The close to set.
060     */
061    public void setClose(boolean close) {
062        this.close = close;
063    }
064
065    /**
066     * @openwire:property version=1
067     * @return Returns the exit.
068     */
069    public boolean isExit() {
070        return exit;
071    }
072
073    /**
074     * @param exit The exit to set.
075     */
076    public void setExit(boolean exit) {
077        this.exit = exit;
078    }
079
080    /**
081     * @openwire:property version=1
082     * @return Returns the faultTolerant.
083     */
084    public boolean isFaultTolerant() {
085        return faultTolerant;
086    }
087
088    /**
089     * @param faultTolerant The faultTolerant to set.
090     */
091    public void setFaultTolerant(boolean faultTolerant) {
092        this.faultTolerant = faultTolerant;
093    }
094
095    /**
096     * @openwire:property version=1
097     * @return Returns the resume.
098     */
099    public boolean isResume() {
100        return resume;
101    }
102
103    /**
104     * @param resume The resume to set.
105     */
106    public void setResume(boolean resume) {
107        this.resume = resume;
108    }
109
110    /**
111     * @openwire:property version=1
112     * @return Returns the suspend.
113     */
114    public boolean isSuspend() {
115        return suspend;
116    }
117
118    /**
119     * @param suspend The suspend to set.
120     */
121    public void setSuspend(boolean suspend) {
122        this.suspend = suspend;
123    }
124
125    /**
126     * @openwire:property version=6 cache=false
127     * @return connected brokers.
128     */
129    public String getConnectedBrokers() {
130        return this.connectedBrokers;
131    }
132
133    /**
134     * @param connectedBrokers the connectedBrokers to set
135     */
136    public void setConnectedBrokers(String connectedBrokers) {
137        this.connectedBrokers = connectedBrokers;
138    }
139
140    /**
141     *  @openwire:property version=6 cache=false
142     * @return the reconnectTo
143     */
144    public String getReconnectTo() {
145        return this.reconnectTo;
146    }
147
148    /**
149     * @param reconnectTo the reconnectTo to set
150     */
151    public void setReconnectTo(String reconnectTo) {
152        this.reconnectTo = reconnectTo;
153    }
154
155    /**
156     * @return the rebalanceConnection
157     *  @openwire:property version=6 cache=false
158     */
159    public boolean isRebalanceConnection() {
160        return this.rebalanceConnection;
161    }
162
163    /**
164     * @param rebalanceConnection the rebalanceConnection to set
165     */
166    public void setRebalanceConnection(boolean rebalanceConnection) {
167        this.rebalanceConnection = rebalanceConnection;
168    }
169}