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.spi; 17 18 import java.util.Collection; 19 20 /** 21 * The plugins manager maintain a set of factories to create plugins on-demand 22 * for monitors. New plugins factories can be registered when application is 23 * running, to enable some fine tweak of application monitoring by simply 24 * deploying new plugins to existing monitors. 25 * 26 * @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a> 27 */ 28 public interface PluginManager 29 { 30 31 /** 32 * Register a plugin factory 33 * 34 * @param <F> the feature that the plugin will provide 35 * @param factory the factory 36 * @param role TODO 37 */ 38 public abstract void registerPlugin( Factory factory, Class role ); 39 40 /** 41 * @param group a name for a group of features 42 * @return all features in the group 43 */ 44 public abstract Collection<Class> getFeatures( String group ); 45 46 public <T> Factory<T> getFactory( Class<T> feature ); 47 48 /** 49 * Retrieve a feature by name. The name can be a short name (simple class 50 * name) of a standard jMonit plugin (from org.jmonit.plugins package) or a 51 * fully qualified class name for custom plugins. 52 * 53 * @param name 54 * @return plublic API class for the feature 55 */ 56 public Class getFeature( String name ); 57 }