Package org.omg.CORBA

Examples of org.omg.CORBA.Request


        Context ctx = null;

        // Create the method request using the default context, the name of
        // the method, the NVList argument list, and the NamedValue for the
        // result.  Then invoke the method by calling invoke() on the Request.
        Request thisReq =
        server._create_request(ctx, "myFunction", argList, resultVal, null, null);
        thisReq.invoke();

        assertTrue (nvArg2.value ().extract_long () == nvArg1.value ().extract_long ());

        // Get the return value from the Request object and output results.
        result = thisReq.result().value();
        assertTrue (result.extract_long () == -100);

        // Should be no exception thrown.
        assertTrue (thisReq.env ().exception () == null);
    }
View Full Code Here


        ExceptionList exceptions = null;

        // Create the method request using the default context, the name of
        // the method, the NVList argument list, and the NamedValue for the
        // result.  Then invoke the method by calling invoke() on the Request.
        Request thisReq =
        server._create_request(ctx, "myFunction", argList, resultVal, exceptions, null);

        thisReq.invoke();

        result = thisReq.result().value();

        // Should be an exception thrown.
        assertTrue (thisReq.env ().exception () != null);
        assertTrue (thisReq.env ().exception () instanceof INTERNAL);
        assertTrue (thisReq.env ().exception ().toString ().indexOf ("A system exception!") != -1);
        assertTrue (nvArg2.value ().extract_long () != nvArg1.value ().extract_long ());
    }
View Full Code Here

        exceptions.add (MyOwnExceptionHelper.type ());

        // Create the method request using the default context, the name of
        // the method, the NVList argument list, and the NamedValue for the
        // result.  Then invoke the method by calling invoke() on the Request.
        Request thisReq =
        server._create_request(ctx, "myFunction", argList, resultVal, exceptions, null);

        thisReq.invoke();

        result = thisReq.result().value();

        // Should be an exception thrown.
        assertTrue (thisReq.env ().exception () != null);
        assertTrue
           (((UnknownUserException)thisReq.env ().exception ()).except.type ().equal (MyOwnExceptionHelper.type ()));
        assertTrue
           ("Param1 > 0".equals ((MyOwnExceptionHelper.read (((UnknownUserException)thisReq.env ().exception ()).except.create_input_stream ())).message));
        assertTrue (nvArg2.value ().extract_long () != nvArg1.value ().extract_long ());
    }
View Full Code Here

        // exceptions.add (MyOwnExceptionHelper.type ());

        // Create the method request using the default context, the name of
        // the method, the NVList argument list, and the NamedValue for the
        // result.  Then invoke the method by calling invoke() on the Request.
        Request thisReq =
        server._create_request(ctx, "myFunction", argList, resultVal, exceptions, null);

        thisReq.invoke();

        result = thisReq.result().value();

        // Should be an exception thrown.
        assertTrue (thisReq.env ().exception () != null);
        assertTrue (thisReq.env ().exception () instanceof UNKNOWN);
        assertTrue (thisReq.env ().exception ().toString ().indexOf ("Caught an unknown exception with typecode id of IDL:org/jacorb/test/bugs/bugjac631/MyOwnException") != -1);
        assertTrue (nvArg2.value ().extract_long () != nvArg1.value ().extract_long ());
    }
View Full Code Here

        // exceptions.add (MyOwnExceptionHelper.type ());

        // Create the method request using the default context, the name of
        // the method, the NVList argument list, and the NamedValue for the
        // result.  Then invoke the method by calling invoke() on the Request.
        Request thisReq =
        server._create_request(ctx, "myFunction", argList, resultVal, exceptions, null);

        thisReq.invoke();

        result = thisReq.result().value();

        // Should be an exception thrown.
        assertTrue (thisReq.env ().exception () != null);
        assertTrue (thisReq.env ().exception () instanceof UNKNOWN);
        assertTrue (thisReq.env ().exception ().toString ().indexOf ("A nullpointer exception") != -1);
        assertTrue (nvArg2.value ().extract_long () != nvArg1.value ().extract_long ());
    }
View Full Code Here

    public ModelParticipant[] contents() {
    if (counterPart!=null) {
            IRAttribute[] allFields = (IRAttribute[])((Interface)this.typeSystemNode).getAllFields();
            ObjectRepresentant[] result = new ObjectRepresentant[allFields.length];
            for (int i=0; i<allFields.length; i++) {
                Request request = ((org.omg.CORBA.Object)counterPart)._request("_get_"+allFields[i].getName());
                IRNode associatedNode = (IRNode)allFields[i].getAssociatedTypeSystemNode();
                request.set_return_type(associatedNode.getTypeCode())// what about alias types?
                try {
                    request.invoke();
                }
                catch (Exception e) {
                    e.printStackTrace();
                }
                Any any = request.return_value();
                if (any!=null) {
                    result[i] = ObjectRepresentantFactory.create(
                                                                 ObjectRepresentantFactory.objectFromAny(any),
                                                                 allFields[i].getAssociatedTypeSystemNode(),
                                                                 allFields[i]);
View Full Code Here

     * @param op org.jacorb.ir;.gui.typesystem.remote.IROperation
     * @param params java.lang.String[]
     */
    public java.lang.Object invokeOperation(IROperation op, String[] params) {
    ModelParticipant[] irParams = op.contents();
    Request request =  ((org.omg.CORBA.Object)counterPart)._request(op.getName());
    IRNode associatedNode = (IRNode)op.getAssociatedTypeSystemNode();
    request.set_return_type(associatedNode.getTypeCode())// was ist mit Alias-Typen?
    for (int i=0; i<irParams.length; i++) {
            IRParameter irParam = (IRParameter)irParams[i];
            switch (irParam.getMode().value()) {
            case ParameterMode._PARAM_IN:
                ObjectRepresentantFactory.insertFromString(request.add_in_arg(),params[i],irParam.getTypeCode().kind());
                break;
            case ParameterMode._PARAM_OUT:
                ObjectRepresentantFactory.insertFromString(request.add_out_arg(),params[i],irParam.getTypeCode().kind());
                break;
            case ParameterMode._PARAM_INOUT:
                ObjectRepresentantFactory.insertFromString(request.add_inout_arg(),params[i],irParam.getTypeCode().kind());
                break;
            }
    }
    request.invoke();
    Any any = request.return_value();
    if (any!=null) {
            return ObjectRepresentantFactory.objectFromAny(any);
    }
    return null;
    }
View Full Code Here

     */
    public synchronized boolean poll_next_response()
    {
        checkShutdownState();

        Request currRequest;

        // poll on each pending request
        Enumeration ve = dynamicRequests.elements();
        while (ve.hasMoreElements() == true) {
            currRequest = (Request)ve.nextElement();
            if (currRequest.poll_response() == true) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

        while (true) {
            // check if there already is a response
            synchronized ( dynamicRequests ) {
                Enumeration elems = dynamicRequests.elements();
                while ( elems.hasMoreElements() ) {
                    Request currRequest = (Request)elems.nextElement();
                    if ( currRequest.poll_response() ) {
                        // get the response for this successfully polled Request
                        currRequest.get_response();
                        dynamicRequests.removeElement(currRequest);
                        return currRequest;
                    }
                }
            }
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.