Coalevo Logo

net.coalevo.bank.service
Interface BankService

All Superinterfaces:
Identifiable, Maintainable, Service

public interface BankService
extends Service, Maintainable

Defines the interface of the bank service.

Version:
1.0.0 (10/02/2009)
Author:
Dieter Wimberger (wimpi)

Field Summary
 
Fields inherited from interface net.coalevo.foundation.model.Maintainable
DO_MAINTENANCE
 
Method Summary
 void closeAccount(Agent caller, AgentIdentifier aid)
          Closes an existing Account.
 void deposit(Agent caller, AgentIdentifier to, long sum)
          Deposits a specific sum to a specified account.
 boolean existsAccount(Agent caller, AgentIdentifier aid)
          Tests if there is an Account bound to a specified agent.
 long getAccountBalance(Agent caller, AgentIdentifier aid)
          Returns the account balance for an existing Account.
 AccountStats getAccountStats(Agent caller)
          Returns summary AccountStats for all Account instances.
 void openAccount(Agent caller, AgentIdentifier aid)
          Opens a new Account bound to a specified agent.
 long retrieve(Agent caller, AgentIdentifier to, long sum)
          Retrieves the specified sum from the given account.
 long transfer(Agent caller, AgentIdentifier from, AgentIdentifier to, long sum)
          Transfer between two accounts.
 
Methods inherited from interface net.coalevo.foundation.model.Service
activate, deactivate, getActions
 
Methods inherited from interface net.coalevo.foundation.model.Identifiable
getIdentifier
 
Methods inherited from interface net.coalevo.foundation.model.Maintainable
doMaintenance
 

Method Detail

existsAccount

boolean existsAccount(Agent caller,
                      AgentIdentifier aid)
                      throws java.lang.SecurityException,
                             BankServiceException
Tests if there is an Account bound to a specified agent.

Parameters:
caller - the requesting Agent.
aid - the identifier of the agent the new account should be bound to.
Returns:
true if account exists, false otherwise.
Throws:
java.lang.SecurityException - if the calling Agent is not authentic or not authorized.
BankServiceException - if an error occurs while executing this action.

openAccount

void openAccount(Agent caller,
                 AgentIdentifier aid)
                 throws java.lang.SecurityException,
                        BankServiceException
Opens a new Account bound to a specified agent.

Parameters:
caller - the requesting Agent.
aid - the identifier of the agent the new account should be bound to.
Throws:
java.lang.SecurityException - if the calling Agent is not authentic or not authorized.
BankServiceException - if an error occurs while executing this action.

closeAccount

void closeAccount(Agent caller,
                  AgentIdentifier aid)
                  throws java.lang.SecurityException,
                         BankServiceException
Closes an existing Account.

Parameters:
caller - the requesting Agent.
aid - the identifier of the agent the new account is bound to.
Throws:
java.lang.SecurityException - if the calling Agent is not authentic or not authorized.
BankServiceException - if an error occurs while executing this action.

getAccountBalance

long getAccountBalance(Agent caller,
                       AgentIdentifier aid)
                       throws java.lang.SecurityException,
                              BankServiceException
Returns the account balance for an existing Account.

Parameters:
caller - the requesting Agent.
aid - the identifier of the agent the new account is bound to.
Returns:
the balance of the specified account.
Throws:
java.lang.SecurityException - if the calling Agent is not authentic or not authorized.
BankServiceException - if an error occurs while executing this action.

transfer

long transfer(Agent caller,
              AgentIdentifier from,
              AgentIdentifier to,
              long sum)
              throws java.lang.SecurityException,
                     BankServiceException
Transfer between two accounts.

Parameters:
caller - the requesting Agent.
from - the identifier of the agent the paying account is bound to.
to - the identifier of the agent the receiving account is bound to.
sum - the sum to be transferred.
Returns:
the amount of money transferred.
Throws:
java.lang.SecurityException - if the calling Agent is not authentic or not authorized.
BankServiceException - if an error occurs while executing this action.

deposit

void deposit(Agent caller,
             AgentIdentifier to,
             long sum)
             throws java.lang.SecurityException,
                    BankServiceException
Deposits a specific sum to a specified account.

Note: At the moment this are means to generate "money". There is no real economic model behind this, given that there is no account where the money is coming from. The method should be guarded by a security policy.

Parameters:
caller - the requesting Agent.
to - the identifier of the agent the receiving account is bound to.
sum - the sum to be awarded.
Throws:
java.lang.SecurityException - if the calling Agent is not authentic or not authorized.
BankServiceException - if an error occurs while executing this action.

retrieve

long retrieve(Agent caller,
              AgentIdentifier to,
              long sum)
              throws java.lang.SecurityException,
                     BankServiceException
Retrieves the specified sum from the given account.

This method should be guarded by a security policy.

Parameters:
caller - the requesting Agent.
to - the identifier of the agent the receiving account is bound to.
sum - the sum to be awarded.
Returns:
the amount retrieved.
Throws:
java.lang.SecurityException - if the calling Agent is not authentic or not authorized.
BankServiceException - if an error occurs while executing this action.

getAccountStats

AccountStats getAccountStats(Agent caller)
                             throws java.lang.SecurityException,
                                    BankServiceException
Returns summary AccountStats for all Account instances.

Parameters:
caller - the requesting Agent.
Returns:
a List of identifier strings.
Throws:
java.lang.SecurityException - if the calling Agent is not authentic or not authorized.
BankServiceException - if an error occurs while executing this action.

Coalevo Logo

(c) 2004-2009 VFI (http://www.vfi.or.at)