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