Class ManagedPayloadCodec
java.lang.Object
org.j7m.middleware.application.distributed.ManagedPayloadCodec
Deterministic version-one data-only frames for durable invocation fingerprints and replay.
The borrowed codec and schema functions must be thread-safe and free of external effects.
References, callbacks, exceptions and control capabilities are rejected. The shared internal
engine also serves partition state, but this public facade always enforces the native12KiB cap.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intLargest binary frame whose base64 representation fits the native16KiB result field. -
Constructor Summary
ConstructorsConstructorDescriptionManagedPayloadCodec(org.j7m.middleware.codec.api.ValueCodec codec, org.j7m.middleware.codec.api.SchemaRegistry schemas) Creates a data frame codec with the native maximum frame size.ManagedPayloadCodec(org.j7m.middleware.codec.api.ValueCodec codec, org.j7m.middleware.codec.api.SchemaRegistry schemas, int maximumBytes) Creates a codec with a stricter host byte limit; all frames include their format headers. -
Method Summary
Modifier and TypeMethodDescriptionFully validates a frame and its schema allowlist before invoking the borrowed value decoder.byte[]Encodes an explicitly declared data value; maps and metadata use sorted string keys.inputHash(org.j7m.middleware.application.api.ManagedServiceContract contract, List<Class<?>> types, Object[] arguments) Fingerprints one complete method's ordered business inputs using the same canonical framing.
-
Field Details
-
MAX_FRAME_BYTES
public static final int MAX_FRAME_BYTESLargest binary frame whose base64 representation fits the native16KiB result field.- See Also:
-
-
Constructor Details
-
ManagedPayloadCodec
public ManagedPayloadCodec(org.j7m.middleware.codec.api.ValueCodec codec, org.j7m.middleware.codec.api.SchemaRegistry schemas) Creates a data frame codec with the native maximum frame size.- Parameters:
codec- borrowed thread-safe value codec; its schema functions must have no external effectsschemas- explicit allowlist, including any supported previous wire versions- Throws:
NullPointerException- if a collaborator is null
-
ManagedPayloadCodec
public ManagedPayloadCodec(org.j7m.middleware.codec.api.ValueCodec codec, org.j7m.middleware.codec.api.SchemaRegistry schemas, int maximumBytes) Creates a codec with a stricter host byte limit; all frames include their format headers. UTF16 code units are length-framed, preserving Java strings without lossy surrogate replacement.- Parameters:
codec- borrowed trusted codecschemas- explicit schema allowlistmaximumBytes- positive frame cap, at most12288 bytes- Throws:
NullPointerException- if a collaborator is nullIllegalArgumentException- if the frame cap is invalid
-
-
Method Details
-
encode
Encodes an explicitly declared data value; maps and metadata use sorted string keys.- Parameters:
value- nullable data valuetype- explicit declared Java data type, never a frame-provided class name- Returns:
- owned version-one frame, bounded by the configured cap
- Throws:
org.j7m.middleware.api.MiddlewareException- with CODEC_ERROR for unsupported types, invalid schemas or bounds
-
decode
Fully validates a frame and its schema allowlist before invoking the borrowed value decoder.- Parameters:
frame- complete version-one frame; trailing bytes are rejectedtype- explicitly trusted expected Java data type- Returns:
- decoded value, possibly null for a nullable/void result
- Throws:
org.j7m.middleware.api.MiddlewareException- with CODEC_ERROR for corruption, unsupported data or incompatible types
-
inputHash
public String inputHash(org.j7m.middleware.application.api.ManagedServiceContract contract, List<Class<?>> types, Object[] arguments) Fingerprints one complete method's ordered business inputs using the same canonical framing. No target, trace carrier, deadline, physical attempt or principal is added to the input hash; authenticated tenant/principal identity belongs to the separate durable key scope.- Parameters:
contract- stable service ID/version and full erased method identitytypes- explicit parameter classes matching the method signaturearguments- ordered values, including a declared business key parameter when present- Returns:
- lowercase SHA-256 digest of version-one canonical business input bytes
- Throws:
org.j7m.middleware.api.MiddlewareException- with CODEC_ERROR for a signature mismatch or unsupported/bounded input
-