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.broker.jmx;
018    
019    import org.apache.activemq.network.NetworkConnector;
020    
021    public class NetworkConnectorView implements NetworkConnectorViewMBean {
022    
023        private final NetworkConnector connector;
024    
025        public NetworkConnectorView(NetworkConnector connector) {
026            this.connector = connector;
027        }
028    
029        public void start() throws Exception {
030            connector.start();
031        }
032    
033        public void stop() throws Exception {
034            connector.stop();
035        }
036    
037        public String getName() {
038            return connector.getName();
039        }
040    
041        public int getNetworkTTL() {
042            return connector.getNetworkTTL();
043        }
044    
045        public int getPrefetchSize() {
046            return connector.getPrefetchSize();
047        }
048    
049        public String getUserName() {
050            return connector.getUserName();
051        }
052    
053        public boolean isBridgeTempDestinations() {
054            return connector.isBridgeTempDestinations();
055        }
056    
057        public boolean isConduitSubscriptions() {
058            return connector.isConduitSubscriptions();
059        }
060    
061        public boolean isDecreaseNetworkConsumerPriority() {
062            return connector.isDecreaseNetworkConsumerPriority();
063        }
064    
065        public boolean isDispatchAsync() {
066            return connector.isDispatchAsync();
067        }
068    
069        public boolean isDynamicOnly() {
070            return connector.isDynamicOnly();
071        }
072        
073        public boolean isDuplex() {
074            return connector.isDuplex();
075        }
076    
077        public void setBridgeTempDestinations(boolean bridgeTempDestinations) {
078            connector.setBridgeTempDestinations(bridgeTempDestinations);
079        }
080    
081        public void setConduitSubscriptions(boolean conduitSubscriptions) {
082            connector.setConduitSubscriptions(conduitSubscriptions);
083        }
084    
085        public void setDispatchAsync(boolean dispatchAsync) {
086            connector.setDispatchAsync(dispatchAsync);
087        }
088    
089        public void setDynamicOnly(boolean dynamicOnly) {
090            connector.setDynamicOnly(dynamicOnly);
091        }
092    
093        public void setNetworkTTL(int networkTTL) {
094            connector.setNetworkTTL(networkTTL);
095        }
096    
097        public void setPassword(String password) {
098            connector.setPassword(password);
099        }
100    
101        public void setPrefetchSize(int prefetchSize) {
102            connector.setPrefetchSize(prefetchSize);
103        }
104    
105        public void setUserName(String userName) {
106            connector.setUserName(userName);
107        }
108    
109        public String getPassword() {
110            String pw = connector.getPassword();
111            // Hide the password for security reasons.
112            if (pw != null) {
113                pw = pw.replaceAll(".", "*");
114            }
115            return pw;
116        }
117    
118        public void setDecreaseNetworkConsumerPriority(boolean decreaseNetworkConsumerPriority) {
119            connector.setDecreaseNetworkConsumerPriority(decreaseNetworkConsumerPriority);
120        }
121    }