Package org.omg.CosTransactions

Examples of org.omg.CosTransactions.Current


            return;
        }

        try
        {
            Current current = OTSManager.get_current();
            System.out.println("Beginning a User transaction to withdraw from an account");
            current.begin();
            try
            {
                Account debiter = _bank.get_account(name_debit);
                debiter.debit(famount);
            }
            catch (NotExistingAccount nea)
            {
                System.out.println("The requested account does not exist!");
                current.rollback_only();
            }
            current.commit(false);
        }
        catch (Exception e)
        {
            System.err.println("ERROR - " + e);
        }
View Full Code Here


            return;
        }

        try
        {
            Current current = OTSManager.get_current();
            System.out.println("Beginning a User transaction to create account");
            current.begin();
            Account acc = _bank.create_account(name);
            System.out.println("Credit the Account");
            acc.credit(current.get_control(), fbalance);
            System.out.println("Attempt to commit the account creation transaction");
            current.commit(false);
        }
        catch (Exception e)
        {
            System.err.println("ERROR - " + e);
        }
View Full Code Here

            return;
        }

        try
        {
            Current current = OTSManager.get_current();
            System.out.println("Beginning a User transaction to get balance");
            current.begin();
            try
            {
                Account acc = _bank.get_account(name);
                System.out.println("Balance : " + acc.balance(current.get_control()));
            }
            catch (NotExistingAccount nea)
            {
                System.out.println("Account not Found");
                current.rollback_only();
            }

            current.commit(false);
        }
        catch (Exception e)
        {
            System.err.println("ERROR - " + e);
        }
View Full Code Here

        {
            System.out.println("Invalid float number, abort operation...");
            return;
        }

        Current current = null;
        try
        {
            current = OTSManager.get_current();
            System.out.println("Beginning a User transaction to Transfer money");
            current.begin();
            try
            {
                Account supplier = _bank.get_account(name_supplier);
                Account consumer = _bank.get_account(name_consumer);

                supplier.debit(current.get_control(), famount);
                consumer.credit(current.get_control(), famount);
            }
            catch (NotExistingAccount nea)
            {
                System.out.println("Account not Found");
                current.rollback_only();
            }

            current.commit(false);
        }
        catch (Exception e)
        {
            System.err.println("ERROR - " + e);
        }
View Full Code Here

            return;
        }

        try
        {
            Current current = OTSManager.get_current();
            System.out.println("Beginning a User transaction to  credit an account");
            current.begin();
            try
            {
                Account consumer = _bank.get_account(name_consumer);
                consumer.credit(current.get_control(), famount);
            }
            catch (NotExistingAccount nea)
            {
                System.out.println("The requested account does not exist!");
                current.rollback_only();
            }

            current.commit(false);
        }
        catch (Exception e)
        {
            System.err.println("ERROR - " + e);
        }
View Full Code Here

            return;
        }

        try
        {
            Current current = OTSManager.get_current();
            System.out.println("Beginning a User transaction to withdraw from an account");
            current.begin();
            try
            {
                Account debiter = _bank.get_account(name_debit);
                debiter.debit(current.get_control(), famount);
            }
            catch (NotExistingAccount nea)
            {
                System.out.println("The requested account does not exist!");
                current.rollback_only();
            }
            current.commit(false);
        }
        catch (Exception e)
        {
            System.err.println("ERROR - " + e);
        }
View Full Code Here

            return;
        }

        try
        {
            Current current = OTSManager.get_current();
            System.out.println("Beginning a User transaction to create account");
            current.begin();
            Account acc = _bank.create_account(name);
            acc.credit(fbalance);
            System.out.println("Attempt to commit the account creation transaction");
            current.commit(false);
        }
        catch (Exception e)
        {
            System.err.println("ERROR - " + e);
        }
View Full Code Here

            return;
        }

        try
        {
            Current current = OTSManager.get_current();
            System.out.println("Beginning a User transaction to get balance");
            current.begin();
            try
            {
                Account acc = _bank.get_account(name);
                System.out.println("Balance : " + acc.balance());
            }
            catch (NotExistingAccount nea)
            {
                System.out.println("Account not Found");
                current.rollback_only();
            }

            current.commit(false);
        }
        catch (Exception e)
        {
            System.err.println("ERROR - " + e);
        }
View Full Code Here

        {
            System.out.println("Invalid float number, abort operation...");
            return;
        }

        Current current = null;
        try
        {
            current = OTSManager.get_current();
            System.out.println("Beginning a User transaction to Transfer money");
            current.begin();
            try
            {
                Account supplier = _bank.get_account(name_supplier);
                Account consumer = _bank.get_account(name_consumer);

                supplier.debit(famount);
                consumer.credit(famount);
            }
            catch (NotExistingAccount nea)
            {
                System.out.println("Account not Found");
                current.rollback_only();
            }

            current.commit(false);
        }
        catch (Exception e)
        {
            System.err.println("ERROR - " + e);
        }
View Full Code Here

            return;
        }

        try
        {
            Current current = OTSManager.get_current();
            System.out.println("Beginning a User transaction to  credit an account");
            current.begin();
            try
            {
                Account consumer = _bank.get_account(name_consumer);
                consumer.credit(famount);
            }
            catch (NotExistingAccount nea)
            {
                System.out.println("The requested account does not exist!");
                current.rollback_only();
            }

            current.commit(false);
        }
        catch (Exception e)
        {
            System.err.println("ERROR - " + e);
        }
View Full Code Here

TOP

Related Classes of org.omg.CosTransactions.Current

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.