/**
   * Test the exceptions raised while accessing the member Name/Value DynAny pairs in a DynStruct
   * object.
   */
  public void testAccessStructPairsEx() {
    String msg;
    org.omg.CORBA.Any any = null;
    org.omg.CORBA.TypeCode tc = null;
    org.omg.DynamicAny.DynStruct dynAny = null;
    org.omg.DynamicAny.NameValuePair[] pairs = null;

    tc = orb.create_exception_tc(ID, NAME, MEMBERS);
    dynAny = createDynAnyFromTypeCode(tc);

    // test inserting a sequence with the wrong number of members
    pairs = new NameValuePair[1];
    any = orb.create_any();
    any.insert_char('a');
    pairs[0] = new NameValuePair("name", any);

    msg = "Failed to raise an InvalidValue exception when passing in a ";
    msg += "name/value sequence containing too many members";
    try {
      dynAny.set_members(pairs);

      fail(msg);
    } catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue ex) {
      // success
    } catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch ex) {
      fail(msg + ": " + ex);
    }
  }
 public static void insert(
     org.omg.CORBA.Any a, org.omg.PortableInterceptor.ObjectReferenceTemplate that) {
   org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
   a.type(type());
   write(out, that);
   a.read_value(out.create_input_stream(), type());
 }
Esempio n. 3
0
  public void send_request(ClientRequestInfo ri) throws ForwardRequest {
    try {
      org.omg.CORBA.Any any = ri.get_slot(slot_id);

      if (any.type().kind().value() == org.omg.CORBA.TCKind._tk_null) {
        logger.debug(
            "tid="
                + Thread.currentThread().getName()
                + ","
                + "ClientInterceptor.send_request, slot is empty");
      } else {
        logger.debug(
            "tid="
                + Thread.currentThread().getName()
                + ","
                + "ClientInterceptor.send_request, adding ServiceContext");

        ServiceContext ctx = new ServiceContext(SERVICE_ID, codec.encode(any));

        ri.add_request_service_context(ctx, false);
      }
    } catch (Exception e) {
      throw new INTERNAL("Caught " + e);
    }
  }
 public static void insert(
     org.omg.CORBA.Any a, org.omg.PortableServer.POAPackage.WrongAdapter that) {
   org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
   a.type(type());
   write(out, that);
   a.read_value(out.create_input_stream(), type());
 }
Esempio n. 5
0
  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();
    }
  }
 public static void insert(
     org.omg.CORBA.Any a, com.sun.corba.se.spi.activation.ServerAlreadyUninstalled that) {
   org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
   a.type(type());
   write(out, that);
   a.read_value(out.create_input_stream(), type());
 }
 public static void insert(
     org.omg.CORBA.Any a, org.omg.DynamicAny.DynAnyPackage.TypeMismatch that) {
   org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
   a.type(type());
   write(out, that);
   a.read_value(out.create_input_stream(), type());
 }
 public static void insert(
     org.omg.CORBA.Any a, org.omg.IOP.CodecFactoryPackage.UnknownEncoding that) {
   org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
   a.type(type());
   write(out, that);
   a.read_value(out.create_input_stream(), type());
 }
 public static void insert(
     org.omg.CORBA.Any a, br.ufes.inf.lprm.generated.PlayerEventDataWrapper that) {
   org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
   a.type(type());
   write(out, that);
   a.read_value(out.create_input_stream(), type());
 }
Esempio n. 10
0
  public void receive_reply(ClientRequestInfo ri) {
    System.out.println("[" + Thread.currentThread() + "] ClientInterceptor: receive_reply()");

    try {
      org.omg.CORBA.Any any = ri.get_slot(slot_id);

      if (any == null) {
        System.out.println("Slot null");
        throw new INTERNAL("Any slot was unexpectedly null");
      }

      String result = any.extract_string();

      if (!result.equals("This is a test AAA")) {
        throw new Exception(
            "Did not receive correct message : got <"
                + result
                + "> and expected <This is a test AAA>");
      }

      System.out.println(
          "["
              + Thread.currentThread()
              + "] ClientInterceptor: receive_reply() - get_slot() = "
              + any);
    } catch (Exception e) {
      e.printStackTrace();
      throw new INTERNAL(e.getMessage());
    }
  }
 public static void insert(
     org.omg.CORBA.Any a, br.univali.portugol.integracao.asa.NoDeclaracaoParametro that) {
   org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
   a.type(type());
   write(out, that);
   a.read_value(out.create_input_stream(), type());
 }
