Class DefaultClientDeviceSupplier

java.lang.Object
io.github.lunasaw.gbproxy.client.service.DefaultClientDeviceSupplier
All Implemented Interfaces:
ClientDeviceSupplier, DeviceSupplier

@Service @ConditionalOnMissingBean(ClientDeviceSupplier.class) public class DefaultClientDeviceSupplier extends Object implements ClientDeviceSupplier
客户端设备提供器默认实现 基于SipClientProperties配置的客户端设备管理

设计原则: 1. 线程安全的设备管理 2. 基于配置的客户端设备初始化 3. 支持动态设备添加和移除 4. 自动生成客户端发送方设备信息

Author:
luna
  • Constructor Details

    • DefaultClientDeviceSupplier

      public DefaultClientDeviceSupplier()
      初始化客户端发送方设备信息
  • Method Details

    • initializeClientFromDevice

      public void initializeClientFromDevice()
      初始化客户端发送方设备信息 基于配置属性创建客户端设备
    • getDevice

      public Device getDevice(String userId)
      Description copied from interface: DeviceSupplier
      根据用户ID获取指定设备 这是设备获取的核心方法,业务方通过userId获取设备数据
      Specified by:
      getDevice in interface DeviceSupplier
      Parameters:
      userId - 用户ID
      Returns:
      设备信息,如果不存在则返回null
    • getClientFromDevice

      public FromDevice getClientFromDevice()
      Description copied from interface: ClientDeviceSupplier
      获取客户端发送方设备信息 用于客户端发送SIP消息时标识发送方设备
      Specified by:
      getClientFromDevice in interface ClientDeviceSupplier
      Returns:
      客户端发送方设备信息,如果不存在则返回null
    • setClientFromDevice

      public void setClientFromDevice(FromDevice fromDevice)
      Description copied from interface: ClientDeviceSupplier
      设置客户端发送方设备信息 用于配置客户端的发送方设备标识
      Specified by:
      setClientFromDevice in interface ClientDeviceSupplier
      Parameters:
      fromDevice - 客户端发送方设备信息
    • getName

      public String getName()
      Description copied from interface: DeviceSupplier
      获取设备提供器的名称标识
      Specified by:
      getName in interface DeviceSupplier
      Returns:
      提供器名称
    • clearAllDevices

      public void clearAllDevices()
      清空所有设备
    • containsDevice

      public boolean containsDevice(String userId)
      检查设备是否存在
      Parameters:
      userId - 用户ID
      Returns:
      是否存在