001 /**
002 *
003 * Copyright 2004 Protique Ltd
004 *
005 * Licensed under the Apache License, Version 2.0 (the "License");
006 * you may not use this file except in compliance with the License.
007 * 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 **/
018
019 package org.activemq.broker.impl;
020
021 import java.util.Properties;
022
023 import org.activemq.message.BrokerInfo;
024
025 /**
026 * Information about a connected Broker
027 */
028
029 public class LocalBrokerInfo extends BrokerInfo{
030
031 DefaultBroker broker;
032 /**
033 * Constructor
034 *
035 * @param broker
036 */
037 protected LocalBrokerInfo(DefaultBroker broker){
038 this.broker = broker;
039 }
040 /**
041 * @param newBrokerName
042 * The brokerName to set.
043 */
044 public void setBrokerName(String newBrokerName){
045 if(broker.isStarted()){
046 throw new RuntimeException("Cannot change the name of the broker after it's started");
047 }
048 if(broker.getBrokerContainer()!=null){
049 broker.getBrokerContainer().doDeRegistration(getBrokerName());
050 broker.getBrokerContainer().doRegistration(newBrokerName);
051 }
052 super.setBrokerName(newBrokerName);
053 }
054
055 /**
056 * @param newClusterName
057 * The clusterName to set.
058 */
059 public void setClusterName(String newClusterName){
060 if(broker.isStarted()){
061 throw new RuntimeException("Cannot change the cluster of the broker after it's started");
062 }
063 super.setClusterName(newClusterName);
064 }
065
066 }