AbstractCore.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.pdd.core;

  21. import org.openspcoop2.protocol.sdk.IProtocolFactory;

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

  31.     private PdDContext pddContext;
  32.     private IProtocolFactory<?> protocolFactory;
  33.     private Object[] args = null;
  34.    
  35.     @Override
  36.     public void init(PdDContext pddContext,IProtocolFactory<?> protocolFactory,Object ... args) {
  37.         this.pddContext = pddContext;
  38.         this.protocolFactory = protocolFactory;
  39.         this.args = args;
  40.     }

  41.    
  42.     public PdDContext getPddContext() {
  43.         return this.pddContext;
  44.     }

  45.     public void setPddContext(PdDContext pddContext) {
  46.         this.pddContext = pddContext;
  47.     }

  48.     public IProtocolFactory<?> getProtocolFactory() {
  49.         return this.protocolFactory;
  50.     }

  51.     public void setProtocolFactory(IProtocolFactory<?> protocolFactory) {
  52.         this.protocolFactory = protocolFactory;
  53.     }

  54.     public Object[] getArgs() {
  55.         return this.args;
  56.     }

  57.     public void setArgs(Object[] args) {
  58.         this.args = args;
  59.     }
  60.    
  61.    
  62.     public static void init(ICore core,PdDContext pddContext,IProtocolFactory<?> protocolFactory,Object ... args){
  63.         if(core==null) {
  64.             throw new RuntimeException("Param core is null");
  65.         }
  66.         core.init(pddContext, protocolFactory, args);
  67.     }
  68. }