#include <CosTransactions.idl>

module demo
{
   module bank
   {
      module transaction
      {
         module explicit
         {
            exception InsufficientFunds{};

            interface Account;

            interface AccountManager {
               Account open(in string name, in float initial_deposit);
            };

            interface TheBank: AccountManager {
               void transfer( in Account source,
                              in Account destination,
                              in float amount )
                  raises( InsufficientFunds );
            };

            interface Account :
               CosTransactions::Resource,
            CosTransactions::TransactionalObject
            {
               readonly attribute float balance;

               void credit( in float amount,
                            in CosTransactions::Control control_ );

               void debit( in float amount,
                           in CosTransactions::Control control_ )
               raises( InsufficientFunds );
            };
         };
      };
   };
};
