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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid清空所有设备booleancontainsDevice(String userId) 检查设备是否存在获取客户端发送方设备信息 用于客户端发送SIP消息时标识发送方设备根据用户ID获取指定设备 这是设备获取的核心方法,业务方通过userId获取设备数据getName()获取设备提供器的名称标识void初始化客户端发送方设备信息 基于配置属性创建客户端设备voidsetClientFromDevice(FromDevice fromDevice) 设置客户端发送方设备信息 用于配置客户端的发送方设备标识Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.github.lunasaw.sip.common.service.DeviceSupplier
getToDevice, getToDevice
-
Constructor Details
-
DefaultClientDeviceSupplier
public DefaultClientDeviceSupplier()初始化客户端发送方设备信息
-
-
Method Details
-
initializeClientFromDevice
public void initializeClientFromDevice()初始化客户端发送方设备信息 基于配置属性创建客户端设备 -
getDevice
Description copied from interface:DeviceSupplier根据用户ID获取指定设备 这是设备获取的核心方法,业务方通过userId获取设备数据- Specified by:
getDevicein interfaceDeviceSupplier- Parameters:
userId- 用户ID- Returns:
- 设备信息,如果不存在则返回null
-
getClientFromDevice
Description copied from interface:ClientDeviceSupplier获取客户端发送方设备信息 用于客户端发送SIP消息时标识发送方设备- Specified by:
getClientFromDevicein interfaceClientDeviceSupplier- Returns:
- 客户端发送方设备信息,如果不存在则返回null
-
setClientFromDevice
Description copied from interface:ClientDeviceSupplier设置客户端发送方设备信息 用于配置客户端的发送方设备标识- Specified by:
setClientFromDevicein interfaceClientDeviceSupplier- Parameters:
fromDevice- 客户端发送方设备信息
-
getName
Description copied from interface:DeviceSupplier获取设备提供器的名称标识- Specified by:
getNamein interfaceDeviceSupplier- Returns:
- 提供器名称
-
clearAllDevices
public void clearAllDevices()清空所有设备 -
containsDevice
检查设备是否存在- Parameters:
userId- 用户ID- Returns:
- 是否存在
-