Class JposDeviceFactory

java.lang.Object
de.gmxhome.conrad.jpos.jpos_base.JposDeviceFactory
Direct Known Subclasses:
Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory, Factory

public class JposDeviceFactory extends Object
General part of JposDevice factory for every JPOS device using this framework. Every device factory tries to get a JposDevice using the specified ID. If this fails, a new object derived from JposDevice will be generated and put into a JposDevice map using putDevice. After closing the last service based on JposBase that holds a specific JposDevice, it uses deleteDevice to remove the JposDevice object from the device map.
  • Field Details

    • Devices

      public static final Map<String,​JposDevice> Devices
      Holds all JposDevice objects currentls created. The ID specified within the constructor of a JposDevice will be used as index into this map.
    • CurrentEntry

      @Deprecated public static jpos.config.JposEntry CurrentEntry
      Deprecated.
      Temporary storage for jpos entries passed to createInstance. Will be filled in checkProperties method of JposBaseDevice for later use in deprecated addDevice methods (those methods that have no JposEntry parameter).
  • Constructor Details

    • JposDeviceFactory

      public JposDeviceFactory()
  • Method Details

    • validateJposConfiguration

      protected void validateJposConfiguration(JposCommonProperties props, JposDevice dev, JposCommonProperties[] claiming, jpos.config.JposEntry entry) throws jpos.JposException
      Initializes property set properties Device and Claiming and calls checkProperties method of the property set to verify correctness of jpos configuration and to initialize some corresponding values.
      Parameters:
      props - Property set to be validated.
      dev - Device to be used by property set.
      claiming - Array containing the currently claimed device, if any.
      entry - Name / Value pairs containing configuration values of the jpos.xml configuration file
      Throws:
      jpos.JposException - if a value specified in entry is invalid
    • getDevice

      public static JposDevice getDevice(String key)
      Retrieves driver implementation derived from JposDevice.
      Parameters:
      key - Key, e.g. COM port
      Returns:
      JposDevice or null
    • putDevice

      public static void putDevice(String key, JposDevice dev) throws jpos.JposException
      Stores driver implementation derived from JposDevice in map Devices
      Parameters:
      key - Key, e.g. COM port
      dev - JposDevice
      Throws:
      jpos.JposException - if Devices contains just an entry with the given key
    • deleteDevice

      public static void deleteDevice(String key) throws jpos.JposException
      Deletes driver implementation derived from JposDevice ou of map Devices. Must be done only if the JposDevice has no property set in any of its lists of lists of property set lists.
      Parameters:
      key - Key, e.g. COM port
      Throws:
      jpos.JposException - if Devices does not contain an entry with the given key