#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 Bank: 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();
             };	   
	};
    };
};
