Files
msgexchange-v2/src/main/kotlin/com/gzzn/omms/msgexchange/codec/XmlCodec.kt
T

25 lines
943 B
Kotlin
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.gzzn.omms.msgexchange.codec
import com.gzzn.omms.msgexchange.domain.DecodedMessage
import com.gzzn.omms.msgexchange.domain.ErrorClass
/**
* ACMA-8 流程 2:解码失败分类(矩阵/状态机:MALFORMED 不重试;CODEC_ERROR 可一键重放)。
*/
data class DecodeFailure(val errorClass: ErrorClass, val detail: String)
sealed interface DecodeResult {
data class Ok(val message: DecodedMessage) : DecodeResult
data class Err(val failure: DecodeFailure) : DecodeResult
}
/**
* XML codecXXE 防护(禁 DTD/外部实体);阶段 1 先 vendor 复用 legacy entity/msg POJO +
* jackson-dataformat-xml + JaxbAnnotationIntrospector(现役已验证组合,ACMA-6 选型)。
* TODO(阶段1后续): vendor POJO 引入与 BDPB workaround 配置化(golden 固化)。
*/
interface XmlCodec {
fun decode(rawXml: String): DecodeResult
fun encodeRqrd(kind: String, rangeJson: String): String
}