⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 accountpoa.java

📁 corba的java的快速开发实例
💻 JAVA
字号:
package com.hcycom.corba.example.bank;


/**
* com/hcycom/corba/example/bank/AccountPOA.java .
* 由 IDL-to-Java 编译器(可移植),版本 "3.2" 生成
* 来自 bank.idl
* 2007年4月23日 星期一 上午10时19分16秒 CST
*/

public abstract class AccountPOA extends org.omg.PortableServer.Servant
 implements com.hcycom.corba.example.bank.AccountOperations, org.omg.CORBA.portable.InvokeHandler
{

  // Constructors

  private static java.util.Hashtable _methods = new java.util.Hashtable ();
  static
  {
    _methods.put ("deposit", new java.lang.Integer (0));
    _methods.put ("withdraw", new java.lang.Integer (1));
    _methods.put ("getBalance", 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 ())
    {

  // return "success" if succeeded, "failure" otherwise
       case 0:  // bank/Account/deposit
       {
         String accountName = in.read_string ();
         int amount = in.read_long ();
         String $result = null;
         $result = this.deposit (accountName, amount);
         out = $rh.createReply();
         out.write_string ($result);
         break;
       }


  // return "success" if succeeded, "failure" otherwise
       case 1:  // bank/Account/withdraw
       {
         String accountName = in.read_string ();
         int amount = in.read_long ();
         String $result = null;
         $result = this.withdraw (accountName, amount);
         out = $rh.createReply();
         out.write_string ($result);
         break;
       }


  // return "success" if succeeded, "failure" otherwise
       case 2:  // bank/Account/getBalance
       {
         String accountName = in.read_string ();
         org.omg.CORBA.IntHolder balance = new org.omg.CORBA.IntHolder ();
         String $result = null;
         $result = this.getBalance (accountName, balance);
         out = $rh.createReply();
         out.write_string ($result);
         out.write_long (balance.value);
         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:bank/Account:1.0"};

  public String[] _all_interfaces (org.omg.PortableServer.POA poa, byte[] objectId)
  {
    return (String[])__ids.clone ();
  }

  public Account _this() 
  {
    return AccountHelper.narrow(
    super._this_object());
  }

  public Account _this(org.omg.CORBA.ORB orb) 
  {
    return AccountHelper.narrow(
    super._this_object(orb));
  }


} // class AccountPOA

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -