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.spi;
018
019 import javax.management.JMException;
020 import javax.management.MBeanServer;
021 import javax.management.ObjectName;
022
023 import org.apache.camel.Service;
024
025 /**
026 * Camel JMX service agent
027 */
028 public interface InstrumentationAgent extends Service {
029
030 /**
031 * Registers object with management infrastructure with a specific name. Object must be annotated or
032 * implement standard MBean interface.
033 *
034 * @param obj the object to register
035 * @param name the name
036 * @throws JMException is thrown if the registration failed
037 */
038 void register(Object obj, ObjectName name) throws JMException;
039
040 /**
041 * Registers object with management infrastructure with a specific name. Object must be annotated or
042 * implement standard MBean interface.
043 *
044 * @param obj the object to register
045 * @param name the name
046 * @param forceRegistration if set to <tt>true</tt>, then object will be registered despite
047 * existing object is already registered with the name.
048 * @throws JMException is thrown if the registration failed
049 */
050 void register(Object obj, ObjectName name, boolean forceRegistration) throws JMException;
051
052 /**
053 * Unregisters object based upon registered name
054 *
055 * @param name the name
056 * @throws JMException is thrown if the unregistration failed
057 */
058 void unregister(ObjectName name) throws JMException;
059
060 /**
061 * Get the MBeanServer which hosts managed objects.
062 * <p/>
063 * <b>Notice:</b> If the JMXEnabled configuration is not set to <tt>true</tt>,
064 * this method will return <tt>null</tt>.
065 *
066 * @return the MBeanServer
067 */
068 MBeanServer getMBeanServer();
069
070 /**
071 * Get domain name for Camel MBeans.
072 * <p/>
073 * <b>Notice:</b> That this can be different that the default domain name of the MBean Server.
074 *
075 * @return domain name
076 */
077 String getMBeanObjectDomainName();
078
079 }