All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.camel.spi.ManagementAgent Maven / Gradle / Ivy

There is a newer version: 4.6.0
Show newest version
/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.camel.spi;

import javax.management.JMException;
import javax.management.MBeanServer;
import javax.management.ObjectName;

import org.apache.camel.ManagementStatisticsLevel;
import org.apache.camel.Service;

/**
 * Camel JMX service agent
 */
public interface ManagementAgent extends Service {

    /**
     * Registers object with management infrastructure with a specific name. Object must be annotated or 
     * implement standard MBean interface.
     *
     * @param obj  the object to register
     * @param name the name
     * @throws JMException is thrown if the registration failed
     */
    void register(Object obj, ObjectName name) throws JMException;
    
    /**
     * Registers object with management infrastructure with a specific name. Object must be annotated or 
     * implement standard MBean interface.
     *
     * @param obj  the object to register
     * @param name the name
     * @param forceRegistration if set to true, then object will be registered despite
     * existing object is already registered with the name.
     * @throws JMException is thrown if the registration failed
     */
    void register(Object obj, ObjectName name, boolean forceRegistration) throws JMException;
    
    /**
     * Unregisters object based upon registered name
     *
     * @param name the name
     * @throws JMException is thrown if the unregistration failed
     */
    void unregister(ObjectName name) throws JMException;

    /**
     * Is the given object registered
     *
     * @param name the name
     * @return true if registered
     */
    boolean isRegistered(ObjectName name);

    /**
     * Creates a new proxy client
     *
     * @param name   the mbean name
     * @param mbean  the client interface, such as from the {@link org.apache.camel.api.management.mbean} package.
     * @return the client or null if mbean does not exists
     */
     T newProxyClient(ObjectName name, Class mbean);

    /**
     * Get the MBeanServer which hosts managed objects.
     * 

* Notice: If the JMXEnabled configuration is not set to true, * this method will return null. * * @return the MBeanServer */ MBeanServer getMBeanServer(); /** * Sets a custom mbean server to use * * @param mbeanServer the custom mbean server */ void setMBeanServer(MBeanServer mbeanServer); /** * Get domain name for Camel MBeans. *

* Notice: That this can be different that the default domain name of the MBean Server. * * @return domain name */ String getMBeanObjectDomainName(); /** * Sets the port used by {@link java.rmi.registry.LocateRegistry}. * * @param port the port */ void setRegistryPort(Integer port); /** * Gets the port used by {@link java.rmi.registry.LocateRegistry}. * * @return the port */ Integer getRegistryPort(); /** * Sets the port clients must use to connect * * @param port the port */ void setConnectorPort(Integer port); /** * Gets the port clients must use to connect * * @return the port */ Integer getConnectorPort(); /** * Sets the default domain on the MBean server * * @param domain the domain */ void setMBeanServerDefaultDomain(String domain); /** * Gets the default domain on the MBean server * * @return the domain */ String getMBeanServerDefaultDomain(); /** * Sets the object domain name * * @param domainName the object domain name */ void setMBeanObjectDomainName(String domainName); /** * Sets the service url * * @param url the service url */ void setServiceUrlPath(String url); /** * Gets the service url * * @return the url */ String getServiceUrlPath(); /** * Whether connector should be created, allowing clients to connect remotely * * @param createConnector true to create connector */ void setCreateConnector(Boolean createConnector); /** * Whether connector is created, allowing clients to connect remotely * * @return true if connector is created */ Boolean getCreateConnector(); /** * Whether to use the platform MBean Server. * * @param usePlatformMBeanServer true to use platform MBean server */ void setUsePlatformMBeanServer(Boolean usePlatformMBeanServer); /** * Whether to use the platform MBean Server. * * @return true if platform MBean server is to be used */ Boolean getUsePlatformMBeanServer(); /** * Whether to only register processors which has a custom id assigned. *

* This allows you to filter unwanted processors. * * @return true if only processors with custom id is registered */ Boolean getOnlyRegisterProcessorWithCustomId(); /** * Whether to only register processors which has a custom id assigned. *

* This allows you to filter unwanted processors. * * @param onlyRegisterProcessorWithCustomId true to only register if custom id has been assigned */ void setOnlyRegisterProcessorWithCustomId(Boolean onlyRegisterProcessorWithCustomId); /** * Whether to always register mbeans. *

* This option is default false. *

* Important: If this option is enabled then any service is registered as mbean. When using * dynamic EIP patterns using unique endpoint urls, you may create excessive mbeans in the registry. * This could lead to degraded performance as memory consumption will rise due the rising number * of mbeans. * * @return true if always registering */ Boolean getRegisterAlways(); /** * Whether to always register mbeans. *

* This option is default false. *

* Important: If this option is enabled then any service is registered as mbean. When using * dynamic EIP patterns using unique endpoint urls, you may create excessive mbeans in the registry. * This could lead to degraded performance as memory consumption will rise due the rising number * of mbeans. * * @param registerAlways true to always register */ void setRegisterAlways(Boolean registerAlways); /** * Whether to register mbeans when starting a new route *

* This option is default true. * * @return true to register when starting a new route */ Boolean getRegisterNewRoutes(); /** * Whether to register mbeans when starting a new route *

* This option is default true. * * @param registerNewRoutes true to register when starting a new route */ void setRegisterNewRoutes(Boolean registerNewRoutes); /** * Whether to remove detected sensitive information (such as passwords) from MBean names and attributes. *

* This option is default false. */ Boolean getMask(); /** * Whether to remove detected sensitive information (such as passwords) from MBean names and attributes. *

* This option is default false. */ void setMask(Boolean sanitize); /** * Gets whether host name is included in MBean names. * * @return true if included */ Boolean getIncludeHostName(); /** * Sets whether to include host name in the {@link ManagementNamingStrategy}. *

* By default this is turned off from Camel 2.13 onwards, but this option * can be set to true to include the hostname as Camel 2.12 or * older releases does. * * @param includeHostName true to include host name in the MBean names. */ void setIncludeHostName(Boolean includeHostName); /** * The naming pattern for creating the CamelContext management name. *

* The default pattern is #name# */ String getManagementNamePattern(); /** * The naming pattern for creating the CamelContext management name. *

* The default pattern is #name# */ void setManagementNamePattern(String managementNamePattern); /** * Sets whether load statistics is enabled (gathers load statistics using a background thread per CamelContext). *

* The default value is false * * @param flag true to enable load statistics */ void setLoadStatisticsEnabled(Boolean flag); /** * Gets whether load statistics is enabled * * @return true if enabled */ Boolean getLoadStatisticsEnabled(); /** * Sets whether endpoint runtime statistics is enabled (gathers runtime usage of each incoming and outgoing endpoints). *

* The default value is true * * @param flag false to disable endpoint runtime statistics */ void setEndpointRuntimeStatisticsEnabled(Boolean flag); /** * Gets whether load statistics is enabled * * @return true if enabled */ Boolean getEndpointRuntimeStatisticsEnabled(); /** * Sets the statistics level *

* Default is {@link org.apache.camel.ManagementStatisticsLevel#Default} *

* The level can be set to Extended to gather additional information * * @param level the new level */ void setStatisticsLevel(ManagementStatisticsLevel level); /** * Gets the statistics level * * @return the level */ ManagementStatisticsLevel getStatisticsLevel(); /** * Gets whether host IP Address to be used instead of host name. * * @return true if included */ Boolean getUseHostIPAddress(); /** * Sets whether to use host IP Address * @param useHostIPAddress true to use IP Address. */ void setUseHostIPAddress(Boolean useHostIPAddress); }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy