The Bank-Skeletons library defines three abstract servant classes:
BankingDemo<account-servant> BankingDemo/<checkingAccount-servant> BankingDemo/<bank-servant>
These classes correspond to the IDL interfaces account, checkingAccount and bank.
The class BankingDemo/<checkingAccount-servant> is defined to inherit from BankingDemo<account-servant>, matching the inheritance relationship declared in the IDL.
Each class inherits from the abstract class PortableServer/<Servant>. This allows instances of the class to be registered with a POA.
In our implementation of the bank server, these servant classes are implemented by the following concrete subclasses:
<bank-implementation> <account-implementation> <checkingAccount-implementation>
The <bank-implementation> class implements BankingDemo/<bank-servant> by representing a bank as a connection to a database:
define class <bank-implementation> (BankingDemo/<bank-servant>)
slot connection :: <connection>,
required-init-keyword: connection:;
constant slot poa :: PortableServer/<POA>,
required-init-keyword: poa:;
constant slot name :: CORBA/<string>,
required-init-keyword: name:;
end class <bank-implementation>;
The bank implementation class includes the slot poa to record the POA in which the bank servant is active, so that servants representing accounts at the bank can be registered in the same POA.
The <account-implementation> class implements BankingDemo/<account-servant>:
define class <account-implementation>
(BankingDemo/<account-servant>)
constant slot bank :: <bank-implementation>,
required-init-keyword: bank:;
constant slot name :: CORBA/<string>,
required-init-keyword: name:;
end class <account-implementation>;
An instance of this class represents an account. The bank slot provides a connection to the database that holds the account's record. The name slot identifies the record in the database.
Finally, the <checkingAccount-implementation> class implements BankingDemo/<checkingAccount-servant> simply by inheriting from <account-implementation>:
define class <checkingAccount-implementation> (<account-implementation>, BankingDemo/<checkingAccount-servant>) end class <checkingAccount-implementation>;