Class SmartcardArchive

java.lang.Object
de.gematik.bbriccs.smartcards.SmartcardArchive

public class SmartcardArchive extends Object
The SmartcardArchive is a factory for Smartcards, which is used to load, cache and manage Smartcards from a given directory.
  • Method Details

    • fromResources

      public static SmartcardArchive fromResources()
      Initialize the SmartcardArchive from resources. For this method to work the ResourceLoader must be able to load the smartcards index file resources/smartcards/smartcards.json
      Returns:
      the SmartcardArchive initialized with the smartcards.json file from resources
    • from

      public static SmartcardArchive from(String path)
      Initialize the SmartcardArchive with a smartcards index file from a given path.
      Parameters:
      path - the path to the smartcards index file or the directory containing the smartcards.json file
      Returns:
      the SmartcardArchive initialized with the given smartcards index file
    • from

      public static SmartcardArchive from(File archiveFile)
      Initialize the SmartcardArchive with a smartcards index file from a given path.
      Parameters:
      archiveFile - pointing to the smartcards.json file or the directory containing the smartcards.json file
      Returns:
      the SmartcardArchive initialized with the smartcards.json file from the given File
    • getConfigs

      public List<SmartcardConfigDto> getConfigs()
      Get all Smartcard configurations known to this SmartcardArchive from the smartcards index file.
      Returns:
      a list of all known Smartcard configurations
    • getConfigsFor

      public List<SmartcardConfigDto> getConfigsFor(SmartcardType type)
      Get all Smartcard configurations known to this SmartcardArchive for a specific SmartcardType.
      Parameters:
      type - of Smartcards
      Returns:
      a list of all known Smartcard configurations for the given SmartcardType
    • getICCSNsFor

      public List<String> getICCSNsFor(SmartcardType type)
      Get all the ICCSNs of the Smartcards of a specific SmartcardType known to this SmartcardArchive
      Parameters:
      type - of Smartcards
      Returns:
      a list of all ICCSNs of the Smartcards of the given SmartcardType
    • getByICCSN

      public <T extends Smartcard> T getByICCSN(Class<T> classType, String iccsn)
      Get a Smartcard with classType and identified by its ICCSN.
      Type Parameters:
      T - the type of Smartcard
      Parameters:
      classType - of the Smartcard
      iccsn - of the Smartcard
      Returns:
      the Smartcard identified by the given ICCSN
    • getSmartcardByICCSN

      public Smartcard getSmartcardByICCSN(SmartcardType type, String iccsn)
      Get a Smartcard with SmartcardType type and identified by its ICCSN.
      Parameters:
      type - of the Smartcard
      iccsn - of the Smartcard
      Returns:
      the Smartcard identified by the given ICCSN
    • getByICCSN

      public Optional<Smartcard> getByICCSN(String iccsn)
      Get a Smartcard safely identified by its ICCSN.
      Parameters:
      iccsn - of the Smartcard
      Returns:
      Optional of the Smartcard if the ICCSN is known to this SmartcardArchive or an empty Optional otherwise
    • getHba

      public Hba getHba(int idx)
      Get a Hba from this SmartcardArchive identified by its index.
      Parameters:
      idx - of the Hba
      Returns:
      a Hba from this SmartcardArchive identified by its index.
    • getHbaByICCSN

      public Hba getHbaByICCSN(String iccsn)
      Get a Hba from this SmartcardArchive identified by its ICCSN.
      Parameters:
      iccsn - of the Hba
      Returns:
      the Hba with the given ICCSN
    • getHbaCards

      public List<Hba> getHbaCards()
      Get all Hba Smartcards which are configured in this SmartcardArchive
      Returns:
      a list of all Hba Smartcards
    • getSmcB

      public SmcB getSmcB(int idx)
      Get a SmcB from this SmartcardArchive identified by its index.
      Parameters:
      idx - of the SmcB
      Returns:
      a SmcB from this SmartcardArchive identified by its index.
    • getSmcbByICCSN

      public SmcB getSmcbByICCSN(String iccsn)
      Get a SmcB from this SmartcardArchive identified by its ICCSN.
      Parameters:
      iccsn - of the SmcB
      Returns:
      the SmcB with the given ICCSN
    • getSmcbCards

      public List<SmcB> getSmcbCards()
      Get all SmcB Smartcards which are configured in this SmartcardArchive
      Returns:
      a list of all SmcB Smartcards
    • getEgk

      public Egk getEgk(int idx)
      Get a Egk from this SmartcardArchive identified by its index.
      Parameters:
      idx - of the Egk
      Returns:
      a Egk from this SmartcardArchive identified by its index.
    • getEgkByICCSN

      public Egk getEgkByICCSN(String iccsn)
      Get a Egk from this SmartcardArchive identified by its ICCSN.
      Parameters:
      iccsn - of the Egk
      Returns:
      the Egk with the given ICCSN
    • getEgkByKvnr

      public Egk getEgkByKvnr(String kvnr)
      Get a Egk from this SmartcardArchive identified by its KVNR.
      Parameters:
      kvnr - of the Egk
      Returns:
      the Egk with the given KVNR
    • getEgkCards

      public List<Egk> getEgkCards()
      Get all Egk Smartcards which are configured in this SmartcardArchive
      Returns:
      a list of all Egk Smartcards