Esempio n. 12
0
 public static void insert(
     org.omg.CORBA.Any a, org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName that) {
   org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
   a.type(type());
   write(out, that);
   a.read_value(out.create_input_stream(), type());
 }
 public static void insert(
     org.omg.CORBA.Any a, org.omg.CosNaming.NamingContextPackage.AlreadyBound that) {
   org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
   a.type(type());
   write(out, that);
   a.read_value(out.create_input_stream(), type());
 }
 public static void insert(
     org.omg.CORBA.Any a, org.jboss.com.sun.org.omg.CORBA.ParameterDescription that) {
   org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
   a.type(type());
   write(out, that);
   a.read_value(out.create_input_stream(), type());
 }
Esempio n. 15
0
 public static void insert(
     org.omg.CORBA.Any a, com.sun.corba.se.PortableActivationIDL.Locator that) {
   org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
   a.type(type());
   write(out, that);
   a.read_value(out.create_input_stream(), type());
 }
 /**
  * Extract i_Trace from an any
  *
  * @param a an any
  * @return the extracted i_Trace value
  */
 public static org.coach.tracing.api.i_Trace extract(org.omg.CORBA.Any a) {
   if (!a.type().equal(type())) throw new org.omg.CORBA.MARSHAL();
   try {
     return org.coach.tracing.api.i_TraceHelper.narrow(a.extract_Object());
   } catch (final org.omg.CORBA.BAD_PARAM e) {
     throw new org.omg.CORBA.MARSHAL(e.getMessage());
   }
 }
 public static void insert(
     org.omg.CORBA.Any a,
     org.eclipse.persistence.sessions.remote.corba.sun.CORBARemoteSessionController that) {
   org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
   a.type(type());
   write(out, that);
   a.read_value(out.create_input_stream(), type());
 }
Esempio n. 18
0
 public static void insert(
     org.omg.CORBA.Any a,
     com.sun.corba.se.PortableActivationIDL.InitialNameServicePackage.NameAlreadyBound that) {
   org.omg.CORBA.portable.OutputStream out = a.create_output_stream();
   a.type(type());
   write(out, that);
   a.read_value(out.create_input_stream(), type());
 }
 public static ServerRunning extract(org.omg.CORBA.Any any) {
   if (any.type().equivalent(type())) return read(any.create_input_stream());
   else
     throw new org.omg.CORBA.BAD_OPERATION(
         org.apache.yoko.orb.OB.MinorCodes.describeBadOperation(
             org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch),
         org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch,
         org.omg.CORBA.CompletionStatus.COMPLETED_NO);
 }
Esempio n. 20
0
  public static Transport extract(org.omg.CORBA.Any any) {
    if (any.type().equivalent(type())) return narrow(any.extract_Object());

    throw new org.omg.CORBA.BAD_OPERATION(
        org.apache.yoko.orb.OB.MinorCodes.describeBadOperation(
            org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch),
        org.apache.yoko.orb.OB.MinorCodes.MinorTypeMismatch,
        org.omg.CORBA.CompletionStatus.COMPLETED_NO);
  }
Esempio n. 21
0
 public void version(java.lang.String value) {
   org.omg.CORBA.Request _request = this._request("_set_version");
   org.omg.CORBA.Any $value = _request.add_in_arg();
   $value.insert_string(value);
   _request.invoke();
   java.lang.Exception _exception = _request.env().exception();
   if (_exception != null) {
     throw (org.omg.CORBA.SystemException) _exception;
   }
   ;
 }
