FileDocCategorySizeDatePackage
_AccountImplBase.javaAPI DocExample3055Thu Nov 08 00:23:40 GMT 2001com.ora.rmibook.chapter23.corbaaccounts

_AccountImplBase.java

package com.ora.rmibook.chapter23.corbaaccounts;


/**
 * _AccountImplBase.java
 * Generated by the IDL-to-Java compiler (portable), version "3.0"
 * from Account.idl
 * Saturday, December 16, 2000 10:18:17 PM PST
 */

public abstract class _AccountImplBase extends org.omg.CORBA.portable.ObjectImpl
    implements Account, org.omg.CORBA.portable.InvokeHandler {

    // Constructors
    public _AccountImplBase () {
    }

    private static java.util.Hashtable _methods = new java.util.Hashtable ();
    static {
        _methods.put("getBalance", new java.lang.Integer (0));
        _methods.put("makeDeposit", new java.lang.Integer (1));
        _methods.put("makeWithdrawal", new java.lang.Integer (2));
    }

    public org.omg.CORBA.portable.OutputStream _invoke(String method,
        org.omg.CORBA.portable.InputStream in,
        org.omg.CORBA.portable.ResponseHandler rh) {
        org.omg.CORBA.portable.OutputStream out = null;
        java.lang.Integer __method = (java.lang.Integer) _methods.get(method);

        if (__method == null)
            throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);

        switch (__method.intValue()) {
        case 0:  // Account/getBalance
            {
                Money __result = null;

                __result = this.getBalance();
                out = rh.createReply();
                MoneyHelper.write(out, __result);
                break;
            }

        case 1:  // Account/makeDeposit
            {
                try {
                    Money amount = MoneyHelper.read(in);

                    this.makeDeposit(amount);
                    out = rh.createReply();
                } catch (NegativeAmountException __ex) {
                    out = rh.createExceptionReply();
                    NegativeAmountExceptionHelper.write(out, __ex);
                }
                break;
            }

        case 2:  // Account/makeWithdrawal
            {
                try {
                    Money amount = MoneyHelper.read(in);

                    this.makeWithdrawal(amount);
                    out = rh.createReply();
                } catch (NegativeAmountException __ex) {
                    out = rh.createExceptionReply();
                    NegativeAmountExceptionHelper.write(out, __ex);
                } catch (OverdraftException __ex) {
                    out = rh.createExceptionReply();
                    OverdraftExceptionHelper.write(out, __ex);
                }
                break;
            }

        default:
            throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
        }

        return out;
    } // _invoke

    // Type-specific CORBA::Object operations
    private static String[] __ids = {
            "IDL:com.ora.rmibook.chapter23.corbaaccounts/Account:1.0"};

    public String[] _ids() {
        return __ids;
    }

} // class _AccountImplBase