/*
 * JBoss, Home of Professional Open Source
 * Copyright 2006, Red Hat Middleware LLC, and individual contributors
 * as indicated by the @author tags. 
 * See the copyright.txt in the distribution for a full listing 
 * of individual contributors.
 * This copyrighted material is made available to anyone wishing to use,
 * modify, copy, or redistribute it subject to the terms and conditions
 * of the GNU Lesser General Public License, v. 2.1.
 * This program is distributed in the hope that it will be useful, but WITHOUT A
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License,
 * v.2.1 along with this distribution; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA  02110-1301, USA.
 * 
 * (C) 2005-2006,
 * @author JBoss Inc.
 */
/*
   Copyright (C) 2003, 2004
   Arjuna Technologies Limited
   Newcastle upon Tyne, UK

   $Id: Bank.idl 2342 2006-03-30 13:06:17Z  $
 */

#include <CosTransactions.idl>

module com {
    module arjuna {
        module demo {
            module jts {
                module explicitremotebank {
                    /*
                        The <CODE>Account</CODE> interface provides access to the bank accounts current state within
                        the scope of the transaction identified by the <CODE>Control</CODE> object.
                     */
                    interface Account
                    {
                        /*
                            Determine the current account balance within the scope of the transaction identified by
                            ctrl.
                         */
                        float balance(in CosTransactions::Control ctrl);

                        /*
                            Credit the account balance within the scope of the transaction "ctrl" with the amount
                            "value".
                         */
                        void credit( in CosTransactions::Control ctrl, in float value );

                        /*
                            Debit the account balance within the scope of the transaction "ctrl" with the amount
                            "value".
                         */
                        void debit( in CosTransactions::Control ctrl, in float value );
                    };

                    /*
                        If the account does not exist.
                     */
                    exception NotExistingAccount
                    { };

                    /*
                        The <CODE>Bank</CODE> object allows a user to create a bank account and to access currently
                        exisiting bank accounts.
                     */
                    interface Bank
                    {
                        /*
                            Create and return a handle on a new bank account with the name "name".
                         */
                        Account create_account( in string name );

                        /*
                            Get access to the account identified by the name "name".
                         */
                        Account get_account( in string name )
                            raises( NotExistingAccount );
                    };
                };
            };
        };
    };
};
