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;
022
023import java.util.ArrayList;
024import java.util.Collection;
025import java.util.LinkedList;
026import java.util.List;
027
028import org.restlet.resource.ServerResource;
029
030import pt.ua.dicoogle.sdk.core.DicooglePlatformInterface;
031import pt.ua.dicoogle.sdk.core.PlatformCommunicatorInterface;
032
033/**
034 * @author Luís A. Bastião Silva <bastiao@ua.pt>
035 * @author Luís S. Ribeiro
036 */
037public abstract class PluginBase implements PluginSet, PlatformCommunicatorInterface{
038    
039        protected List<IndexerInterface> indexPlugins = new ArrayList<>();
040    protected List<GraphicalInterface> graphicPlugins = new ArrayList<>();
041    protected List<QueryInterface> queryPlugins = new ArrayList<>();
042    protected List<JettyPluginInterface> jettyPlugins = new ArrayList<>();
043    //protected List<StorageInterface> storagePlugins = new ArrayList<>();
044    protected List<StorageInterface> storagePlugins = new LinkedList<>();
045    
046    protected List<ServerResource> services = new ArrayList<>();
047    protected ConfigurationHolder settings = null;
048    
049    protected DicooglePlatformInterface platform;
050    
051    @Override
052    public List<IndexerInterface> getIndexPlugins() {
053        return indexPlugins;
054    }
055
056 
057    @Override
058    public List<GraphicalInterface> getGraphicalPlugins() {
059        return graphicPlugins;
060    }
061
062
063    @Override
064    public List<QueryInterface> getQueryPlugins() {
065        return queryPlugins;
066    }
067
068   
069    @Override
070    public List<ServerResource> getRestPlugins() {
071        return services;
072    }
073    
074    @Override
075    public List<JettyPluginInterface> getJettyPlugins(){
076        return jettyPlugins;
077    }
078      
079    @Override
080    public abstract String getName();
081    
082    @Override
083    public ConfigurationHolder getSettings(){
084        return settings;
085    }
086    
087    @Override
088    public void setSettings(ConfigurationHolder xmlSettings){
089        settings = xmlSettings;
090    }
091    
092    @Override
093    public void shutdown(){
094        
095        //settings.save();
096    }
097
098    @Override
099    public Collection<StorageInterface> getStoragePlugins() 
100    {
101        return storagePlugins;
102    }
103    
104    @Override
105        public void setPlatformProxy(DicooglePlatformInterface core) {
106                this.platform = core;
107        }
108    
109}