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 java.util.List; 020 021import org.apache.camel.api.management.mbean.ManagedCamelContextMBean; 022import org.apache.camel.api.management.mbean.ManagedConsumerMBean; 023import org.apache.camel.api.management.mbean.ManagedProcessorMBean; 024import org.apache.camel.api.management.mbean.ManagedRouteMBean; 025import org.apache.camel.api.management.mbean.ManagedStepMBean; 026 027public interface ManagedCamelContext { 028 029 /** 030 * Gets the managed Camel CamelContext client api 031 */ 032 ManagedCamelContextMBean getManagedCamelContext(); 033 034 /** 035 * Gets the managed processor client api from any of the routes which with the given id 036 * 037 * @param id id of the processor 038 * @return the processor or <tt>null</tt> if not found 039 */ 040 default ManagedProcessorMBean getManagedProcessor(String id) { 041 return getManagedProcessor(id, ManagedProcessorMBean.class); 042 } 043 044 /** 045 * Gets the managed processor client api from any of the routes which with the given id 046 * 047 * @param id id of the processor 048 * @param type the managed processor type from the 049 * {@link org.apache.camel.api.management.mbean} package. 050 * @return the processor or <tt>null</tt> if not found 051 * @throws IllegalArgumentException if the type is not compliant 052 */ 053 <T extends ManagedProcessorMBean> T getManagedProcessor(String id, Class<T> type); 054 055 /** 056 * Gets the managed step client api from any of the routes which with the given id 057 * 058 * @param id id of the step 059 * @return the step or <tt>null</tt> if not found 060 */ 061 ManagedStepMBean getManagedStep(String id); 062 063 /** 064 * Gets the managed route client api with the given route id 065 * 066 * @param routeId id of the route 067 * @return the route or <tt>null</tt> if not found 068 */ 069 default ManagedRouteMBean getManagedRoute(String routeId) { 070 return getManagedRoute(routeId, ManagedRouteMBean.class); 071 } 072 073 /** 074 * Gets the managed route client api with the given route id 075 * 076 * @param routeId id of the route 077 * @param type the managed route type from the {@link org.apache.camel.api.management.mbean} 078 * package. 079 * @return the route or <tt>null</tt> if not found 080 * @throws IllegalArgumentException if the type is not compliant 081 */ 082 <T extends ManagedRouteMBean> T getManagedRoute(String routeId, Class<T> type); 083 084 /** 085 * Gets all the managed routes 086 * 087 * @return the routes or an empty list if no routes exists 088 */ 089 List<ManagedRouteMBean> getManagedRoutes(); 090 091 /** 092 * Gets all the managed routes for the given group 093 * 094 * @param groupId the group id 095 * @return the routes or an empty list if no routes exists for the group 096 */ 097 List<ManagedRouteMBean> getManagedRoutesByGroup(String groupId); 098 099 /** 100 * Gets the managed consumer client api from any of the routes which with the given route id 101 * 102 * @param id route id having the consumer 103 * @return the consumer or <tt>null</tt> if not found 104 */ 105 default ManagedConsumerMBean getManagedConsumer(String id) { 106 return getManagedConsumer(id, ManagedConsumerMBean.class); 107 } 108 109 /** 110 * Gets the managed consumer client api from any of the routes which with the given route id 111 * 112 * @param id route id having the consumer 113 * @param type the managed consumer type from the {@link org.apache.camel.api.management.mbean} 114 * package. 115 * @return the consumer or <tt>null</tt> if not found 116 * @throws IllegalArgumentException if the type is not compliant 117 */ 118 <T extends ManagedConsumerMBean> T getManagedConsumer(String id, Class<T> type); 119 120}