The bank fasl file defines three abstract servant classesBankingDemo:account-servant,BankingDemo:checkingAccount-servant, andBankingDemo:bank-servant corresponding to the IDL interfacesaccount,checkingAccount, andbank. The classBankingDemo:checkingAccount-servant is defined to inherit fromBankingDemo:account-servant, matching the inheritance relationship in the IDL.
Note that each class inherits from the abstract classPortableServer:ServantBase, allowing instances of the class to be registered with a POA.
In our implementation of the bank server, these servant classes are implemented by the subclasses
bank-implementation,account-implementation, andcheckingAccount-implementationThebank-implementation class implementsBankingDemo:bank-servant by representing a bank as a connection to a database:
(defclass bank-implementation (BankingDemo:Bank-servant) ((connection :initarg :connection) (poa :initarg :poa) (account-impls :initform nil)))
We have included thepoa slot 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. A slotop:name corresponding to the attribute name defined in the IDL is inherited from theBank-servant, as are definitions of accessor functions for this slot.
Theaccount-implementation class implementsBankingDemo:account-servant:
(defclass account-implementation (BankingDemo:Account-servant) ((bank :initarg :bank)))
An instance of this class represents an account. Thebank slot provides a connection to the database that holds the account's record. Slotsop:name andop:balance, corresponding to attributes defined in the IDL, are inherited fromaccount-servant. Thename slot identifies the record in the database.
Finally, thecheckingAccount-implementation class implementsBankingDemo:checkingAccount-servant simply by inheriting fromaccount-implementation:
(defclass checkingaccount-implementation (Bankingdemo:Checkingaccount-servant account-implementation) ())
A slotop:limit, corresponding to the attribute limit defined in the IDL, is inherited fromcheckingaccount-servant.