Java Code Examples for org.omg.CORBA.Any#write_value()

The following examples show how to use org.omg.CORBA.Any#write_value() . 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: CDROutputStream_1_0.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void write_any(Any any)
{
    if ( any == null )
        throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);

    write_TypeCode(any.type());
    any.write_value(parent);
}
 
Example 2
Source File: CDROutputStream_1_0.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void write_any(Any any)
{
    if ( any == null )
        throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);

    write_TypeCode(any.type());
    any.write_value(parent);
}
 
Example 3
Source File: CDREncapsCodec.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert the given any into a CDR encapsulated octet sequence.
 * If sendTypeCode is true, the type code is sent with the message, as in
 * a standard encapsulation.  If it is false, only the data is sent.
 * Either way, the endian type is sent as the first part of the message.
 */
private byte[] encodeImpl( Any data, boolean sendTypeCode )
    throws InvalidTypeForEncoding
{
    if( data == null )
        throw wrapper.nullParam() ;

    // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
    // the body of this method.  This is due to the fact that CDR*Stream
    // will never throw an exception if the encoding is invalid.  To
    // fix this, the CDROutputStream must know the version of GIOP it
    // is encoding for and it must check to ensure that, for example,
    // wstring cannot be encoded in GIOP 1.0.
    //
    // As part of the GIOP 1.2 work, the CDRInput and OutputStream will
    // be versioned.  This can be handled once this work is complete.

    // Create output stream with default endianness.
    EncapsOutputStream cdrOut =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(
        (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );

    // This is an encapsulation, so put out the endian:
    cdrOut.putEndian();

    // Sometimes encode type code:
    if( sendTypeCode ) {
        cdrOut.write_TypeCode( data.type() );
    }

    // Encode value and return.
    data.write_value( cdrOut );

    return cdrOut.toByteArray();
}
 
Example 4
Source File: CDROutputStream_1_0.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void write_any(Any any)
{
    if ( any == null )
        throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);

    write_TypeCode(any.type());
    any.write_value(parent);
}
 
Example 5
Source File: IDLJavaSerializationOutputStream.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public final void write_any(Any any) {
    if (any == null) {
        throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
    }
    write_TypeCode(any.type());
    any.write_value(parent);
}
 
Example 6
Source File: CDROutputStream_1_0.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void write_any(Any any)
{
    if ( any == null )
        throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);

    write_TypeCode(any.type());
    any.write_value(parent);
}
 
Example 7
Source File: CDREncapsCodec.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert the given any into a CDR encapsulated octet sequence.
 * If sendTypeCode is true, the type code is sent with the message, as in
 * a standard encapsulation.  If it is false, only the data is sent.
 * Either way, the endian type is sent as the first part of the message.
 */
