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 java.util.Collection;
022
023import net.xeoh.plugins.base.Plugin;
024
025import org.restlet.resource.ServerResource;
026
027import pt.ua.dicoogle.sdk.settings.ConfigurationHolder;
028
029/**
030 * This is the class responsible for creating a Dicoolge plugin.
031 * The developer may use this interface in order to manage and expose the implemented plugins. One instance
032 * of each installed plugin set is created by injecting it as a {@link PluginImplementation}. All instances
033 * are expected to be thread safe. It is highly recommended that provided collections are immutable, and
034 * that no modifications are performed in getter methods.
035 * 
036 * @author psytek
037 * @author Luís A. Bastião Silva <bastiao@ua.pt>
038 */
039public interface PluginSet extends Plugin {
040    
041    /**
042     * Gets the indexer plugins enclosed in this plugin set.
043     * This collection must be immutable.
044     * @return IndexPluginInterface returns a list of active index plugins
045     * @see IndexerInterface
046     */
047    public Collection<IndexerInterface> getIndexPlugins();
048
049    /**
050     * Gets the graphical plugins enclosed in this plugin set.
051     * This collection must be immutable.
052     * @return 
053     * @deprecated the Swing-based remote user interface is deprecated
054     */
055    public Collection<GraphicalInterface> getGraphicalPlugins();
056
057    /**
058     * Gets the query plugins enclosed in this plugin set.
059     * This collection must be immutable.
060     * @return a collection of query plugins
061     * @see QueryInterface
062     */
063    public Collection<QueryInterface> getQueryPlugins();
064    
065    /**
066     * Gets the storage plugins enclosed in this plugin set.
067     * This collection must be immutable.
068     * @return Collection holding the StoragePlugins of this PluginSet
069     */
070    public Collection<StorageInterface> getStoragePlugins();
071    
072    /**
073     * Obtains a collection of access to the RESTful resources. These plugins will be installed to
074     * the web service hierarchy according to a name defined by the object's {@code toString()} method.
075     * This collection must be immutable.
076     * @return a collection of Restlet-based server resources, implementing {@code toString()}
077     * to provide the resource name
078     */
079    public Collection<ServerResource> getRestPlugins();
080    
081    /**
082     * Obtains a collection of Jetty plugins, so as to implement web services via Dicoogle.
083     * This collection must be immutable.
084     * @return a collection of Jetty plugins to the core application
085     * @see JettyPluginInterface
086     */
087    public Collection<JettyPluginInterface> getJettyPlugins();
088    
089    /**
090     * Gets the plugin's name. This name will be used for identifying index/query/storage providers,
091     * and should be unique among the total plugin sets installed.
092     * @return the name of the plugin, never changes
093     */
094    public String getName();
095    
096    /**
097     * Defines the plugin's settings. This method will be called once after the plugin set was instantiated
098     * with plugin-scoped settings. Dicoogle users can modify these settings by accessing the XML file with
099     * the same name in the "Settings" folder. Developers may define such settings programmatically from the
100     * plugin itself.
101     * @param xmlSettings an XML-based configuration holder
102     */
103    public void setSettings(ConfigurationHolder xmlSettings);
104    
105    /**
106     * Retrieves the plugin's settings.
107     * @return an XML-based configuration holder
108     */
109    public ConfigurationHolder getSettings();
110
111    /**
112     * Signals a plugin to stop. Upon an invocation of this method, the plugin may clean allocated resources
113     * and save state if required.
114     */
115    public void shutdown();
116    
117}