1 /******************************************************************************* 2 * Copyright (c) 2007, 2014 Massimiliano Ziccardi 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 it.jnrpe.plugins; 17 18 import java.util.Collection; 19 20 /** 21 * The interface that all the plugin repository classes must implement. 22 * 23 * @author Massimiliano Ziccardi 24 */ 25 public interface IPluginRepository { 26 27 /** 28 * Returns an instance of the plugin declared inside the plugin definition. 29 * identified by the passed name. 30 * 31 * @param name 32 * The name of the plugin to be instantiated. 33 * @return The plugin instance 34 * @throws UnknownPluginException 35 * if no plugins with the given name exists 36 */ 37 IPluginInterface getPlugin(final String name) throws UnknownPluginException; 38 39 /** 40 * Returns all the plugin definitions managed by this repository. 41 * 42 * @return The collection of plugin definitions. 43 */ 44 Collection<PluginDefinition> getAllPlugins(); 45 46 /** 47 * Adds a plugin definition to this repository. 48 * 49 * @param pluginDef 50 * The plugin definition to be added. 51 */ 52 void addPluginDefinition(final PluginDefinition pluginDef); 53 54 /** 55 * Removes a plugin definition from the repository. 56 * 57 * @param pluginDef 58 * The plugin to be removed 59 */ 60 void removePluginDefinition(final PluginDefinition pluginDef); 61 }