1 /* 2 ~ Copyright 2006-2007 Nicolas De Loof. 3 ~ 4 ~ Licensed under the Apache License, Version 2.0 (the "License"); 5 ~ you may not use this file except in compliance with the License. 6 ~ You may obtain a copy of the License at 7 ~ 8 ~ http://www.apache.org/licenses/LICENSE-2.0 9 ~ 10 ~ Unless required by applicable law or agreed to in writing, software 11 ~ distributed under the License is distributed on an "AS IS" BASIS, 12 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 ~ See the License for the specific language governing permissions and 14 ~ limitations under the License. 15 */ 16 package org.jmonit; 17 18 import java.util.Collection; 19 import java.util.Set; 20 21 import org.jmonit.spi.PluginManager; 22 23 /** 24 * A <b>Repository</b> contains all the monitors used by the application and 25 * provides a centralized way to acces them. A monitor is defined in the 26 * repository by the pair category + name. 27 * <p> 28 * Categories are used to group monitors that handle comparable resources. For 29 * example a <tt>jdbc</tt> category will group all <code>Monitor</code>s 30 * that instrument the data acces layer. The category can have sub-categories 31 * using a dot notation. For example, the <tt>jdbc.procedures</tt> category 32 * can group data acces layer monitors dedicated to invocation of stored 33 * procedures. 34 * 35 * @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a> 36 */ 37 public interface Repository 38 { 39 /** 40 * @param name monitor name 41 * @return The monitor uniquely defines by it's name 42 */ 43 Monitor getMonitor( String name ); 44 45 /** 46 * @param tag tag 47 * @return all monitors having the requested tag 48 */ 49 Collection<Monitor> getMonitorsWithTag( String tag ); 50 51 /** 52 * @return The tags used by existing monitors 53 */ 54 Set<String> getTags(); 55 56 /** 57 * @param tags the tags the returned monitor must have 58 * @return all monitors having the requested tags 59 */ 60 Collection<Monitor> getMonitorsWithTags( String[] tags ); 61 62 /** 63 * @return all monitors 64 */ 65 Collection<Monitor> getMonitors(); 66 67 /** 68 * @return all monitors that support the expected set of features 69 */ 70 Collection<Monitor> getMonitorsWithFeatures( Class[] features ); 71 72 /** 73 * Register a custom featureManager 74 * 75 * @param featureManager 76 */ 77 void setFeatureManager( PluginManager featureManager ); 78 79 /** 80 * @return the active feature manager 81 */ 82 PluginManager getFeatureManager(); 83 84 }