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 StringgetDeviceId(FromDevice fromDevice) 获取设备IDprotected StringgetTargetDeviceId(ToDevice toDevice) 获取目标设备IDprotected String发送命令protected void参数校验Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
executein 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:
executein interfaceServerCommandStrategy- Parameters:
fromDevice- 发送设备toDevice- 接收设备errorEvent- 错误事件okEvent- 成功事件params- 命令参数- Returns:
- callId
-
execute
Description copied from interface:ServerCommandStrategy执行命令(使用请求对象)- Specified by:
executein 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
-