|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfulmine.rpc.RpcCodec
public class RpcCodec
Standard implementation of an IRpcCodec. The encoding format in ABNF
is as follows:
ENCODED = MARKER "|" KEY ARGS
MARKER = 1*DIGIT ; the RPC marker ID
KEY = "RpcKey" (1*DIGIT) ; this is the RPC key
ARGS = 0*("|" ARG)
ARG = 1*(ALPHA / DIGIT) ; argument values sent as their string value
The character '|' is special, so the arguments are further encoded/decoded to
capture any '|' characters and replace them with '&|' (i.e. & + the HTML
escape sequence for '|')
| Constructor Summary | |
|---|---|
RpcCodec(IRpcRegistry registry)
Construct the codec with the registry. |
|
| Method Summary | |
|---|---|
QuadValue<IRpcMarker,String,String,IField[]> |
decode(byte[] rpcData)
Decode the byte[] into the RPC marker, key, identity of the
remote context invoking this RPC and arguments. |
byte[] |
encode(IRpcMarker rpcMarker,
String rpcKey,
String contextIdentity,
IField[] args)
Encode the RPC marker, key and arguments into a byte[] |
String[] |
getArgs()
Get the RPC arguments from the RPC data. |
String |
getRpcKey()
Get the RPC key from the RPC data. |
void |
setData(byte[] rpcData)
Set the RPC data to use for the getRpcKey() and
getArgs() |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RpcCodec(IRpcRegistry registry)
registry - the RPC definition registry| Method Detail |
|---|
public QuadValue<IRpcMarker,String,String,IField[]> decode(byte[] rpcData)
IRpcCodecbyte[] into the RPC marker, key, identity of the
remote context invoking this RPC and arguments. The name of the remote
context is important for updating the correct RPC result record.
decode in interface IRpcCodecrpcData - the byte[] to decode
QuasValue holding the RPC marker, key, identity of the
remote context invoking this RPC and the arguments for the
invocation, null if it cannot be decoded.
public byte[] encode(IRpcMarker rpcMarker,
String rpcKey,
String contextIdentity,
IField[] args)
IRpcCodecbyte[]
encode in interface IRpcCodecrpcMarker - the RPC marker to encoderpcKey - the RPC key to encodecontextIdentity - the identity of the context invoking the RPCargs - the arguments to encode
byte[] with the encoded RPC marker, key and
arguments.public String getRpcKey()
setData(byte[])
public String[] getArgs()
setData(byte[])
public void setData(byte[] rpcData)
getRpcKey() and
getArgs()
rpcData - the RPC data in its byte form
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||