Class JSONResourceAdapter

java.lang.Object
net.simplace.sim.io.FWSimIOAdapter
net.simplace.sim.io.resources.FWSimInputAdapter
net.simplace.sim.io.resources.FWSimResourceAdapter<com.fasterxml.jackson.databind.JsonNode>
net.simplace.sim.io.resources.adapter.JSONResourceAdapter
All Implemented Interfaces:
FWSimFieldContainer

public class JSONResourceAdapter extends FWSimResourceAdapter<com.fasterxml.jackson.databind.JsonNode>
Resource adapter for JSON data (JSONInterface, e.g. from a web service). The data is read on every call of getData(FWSimVarMap); the unique id of the cache is derived from the adapter name and the content, so transformers detect changed source data.
Author:
Andreas Enders
  • Constructor Details

    • JSONResourceAdapter

      public JSONResourceAdapter(org.jdom2.Element aResourceElement, FWSimSession aSession, int aOrderNumber)
      Creates the adapter from a resource element of the solution.
      Parameters:
      aResourceElement - the resource element
      aSession - the session
      aOrderNumber - order number of the adapter
    • JSONResourceAdapter

      public JSONResourceAdapter(org.jdom2.Element aResourceElement, String aURL, String aPath, String aVarName, String aComponentName, int aOrderNumber, FWSimSession aFwSimSession, FWSimIOAdapter.FREQUENCE aFrequence, Map<String,String> aKeyMap) throws Exception
      Creates the adapter from a resource element with its own JSON interface.
      Parameters:
      aResourceElement - the resource element
      aURL - URL of the JSON data
      aPath - path to the data within the JSON document
      aVarName - name of the variable in the JSON document
      aComponentName - name of the interface
      aOrderNumber - order number of the adapter
      aFwSimSession - the session
      aFrequence - not used (taken from the element)
      aKeyMap - not used (taken from the element)
      Throws:
      Exception - if the interface cannot be created
    • JSONResourceAdapter

      public JSONResourceAdapter(String aURL, String aPath, String aVarName, String aComponentName, int aOrderNumber, FWSimSession aFwSimSession, FWSimIOAdapter.FREQUENCE aFrequence, Map<String,String> aKeyMap) throws Exception
      Creates the adapter from the graph panel with its own JSON interface.
      Parameters:
      aURL - URL of the JSON data
      aPath - path to the data within the JSON document
      aVarName - name of the variable in the JSON document
      aComponentName - name of the adapter and the interface
      aOrderNumber - order number of the adapter
      aFwSimSession - the session
      aFrequence - frequency the data is read with
      aKeyMap - key variables; if empty, the user is asked to select them
      Throws:
      Exception - if the interface cannot be created
    • JSONResourceAdapter

      public JSONResourceAdapter(FWSimResourceAdapter<?> aAdapter, JSONInterface aInterface)
      Copy constructor used when the interface is replaced; the key variables are taken over.
      Parameters:
      aAdapter - the adapter to copy
      aInterface - the new interface
  • Method Details