コード例 #1
0
ファイル: AccountManagerImpl.java プロジェクト: mberionni/uni
  public void invoke(
      org.omg.CORBA.ServerRequest request) { // Ensure that the operation name is correct
    System.out.println("invocato metodo " + request.operation() + " in AccounManagerImpl");
    Float balance;
    String name = new String(_object_id());

    if (request.operation().equals("open")) {
      org.omg.CORBA.NVList params = orb.create_list(1);
      org.omg.CORBA.Any any = orb.create_any();
      any.insert_string(new String(""));
      params.add_value("nomeFile", any, org.omg.CORBA.ARG_IN.value);
      request.arguments(params);
      try {
        name = params.item(0).value().extract_string();
      } catch (Exception e) {
        System.out.println("ERRORE:");
        e.printStackTrace();
      }
      // Invoke the actual implementation and fill out the result
      org.omg.CORBA.Object account = open(name);
      org.omg.CORBA.Any result = orb.create_any();
      result.insert_Object(account);
      request.set_result(result);
    } else {
      System.out.println("Errore nell'ivocazione dinamica del metodo open");
      throw new org.omg.CORBA.BAD_PARAM();
    }
  }
コード例 #2
0
 public void invoke(org.omg.CORBA.ServerRequest _request) {
   java.lang.Object _method = _methods.get(_request.operation());
   if (_method == null) {
     throw new org.omg.CORBA.BAD_OPERATION(_request.operation());
   }
   int _method_id = ((java.lang.Integer) _method).intValue();
   switch (_method_id) {
     case 0:
       {
         org.omg.CORBA.NVList _params = _orb().create_list(0);
         _request.arguments(_params);
         java.lang.String _result = this.sayHello();
         org.omg.CORBA.Any _resultAny = _orb().create_any();
         _resultAny.insert_string(_result);
         _request.set_result(_resultAny);
         return;
       }
   }
 }
コード例 #3
0
 // DSI Dispatch call
 public void invoke(org.omg.CORBA.ServerRequest r) {
   switch (((java.lang.Integer) _methods.get(r.op_name())).intValue()) {
     case 0: // kxml.util.remote.RemoteObservable.deleteObserver
       {
         org.omg.CORBA.NVList _list = _orb().create_list(0);
         org.omg.CORBA.Any _observer = _orb().create_any();
         _observer.type(kxml.util.remote.RemoteObserverHelper.type());
         _list.add_value("observer", _observer, org.omg.CORBA.ARG_IN.value);
         r.params(_list);
         kxml.util.remote.RemoteObserver observer;
         observer = kxml.util.remote.RemoteObserverHelper.extract(_observer);
         this.deleteObserver(observer);
         org.omg.CORBA.Any __return = _orb().create_any();
         __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
         r.result(__return);
       }
       break;
     case 1: // kxml.util.remote.RemoteObservable.addObserver
       {
         org.omg.CORBA.NVList _list = _orb().create_list(0);
         org.omg.CORBA.Any _observer = _orb().create_any();
         _observer.type(kxml.util.remote.RemoteObserverHelper.type());
         _list.add_value("observer", _observer, org.omg.CORBA.ARG_IN.value);
         r.params(_list);
         kxml.util.remote.RemoteObserver observer;
         observer = kxml.util.remote.RemoteObserverHelper.extract(_observer);
         this.addObserver(observer);
         org.omg.CORBA.Any __return = _orb().create_any();
         __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
         r.result(__return);
       }
       break;
     default:
       throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
   }
 }