Package org.omg.CORBA

Examples of org.omg.CORBA.Request


        }
    }

    public Object invoke() throws CorbaInvocationException {
        // Create request
        Request request = object._request(operation.getName());

        // Set parameters
        Any arg = null;
        List memArgs = new ArrayList();
        if (parameters!=null) {
            List patamList = new LinkedList(Arrays.asList(parameters));
            Iterator paramsIter = patamList.iterator();
            for (int i = 0; i < parameterTypeList.size(); i++) {
                Member member = (Member) parameterTypeList.get(i);
                DataType type = member.getDataType();
                Object value = null;
                String mode = member.getMode();
                if (mode.equals(Member.MODE_IN)) {
                    arg = request.add_in_arg();
                    value = paramsIter.next();
                }else if (mode.equals(Member.MODE_INOUT)) {
                    arg = request.add_inout_arg();
                    value = paramsIter.next();
                } else if (mode.equals(Member.MODE_OUT)) {
                    arg = request.add_out_arg();
                    value = CorbaUtil.getEmptyValue(type);
                }

                memArgs.add(arg);
                CorbaUtil.insertValue(arg, type, value);
            }
        }

        // Set return type
        DataType returnType = operation.getReturnType();
        if (returnType!=null) {
            TypeCode typeCode = returnType.getTypeCode();
            request.set_return_type(typeCode);
        }

        // Set exceptions
        List exceptions = operation.getRaises();
        if (exceptions!=null && !exceptions.isEmpty()) {
            ExceptionList exceptionList = request.exceptions();
            for (int i = 0; i < exceptions.size(); i++) {
                ExceptionType exType = (ExceptionType) exceptions.get(i);
                exceptionList.add(exType.getTypeCode());
            }
        }

        // Invoke
        request.invoke();

        // Get exception
        Object returnValue = null;
        Exception exception = request.env().exception();
        if (exception == null) {
            // Extract the return value
            if (returnType != null) {
                Any returned = request.return_value();
                returnValue = CorbaUtil.extractValue(returnType, returned);
            }

            // Extract the values of inout and out parameters
            returnedParams = new ArrayList();
View Full Code Here


        }
    }

    public Object invoke() throws CorbaInvocationException {
        // Create request
        Request request = object._request(operation.getName());

        // Set parameters
        Any arg = null;
        List memArgs = new ArrayList();
        if (parameters!=null) {
            List patamList = new LinkedList(Arrays.asList(parameters));
            Iterator paramsIter = patamList.iterator();
            for (int i = 0; i < parameterTypeList.size(); i++) {
                Member member = (Member) parameterTypeList.get(i);
                DataType type = member.getDataType();
                Object value = null;
                String mode = member.getMode();
                if (mode.equals(Member.MODE_IN)) {
                    arg = request.add_in_arg();
                    value = paramsIter.next();
                } else if (mode.equals(Member.MODE_INOUT)) {
                    arg = request.add_inout_arg();
                    value = paramsIter.next();
                } else if (mode.equals(Member.MODE_OUT)) {
                    arg = request.add_out_arg();
                    value = CorbaUtil.getEmptyValue(type);
                }

                memArgs.add(arg);
                CorbaUtil.insertValue(arg, type, value);
            }
        }

        // Set return type
        DataType returnType = operation.getReturnType();
        if (returnType!=null) {
            TypeCode typeCode = returnType.getTypeCode();
            request.set_return_type(typeCode);
        }

        // Set exceptions
        List exceptions = operation.getRaises();
        if (exceptions!=null && !exceptions.isEmpty()) {
            ExceptionList exceptionList = request.exceptions();
            for (int i = 0; i < exceptions.size(); i++) {
                ExceptionType exType = (ExceptionType) exceptions.get(i);
                exceptionList.add(exType.getTypeCode());
            }
        }

        // Invoke
        request.invoke();

        // Get exception
        Object returnValue = null;
        Exception exception = request.env().exception();
        if (exception == null) {
            // Extract the return value
            if (returnType != null) {
                Any returned = request.return_value();
                returnValue = CorbaUtil.extractValue(returnType, returned);
            }

            // Extract the values of inout and out parameters
            returnedParams = new ArrayList();
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 = 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"),
                            EasyMock.isA(NVList.class),
                            EasyMock.isA(NamedValue.class),
                            EasyMock.isA(ExceptionList.class),
                            EasyMock.isA(ContextList.class)));
        EasyMock.expectLastCall().andReturn(r);
        r.invoke();
        EasyMock.expectLastCall();
       
        control.replay();
        Request request = conduit.getRequest(message, "greetMe", nvList, ret, exList);
        request.invoke();
        control.verify();
       
          /* try {
                ContextList ctxList = orb.create_context_list();
                Context ctx = orb.get_default_context();
View Full Code Here

        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) {
            throw new CorbaBindingException("Couldn't build the corba request");
        }
        try {
            request.invoke();
        } catch (SystemException ex) {
            message.setContent(Exception.class, new Fault(ex));
            message.setSystemException(ex);
            return;
        }
        Exception ex = request.env().exception();
        if (ex != null) {
            if (ex instanceof UnknownUserException) {
                UnknownUserException userEx = (UnknownUserException) ex;
                Any except = userEx.except;
                RaisesType raises = exceptions.get(except.type());
View Full Code Here

                                 String opName,
                                 org.omg.CORBA.NVList nvlist,
                                 org.omg.CORBA.NamedValue ret,
                                 org.omg.CORBA.ExceptionList exList)
        throws Exception {
        Request request = null;
        if (orb == null) {
            prepareOrb();
        }
        ContextList ctxList = orb.create_context_list();
        Context ctx = null;
View Full Code Here

        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) {
            throw new CorbaBindingException("Couldn't build the corba request");
        }
        try {
            request.invoke();
        } catch (SystemException ex) {
            message.setContent(Exception.class, new Fault(ex));
            message.setSystemException(ex);
            return;
        }
        Exception ex = request.env().exception();
        if (ex != null) {
            if (ex instanceof UnknownUserException) {
                UnknownUserException userEx = (UnknownUserException) ex;
                Any except = userEx.except;
                RaisesType raises = exceptions.get(except.type());
View Full Code Here

                                 String opName,
                                 org.omg.CORBA.NVList nvlist,
                                 org.omg.CORBA.NamedValue ret,
                                 org.omg.CORBA.ExceptionList exList)
        throws Exception {
        Request request = null;
        if (orb == null) {
            prepareOrb();
        }
        ContextList ctxList = orb.create_context_list();
        Context ctx = 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"),
                            EasyMock.isA(NVList.class),
                            EasyMock.isA(NamedValue.class),
                            EasyMock.isA(ExceptionList.class),
                            EasyMock.isA(ContextList.class)));
        EasyMock.expectLastCall().andReturn(r);
        r.invoke();
        EasyMock.expectLastCall();
       
        control.replay();
        Request request = conduit.getRequest(message, "greetMe", nvList, ret, exList);
        request.invoke();
        control.verify();
       
          /* try {
                ContextList ctxList = orb.create_context_list();
                Context ctx = orb.get_default_context();
View Full Code Here

        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) {
            throw new CorbaBindingException("Couldn't build the corba request");
        }
        try {
            request.invoke();
        } catch (SystemException ex) {
            message.setContent(Exception.class, new Fault(ex));
            message.setSystemException(ex);
            return;
        }
        Exception ex = request.env().exception();
        if (ex != null) {
            if (ex instanceof UnknownUserException) {
                UnknownUserException userEx = (UnknownUserException) ex;
                Any except = userEx.except;
                RaisesType raises = exceptions.get(except.type());
View Full Code Here

                                 String opName,
                                 org.omg.CORBA.NVList nvlist,
                                 org.omg.CORBA.NamedValue ret,
                                 org.omg.CORBA.ExceptionList exList)
        throws Exception {
        Request request = null;
        if (orb == null) {
            prepareOrb();
        }
        ContextList ctxList = orb.create_context_list();
        Context ctx = null;
View Full Code Here

TOP

Related Classes of org.omg.CORBA.Request

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.