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 */
017package org.apache.camel.api.management;
018
019import org.apache.camel.api.management.mbean.ManagedCamelContextMBean;
020import org.apache.camel.api.management.mbean.ManagedProcessorMBean;
021import org.apache.camel.api.management.mbean.ManagedRouteMBean;
022
023public interface ManagedCamelContext {
024
025    /**
026     * Gets the managed Camel CamelContext client api
027     */
028    ManagedCamelContextMBean getManagedCamelContext();
029
030    /**
031     * Gets the managed processor client api from any of the routes which with the given id
032     *
033     * @param id id of the processor
034     * @return the processor or <tt>null</tt> if not found
035     */
036    default ManagedProcessorMBean getManagedProcessor(String id) {
037        return getManagedProcessor(id, ManagedProcessorMBean.class);
038    }
039
040    /**
041     * Gets the managed processor client api from any of the routes which with the given id
042     *
043     * @param id id of the processor
044     * @param type the managed processor type from the {@link org.apache.camel.api.management.mbean} package.
045     * @return the processor or <tt>null</tt> if not found
046     * @throws IllegalArgumentException if the type is not compliant
047     */
048    <T extends ManagedProcessorMBean> T getManagedProcessor(String id, Class<T> type);
049
050    /**
051     * Gets the managed route client api with the given route id
052     *
053     * @param routeId id of the route
054     * @return the route or <tt>null</tt> if not found
055     */
056    default ManagedRouteMBean getManagedRoute(String routeId) {
057        return getManagedRoute(routeId, ManagedRouteMBean.class);
058    }
059
060    /**
061     * Gets the managed route client api with the given route id
062     *
063     * @param routeId id of the route
064     * @param type the managed route type from the {@link org.apache.camel.api.management.mbean} package.
065     * @return the route or <tt>null</tt> if not found
066     * @throws IllegalArgumentException if the type is not compliant
067     */
068    <T extends ManagedRouteMBean> T getManagedRoute(String routeId, Class<T> type);
069
070}