Class AbstractServerCommandStrategy
java.lang.Object
io.github.lunasaw.gbproxy.server.transmit.cmd.strategy.AbstractServerCommandStrategy
- All Implemented Interfaces:
ServerCommandStrategy
- Direct Known Subclasses:
AckCommandStrategy
,ByeCommandStrategy
,InfoCommandStrategy
,InviteCommandStrategy
,MessageCommandStrategy
,RegisterCommandStrategy
,SubscribeCommandStrategy
抽象服务端命令策略基类
提供通用的命令执行逻辑和工具方法
- Author:
- luna
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
构建命令内容执行命令(使用请求对象)execute
(FromDevice fromDevice, ToDevice toDevice, Event errorEvent, Event okEvent, Map<String, Object> params) 执行命令(带事件)执行命令protected String
生成随机序列号protected String
getDeviceId
(FromDevice fromDevice) 获取设备IDprotected String
getTargetDeviceId
(ToDevice toDevice) 获取目标设备IDprotected String
发送命令protected void
参数校验Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.lunasaw.gbproxy.server.transmit.cmd.strategy.ServerCommandStrategy
getCommandDescription, getCommandType
-
Constructor Details
-
AbstractServerCommandStrategy
public AbstractServerCommandStrategy()
-
-
Method Details
-
execute
Description copied from interface:ServerCommandStrategy
执行命令- Specified by:
execute
in interfaceServerCommandStrategy
- Parameters:
fromDevice
- 发送设备toDevice
- 接收设备params
- 命令参数- Returns:
- callId
-
execute
public String execute(FromDevice fromDevice, ToDevice toDevice, Event errorEvent, Event okEvent, Map<String, Object> params) Description copied from interface:ServerCommandStrategy
执行命令(带事件)- Specified by:
execute
in interfaceServerCommandStrategy
- Parameters:
fromDevice
- 发送设备toDevice
- 接收设备errorEvent
- 错误事件okEvent
- 成功事件params
- 命令参数- Returns:
- callId
-
execute
Description copied from interface:ServerCommandStrategy
执行命令(使用请求对象)- Specified by:
execute
in interfaceServerCommandStrategy
- Parameters:
req
- 命令请求参数- Returns:
- callId
-
validateParams
参数校验- Parameters:
req
- 命令请求参数
-
buildCommandContent
构建命令内容- Parameters:
req
- 命令请求参数- Returns:
- 命令内容
-
sendCommand
发送命令- Parameters:
req
- 命令请求参数- Returns:
- callId
-
generateSn
生成随机序列号- Returns:
- 序列号
-
getDeviceId
获取设备ID- Parameters:
fromDevice
- 发送设备- Returns:
- 设备ID
-
getTargetDeviceId
获取目标设备ID- Parameters:
toDevice
- 接收设备- Returns:
- 设备ID
-