private byte[] encodeImpl( Any data, boolean sendTypeCode )
    throws InvalidTypeForEncoding
{
    if( data == null )
        throw wrapper.nullParam() ;

    // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
    // the body of this method.  This is due to the fact that CDR*Stream
    // will never throw an exception if the encoding is invalid.  To
    // fix this, the CDROutputStream must know the version of GIOP it
    // is encoding for and it must check to ensure that, for example,
    // wstring cannot be encoded in GIOP 1.0.
    //
    // As part of the GIOP 1.2 work, the CDRInput and OutputStream will
    // be versioned.  This can be handled once this work is complete.

    // Create output stream with default endianness.
    EncapsOutputStream cdrOut =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(
        (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );

    // This is an encapsulation, so put out the endian:
    cdrOut.putEndian();

    // Sometimes encode type code:
    if( sendTypeCode ) {
        cdrOut.write_TypeCode( data.type() );
    }

    // Encode value and return.
    data.write_value( cdrOut );

    return cdrOut.toByteArray();
}
 
Example 8
Source File: IDLJavaSerializationOutputStream.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public final void write_any(Any any) {
    if (any == null) {
        throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
    }
    write_TypeCode(any.type());
    any.write_value(parent);
}
 
Example 9
Source File: CDREncapsCodec.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert the given any into a CDR encapsulated octet sequence.
 * If sendTypeCode is true, the type code is sent with the message, as in
 * a standard encapsulation.  If it is false, only the data is sent.
 * Either way, the endian type is sent as the first part of the message.
 */
private byte[] encodeImpl( Any data, boolean sendTypeCode )
    throws InvalidTypeForEncoding
{
    if( data == null )
        throw wrapper.nullParam() ;

    // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
    // the body of this method.  This is due to the fact that CDR*Stream
    // will never throw an exception if the encoding is invalid.  To
    // fix this, the CDROutputStream must know the version of GIOP it
    // is encoding for and it must check to ensure that, for example,
    // wstring cannot be encoded in GIOP 1.0.
    //
    // As part of the GIOP 1.2 work, the CDRInput and OutputStream will
    // be versioned.  This can be handled once this work is complete.

    // Create output stream with default endianness.
    EncapsOutputStream cdrOut =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(
        (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );

    // This is an encapsulation, so put out the endian:
    cdrOut.putEndian();

    // Sometimes encode type code:
    if( sendTypeCode ) {
        cdrOut.write_TypeCode( data.type() );
    }

    // Encode value and return.
    data.write_value( cdrOut );

    return cdrOut.toByteArray();
}
 
Example 10
Source File: CDREncapsCodec.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert the given any into a CDR encapsulated octet sequence.
 * If sendTypeCode is true, the type code is sent with the message, as in
 * a standard encapsulation.  If it is false, only the data is sent.
 * Either way, the endian type is sent as the first part of the message.
 */
private byte[] encodeImpl( Any data, boolean sendTypeCode )
    throws InvalidTypeForEncoding
{
    if( data == null )
        throw wrapper.nullParam() ;

    // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
    // the body of this method.  This is due to the fact that CDR*Stream
    // will never throw an exception if the encoding is invalid.  To
    // fix this, the CDROutputStream must know the version of GIOP it
    // is encoding for and it must check to ensure that, for example,
    // wstring cannot be encoded in GIOP 1.0.
    //
    // As part of the GIOP 1.2 work, the CDRInput and OutputStream will
    // be versioned.  This can be handled once this work is complete.

    // Create output stream with default endianness.
    EncapsOutputStream cdrOut =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(
        (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );

    // This is an encapsulation, so put out the endian:
    cdrOut.putEndian();

    // Sometimes encode type code:
    if( sendTypeCode ) {
        cdrOut.write_TypeCode( data.type() );
    }

    // Encode value and return.
    data.write_value( cdrOut );

    return cdrOut.toByteArray();
}
 
Example 11
Source File: CDROutputStream_1_0.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void write_any(Any any)
{
    if ( any == null )
        throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);

    write_TypeCode(any.type());
    any.write_value(parent);
}
 
Example 12
Source File: CDREncapsCodec.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Convert the given any into a CDR encapsulated octet sequence.
 * If sendTypeCode is true, the type code is sent with the message, as in
 * a standard encapsulation.  If it is false, only the data is sent.
 * Either way, the endian type is sent as the first part of the message.
 */
private byte[] encodeImpl( Any data, boolean sendTypeCode )
    throws InvalidTypeForEncoding
{
    if( data == null )
        throw wrapper.nullParam() ;

    // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
    // the body of this method.  This is due to the fact that CDR*Stream
    // will never throw an exception if the encoding is invalid.  To
    // fix this, the CDROutputStream must know the version of GIOP it
    // is encoding for and it must check to ensure that, for example,
    // wstring cannot be encoded in GIOP 1.0.
    //
    // As part of the GIOP 1.2 work, the CDRInput and OutputStream will
    // be versioned.  This can be handled once this work is complete.

    // Create output stream with default endianness.
    EncapsOutputStream cdrOut =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(
        (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );

    // This is an encapsulation, so put out the endian:
    cdrOut.putEndian();

    // Sometimes encode type code:
    if( sendTypeCode ) {
        cdrOut.write_TypeCode( data.type() );
    }

    // Encode value and return.
    data.write_value( cdrOut );

    return cdrOut.toByteArray();
}
 
Example 13
Source File: CDREncapsCodec.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Convert the given any into a CDR encapsulated octet sequence.
 * If sendTypeCode is true, the type code is sent with the message, as in
 * a standard encapsulation.  If it is false, only the data is sent.
 * Either way, the endian type is sent as the first part of the message.
 */
private byte[] encodeImpl( Any data, boolean sendTypeCode )
    throws InvalidTypeForEncoding
{
    if( data == null )
        throw wrapper.nullParam() ;

    // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in
    // the body of this method.  This is due to the fact that CDR*Stream
    // will never throw an exception if the encoding is invalid.  To
    // fix this, the CDROutputStream must know the version of GIOP it
    // is encoding for and it must check to ensure that, for example,
    // wstring cannot be encoded in GIOP 1.0.
    //
    // As part of the GIOP 1.2 work, the CDRInput and OutputStream will
    // be versioned.  This can be handled once this work is complete.

    // Create output stream with default endianness.
    EncapsOutputStream cdrOut =
        sun.corba.OutputStreamFactory.newEncapsOutputStream(
        (com.sun.corba.se.spi.orb.ORB)orb, giopVersion );

    // This is an encapsulation, so put out the endian:
    cdrOut.putEndian();

    // Sometimes encode type code:
    if( sendTypeCode ) {
        cdrOut.write_TypeCode( data.type() );
    }

    // Encode value and return.
    data.write_value( cdrOut );

    return cdrOut.toByteArray();
}
 
Example 14
Source File: IDLJavaSerializationOutputStream.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public final void write_any(Any any) {
    if (any == null) {
        throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
    }
    write_TypeCode(any.type());
    any.write_value(parent);
}
 
Example 15
Source File: CorbaServerRequestDispatcherImpl.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/** Must always be called, just after the servant's method returns.
 *  Creates the ReplyMessage header and puts in the transaction context
 *  if necessary.
 */
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);

        // Check if the servant set a SystemException or
        // UserException
        CorbaMessageMediator resp;
        String repId=null;
        try {
            repId = excany.type().id();
        } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
            throw wrapper.problemWithExceptionTypecode( e ) ;
        }

        if (ORBUtility.isSystemException(repId)) {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling system exception");
            }

            // Get the exception object from the Any
            InputStream in = excany.create_input_stream();
            SystemException ex = ORBUtility.readSystemException(in);
            // Marshal the exception back
            resp = req.getProtocolHandler()
                .createSystemExceptionResponse(req, ex, scs);
        } else {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling user exception");
            }

            resp = req.getProtocolHandler()
                .createUserExceptionResponse(req, scs);
            OutputStream os = (OutputStream)resp.getOutputObject();
            excany.write_value(os);
        }

        return resp;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any<-: " + opAndId(req));
        }
    }
}
 
