#include <CosTransactions.idl>
#include <CosConcurrencyControl.idl>

module demo {
   module bank {
      module concurrency {
         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 {
            float get_balance( in CosTransactions::Control control_ );

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

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