001/**
002 * Copyright (C) 2014  Universidade de Aveiro, DETI/IEETA, Bioinformatics Group - http://bioinformatics.ua.pt/
003 *
004 * This file is part of Dicoogle/dicoogle-sdk.
005 *
006 * Dicoogle/dicoogle-sdk is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 *
011 * Dicoogle/dicoogle-sdk is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014 * GNU General Public License for more details.
015 *
016 * You should have received a copy of the GNU General Public License
017 * along with Dicoogle.  If not, see <http://www.gnu.org/licenses/>.
018 */
019package pt.ua.dicoogle.sdk;
020
021import pt.ua.dicoogle.sdk.settings.ConfigurationHolder;
022import net.xeoh.plugins.base.Plugin;
023
024/** Class interface representing a generic plugin.
025 * <p>
026 * These plugins can have an initialization process, and can be enabled or disabled by the system.
027 * Furthermore, every plugin must have a name, so that Dicoogle can address it and control it. No further
028 * assumptions are made here regarding functionality. Any other more specific functionality must be defined
029 * as a class inheriting from this one.</p>
030 * 
031 * @author Frederico Valente
032 * @author Luís A. Bastião Silva <bastiao@ua.pt>
033 */
034public interface DicooglePlugin extends Plugin {
035    
036    /**
037     * Obtains the unique name of plugin. 
038     * A plugin must have a name to serve as an ID, and this is the method from where it is retrieved. This
039     * name must never change.
040     * 
041     * @return the name of the plugin
042     */
043    public abstract String getName();
044    
045    /**
046     * Issues the plugin to become enabled. It is expected that an enabled plugin, once configured, is ready
047     * to perform its main tasks.
048     * 
049     * @return whether the plugin was successfully enabled
050     */
051    public abstract boolean enable();
052    
053    /**
054     * Issues the plugin to become disabled. When called, the plugin is responsible
055     * for stopping all services that the plugin is running. 
056     * @return whether the plugin was successfully disabled
057     */
058    public abstract boolean disable();
059    
060    
061    /**
062     * Verifies if the plugin is enabled.
063     *
064     * @return whether the plugin is enabled
065     */
066    public abstract boolean isEnabled();
067
068    /** Sets the settings of this plugin.
069     * This method lets the plugin receive its settings from the core Dicoogle system.
070     * 
071     * @param settings the parameters that will be used by the plugin
072     */
073    public abstract void setSettings(ConfigurationHolder settings);
074    
075    /**
076     * Obtains access to the settings of the plugin.
077     * @return the plugin's settings
078     */
079    public abstract ConfigurationHolder getSettings();    
080}