Example 16
Source File: CorbaServerRequestDispatcherImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/** Must always be called, just after the servant's method returns.
 *  Creates the ReplyMessage header and puts in the transaction context
 *  if necessary.
 */
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);

        // Check if the servant set a SystemException or
        // UserException
        CorbaMessageMediator resp;
        String repId=null;
        try {
            repId = excany.type().id();
        } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
            throw wrapper.problemWithExceptionTypecode( e ) ;
        }

        if (ORBUtility.isSystemException(repId)) {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling system exception");
            }

            // Get the exception object from the Any
            InputStream in = excany.create_input_stream();
            SystemException ex = ORBUtility.readSystemException(in);
            // Marshal the exception back
            resp = req.getProtocolHandler()
                .createSystemExceptionResponse(req, ex, scs);
        } else {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling user exception");
            }

            resp = req.getProtocolHandler()
                .createUserExceptionResponse(req, scs);
            OutputStream os = (OutputStream)resp.getOutputObject();
            excany.write_value(os);
        }

        return resp;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any<-: " + opAndId(req));
        }
    }
}
 
Example 17
Source File: CorbaServerRequestDispatcherImpl.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/** Must always be called, just after the servant's method returns.
 *  Creates the ReplyMessage header and puts in the transaction context
 *  if necessary.
 */
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);

        // Check if the servant set a SystemException or
        // UserException
        CorbaMessageMediator resp;
        String repId=null;
        try {
            repId = excany.type().id();
        } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
            throw wrapper.problemWithExceptionTypecode( e ) ;
        }

        if (ORBUtility.isSystemException(repId)) {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling system exception");
            }

            // Get the exception object from the Any
            InputStream in = excany.create_input_stream();
            SystemException ex = ORBUtility.readSystemException(in);
            // Marshal the exception back
            resp = req.getProtocolHandler()
                .createSystemExceptionResponse(req, ex, scs);
        } else {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling user exception");
            }

            resp = req.getProtocolHandler()
                .createUserExceptionResponse(req, scs);
            OutputStream os = (OutputStream)resp.getOutputObject();
            excany.write_value(os);
        }

        return resp;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any<-: " + opAndId(req));
        }
    }
}
 
