webfunds.sox
Class NymRequest

java.lang.Object
  |
  +--webfunds.sox.Encodable
        |
        +--webfunds.sox.Request
              |
              +--webfunds.sox.NymRequest

public class NymRequest
extends Request

A Request to set or notify the server of application level details pertaining to the registered key used. Could be used for identity management.

See Also:
Serialized Form

Field Summary
static java.lang.String name
           
 java.lang.String[] names
           
protected  int version
           
static int VERSION
          The version of the encoded request.
 
Fields inherited from class webfunds.sox.Request
account, REQ_not_used_yet, REQ_ORIGINAL, REQ_SUBS_ADD_V, req_version, REQ_VERSION, requestId, sig, timestamp
 
Constructor Summary
NymRequest(byte[] data)
           
NymRequest(java.io.InputStream is)
           
NymRequest(java.lang.String requestId, AccountId acc)
           
 
Method Summary
protected static void cycle()
           
 void decode(java.io.InputStream is)
          Update this request object with the values from a request encoded as a byte array (such as previously returned from the encode() method of a request object).
 void encode(java.io.OutputStream os)
          Encode a deposit request to an output stream, suitable for using with RequestPacket to send to remote servers (which use the decode() method to re-construct the object).
 boolean equals(java.lang.Object obj)
           
 Reply errorReply(int e)
          Get a Reply with Errors set.
static NymRequest example()
           
 long getFlags()
          Rather than predict what information is required, just use a big long for flags.
 java.lang.String getName()
          Returns the name of the packet as it goes on the wire.
 java.lang.String[] getNames()
          Rather than predict what information is required, just use an array of strings.
 NymReply goodReply(java.lang.String[] names, long flags)
           
protected static void input()
           
static void main(java.lang.String[] args)
           
protected static void output()
           
protected static void readWrite()
           
 Reply reconstructReply(byte[] b)
          Get the Reply returned for this request
 void setFlags(long flags)
           
 void setNames(java.lang.String[] n)
          Set the names.
 java.lang.String toString()
          Convert this object to a human readable string
 
Methods inherited from class webfunds.sox.Request
getAccountId, getRequestId, getRequestVersion, getTimestamp, getVersion, isSigned, setRequestVersion, setSignature, verify
 
Methods inherited from class webfunds.sox.Encodable
decode, encode, readByteArray, readCertificate, readProperties, readString, writeByteArray, writeCertificate, writeProperties, writeString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION

public static final int VERSION
The version of the encoded request.

version

protected int version

name

public static final java.lang.String name

names

public java.lang.String[] names
Constructor Detail

NymRequest

public NymRequest(java.lang.String requestId,
                  AccountId acc)
           throws SOXKeyException

NymRequest

public NymRequest(byte[] data)
           throws SOXPacketException

NymRequest

public NymRequest(java.io.InputStream is)
           throws SOXPacketException
Method Detail

getName

public java.lang.String getName()
Description copied from class: Request
Returns the name of the packet as it goes on the wire.
Overrides:
getName in class Request

getNames

public java.lang.String[] getNames()
Rather than predict what information is required, just use an array of strings. Some conventions: 0. short, printable PUBLISHABLE nickname 1. email address 2. minimum value of 3rd party deposits (mail) Fields can be empty (null or empty, it is the same with SOX). Any other definitions can be handled at the application layer.

setNames

public void setNames(java.lang.String[] n)
Set the names. The array is copied, and all nulls converted to empties. Note that the strings are really treated as byte arrays.

getFlags

public long getFlags()
Rather than predict what information is required, just use a big long for flags. Any definitions can be handled at the application layer.

setFlags

public void setFlags(long flags)

errorReply

public Reply errorReply(int e)
Get a Reply with Errors set.
Overrides:
errorReply in class Request
Tags copied from class: Request
Parameters:
err - is the error number to set the reply to

goodReply

public NymReply goodReply(java.lang.String[] names,
                          long flags)

reconstructReply

public Reply reconstructReply(byte[] b)
                       throws SOXPacketException
Get the Reply returned for this request
Overrides:
reconstructReply in class Request
Tags copied from class: Request
Parameters:
err - is the error number to set the reply to

encode

public void encode(java.io.OutputStream os)
            throws java.io.IOException
Description copied from class: Request
Encode a deposit request to an output stream, suitable for using with RequestPacket to send to remote servers (which use the decode() method to re-construct the object). If the signature is not present, an unsigned request will be encoded. (That is, it is sign()'s responsibility to set the sig to null in order to sign.)
Overrides:
encode in class Request
Tags copied from class: Request
Parameters:
os - the stream on which to send the output
Returns:
byte[] the request in encoded form

decode

public void decode(java.io.InputStream is)
            throws java.io.IOException,
                   SOXPacketException
Description copied from class: Request
Update this request object with the values from a request encoded as a byte array (such as previously returned from the encode() method of a request object). If the signature is not present in the encoded data, the current signature (if any) will be removed. This method is usually used by subclasses to decode the request/timestamp/sig fields.
Overrides:
decode in class Request
Tags copied from class: Request
Parameters:
is - the stream from which to read the request

toString

public java.lang.String toString()
Description copied from class: Request
Convert this object to a human readable string
Overrides:
toString in class Request

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class Request

example

public static NymRequest example()

main

public static void main(java.lang.String[] args)

cycle

protected static void cycle()
                     throws java.lang.Exception

output

protected static void output()
                      throws java.lang.Exception

readWrite

protected static void readWrite()
                         throws java.lang.Exception

input

protected static void input()
                     throws java.lang.Exception