ArchivePluginArchivio.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.config.RegistroPlugin;
  22. import org.openspcoop2.protocol.sdk.ProtocolException;

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

  31.     public static String buildKey(String nome) throws ProtocolException{
  32.        
  33.         if(nome==null){
  34.             throw new ProtocolException("nome non fornito");
  35.         }
  36.        
  37.         StringBuilder bf = new StringBuilder();
  38.         bf.append("PluginArchivio_");
  39.         bf.append(nome);
  40.         return bf.toString();
  41.     }
  42.    
  43.     @Override
  44.     public String key() throws ProtocolException {
  45.         return ArchivePluginArchivio.buildKey(this.nome);
  46.     }
  47.    
  48.     @Override
  49.     public int position() throws ProtocolException {
  50.         return this.posizione;
  51.     }
  52.    
  53.    
  54.     private String nome;
  55.     private int posizione;
  56.     private RegistroPlugin plugin;
  57.    
  58.     private ArchiveIdCorrelazione idCorrelazione; // permette di correlare piĆ¹ oggetti tra di loro

  59.     public ArchivePluginArchivio(RegistroPlugin plugin, ArchiveIdCorrelazione idCorrelazione) throws ProtocolException{
  60.        
  61.         if(plugin==null){
  62.             throw new ProtocolException("Plugin non fornito");
  63.         }
  64.         if(plugin.getNome()==null){
  65.             throw new ProtocolException("Plugin.nome non definito");
  66.         }
  67.         this.nome = plugin.getNome();
  68.         this.posizione = plugin.getPosizione();
  69.         this.plugin = plugin;
  70.        
  71.         this.idCorrelazione = idCorrelazione;
  72.        
  73.     }
  74.    
  75.     public String getNome() {
  76.         return this.nome;
  77.     }
  78.     public RegistroPlugin getPlugin() {
  79.         return this.plugin;
  80.     }
  81.    
  82.     public ArchiveIdCorrelazione getIdCorrelazione() {
  83.         return this.idCorrelazione;
  84.     }

  85. }