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 represent the durable subscriptions contained by the broker
023 * This is used to synchronize durable subs on bridge creation
024 *
025 * @openwire:marshaller code="92"
026 *
027 */
028public class BrokerSubscriptionInfo extends BaseCommand {
029
030    public static final byte DATA_STRUCTURE_TYPE = CommandTypes.BROKER_SUBSCRIPTION_INFO;
031
032    BrokerId brokerId;
033    String brokerName;
034    ConsumerInfo subscriptionInfos[];
035
036    public BrokerSubscriptionInfo() {
037
038    }
039
040    public BrokerSubscriptionInfo(String brokerName) {
041        this.brokerName = brokerName;
042    }
043
044    public BrokerSubscriptionInfo copy() {
045        BrokerSubscriptionInfo copy = new BrokerSubscriptionInfo();
046        copy(copy);
047        return copy;
048    }
049
050    private void copy(BrokerSubscriptionInfo copy) {
051        super.copy(copy);
052        copy.subscriptionInfos = this.subscriptionInfos;
053        copy.brokerName = this.brokerName;
054        copy.brokerId = this.brokerId;
055    }
056
057    @Override
058    public Response visit(CommandVisitor visitor) throws Exception {
059        return visitor.processBrokerSubscriptionInfo(this);
060    }
061
062    @Override
063    public byte getDataStructureType() {
064        return DATA_STRUCTURE_TYPE;
065    }
066
067    /**
068     * @openwire:property version=12
069     */
070    public BrokerId getBrokerId() {
071        return brokerId;
072    }
073
074    public void setBrokerId(BrokerId brokerId) {
075        this.brokerId = brokerId;
076    }
077
078    /**
079     * @openwire:property version=12
080     */
081    public String getBrokerName() {
082        return brokerName;
083    }
084
085    public void setBrokerName(String brokerName) {
086        this.brokerName = brokerName;
087    }
088
089    /**
090     * @openwire:property version=12
091     */
092    public ConsumerInfo[] getSubscriptionInfos() {
093        return subscriptionInfos;
094    }
095
096    public void setSubscriptionInfos(ConsumerInfo[] subscriptionInfos) {
097        this.subscriptionInfos = subscriptionInfos;
098    }
099
100}