webfunds.sox
Class RegisterRequest

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

public class RegisterRequest
extends Request

A Request class that registers a client key with an issuer, by means of the "Register" request

See Also:
Serialized Form

Field Summary
protected  AccountId id
           
protected  java.security.PublicKey key
           
static java.lang.String name
           
protected  int version
           
static int VERSION
          The version of the encoded register 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
RegisterRequest(byte[] data)
           
RegisterRequest(java.io.InputStream is)
           
RegisterRequest(java.lang.String requestId, AccountId acc, java.security.PublicKey key)
           
 
Method Summary
 AccountId accountId()
           
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 RegisterRequest example()
           
 java.lang.String getName()
          Returns the name of the packet as it goes on the wire.
 RegisterReply goodReply(AccountId id)
           
 void init(java.security.PublicKey key)
           
protected static void input()
           
static void main(java.lang.String[] args)
           
protected static void output()
           
 java.security.PublicKey publicKey()
          Get the key from this request
protected static void readWrite()
           
 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, reconstructReply, 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 register request. Originally, in Request.VERSION == 2, there were no local versions. We'll call that VERS == 1.

version

protected int version

name

public static final java.lang.String name

key

protected java.security.PublicKey key

id

protected AccountId id
Constructor Detail

RegisterRequest

public RegisterRequest(java.lang.String requestId,
                       AccountId acc,
                       java.security.PublicKey key)
                throws SOXKeyException

RegisterRequest

public RegisterRequest(byte[] data)
                throws SOXPacketException

RegisterRequest

public RegisterRequest(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

publicKey

public java.security.PublicKey publicKey()
Get the key from this request
Returns:
a public key

accountId

public AccountId accountId()

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 RegisterReply goodReply(AccountId id)

init

public void init(java.security.PublicKey key)
          throws SOXKeyException

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 RegisterRequest 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