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.camel.core.xml;
018    
019    import javax.xml.bind.annotation.XmlAccessType;
020    import javax.xml.bind.annotation.XmlAccessorType;
021    import javax.xml.bind.annotation.XmlAttribute;
022    import javax.xml.bind.annotation.XmlRootElement;
023    
024    import org.apache.camel.ManagementStatisticsLevel;
025    import org.apache.camel.model.IdentifiedType;
026    
027    /**
028     * The JAXB type class for the configuration of jmxAgent
029     *
030     * @version 
031     */
032    @XmlRootElement(name = "jmxAgent")
033    @XmlAccessorType(XmlAccessType.FIELD)
034    public class CamelJMXAgentDefinition extends IdentifiedType {
035    
036        /**
037         * Disable JMI (default false)
038         */
039        @XmlAttribute(required = false)
040        private String disabled = "false";
041    
042        /**
043         * Only register processor if a custom id was defined for it.
044         */
045        @XmlAttribute(required = false)
046        private String onlyRegisterProcessorWithCustomId = "false";
047    
048        /**
049         * RMI connector registry port (default 1099)
050         */
051        @XmlAttribute(required = false)
052        private String registryPort;
053    
054        /**
055         * RMI connector server port (default -1 not used)
056         */
057        @XmlAttribute(required = false)
058        private String connectorPort;
059    
060        /**
061         * MBean server default domain name (default org.apache.camel)
062         */
063        @XmlAttribute(required = false)
064        private String mbeanServerDefaultDomain;
065    
066        /**
067         * MBean object domain name (default org.apache.camel)
068         */
069        @XmlAttribute(required = false)
070        private String mbeanObjectDomainName;
071    
072        /**
073         * JMX Service URL path (default /jmxrmi)
074         */
075        @XmlAttribute(required = false)
076        private String serviceUrlPath;
077    
078        /**
079         * A flag that indicates whether the agent should be created
080         */
081        @XmlAttribute(required = false)
082        private String createConnector = "true";
083    
084        /**
085         * A flag that indicates whether the platform mbean server should be used
086         */
087        @XmlAttribute(required = false)
088        private String usePlatformMBeanServer = "true";
089    
090        /**
091         * A flag that indicates whether to register mbeans always
092         */
093        @XmlAttribute(required = false)
094        private String registerAlways;
095    
096        /**
097         * A flag that indicates whether to register mbeans when starting new routes
098         */
099        @XmlAttribute(required = false)
100        private String registerNewRoutes = "true";
101    
102        /**
103         * Level of granularity for performance statistics enabled
104         */
105        @XmlAttribute(required = false)
106        private ManagementStatisticsLevel statisticsLevel = ManagementStatisticsLevel.All;
107    
108        public String getDisabled() {
109            return disabled;
110        }
111    
112        public void setDisabled(String disabled) {
113            this.disabled = disabled;
114        }
115    
116        public String getOnlyRegisterProcessorWithCustomId() {
117            return onlyRegisterProcessorWithCustomId;
118        }
119    
120        public void setOnlyRegisterProcessorWithCustomId(String onlyRegisterProcessorWithCustomId) {
121            this.onlyRegisterProcessorWithCustomId = onlyRegisterProcessorWithCustomId;
122        }
123    
124        public String getRegistryPort() {
125            return registryPort;
126        }
127    
128        public void setRegistryPort(String registryPort) {
129            this.registryPort = registryPort;
130        }
131    
132        public String getConnectorPort() {
133            return connectorPort;
134        }
135    
136        public void setConnectorPort(String connectorPort) {
137            this.connectorPort = connectorPort;
138        }
139    
140        public String getMbeanServerDefaultDomain() {
141            return mbeanServerDefaultDomain;
142        }
143    
144        public void setMbeanServerDefaultDomain(String mbeanServerDefaultDomain) {
145            this.mbeanServerDefaultDomain = mbeanServerDefaultDomain;
146        }
147    
148        public String getMbeanObjectDomainName() {
149            return mbeanObjectDomainName;
150        }
151    
152        public void setMbeanObjectDomainName(String mbeanObjectDomainName) {
153            this.mbeanObjectDomainName = mbeanObjectDomainName;
154        }
155    
156        public String getServiceUrlPath() {
157            return serviceUrlPath;
158        }
159    
160        public void setServiceUrlPath(String serviceUrlPath) {
161            this.serviceUrlPath = serviceUrlPath;
162        }
163    
164        public String getCreateConnector() {
165            return createConnector;
166        }
167    
168        public void setCreateConnector(String createConnector) {
169            this.createConnector = createConnector;
170        }
171    
172        public String getUsePlatformMBeanServer() {
173            return usePlatformMBeanServer;
174        }
175    
176        public void setUsePlatformMBeanServer(String usePlatformMBeanServer) {
177            this.usePlatformMBeanServer = usePlatformMBeanServer;
178        }
179    
180        public ManagementStatisticsLevel getStatisticsLevel() {
181            return statisticsLevel;
182        }
183    
184        public void setStatisticsLevel(ManagementStatisticsLevel statisticsLevel) {
185            this.statisticsLevel = statisticsLevel;
186        }
187    
188        public String getRegisterAlways() {
189            return registerAlways;
190        }
191    
192        public void setRegisterAlways(String registerAlways) {
193            this.registerAlways = registerAlways;
194        }
195    
196        public String getRegisterNewRoutes() {
197            return registerNewRoutes;
198        }
199    
200        public void setRegisterNewRoutes(String registerNewRoutes) {
201            this.registerNewRoutes = registerNewRoutes;
202        }
203    
204        @Override
205        public String toString() {
206            StringBuilder sb = new StringBuilder();
207            sb.append("CamelJMXAgent[");
208            sb.append("usePlatformMBeanServer=").append(usePlatformMBeanServer);
209            if (createConnector != null) {
210                sb.append(", createConnector=").append(createConnector);
211            }
212            if (connectorPort != null) {
213                sb.append(", connectorPort=").append(connectorPort);
214            }
215            if (registryPort != null) {
216                sb.append(", registryPort=").append(registryPort);
217            }
218            if (serviceUrlPath != null) {
219                sb.append(", serviceUrlPath=").append(serviceUrlPath);
220            }
221            if (mbeanServerDefaultDomain != null) {
222                sb.append(", mbeanServerDefaultDomain=").append(mbeanServerDefaultDomain);
223            }
224            if (mbeanObjectDomainName != null) {
225                sb.append(", mbeanObjectDomainName=").append(mbeanObjectDomainName);
226            }
227            if (statisticsLevel != null) {
228                sb.append(", statisticsLevel=").append(statisticsLevel);
229            }
230            if (registerAlways != null) {
231                sb.append(", registerAlways=").append(registerAlways);
232            }
233            if (registerNewRoutes != null) {
234                sb.append(", registerNewRoutes=").append(registerNewRoutes);
235            }
236            sb.append("]");
237            return sb.toString();
238        }
239    
240    }