org.omg.CORBA.NamedValue Java Examples

The following examples show how to use org.omg.CORBA.NamedValue. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServerRequestImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/** This is called from the ORB after the DynamicImplementation.invoke
 *  returns. Here we marshal the return value and inout/out params.
 */
public void marshalReplyParams(OutputStream os)
{
    // marshal the operation return value
    _resultAny.write_value(os);

    // marshal the inouts/outs
    NamedValue arg = null;

    for (int i=0; i < _arguments.count() ; i++) {
        try {
            arg = _arguments.item(i);
        } catch (Bounds e) {}

        if ((arg.flags() == org.omg.CORBA.ARG_OUT.value) ||
            (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
            arg.value().write_value(os);
        }
    }
}
 
Example #2
Source File: ClientRequestInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * See RequestInfoImpl for javadoc.
 */
public Any result (){
    checkAccess( MID_RESULT );

    if( cachedResult == null ) {
        if( request == null ) {
            throw stdWrapper.piOperationNotSupported5() ;
        }
        // Get the result from the DII request data.
        NamedValue nvResult = request.result( );

        if( nvResult == null ) {
            throw wrapper.piDiiResultIsNull() ;
        }

        cachedResult = nvResult.value();
    }

    // Good citizen: In the interest of efficiency, we assume that
    // interceptors will not modify the contents of the result Any.
    // Otherwise, we would need to create a deep copy of the Any.

    return cachedResult;
}
 
Example #3
Source File: ServerRequestImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/** This is called from the ORB after the DynamicImplementation.invoke
 *  returns. Here we marshal the return value and inout/out params.
 */
public void marshalReplyParams(OutputStream os)
{
    // marshal the operation return value
    _resultAny.write_value(os);

    // marshal the inouts/outs
    NamedValue arg = null;

    for (int i=0; i < _arguments.count() ; i++) {
        try {
            arg = _arguments.item(i);
        } catch (Bounds e) {}

        if ((arg.flags() == org.omg.CORBA.ARG_OUT.value) ||
            (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
            arg.value().write_value(os);
        }
    }
}
 
Example #4
Source File: CorbaConduit.java    From cxf with Apache License 2.0 6 votes vote down vote up
public NamedValue getReturn(CorbaMessage message) {
    if (orb == null) {
        prepareOrb();
    }
    CorbaStreamable retVal = message.getStreamableReturn();
    NamedValue ret = null;
    if (retVal != null) {
        Any returnAny = CorbaAnyHelper.createAny(orb);
        retVal.getObject().setIntoAny(returnAny, retVal, false);
        ret = orb.create_named_value(retVal.getName(), returnAny, org.omg.CORBA.ARG_OUT.value);
    } else {
        // for some reason, some ORBs do 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);
    }
    return ret;
}
 
Example #5
Source File: ServerRequestImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** This is called from the ORB after the DynamicImplementation.invoke
 *  returns. Here we marshal the return value and inout/out params.
 */
public void marshalReplyParams(OutputStream os)
{
    // marshal the operation return value
    _resultAny.write_value(os);

    // marshal the inouts/outs
    NamedValue arg = null;

    for (int i=0; i < _arguments.count() ; i++) {
        try {
            arg = _arguments.item(i);
        } catch (Bounds e) {}

        if ((arg.flags() == org.omg.CORBA.ARG_OUT.value) ||
            (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
            arg.value().write_value(os);
        }
    }
}
 
Example #6
Source File: ClientRequestInfoImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/**
 * See RequestInfoImpl for javadoc.
 */
public Any result (){
    checkAccess( MID_RESULT );

    if( cachedResult == null ) {
        if( request == null ) {
            throw stdWrapper.piOperationNotSupported5() ;
        }
        // Get the result from the DII request data.
        NamedValue nvResult = request.result( );

        if( nvResult == null ) {
            throw wrapper.piDiiResultIsNull() ;
        }

        cachedResult = nvResult.value();
    }

    // Good citizen: In the interest of efficiency, we assume that
    // interceptors will not modify the contents of the result Any.
    // Otherwise, we would need to create a deep copy of the Any.

    return cachedResult;
}
 
Example #7
Source File: ServerRequestImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/** This is called from the ORB after the DynamicImplementation.invoke
 *  returns. Here we marshal the return value and inout/out params.
 */
public void marshalReplyParams(OutputStream os)
{
    // marshal the operation return value
    _resultAny.write_value(os);

    // marshal the inouts/outs
    NamedValue arg = null;

    for (int i=0; i < _arguments.count() ; i++) {
        try {
            arg = _arguments.item(i);
        } catch (Bounds e) {}

        if ((arg.flags() == org.omg.CORBA.ARG_OUT.value) ||
            (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
            arg.value().write_value(os);
        }
    }
}
 
Example #8
Source File: ClientRequestInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * See RequestInfoImpl for javadoc.
 */
public Any result (){
    checkAccess( MID_RESULT );

    if( cachedResult == null ) {
        if( request == null ) {
            throw stdWrapper.piOperationNotSupported5() ;
        }
        // Get the result from the DII request data.
        NamedValue nvResult = request.result( );

        if( nvResult == null ) {
            throw wrapper.piDiiResultIsNull() ;
        }

        cachedResult = nvResult.value();
    }

    // Good citizen: In the interest of efficiency, we assume that
    // interceptors will not modify the contents of the result Any.
    // Otherwise, we would need to create a deep copy of the Any.

    return cachedResult;
}
 
Example #9
Source File: ServerRequestImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
/** This is called from the ORB after the DynamicImplementation.invoke
 *  returns. Here we marshal the return value and inout/out params.
 */
public void marshalReplyParams(OutputStream os)
{
    // marshal the operation return value
    _resultAny.write_value(os);

    // marshal the inouts/outs
    NamedValue arg = null;

    for (int i=0; i < _arguments.count() ; i++) {
        try {
            arg = _arguments.item(i);
        } catch (Bounds e) {}

        if ((arg.flags() == org.omg.CORBA.ARG_OUT.value) ||
            (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
            arg.value().write_value(os);
        }
    }
}
 
Example #10
Source File: ClientRequestInfoImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * See RequestInfoImpl for javadoc.
 */
public Any result (){
    checkAccess( MID_RESULT );

    if( cachedResult == null ) {
        if( request == null ) {
            throw stdWrapper.piOperationNotSupported5() ;
        }
        // Get the result from the DII request data.
        NamedValue nvResult = request.result( );

        if( nvResult == null ) {
            throw wrapper.piDiiResultIsNull() ;
        }

        cachedResult = nvResult.value();
    }

    // Good citizen: In the interest of efficiency, we assume that
    // interceptors will not modify the contents of the result Any.
    // Otherwise, we would need to create a deep copy of the Any.

    return cachedResult;
}
 
Example #11
Source File: CorbaConduitTest.java    From cxf with Apache License 2.0 6 votes vote down vote up
@Test
public void testBuildReturn() throws Exception {
    Message msg = new MessageImpl();
    CorbaMessage message = new CorbaMessage(msg);

    QName objName = new QName("returnName");
    QName objIdlType = new QName(CorbaConstants.NU_WSDL_CORBA, "short", CorbaConstants.NP_WSDL_CORBA);
    TypeCode objTypeCode = orb.get_primitive_tc(TCKind.tk_short);
    CorbaPrimitiveHandler obj1 = new CorbaPrimitiveHandler(objName, objIdlType, objTypeCode, null);
    CorbaStreamable arg = message.createStreamableObject(obj1, objName);

    CorbaConduit conduit = setupCorbaConduit(false);
    NamedValue ret = conduit.getReturn(message);
    assertNotNull("Return should not be null", ret != null);
    assertEquals("name should be equal", ret.name(), "return");

    message.setStreamableReturn(arg);
    NamedValue ret2 = conduit.getReturn(message);
    assertNotNull("Return2 should not be null", ret2 != null);
    assertEquals("name should be equal", ret2.name(), "returnName");
}
 
Example #12
Source File: ServerRequestImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/** This is called from the ORB after the DynamicImplementation.invoke
 *  returns. Here we marshal the return value and inout/out params.
 */
public void marshalReplyParams(OutputStream os)
{
    // marshal the operation return value
    _resultAny.write_value(os);

    // marshal the inouts/outs
    NamedValue arg = null;

    for (int i=0; i < _arguments.count() ; i++) {
        try {
            arg = _arguments.item(i);
        } catch (Bounds e) {}

        if ((arg.flags() == org.omg.CORBA.ARG_OUT.value) ||
            (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
            arg.value().write_value(os);
        }
    }
}
 
Example #13
Source File: ClientRequestInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * See RequestInfoImpl for javadoc.
 */
public Any result (){
    checkAccess( MID_RESULT );

    if( cachedResult == null ) {
        if( request == null ) {
            throw stdWrapper.piOperationNotSupported5() ;
        }
        // Get the result from the DII request data.
        NamedValue nvResult = request.result( );

        if( nvResult == null ) {
            throw wrapper.piDiiResultIsNull() ;
        }

        cachedResult = nvResult.value();
    }

    // Good citizen: In the interest of efficiency, we assume that
    // interceptors will not modify the contents of the result Any.
    // Otherwise, we would need to create a deep copy of the Any.

    return cachedResult;
}
 
Example #14
Source File: RequestImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void unmarshalReply(InputStream is)
{
    // First unmarshal the return value if it is not void
    if ( _result != null ) {
        Any returnAny = _result.value();
        TypeCode returnType = returnAny.type();
        if ( returnType.kind().value() != TCKind._tk_void )
            returnAny.read_value(is, returnType);
    }

    // Now unmarshal the out/inout args
    try {
        for ( int i=0; i<_arguments.count() ; i++) {
            NamedValue nv = _arguments.item(i);
            switch( nv.flags() ) {
            case ARG_IN.value:
                break;
            case ARG_OUT.value:
            case ARG_INOUT.value:
                Any any = nv.value();
                any.read_value(is, any.type());
                break;
            }
        }
    }
    catch ( org.omg.CORBA.Bounds ex ) {
        // Cannot happen since we only iterate till _arguments.count()
    }
}
 
Example #15
Source File: RequestInfoImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Internal utility method to convert an NVList into a PI Parameter[]
 */
protected Parameter[] nvListToParameterArray( NVList parNVList ) {

    // _REVISIT_ This utility method should probably be doing a deep
    // copy so interceptor can't accidentally change the arguments.

    int count = parNVList.count();
    Parameter[] plist = new Parameter[count];
    try {
        for( int i = 0; i < count; i++ ) {
            Parameter p = new Parameter();
            plist[i] = p;
            NamedValue nv = parNVList.item( i );
            plist[i].argument = nv.value();
            // ParameterMode spec can be found in 99-10-07.pdf
            // Section:10.5.22
            // nv.flags spec can be found in 99-10-07.pdf
            // Section 7.1.1
            // nv.flags has ARG_IN as 1, ARG_OUT as 2 and ARG_INOUT as 3
            // To convert this into enum PARAM_IN, PARAM_OUT and
            // PARAM_INOUT the value is subtracted by 1.
            plist[i].mode = ParameterMode.from_int( nv.flags() - 1 );
        }
    } catch ( Exception e ) {
        throw wrapper.exceptionInArguments( e ) ;
    }

    return plist;
}
 
Example #16
Source File: NVListImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public NamedValue add_item(String itemName, int flags)
{
    NamedValue tmpVal = new NamedValueImpl(orb, itemName, new AnyImpl(orb),
                                           flags);
    _namedValues.addElement(tmpVal);
    return tmpVal;
}
 
Example #17
Source File: RequestImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void unmarshalReply(InputStream is)
{
    // First unmarshal the return value if it is not void
    if ( _result != null ) {
        Any returnAny = _result.value();
        TypeCode returnType = returnAny.type();
        if ( returnType.kind().value() != TCKind._tk_void )
            returnAny.read_value(is, returnType);
    }

    // Now unmarshal the out/inout args
    try {
        for ( int i=0; i<_arguments.count() ; i++) {
            NamedValue nv = _arguments.item(i);
            switch( nv.flags() ) {
            case ARG_IN.value:
                break;
            case ARG_OUT.value:
            case ARG_INOUT.value:
                Any any = nv.value();
                any.read_value(is, any.type());
                break;
            }
        }
    }
    catch ( org.omg.CORBA.Bounds ex ) {
        // Cannot happen since we only iterate till _arguments.count()
    }
}
 
Example #18
Source File: CorbaClientDelegateImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public Request create_request(org.omg.CORBA.Object obj,
                              Context ctx,
                              String operation,
                              NVList arg_list,
                              NamedValue result,
                              ExceptionList exclist,
                              ContextList ctxlist)
{
    return new RequestImpl(orb, obj, ctx, operation, arg_list, result,
                           exclist, ctxlist);
}
 
Example #19
Source File: CorbaClientDelegateImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public Request create_request(org.omg.CORBA.Object obj,
                              Context ctx,
                              String operation,
                              NVList arg_list,
                              NamedValue result,
                              ExceptionList exclist,
                              ContextList ctxlist)
{
    return new RequestImpl(orb, obj, ctx, operation, arg_list, result,
                           exclist, ctxlist);
}
 
Example #20
Source File: ServerRequestImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void arguments(NVList args)
{
    if (_paramsCalled)
        throw _wrapper.argumentsCalledMultiple() ;

    if (_exceptionSet)
        throw _wrapper.argumentsCalledAfterException() ;

    if (args == null )
        throw _wrapper.argumentsCalledNullArgs() ;

    _paramsCalled = true;

    NamedValue arg = null;
    for (int i=0; i < args.count() ; i++) {
        try {
            arg = args.item(i);
        } catch (Bounds e) {
            throw _wrapper.boundsCannotOccur(e) ;
        }

        try {
            if ((arg.flags() == org.omg.CORBA.ARG_IN.value) ||
                (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
                // unmarshal the value into the Any
                arg.value().read_value(_ins, arg.value().type());
            }
        } catch ( Exception ex ) {
            throw _wrapper.badArgumentsNvlist( ex ) ;
        }
    }

    // hang on to the NVList for marshaling the result
    _arguments = args;

    _orb.getPIHandler().setServerPIInfo( _arguments );
    _orb.getPIHandler().invokeServerPIIntermediatePoint();
}
 
Example #21
Source File: NVListImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public NamedValue add_item(String itemName, int flags)
{
    NamedValue tmpVal = new NamedValueImpl(orb, itemName, new AnyImpl(orb),
                                           flags);
    _namedValues.addElement(tmpVal);
    return tmpVal;
}
 
Example #22
Source File: NVListImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public NamedValue item(int index)
    throws Bounds
{
    try {
        return (NamedValue) _namedValues.elementAt(index);
    } catch (ArrayIndexOutOfBoundsException e) {
        throw new Bounds();
    }
}
 
Example #23
Source File: CorbaClientDelegateImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public Request create_request(org.omg.CORBA.Object obj,
                              Context ctx,
                              String operation,
                              NVList arg_list,
                              NamedValue result)
{
    return new RequestImpl(orb, obj, ctx, operation, arg_list,
                           result, null, null);
}
 
Example #24
Source File: CorbaClientDelegateImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public Request create_request(org.omg.CORBA.Object obj,
                              Context ctx,
                              String operation,
                              NVList arg_list,
                              NamedValue result,
                              ExceptionList exclist,
                              ContextList ctxlist)
{
    return new RequestImpl(orb, obj, ctx, operation, arg_list, result,
                           exclist, ctxlist);
}
 
Example #25
Source File: RequestInfoImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Internal utility method to convert an NVList into a PI Parameter[]
 */
protected Parameter[] nvListToParameterArray( NVList parNVList ) {

    // _REVISIT_ This utility method should probably be doing a deep
    // copy so interceptor can't accidentally change the arguments.

    int count = parNVList.count();
    Parameter[] plist = new Parameter[count];
    try {
        for( int i = 0; i < count; i++ ) {
            Parameter p = new Parameter();
            plist[i] = p;
            NamedValue nv = parNVList.item( i );
            plist[i].argument = nv.value();
            // ParameterMode spec can be found in 99-10-07.pdf
            // Section:10.5.22
            // nv.flags spec can be found in 99-10-07.pdf
            // Section 7.1.1
            // nv.flags has ARG_IN as 1, ARG_OUT as 2 and ARG_INOUT as 3
            // To convert this into enum PARAM_IN, PARAM_OUT and
            // PARAM_INOUT the value is subtracted by 1.
            plist[i].mode = ParameterMode.from_int( nv.flags() - 1 );
        }
    } catch ( Exception e ) {
        throw wrapper.exceptionInArguments( e ) ;
    }

    return plist;
}
 
Example #26
Source File: CorbaClientDelegateImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Request create_request(org.omg.CORBA.Object obj,
                              Context ctx,
                              String operation,
                              NVList arg_list,
                              NamedValue result,
                              ExceptionList exclist,
                              ContextList ctxlist)
{
    return new RequestImpl(orb, obj, ctx, operation, arg_list, result,
                           exclist, ctxlist);
}
 
Example #27
Source File: NVListImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public NamedValue add_item(String itemName, int flags)
{
    NamedValue tmpVal = new NamedValueImpl(orb, itemName, new AnyImpl(orb),
                                           flags);
    _namedValues.addElement(tmpVal);
    return tmpVal;
}
 
Example #28
Source File: ServerRequestImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void arguments(NVList args)
{
    if (_paramsCalled)
        throw _wrapper.argumentsCalledMultiple() ;

    if (_exceptionSet)
        throw _wrapper.argumentsCalledAfterException() ;

    if (args == null )
        throw _wrapper.argumentsCalledNullArgs() ;

    _paramsCalled = true;

    NamedValue arg = null;
    for (int i=0; i < args.count() ; i++) {
        try {
            arg = args.item(i);
        } catch (Bounds e) {
            throw _wrapper.boundsCannotOccur(e) ;
        }

        try {
            if ((arg.flags() == org.omg.CORBA.ARG_IN.value) ||
                (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) {
                // unmarshal the value into the Any
                arg.value().read_value(_ins, arg.value().type());
            }
        } catch ( Exception ex ) {
            throw _wrapper.badArgumentsNvlist( ex ) ;
        }
    }

    // hang on to the NVList for marshaling the result
    _arguments = args;

    _orb.getPIHandler().setServerPIInfo( _arguments );
    _orb.getPIHandler().invokeServerPIIntermediatePoint();
}
 
Example #29
Source File: RequestInfoImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Internal utility method to convert an NVList into a PI Parameter[]
 */
protected Parameter[] nvListToParameterArray( NVList parNVList ) {

    // _REVISIT_ This utility method should probably be doing a deep
    // copy so interceptor can't accidentally change the arguments.

    int count = parNVList.count();
    Parameter[] plist = new Parameter[count];
    try {
        for( int i = 0; i < count; i++ ) {
            Parameter p = new Parameter();
            plist[i] = p;
            NamedValue nv = parNVList.item( i );
            plist[i].argument = nv.value();
            // ParameterMode spec can be found in 99-10-07.pdf
            // Section:10.5.22
            // nv.flags spec can be found in 99-10-07.pdf
            // Section 7.1.1
            // nv.flags has ARG_IN as 1, ARG_OUT as 2 and ARG_INOUT as 3
            // To convert this into enum PARAM_IN, PARAM_OUT and
            // PARAM_INOUT the value is subtracted by 1.
            plist[i].mode = ParameterMode.from_int( nv.flags() - 1 );
        }
    } catch ( Exception e ) {
        throw wrapper.exceptionInArguments( e ) ;
    }

    return plist;
}
 
Example #30
Source File: RequestInfoImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Internal utility method to convert an NVList into a PI Parameter[]
 */
protected Parameter[] nvListToParameterArray( NVList parNVList ) {

    // _REVISIT_ This utility method should probably be doing a deep
    // copy so interceptor can't accidentally change the arguments.

    int count = parNVList.count();
    Parameter[] plist = new Parameter[count];
    try {
        for( int i = 0; i < count; i++ ) {
            Parameter p = new Parameter();
            plist[i] = p;
            NamedValue nv = parNVList.item( i );
            plist[i].argument = nv.value();
            // ParameterMode spec can be found in 99-10-07.pdf
            // Section:10.5.22
            // nv.flags spec can be found in 99-10-07.pdf
            // Section 7.1.1
            // nv.flags has ARG_IN as 1, ARG_OUT as 2 and ARG_INOUT as 3
            // To convert this into enum PARAM_IN, PARAM_OUT and
            // PARAM_INOUT the value is subtracted by 1.
            plist[i].mode = ParameterMode.from_int( nv.flags() - 1 );
        }
    } catch ( Exception e ) {
        throw wrapper.exceptionInArguments( e ) ;
    }

    return plist;
}