Esempio n. 22
0
 public void is_abstract(boolean value) {
   org.omg.CORBA.Request _request = this._request("_set_is_abstract");
   org.omg.CORBA.Any $value = _request.add_in_arg();
   $value.insert_boolean(value);
   _request.invoke();
   java.lang.Exception _exception = _request.env().exception();
   if (_exception != null) {
     throw (org.omg.CORBA.SystemException) _exception;
   }
   ;
 }
Esempio n. 23
0
 public void printSAS() {
   try {
     org.omg.PortableInterceptor.Current current =
         (org.omg.PortableInterceptor.Current) orb.resolve_initial_references("PICurrent");
     org.omg.CORBA.Any anyName =
         current.get_slot(org.jacorb.security.sas.SASInitializer.sasPrincipalNamePIC);
     String name = anyName.extract_string();
     System.out.println("printSAS for user " + name);
   } catch (Exception e) {
     System.out.println("printSAS Error: " + e);
   }
 }
Esempio n. 24
0
 public org.omg.CORBA.ConstantDef create_constant(
     java.lang.String id,
     java.lang.String name,
     java.lang.String version,
     org.omg.CORBA.IDLType type,
     org.omg.CORBA.Any value) {
   org.omg.CORBA.Request _request = this._request("create_constant");
   _request.set_return_type(org.omg.CORBA.ConstantDefHelper.type());
   org.omg.CORBA.Any $id = _request.add_named_in_arg("id");
   $id.insert_string(id);
   org.omg.CORBA.Any $name = _request.add_named_in_arg("name");
   $name.insert_string(name);
   org.omg.CORBA.Any $version = _request.add_named_in_arg("version");
   $version.insert_string(version);
   org.omg.CORBA.Any $type = _request.add_named_in_arg("type");
   org.omg.CORBA.IDLTypeHelper.insert($type, type);
   org.omg.CORBA.Any $value = _request.add_named_in_arg("value");
   $value.insert_any(value);
   _request.invoke();
   java.lang.Exception _exception = _request.env().exception();
   if (_exception != null) {
     if (_exception instanceof org.omg.CORBA.UnknownUserException) {
       org.omg.CORBA.UnknownUserException _userException =
           (org.omg.CORBA.UnknownUserException) _exception;
     }
     throw (org.omg.CORBA.SystemException) _exception;
   }
   ;
   org.omg.CORBA.ConstantDef _result;
   _result = org.omg.CORBA.ConstantDefHelper.extract(_request.return_value());
   return _result;
 }
