Class FWSimSyncAdapter

java.lang.Object
net.simplace.sim.io.FWSimIOAdapter
net.simplace.sim.io.sync.FWSimSyncAdapter
All Implemented Interfaces:
FWSimFieldContainer

public abstract class FWSimSyncAdapter extends FWSimIOAdapter
Base class of synchronisation adapters for synchronized projects: when all simulations of a synchronized project wait, FWSimSyncManager.sync(Map) is called with their variable maps, so the adapters can exchange data between the simulations. Subclasses need a public constructor (FWSimSession, Element, Integer). Currently there are no implementations.
Author:
aenders
  • Constructor Details

    • FWSimSyncAdapter

      protected FWSimSyncAdapter(FWSimSession aSession, org.jdom2.Element aSyncElement, Integer aOrderNumber)
      Parameters:
      aSession - the session
      aSyncElement - the XML element describing the adapter
      aOrderNumber - position of the adapter in the order of execution
  • Method Details

    • createSyncAdapter

      protected static FWSimSyncAdapter createSyncAdapter(FWSimSession aSession, org.jdom2.Element aSyncElement, int aOrderNumber)
      Instantiates the adapter class given in the attribute class of the element by reflection.
      Parameters:
      aSession - the session
      aSyncElement - the XML element describing the adapter
      aOrderNumber - position of the adapter in the order of execution
      Returns:
      the new adapter, or null if the class is abstract or cannot be instantiated (error is logged)
    • sync

      public abstract FWSimResourceCache sync(Map<String, FWSimVarMap> aVarMapsContainer)
      Synchronises the waiting simulations.
      Parameters:
      aVarMapsContainer - variable maps of the simulations of the project, by simulation id
      Returns:
      cache with the synchronised data
    • getOutputVariables

      public Collection<FWSimVariable<?>> getOutputVariables()
      returning the variables from the header information
      Returns:
      the output variables of the field map
      See Also:
    • getInputVariables

      public Collection<FWSimVariable<?>> getInputVariables()
      always returning empty list because this adapters are not meant to receive input data
      Returns:
      the input variables of the field map
      See Also:
    • getContentType

      public FWSimVariable.CONTENT_TYPE getContentType()
      Returns:
      the content type of the variables of this container (e.g. sys, mgm)
      See Also:
    • getJexlScript

      public JexlRuleScript getJexlScript()
      Returns:
      the rule script of the adapter, compiled on first call
    • getVarMap

      public FWSimVarMap getVarMap()
      Returns:
      the var map this container belongs to
    • toXML

      public org.jdom2.Element toXML()
      Returns:
      an XML element with all settings of this container