ArchivePluginClasse.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */
  20. package org.openspcoop2.protocol.sdk.archive;

  21. import org.openspcoop2.core.plugins.Plugin;
  22. import org.openspcoop2.protocol.sdk.ProtocolException;

  23. /**
  24.  * ArchivePluginClasse
  25.  *
  26.  * @author Poli Andrea (apoli@link.it)
  27.  * @author $Author$
  28.  * @version $Rev$, $Date$
  29.  */
  30. public class ArchivePluginClasse implements IArchiveObject {

  31.     public static String buildKey(String tipoPlugin, String tipo) throws ProtocolException{
  32.        
  33.         if(tipoPlugin==null){
  34.             throw new ProtocolException("tipoPlugin non fornito");
  35.         }
  36.         if(tipo==null){
  37.             throw new ProtocolException("tipo non fornito");
  38.         }
  39.        
  40.         StringBuilder bf = new StringBuilder();
  41.         bf.append("PluginClasse_");
  42.         bf.append(tipoPlugin);
  43.         bf.append("_");
  44.         bf.append(tipo);
  45.         return bf.toString();
  46.     }
  47.    
  48.     @Override
  49.     public String key() throws ProtocolException {
  50.         return ArchivePluginClasse.buildKey(this.tipoPlugin, this.tipo);
  51.     }
  52.    
  53.    
  54.    
  55.     private String tipoPlugin;
  56.     private String tipo;
  57.     private Plugin plugin;
  58.    
  59.     private ArchiveIdCorrelazione idCorrelazione; // permette di correlare più oggetti tra di loro

  60.     public ArchivePluginClasse(Plugin plugin, ArchiveIdCorrelazione idCorrelazione) throws ProtocolException{
  61.        
  62.         if(plugin==null){
  63.             throw new ProtocolException("Plugin non fornito");
  64.         }
  65.         if(plugin.getTipoPlugin()==null){
  66.             throw new ProtocolException("Plugin.tipoPlugin non definito");
  67.         }
  68.         if(plugin.getTipo()==null){
  69.             throw new ProtocolException("Plugin.tipo non definito");
  70.         }
  71.         this.tipoPlugin = plugin.getTipoPlugin();
  72.         this.tipo = plugin.getTipo();
  73.         this.plugin = plugin;
  74.        
  75.         this.idCorrelazione = idCorrelazione;
  76.        
  77.     }
  78.    
  79.     public String getTipoPlugin() {
  80.         return this.tipoPlugin;
  81.     }
  82.     public String getTipo() {
  83.         return this.tipo;
  84.     }
  85.     public Plugin getPlugin() {
  86.         return this.plugin;
  87.     }
  88.    
  89.     public ArchiveIdCorrelazione getIdCorrelazione() {
  90.         return this.idCorrelazione;
  91.     }

  92. }