Esempio n. 25
0
 public org.omg.CORBA.InterfaceDef create_interface(
     java.lang.String id,
     java.lang.String name,
     java.lang.String version,
     org.omg.CORBA.InterfaceDef[] base_interfaces,
     boolean is_abstract) {
   org.omg.CORBA.Request _request = this._request("create_interface");
   _request.set_return_type(org.omg.CORBA.InterfaceDefHelper.type());
   org.omg.CORBA.Any $id = _request.add_named_in_arg("id");
   $id.insert_string(id);
   org.omg.CORBA.Any $name = _request.add_named_in_arg("name");
   $name.insert_string(name);
   org.omg.CORBA.Any $version = _request.add_named_in_arg("version");
   $version.insert_string(version);
   org.omg.CORBA.Any $base_interfaces = _request.add_named_in_arg("base_interfaces");
   org.omg.CORBA.InterfaceDefSeqHelper.insert($base_interfaces, base_interfaces);
   org.omg.CORBA.Any $is_abstract = _request.add_named_in_arg("is_abstract");
   $is_abstract.insert_boolean(is_abstract);
   _request.invoke();
   java.lang.Exception _exception = _request.env().exception();
   if (_exception != null) {
     if (_exception instanceof org.omg.CORBA.UnknownUserException) {
       org.omg.CORBA.UnknownUserException _userException =
           (org.omg.CORBA.UnknownUserException) _exception;
     }
     throw (org.omg.CORBA.SystemException) _exception;
   }
   ;
   org.omg.CORBA.InterfaceDef _result;
   _result = org.omg.CORBA.InterfaceDefHelper.extract(_request.return_value());
   return _result;
 }
 /**
  * Extract ExceptionPretNotDeleted from an any
  *
  * @param a an any
  * @return the extracted ExceptionPretNotDeleted value
  */
 public static LivreEnLigne.ExceptionPretNotDeleted extract(org.omg.CORBA.Any a) {
   if (!a.type().equal(type())) throw new org.omg.CORBA.MARSHAL();
   if (HAS_OPENORB && a instanceof org.openorb.CORBA.Any) {
     // streamable extraction. The jdk stubs incorrectly define the Any stub
     org.openorb.CORBA.Any any = (org.openorb.CORBA.Any) a;
     try {
       org.omg.CORBA.portable.Streamable s = any.extract_Streamable();
       if (s instanceof LivreEnLigne.ExceptionPretNotDeletedHolder)
         return ((LivreEnLigne.ExceptionPretNotDeletedHolder) s).value;
     } catch (org.omg.CORBA.BAD_INV_ORDER ex) {
     }
     LivreEnLigne.ExceptionPretNotDeletedHolder h =
         new LivreEnLigne.ExceptionPretNotDeletedHolder(read(a.create_input_stream()));
     a.insert_Streamable(h);
     return h.value;
   }
   return read(a.create_input_stream());
 }
 /**
  * Extract IndexOutOfRange from an any
  *
  * @param a an any
  * @return the extracted IndexOutOfRange value
  */
 public static org.coach.tracing.api.IndexOutOfRange extract(org.omg.CORBA.Any a) {
   if (!a.type().equal(type())) throw new org.omg.CORBA.MARSHAL();
   if (HAS_OPENORB && a instanceof org.openorb.CORBA.Any) {
     // streamable extraction. The jdk stubs incorrectly define the Any stub
     org.openorb.CORBA.Any any = (org.openorb.CORBA.Any) a;
     try {
       org.omg.CORBA.portable.Streamable s = any.extract_Streamable();
       if (s instanceof org.coach.tracing.api.IndexOutOfRangeHolder)
         return ((org.coach.tracing.api.IndexOutOfRangeHolder) s).value;
     } catch (org.omg.CORBA.BAD_INV_ORDER ex) {
     }
     org.coach.tracing.api.IndexOutOfRangeHolder h =
         new org.coach.tracing.api.IndexOutOfRangeHolder(read(a.create_input_stream()));
     a.insert_Streamable(h);
     return h.value;
   }
   return read(a.create_input_stream());
 }
Esempio n. 28
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;
       }
   }
 }
Esempio n. 29
0
 public org.omg.CORBA.Contained lookup(java.lang.String search_name) {
   org.omg.CORBA.Request _request = this._request("lookup");
   _request.set_return_type(org.omg.CORBA.ContainedHelper.type());
   org.omg.CORBA.Any $search_name = _request.add_named_in_arg("search_name");
   $search_name.insert_string(search_name);
   _request.invoke();
   java.lang.Exception _exception = _request.env().exception();
   if (_exception != null) {
     if (_exception instanceof org.omg.CORBA.UnknownUserException) {
       org.omg.CORBA.UnknownUserException _userException =
           (org.omg.CORBA.UnknownUserException) _exception;
     }
     throw (org.omg.CORBA.SystemException) _exception;
   }
   ;
   org.omg.CORBA.Contained _result;
   _result = org.omg.CORBA.ContainedHelper.extract(_request.return_value());
   return _result;
 }
Esempio n. 30
0
 public boolean is_a(java.lang.String interface_id) {
   org.omg.CORBA.Request _request = this._request("is_a");
   _request.set_return_type(
       org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_boolean));
   org.omg.CORBA.Any $interface_id = _request.add_named_in_arg("interface_id");
   $interface_id.insert_string(interface_id);
   _request.invoke();
   java.lang.Exception _exception = _request.env().exception();
   if (_exception != null) {
     if (_exception instanceof org.omg.CORBA.UnknownUserException) {
       org.omg.CORBA.UnknownUserException _userException =
           (org.omg.CORBA.UnknownUserException) _exception;
     }
     throw (org.omg.CORBA.SystemException) _exception;
   }
   ;
   boolean _result;
   _result = _request.return_value().extract_boolean();
   return _result;
 }