|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.elkoserver.foundation.actor.BasicProtocolHandler
org.elkoserver.server.context.AdminObject
org.elkoserver.server.workshop.bank.client.BankClient
public class BankClient
Internal object that acts as a client for the external 'bank' service.
| Nested Class Summary | |
|---|---|
static class |
BankClient.AccountDesc
A struct describing an account, returned as part of the results from query accounts. |
static class |
BankClient.AccountResultHandler
Result handler class for requests that return an account ref (delete account, freeze account, and unfreeze account). |
static class |
BankClient.AccountsResultHandler
Result handler class for requests that return an array of account refs (make accounts). |
static class |
BankClient.BalanceResultHandler
Result handler class for requests that affect an account balance (mint, unmint, and unmintEncmbrance). |
static class |
BankClient.BankReplyHandler
Base class for request-specific handlers for replies from the bank. |
static class |
BankClient.CurrencyResultHandler
Result handler class for the make currency request. |
static class |
BankClient.EncumberResultHandler
Result handler class for the encumber request. |
static class |
BankClient.EncumbranceDesc
A struct describing an encumbrance, returned as part of the results from query accounts. |
static class |
BankClient.KeyResultHandler
Result handler class for request that return a key (cancel key, duplicate key, issue root key, and make key). |
static class |
BankClient.QueryAccountsResultHandler
Result handler class for the query account request. |
static class |
BankClient.QueryCurrenciesResultHandler
Result handler class for the query currencies request. |
static class |
BankClient.QueryEncumbranceResultHandler
Result handler class for the query encumbrance request. |
static class |
BankClient.ReleaseResultHandler
Result handler class for the release request. |
static class |
BankClient.TransferResultHandler
Result handler class for transfer requests (transfer and transferEncumbrance). |
| Constructor Summary | |
|---|---|
BankClient(String serviceName)
Constructor. |
|
| Method Summary | |
|---|---|
void |
activate(String ref,
Contextor contextor)
Make this object live inside the context server. |
void |
cancelkey(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optCancel)
JSON message handler for the response to a cancel key request. |
void |
cancelKey(String key,
String memo,
String cancel,
BankClient.KeyResultHandler resultHandler)
Cancel an authorization key. |
void |
deleteaccount(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optAccount)
JSON message handler for the response to a delete account request. |
void |
deleteAccount(String key,
String memo,
String account,
BankClient.AccountResultHandler resultHandler)
Delete an account. |
void |
dupkey(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optNewkey)
JSON message handler for the response to a duplicate key request. |
void |
dupKey(String key,
String memo,
String expires,
BankClient.KeyResultHandler resultHandler)
Duplicate an authorization key. |
void |
encumber(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optEnc,
OptInteger optSrcbal)
JSON message handler for the response to an encumber request. |
void |
encumber(String key,
String memo,
String src,
int amount,
long expiration,
BankClient.EncumberResultHandler resultHandler)
Encumber an account, i.e., provisionally reserve funds for a fuure transaction. |
void |
freezeaccount(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optAccount)
JSON message handler for the response to a freeze account request. |
void |
freezeAccount(String key,
String memo,
String account,
BankClient.AccountResultHandler resultHandler)
Freeze an account, rendering it temporarily unable to participate in transactions. |
void |
issueRootKey(BankClient.KeyResultHandler resultHandler)
Obtain the bank's root key, if nobody yet has it. |
void |
issuerootkey(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optRootkey)
JSON message handler for the response to an issue root key request. |
void |
makeaccounts(ServiceActor from,
String xid,
OptString fail,
OptString desc,
String[] accounts)
JSON message handler for the response to a make account request. |
void |
makeAccounts(String key,
String memo,
String[] currencies,
String owner,
BankClient.AccountsResultHandler resultHandler)
Create a set of new accounts. |
void |
makecurrency(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optCurrency)
JSON message handler for the response to a make currency request. |
void |
makeCurrency(String key,
String memo,
String currency,
BankClient.CurrencyResultHandler resultHandler)
Create a new currency. |
void |
makekey(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optNewkey)
JSON message handler for the response to a make key request. |
void |
makeKey(String key,
String memo,
String type,
String currency,
String expires,
BankClient.KeyResultHandler resultHandler)
Create a new authorization key. |
void |
mint(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optDst,
OptInteger optDstbal)
JSON message handler for the response to a mint request. |
void |
mint(String key,
String memo,
String dst,
int amount,
BankClient.BalanceResultHandler resultHandler)
Create money into an accont. |
void |
queryaccounts(ServiceActor from,
String xid,
OptString fail,
OptString desc,
BankClient.AccountDesc[] accounts)
JSON message handler for the response to a query account request. |
void |
queryAccounts(String key,
String memo,
String[] accounts,
boolean encs,
BankClient.QueryAccountsResultHandler resultHandler)
Get information about an account. |
void |
querycurrencies(ServiceActor from,
String xid,
OptString fail,
OptString desc,
Currency[] currencies)
JSON message handler for the response to a query currencies request. |
void |
queryCurrencies(String key,
String memo,
BankClient.QueryCurrenciesResultHandler resultHandler)
Get information about extant currencies. |
void |
queryenc(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optEnc,
OptString optCurr,
OptString optAccount,
OptInteger optAmount,
OptString optExpires,
OptString optMemo)
JSON message handler for the response to a query encumbrance request. |
void |
queryEncumbrance(String key,
String memo,
String enc,
BankClient.QueryEncumbranceResultHandler resultHandler)
Get information about an encumbrance. |
void |
releaseenc(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optSrc,
OptInteger optSrcbal,
OptBoolean optActive)
JSON message handler for the response to a release encumbrance request. |
void |
releaseEncumbrance(String key,
String memo,
String enc,
BankClient.ReleaseResultHandler resultHandler)
Release a previous encumbrance on an account. |
void |
run(Object obj)
Callback that is invoked when the service connection is established or fails to be established. |
String |
status()
Get the current status of the connection to the external service. |
void |
transfer(String key,
String memo,
String src,
String dst,
int amount,
BankClient.TransferResultHandler resultHandler)
Transfer money from one account to another. |
void |
transferEncumbrance(String key,
String memo,
String enc,
String dst,
BankClient.TransferResultHandler resultHandler)
Transfer encumbered funds into another account. |
void |
unfreezeaccount(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optAccount)
JSON message handler for the response to an unfreeze account request. |
void |
unfreezeAccount(String key,
String memo,
String account,
BankClient.AccountResultHandler resultHandler)
Unfreeze an account, rendering it once again able to participate in transactions. |
void |
unmint(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optSrc,
OptInteger optSrcbal)
JSON message handler for the response to an unmint request. |
void |
unmint(String key,
String memo,
String src,
int amount,
BankClient.BalanceResultHandler resultHandler)
Destroy money from an account. |
void |
unmintenc(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optSrc,
OptInteger optSrcbal)
JSON message handler for the response to an unmint encumbrance request. |
void |
unmintEncumbrance(String key,
String memo,
String enc,
BankClient.BalanceResultHandler resultHandler)
Destroy encumbered funds. |
void |
xfer(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optSrc,
OptInteger optSrcbal,
OptString optDst,
OptInteger optDstbal)
JSON message handler for the response to a transfer request. |
void |
xferenc(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optSrc,
OptInteger optSrcbal,
OptString optDst,
OptInteger optDstbal)
JSON message handler for the response to a transfer encumbrance request. |
| Methods inherited from class org.elkoserver.server.context.AdminObject |
|---|
contextor, ref |
| Methods inherited from class org.elkoserver.foundation.actor.BasicProtocolHandler |
|---|
auth, debug, disconnect, ping, pong |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
@JSONMethod(value="servicename") public BankClient(String serviceName)
| Method Detail |
|---|
public void activate(String ref,
Contextor contextor)
activate in interface InternalObjectactivate in class AdminObjectref - Reference string identifying this object in the static
object table.contextor - The contextor for this server.public void run(Object obj)
run in interface ArgRunnableobj - The connection to the bank service, or null if connection
setup failed.public String status()
public void cancelKey(String key,
String memo,
String cancel,
BankClient.KeyResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.cancel - Ref of key to be cancelled.resultHandler - Callback to be invoked on the result.
public void deleteAccount(String key,
String memo,
String account,
BankClient.AccountResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.account - Ref of account to be deleted.resultHandler - Callback to be invoked on the result.
public void dupKey(String key,
String memo,
String expires,
BankClient.KeyResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.expires - Expiration time for the new key.resultHandler - Callback to be invoked on the result.
public void encumber(String key,
String memo,
String src,
int amount,
long expiration,
BankClient.EncumberResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.src - Ref of account to be encumbered.amount - Quantity of funds to encumber.expiration - Expiration time for encumbrance.resultHandler - Callback to be invoked on the result.
public void freezeAccount(String key,
String memo,
String account,
BankClient.AccountResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.account - Ref of account to be frozen.resultHandler - Callback to be invoked on the result.public void issueRootKey(BankClient.KeyResultHandler resultHandler)
resultHandler - Callback to be invoked on the result.
public void makeAccounts(String key,
String memo,
String[] currencies,
String owner,
BankClient.AccountsResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.currencies - Currencies in which the new accounts will be
denominated.owner - Ref of the account owner.resultHandler - Callback to be invoked on the result.
public void makeCurrency(String key,
String memo,
String currency,
BankClient.CurrencyResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.currency - Name for the new currency.resultHandler - Callback to be invoked on the result.
public void makeKey(String key,
String memo,
String type,
String currency,
String expires,
BankClient.KeyResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.type - Type of authorization new key should grant.currency - Optioal name of currency scoping new key's authority,
or null.expires - Expiration time for the new key.resultHandler - Callback to be invoked on the result.
public void mint(String key,
String memo,
String dst,
int amount,
BankClient.BalanceResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.dst - Ref of account to receive the funds.amount - Quantity of money to create.resultHandler - Callback to be invoked on the result.
public void queryAccounts(String key,
String memo,
String[] accounts,
boolean encs,
BankClient.QueryAccountsResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.account - Ref of the account being queried.encs - Flag that is true if the results should also include
information about extant encumbrances on the account.resultHandler - Callback to be invoked on the result.
public void queryCurrencies(String key,
String memo,
BankClient.QueryCurrenciesResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.resultHandler - Callback to be invoked on the result.
public void queryEncumbrance(String key,
String memo,
String enc,
BankClient.QueryEncumbranceResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.enc - Ref of the enumbrance being queried.resultHandler - Callback to be invoked on the result.
public void releaseEncumbrance(String key,
String memo,
String enc,
BankClient.ReleaseResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.enc - Ref of the encumbrance to be releasedresultHandler - Callback to be invoked on the result.
public void transfer(String key,
String memo,
String src,
String dst,
int amount,
BankClient.TransferResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.src - Ref of source account.dst - Ref of destination account.amount - Quantity of funds to transfer.resultHandler - Callback to be invoked on the result.
public void transferEncumbrance(String key,
String memo,
String enc,
String dst,
BankClient.TransferResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.enc - Encumbrance that is the source of funds.dst - Ref of destination account.resultHandler - Callback to be invoked on the result.
public void unfreezeAccount(String key,
String memo,
String account,
BankClient.AccountResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotation.account - Ref of account to be frozen.resultHandler - Callback to be invoked on the result.
public void unmint(String key,
String memo,
String src,
int amount,
BankClient.BalanceResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotationsrc - Ref of account to lose the funds.amount - Quantity of money to destroy.resultHandler - Callback to be invoked on the result.
public void unmintEncumbrance(String key,
String memo,
String enc,
BankClient.BalanceResultHandler resultHandler)
key - Authorizing key.memo - Transaction annotationsrc - Ref of encumbrance that reserves the funds to be destroyed.resultHandler - Callback to be invoked on the result.
@JSONMethod(value={"xid","fail","desc","cancel"})
public void cancelkey(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optCancel)
@JSONMethod(value={"xid","fail","desc","account"})
public void deleteaccount(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optAccount)
@JSONMethod(value={"xid","fail","desc","newkey"})
public void dupkey(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optNewkey)
@JSONMethod(value={"xid","fail","desc","enc","srcbal"})
public void encumber(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optEnc,
OptInteger optSrcbal)
@JSONMethod(value={"xid","fail","desc","account"})
public void freezeaccount(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optAccount)
@JSONMethod(value={"xid","fail","desc","rootkey"})
public void issuerootkey(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optRootkey)
@JSONMethod(value={"xid","fail","desc","?accounts"})
public void makeaccounts(ServiceActor from,
String xid,
OptString fail,
OptString desc,
String[] accounts)
@JSONMethod(value={"xid","fail","desc","currency"})
public void makecurrency(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optCurrency)
@JSONMethod(value={"xid","fail","desc","newkey"})
public void makekey(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optNewkey)
@JSONMethod(value={"xid","fail","desc","dst","dstbal"})
public void mint(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optDst,
OptInteger optDstbal)
@JSONMethod(value={"xid","fail","desc","?accounts"})
public void queryaccounts(ServiceActor from,
String xid,
OptString fail,
OptString desc,
BankClient.AccountDesc[] accounts)
@JSONMethod(value={"xid","fail","desc","?currencies"})
public void querycurrencies(ServiceActor from,
String xid,
OptString fail,
OptString desc,
Currency[] currencies)
@JSONMethod(value={"xid","fail","desc","enc","curr","account","amount","expires","memo"})
public void queryenc(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optEnc,
OptString optCurr,
OptString optAccount,
OptInteger optAmount,
OptString optExpires,
OptString optMemo)
@JSONMethod(value={"xid","fail","desc","src","srcbal","active"})
public void releaseenc(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optSrc,
OptInteger optSrcbal,
OptBoolean optActive)
@JSONMethod(value={"xid","fail","desc","account"})
public void unfreezeaccount(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optAccount)
@JSONMethod(value={"xid","fail","desc","src","srcbal"})
public void unmint(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optSrc,
OptInteger optSrcbal)
@JSONMethod(value={"xid","fail","desc","src","srcbal"})
public void unmintenc(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optSrc,
OptInteger optSrcbal)
@JSONMethod(value={"xid","fail","desc","src","srcbal","dst","dstbal"})
public void xfer(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optSrc,
OptInteger optSrcbal,
OptString optDst,
OptInteger optDstbal)
@JSONMethod(value={"xid","fail","desc","src","srcbal","dst","dstbal"})
public void xferenc(ServiceActor from,
String xid,
OptString fail,
OptString desc,
OptString optSrc,
OptInteger optSrcbal,
OptString optDst,
OptInteger optDstbal)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||