Examples of NVList


Examples of org.omg.CORBA.NVList

    //
    // 8.3.1: "Unless it calls set_exception, the DIR must call arguments
    // exactly once, even if the operation signature contains no
    // parameters."
    //
    NVList list = orb_.create_list(0);
    request.arguments(list);

    org.omg.CORBA.Object currentObj = null;
    try
      {
View Full Code Here

Examples of org.omg.CORBA.NVList

  {
    String name = request.operation();

    if (name.equals("aMethod"))
      {
        NVList list = orb_.create_list(0);
        request.arguments(list);

        if (compare_)
          {
            byte[] oid = null;
            try
              {
                oid = current_.get_object_id();
              }
            catch (org.omg.PortableServer.CurrentPackage.NoContext ex)
              {
                throw new RuntimeException();
              }

            String oidString = new String(oid);

            TEST(oidString.equals(name_));
          }

        return;
      }

    System.err.println("DSI implementation: unknown operation: " + name);

    NVList list = orb_.create_list(0);
    request.arguments(list);

    Any exAny = orb_.create_any();
    exAny.insert_Streamable(new BAD_OPERATIONHolder(new BAD_OPERATION()));
View Full Code Here

Examples of org.omg.CORBA.NVList

    r.add_in_arg().insert_long(2);
    r.add_inout_arg().insert_short((short) 3);
    r.add_inout_arg().insert_string("[string 4]");
    r.add_out_arg().type(orb.get_primitive_tc(TCKind.tk_double));

    NVList para = r.arguments();

    try
      {
        assertEquals("octet", para.item(0).value().extract_octet(), 0);
        assertEquals("long (in parameter)",
                     para.item(1).value().extract_long(), 2
                    );
        assertEquals("short", para.item(2).value().extract_short(), 3);
        assertEquals("string", para.item(3).value().extract_string(),
                     "[string 4]"
                    );
      }
    catch (Exception ex)
      {
        fail("Unexpected " + ex.getClass().getName() + ":" + ex.getMessage());
      }

    // For the last parameter, the value is not set.
    r.set_return_type(orb.get_primitive_tc(TCKind.tk_long));

    r.invoke();

    assertEquals("Returned value", r.result().value().extract_long(), 452572);

    para = r.arguments();

    try
      {
        assertEquals("octet", para.item(0).value().extract_octet(), 1);
        assertEquals("long (in parameter)",
                     para.item(1).value().extract_long(), 2
                    );
        assertEquals("short", para.item(2).value().extract_short(), 4);
        assertEquals("string", para.item(3).value().extract_string(),
                     "[string 4] [return]"
                    );
        assertEquals("double", para.item(4).value().extract_double(), 1.0,
                     Double.MIN_VALUE
                    );
      }
    catch (Exception ex)
      {
View Full Code Here

Examples of org.omg.CORBA.NVList

            // if blank makes it as a global scope.
            // The second parameter is op_flags which is set to RESTRICT_SCOPE
            // As there is only one defined in the spec.
            // The Third param is the pattern which is '*' requiring it to
            // get all the contexts.
            NVList nvList = ctx.get_values( "", CTX_RESTRICT_SCOPE.value,"*" );
            String[] context = new String[(nvList.count() * 2) ];
            if( ( nvList != null ) &&( nvList.count() != 0 ) ) {
                // The String[] array will contain Name and Value for each
                // context and hence double the size in the array.
                int index = 0;
                for( int i = 0; i < nvList.count(); i++ ) {
                    NamedValue nv;
                    try {
                        nv = nvList.item( i );
                    }
                    catch (Exception e ) {
                        return (String[]) null;
                    }
                    context[index] = nv.name();
View Full Code Here

Examples of org.omg.CORBA.NVList

        }
        return result;
    }

    public static NVList nvListFromStreamables(ORB orb, CorbaStreamable[] streamables) {
        NVList list = null;
        if (streamables != null && streamables.length > 0) {
            list = orb.create_list(streamables.length);
            for (int i = 0; i < streamables.length; ++i) {
                Any value = orb.create_any();
                value.insert_Streamable(streamables[i]);
                list.add_value(streamables[i].getName(), value, streamables[i].getMode());
            }
        } else {
            list = orb.create_list(0);
        }
        return list;
View Full Code Here

Examples of org.omg.CORBA.NVList

                ((CorbaBindingImpl)serverBinding.getBindingImpl()).getCorbaTypeMaps();

            // Build a list of streamables that correspond to the values that should be contained in the
            // argument list of the ServerRequest, build the correct NVList and retreive the arguments
            CorbaStreamable[] arguments = new CorbaStreamable[paramTypes.size()];
            NVList list = prepareDIIArgsList(corbaCtx, objectCtx, arguments, paramTypes, typeMaps, callback);
            request.arguments(list);

            serverBinding.getBindingImpl().unmarshal(corbaCtx, objectCtx, callback);

            boolean isOneWay = callback.isOneWay();
            doCeltixInvocation(callback, objectCtx);

            corbaCtx.put(ObjectMessageContext.MESSAGE_INPUT, Boolean.FALSE);
            if (!isOneWay) {
                if (objectCtx.getException() != null) {
                    serverBinding.getBindingImpl().marshalFault(objectCtx, corbaCtx, callback);
                    Any exAny = orb.create_any();
                    exAny.insert_Streamable(corbaCtx.getMessage().getStreamableException());
                    request.set_exception(exAny);
                } else {
                    serverBinding.getBindingImpl().marshal(objectCtx, corbaCtx, callback);

                    arguments = corbaCtx.getMessage().getStreamableArguments();
                    for (int i = 0; i < arguments.length; ++i) {
                        if (list.item(i).flags() != org.omg.CORBA.ARG_IN.value) {
                            list.item(i).value().insert_Streamable(arguments[i]);
                        }
                    }

                    CorbaStreamable resultValue = corbaCtx.getMessage().getStreamableReturn();
                    if (resultValue != null) {
View Full Code Here

Examples of org.omg.CORBA.NVList

    }
   
    public NVList prepareDIIArgsList(CorbaMessageContext corbaCtx, ObjectMessageContext objContext,
                                     CorbaStreamable[] streamables, List<ParamType> params, 
                                     List<CorbaTypeMap> typeMaps, DataBindingCallback callback) {
        NVList list = orb.create_list(streamables.length);

        // We need to check to see if Celtix is using the return type of the operation as the method for
        // passing back the value of a CORBA out parameter.
        Object[] args = objContext.getMessageObjects();
        boolean hasOutParamReturn = false;
        if (args != null) {
            hasOutParamReturn = params.size() != args.length;
        } else {
            hasOutParamReturn = params.size() > 0;
        }
       
        int paramOffset = 0;
        int cbParamCount = 0;
        for (Iterator<ParamType> iter = params.iterator(); iter.hasNext();) {
            int index = cbParamCount + paramOffset;
            ParamType pType = iter.next();
            QName paramName = null;
            if (pType.getMode().equals(ModeType.OUT) && hasOutParamReturn) {
                paramName = new QName(callback.getWebResult().targetNamespace(),
                                      callback.getWebResult().name());
                paramOffset = 1;
            } else {
                paramName = new QName(callback.getWebParam(cbParamCount).targetNamespace(),
                                      callback.getWebParam(cbParamCount).name());
                cbParamCount++;
            }
            QName paramIdlType = pType.getIdltype();
            ModeType paramMode = pType.getMode();

            CorbaObjectHandler obj =
                CorbaHandlerUtils.initializeObjectHandler(orb, paramName, paramIdlType, typeMaps);

            streamables[index] = new CorbaStreamable(obj, paramName);
            if (paramMode.value().equals("in")) {
                streamables[index].setMode(org.omg.CORBA.ARG_IN.value);
            } else if (paramMode.value().equals("out")) {
                streamables[index].setMode(org.omg.CORBA.ARG_OUT.value);
            } else {
                streamables[index].setMode(org.omg.CORBA.ARG_INOUT.value);
            }

            Any value = orb.create_any();
            value.insert_Streamable(streamables[index]);
            list.add_value(streamables[index].getName(), value, streamables[index].getMode());
            corbaCtx.getMessage().addStreamableArgument(streamables[index]);
        }
        return list;
    }
View Full Code Here

Examples of org.omg.CORBA.NVList

        try {
            objectCtx.put(ObjectMessageContext.WSDL_OPERATION, callback.getOperationName());

            // Build the list of DII arguments, contexts, returns, and exceptions
            CorbaStreamable[] arguments = message.getStreamableArguments();
            NVList list = orb.create_list(arguments.length);

            for (int i = 0; i < arguments.length; ++i) {
                Any value = orb.create_any();
                value.insert_Streamable(arguments[i]);
                list.add_value(arguments[i].getName(), value, arguments[i].getMode());
            }

            ContextList ctxList = orb.create_context_list();
            Context ctx = orb.get_default_context();

            CorbaStreamable retVal = mc.getMessage().getStreamableReturn();
            NamedValue ret = null;
            if (retVal != null) {
                Any returnAny = orb.create_any();
                returnAny.insert_Streamable(retVal);
                ret = orb.create_named_value(retVal.getName(), returnAny, org.omg.CORBA.ARG_OUT.value);
            } else {
                // TODO: REVISIT: for some reason, the yoko ORB does not like to have a null NamedValue
                // return value. Create this 'empty' one if a void return type is used.
                ret = orb.create_named_value("return", orb.create_any(), org.omg.CORBA.ARG_OUT.value);
            }

            // Get the typecodes for the exceptions this operation can throw.  These are defined in the
            // operation definition from WSDL.
            ExceptionList exList = orb.create_exception_list();
            OperationType operation = CorbaUtils.getCorbaOperationType(callback.getOperationName(),
                                                                       bus,
                                                                       endpointRef);

            if (operation == null) {
                throw new CorbaBindingException("Unable to obtain operation definition");
            }

            Map<TypeCode, RaisesType> exceptions = getOperationExceptions(operation);
            Object[] tcs = exceptions.keySet().toArray();
            for (int i = 0; i < exceptions.size(); ++i) {
                exList.add((TypeCode) tcs[i]);
            }

            Request request =
                target._create_request(ctx,
                                       (String)objectCtx.get(ObjectMessageContext.WSDL_OPERATION),
                                       list,
                                       ret,
                                       exList,
                                       ctxList);
            request.invoke();

            mc.put(ObjectMessageContext.MESSAGE_INPUT, Boolean.FALSE);
            java.lang.Exception ex = request.env().exception();
            if (ex == null) {
                if (retVal != null) {
                    message.setStreamableReturnValue(retVal.getObject());
                }

                for (int i = 0; i < list.count(); ++i) {
                    NamedValue arg = (NamedValue) list.item(i);
                    if (arg.flags() != org.omg.CORBA.ARG_IN.value) {
                        CorbaStreamable streamable = (CorbaStreamable)arg.value().extract_Streamable();
                        message.setStreamableArgumentValue(streamable.getObject(), i);
                    }
                }
View Full Code Here

Examples of org.omg.CORBA.NVList

        corbaBinding.marshal(objectCtx, mc, callback);
        CorbaMessage message = mc.getMessage();

        try {
            CorbaStreamable[] arguments = message.getStreamableArguments();
            NVList list = orb.create_list(arguments.length);

            for (int i = 0; i < arguments.length; ++i) {
                Any value = orb.create_any();
                value.insert_Streamable(arguments[i]);
                list.add_value(arguments[i].getName(), value, arguments[i].getMode());
            }

            ContextList ctxList = orb.create_context_list();
            Context ctx = orb.get_default_context();
View Full Code Here

Examples of org.omg.CORBA.NVList

            // if blank makes it as a global scope.
            // The second parameter is op_flags which is set to RESTRICT_SCOPE
            // As there is only one defined in the spec.
            // The Third param is the pattern which is '*' requiring it to
            // get all the contexts.
            NVList nvList = ctx.get_values( "", CTX_RESTRICT_SCOPE.value,"*" );
            String[] context = new String[(nvList.count() * 2) ];
            if( ( nvList != null ) &&( nvList.count() != 0 ) ) {
                // The String[] array will contain Name and Value for each
                // context and hence double the size in the array.
                int index = 0;
                for( int i = 0; i < nvList.count(); i++ ) {
                    NamedValue nv;
                    try {
                        nv = nvList.item( i );
                    }
                    catch (Exception e ) {
                        return (String[]) null;
                    }
                    context[index] = nv.name();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.