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