Example 18
Source File: CorbaServerRequestDispatcherImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/** Must always be called, just after the servant's method returns.
 *  Creates the ReplyMessage header and puts in the transaction context
 *  if necessary.
 */
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);

        // Check if the servant set a SystemException or
        // UserException
        CorbaMessageMediator resp;
        String repId=null;
        try {
            repId = excany.type().id();
        } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
            throw wrapper.problemWithExceptionTypecode( e ) ;
        }

        if (ORBUtility.isSystemException(repId)) {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling system exception");
            }

            // Get the exception object from the Any
            InputStream in = excany.create_input_stream();
            SystemException ex = ORBUtility.readSystemException(in);
            // Marshal the exception back
            resp = req.getProtocolHandler()
                .createSystemExceptionResponse(req, ex, scs);
        } else {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling user exception");
            }

            resp = req.getProtocolHandler()
                .createUserExceptionResponse(req, scs);
            OutputStream os = (OutputStream)resp.getOutputObject();
            excany.write_value(os);
        }

        return resp;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any<-: " + opAndId(req));
        }
    }
}
 
Example 19
Source File: CorbaServerRequestDispatcherImpl.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/** Must always be called, just after the servant's method returns.
 *  Creates the ReplyMessage header and puts in the transaction context
 *  if necessary.
 */
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);

        // Check if the servant set a SystemException or
        // UserException
        CorbaMessageMediator resp;
        String repId=null;
        try {
            repId = excany.type().id();
        } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
            throw wrapper.problemWithExceptionTypecode( e ) ;
        }

        if (ORBUtility.isSystemException(repId)) {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling system exception");
            }

            // Get the exception object from the Any
            InputStream in = excany.create_input_stream();
            SystemException ex = ORBUtility.readSystemException(in);
            // Marshal the exception back
            resp = req.getProtocolHandler()
                .createSystemExceptionResponse(req, ex, scs);
        } else {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling user exception");
            }

            resp = req.getProtocolHandler()
                .createUserExceptionResponse(req, scs);
            OutputStream os = (OutputStream)resp.getOutputObject();
            excany.write_value(os);
        }

        return resp;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any<-: " + opAndId(req));
        }
    }
}
 
Example 20
Source File: CorbaServerRequestDispatcherImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/** Must always be called, just after the servant's method returns.
 *  Creates the ReplyMessage header and puts in the transaction context
 *  if necessary.
 */
protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any->: " + opAndId(req));
        }

        ServiceContexts scs = new ServiceContexts(orb);

        // Check if the servant set a SystemException or
        // UserException
        CorbaMessageMediator resp;
        String repId=null;
        try {
            repId = excany.type().id();
        } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
            throw wrapper.problemWithExceptionTypecode( e ) ;
        }

        if (ORBUtility.isSystemException(repId)) {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling system exception");
            }

            // Get the exception object from the Any
            InputStream in = excany.create_input_stream();
            SystemException ex = ORBUtility.readSystemException(in);
            // Marshal the exception back
            resp = req.getProtocolHandler()
                .createSystemExceptionResponse(req, ex, scs);
        } else {
            if (orb.subcontractDebugFlag) {
                dprint(".sendingReply/Any: " + opAndId(req)
                       + ": handling user exception");
            }

            resp = req.getProtocolHandler()
                .createUserExceptionResponse(req, scs);
            OutputStream os = (OutputStream)resp.getOutputObject();
            excany.write_value(os);
        }

        return resp;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".sendingReply/Any<-: " + opAndId(req));
        }
    }
}