Package org.omg.CORBA

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


    }
   
    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

        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

        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

            // 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

        CorbaStreamable arg = message.createStreamableObject(obj1, objName);       
        arguments[0] = arg;
        arguments[0].setMode(org.omg.CORBA.ARG_OUT.value);
       
        CorbaConduit conduit = setupCorbaConduit(false);
        NVList list = conduit.getArguments(message);
        assertNotNull("list should not be null", list != null);
       
        message.setStreamableArguments(arguments);
        NVList listArgs = (NVList)conduit.getArguments(message);
        assertNotNull("listArgs should not be null", listArgs != null);
        assertNotNull("listArgs Item should not be null", listArgs.item(0) != null);
        assertEquals("Name should be equal", listArgs.item(0).name(), "object");
        assertEquals("flags should be 2", listArgs.item(0).flags(), 2);
        assertNotNull("Any Value should not be null", listArgs.item(0).value() != null);       
    }
View Full Code Here

        org.omg.CORBA.Object obj = control.createMock(org.omg.CORBA.Object.class);
        EasyMock.expect(message.get(CorbaConstants.CORBA_ENDPOINT_OBJECT)).andReturn(obj);
       
        //msg.put(CorbaConstants.CORBA_ENDPOINT_OBJECT, obj);       
        Request r = control.createMock(Request.class);       
        NVList nvList = (NVList)orb.create_list(0);
        NamedValue ret = control.createMock(NamedValue.class);
        ExceptionList exList = control.createMock(ExceptionList.class);       
       
        EasyMock.expect(obj._create_request((Context)EasyMock.anyObject(),
                            EasyMock.eq("greetMe"),
View Full Code Here

        return endpointInfo.getAddress();
    }
       
    public void buildRequest(CorbaMessage message, OperationType opType) throws Exception {       
        ServiceInfo service = message.getExchange().get(ServiceInfo.class);
        NVList nvlist = getArguments(message);
        NamedValue ret = getReturn(message);
        Map<TypeCode, RaisesType> exceptions = getOperationExceptions(opType, typeMap);
        ExceptionList exList = getExceptionList(exceptions, message, opType);
        Request request = getRequest(message, opType.getName(), nvlist, ret, exList);
        if (request == null) {
View Full Code Here

    public NVList getArguments(CorbaMessage message) {
        if (orb == null) {
            prepareOrb();
        }
        // Build the list of DII arguments, returns, and exceptions
        NVList list = null;
        if (message.getStreamableArguments() != null) {
            CorbaStreamable[] arguments = message.getStreamableArguments();
            list = orb.create_list(arguments.length);

            for (CorbaStreamable argument : arguments) {
                Any value = CorbaAnyHelper.createAny(orb);
                argument.getObject().setIntoAny(value, argument, true);
                list.add_value(argument.getName(), value, argument.getMode());
            }
        } else {
            list = orb.create_list(0);
        }
View Full Code Here

        return endpointInfo.getAddress();
    }
       
    public void buildRequest(CorbaMessage message, OperationType opType) throws Exception {       
        ServiceInfo service = message.getExchange().get(ServiceInfo.class);
        NVList nvlist = getArguments(message);
        NamedValue ret = getReturn(message);
        Map<TypeCode, RaisesType> exceptions = getOperationExceptions(opType, typeMap);
        ExceptionList exList = getExceptionList(exceptions, message, opType);
        Request request = getRequest(message, opType.getName(), nvlist, ret, exList);
        if (request == null) {
View Full Code Here

TOP

Related Classes of org.omg.CORBA.NVList

Copyright © 2018 www.massapicom. 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.