Java Code Examples for org.omg.CORBA.portable.OutputStream

The following are top voted examples for showing how to use org.omg.CORBA.portable.OutputStream. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: openjdk-jdk10   File: StubIORImpl.java   View source code 6 votes vote down vote up
public StubIORImpl( org.omg.CORBA.Object obj )
{
    // write the IOR to an OutputStream and get an InputStream
    OutputStream ostr = StubAdapter.getORB( obj ).create_output_stream();
    ostr.write_Object(obj);
    InputStream istr = ostr.create_input_stream();

    // read the IOR components back from the stream
    int typeLength = istr.read_long();
    typeData = new byte[typeLength];
    istr.read_octet_array(typeData, 0, typeLength);
    int numProfiles = istr.read_long();
    profileTags = new int[numProfiles];
    profileData = new byte[numProfiles][];
    for (int i = 0; i < numProfiles; i++) {
        profileTags[i] = istr.read_long();
        profileData[i] = new byte[istr.read_long()];
        istr.read_octet_array(profileData[i], 0, profileData[i].length);
    }
}
 
Example 2
Project: openjdk-jdk10   File: StubIORImpl.java   View source code 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 3
Project: OpenJSharp   File: AnyImpl.java   View source code 6 votes vote down vote up
/**
 * returns an input stream that an Any value can be marshaled out of.
 *
 * @result          the InputStream to marshal value of Any out of.
 */
public org.omg.CORBA.portable.InputStream create_input_stream()
{
    //
    // We create a new InputStream so that multiple threads can call here
    // and read the streams in parallel without thread safety problems.
    //
    //debug.log ("create_input_stream");
    if (AnyImpl.isStreamed[realType().kind().value()]) {
        return stream.dup();
    } else {
        OutputStream os = (OutputStream)orb.create_output_stream();
        TCUtility.marshalIn(os, realType(), value, object);

        return os.create_input_stream();
    }
}
 
Example 4
Project: OpenJSharp   File: ServerRequestImpl.java   View source code 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 5
Project: OpenJSharp   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
public void writeTo(java.io.OutputStream s)
    throws java.io.IOException
{
    byte[] tmpBuf = null;

    if (bbwi.byteBuffer.hasArray())
    {
        tmpBuf = bbwi.byteBuffer.array();
    }
    else
    {
        int size = bbwi.position();
        tmpBuf = new byte[size];
        // Micro-benchmarks are showing a loop of ByteBuffer.get(int) is
        // faster than ByteBuffer.get(byte[], offset, length)
        for (int i = 0; i < size; i++)
            tmpBuf[i] = bbwi.byteBuffer.get(i);
    }

    s.write(tmpBuf, 0, bbwi.position());
}
 
Example 6
Project: OpenJSharp   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
public void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) {

        byte[] buf = null;

        if (bbwi.byteBuffer.hasArray())
        {
            buf = bbwi.byteBuffer.array();
        }
        else
        {
            int size = bbwi.position();
            buf = new byte[size];
            // Micro-benchmarks are showing a loop of ByteBuffer.get(int) is
            // faster than ByteBuffer.get(byte[], offset, length)
            for (int i = 0; i < size; i++)
                buf[i] = bbwi.byteBuffer.get(i);
        }

        s.write_long(bbwi.position());
        s.write_octet_array(buf, 0, bbwi.position());

    }
 
Example 7
Project: OpenJSharp   File: StubIORImpl.java   View source code 6 votes vote down vote up
public StubIORImpl( org.omg.CORBA.Object obj )
{
    // write the IOR to an OutputStream and get an InputStream
    OutputStream ostr = StubAdapter.getORB( obj ).create_output_stream();
    ostr.write_Object(obj);
    InputStream istr = ostr.create_input_stream();

    // read the IOR components back from the stream
    int typeLength = istr.read_long();
    typeData = new byte[typeLength];
    istr.read_octet_array(typeData, 0, typeLength);
    int numProfiles = istr.read_long();
    profileTags = new int[numProfiles];
    profileData = new byte[numProfiles][];
    for (int i = 0; i < numProfiles; i++) {
        profileTags[i] = istr.read_long();
        profileData[i] = new byte[istr.read_long()];
        istr.read_octet_array(profileData[i], 0, profileData[i].length);
    }
}
 
Example 8
Project: OpenJSharp   File: StubIORImpl.java   View source code 6 votes vote down vote up
public Delegate getDelegate( ORB orb )
{
    // write the IOR components to an org.omg.CORBA.portable.OutputStream
    OutputStream ostr = orb.create_output_stream();
    ostr.write_long(typeData.length);
    ostr.write_octet_array(typeData, 0, typeData.length);
    ostr.write_long(profileTags.length);
    for (int i = 0; i < profileTags.length; i++) {
        ostr.write_long(profileTags[i]);
        ostr.write_long(profileData[i].length);
        ostr.write_octet_array(profileData[i], 0, profileData[i].length);
    }

    InputStream istr = ostr.create_input_stream() ;

    // read the IOR back from the stream
    org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
    return StubAdapter.getDelegate( obj ) ;
}
 
Example 9
Project: openjdk-jdk10   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
public void writeTo(java.io.OutputStream s)
    throws java.io.IOException
{
    byte[] tmpBuf = null;

    if (bbwi.byteBuffer.hasArray())
    {
        tmpBuf = bbwi.byteBuffer.array();
    }
    else
    {
        int size = bbwi.position();
        tmpBuf = new byte[size];
        // Micro-benchmarks are showing a loop of ByteBuffer.get(int) is
        // faster than ByteBuffer.get(byte[], offset, length)
        for (int i = 0; i < size; i++)
            tmpBuf[i] = bbwi.byteBuffer.get(i);
    }

    s.write(tmpBuf, 0, bbwi.position());
}
 
Example 10
Project: openjdk-jdk10   File: AnyImpl.java   View source code 6 votes vote down vote up
/**
 * returns an input stream that an Any value can be marshaled out of.
 *
 * @return          the InputStream to marshal value of Any out of.
 */
public org.omg.CORBA.portable.InputStream create_input_stream()
{
    //
    // We create a new InputStream so that multiple threads can call here
    // and read the streams in parallel without thread safety problems.
    //
    //debug.log ("create_input_stream");
    if (AnyImpl.isStreamed[realType().kind().value()]) {
        return stream.dup();
    } else {
        OutputStream os = (OutputStream)orb.create_output_stream();
        TCUtility.marshalIn(os, realType(), value, object);

        return os.create_input_stream();
    }
}
 
Example 11
Project: openjdk-jdk10   File: ServerRequestImpl.java   View source code 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 12
Project: android-perftracking   File: EventWriterSpec.java   View source code 5 votes vote down vote up
private String extractWrittenString(OutputStream outputStream) throws IOException {
  ArgumentCaptor<byte[]> captor = ArgumentCaptor.forClass(byte[].class);
  verify(outputStream).write(captor.capture(), anyInt(), anyInt());
  byte[] writtenBytes = captor.getValue();
  assertThat(writtenBytes).isNotEmpty();
  return new String(writtenBytes);
}
 
Example 13
Project: OpenJSharp   File: AnyImpl.java   View source code 5 votes vote down vote up
/**
 * returns an output stream that an Any value can be marshaled into.
 *
 * @result          the OutputStream to marshal value of Any into
 */
public org.omg.CORBA.portable.OutputStream create_output_stream()
{
    //debug.log ("create_output_stream");
    final ORB finalorb = this.orb;
    return AccessController.doPrivileged(new PrivilegedAction<AnyOutputStream>() {
        @Override
        public AnyOutputStream run() {
            return new AnyOutputStream(finalorb);
        }
    });
}
 
Example 14
Project: OpenJSharp   File: AnyImpl.java   View source code 5 votes vote down vote up
public void write_value(OutputStream out)
{
    //debug.log ("write_value");
    if (AnyImpl.isStreamed[realType().kind().value()]) {
        typeCode.copy(stream.dup(), out);
    } else {
        // _REVISIT_ check isInitialized whether all we write is TypeCode!
        TCUtility.marshalIn(out, realType(), value, object);
    }
}
 
Example 15
Project: OpenJSharp   File: AnyImpl.java   View source code 5 votes vote down vote up
public Any extractAny(TypeCode memberType, ORB orb) {
    Any returnValue = orb.create_any();
    OutputStream out = returnValue.create_output_stream();
    TypeCodeImpl.convertToNative(orb, memberType).copy((InputStream)stream, out);
    returnValue.read_value(out.create_input_stream(), memberType);
    return returnValue;
}
 
Example 16
Project: OpenJSharp   File: AnyImpl.java   View source code 5 votes vote down vote up
static public Any extractAnyFromStream(TypeCode memberType, InputStream input, ORB orb) {
    Any returnValue = orb.create_any();
    OutputStream out = returnValue.create_output_stream();
    TypeCodeImpl.convertToNative(orb, memberType).copy(input, out);
    returnValue.read_value(out.create_input_stream(), memberType);
    return returnValue;
}
 
Example 17
Project: OpenJSharp   File: SpecialMethod.java   View source code 5 votes vote down vote up
public CorbaMessageMediator invoke(java.lang.Object servant,
                                   CorbaMessageMediator request,
                                   byte[] objectId,
                                   ObjectAdapter objectAdapter)
{
    boolean result = (servant == null) || (servant instanceof NullServant) ;
    CorbaMessageMediator response =
        request.getProtocolHandler().createResponse(request, null);
    ((OutputStream)response.getOutputObject()).write_boolean(result);
    return response;
}
 
Example 18
Project: OpenJSharp   File: SpecialMethod.java   View source code 5 votes vote down vote up
public CorbaMessageMediator invoke(java.lang.Object servant,
                                   CorbaMessageMediator request,
                                   byte[] objectId,
                                   ObjectAdapter objectAdapter)
{
    if ((servant == null) || (servant instanceof NullServant)) {
        ORB orb = (ORB)request.getBroker() ;
        ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
            CORBALogDomains.OA_INVOCATION ) ;

        return request.getProtocolHandler().createSystemExceptionResponse(
            request, wrapper.badSkeleton(), null);
    }

    String[] ids = objectAdapter.getInterfaces( servant, objectId );
    String clientId =
        ((InputStream)request.getInputObject()).read_string();
    boolean answer = false;
    for(int i = 0; i < ids.length; i++)
        if (ids[i].equals(clientId)) {
            answer = true;
            break;
        }

    CorbaMessageMediator response =
        request.getProtocolHandler().createResponse(request, null);
    ((OutputStream)response.getOutputObject()).write_boolean(answer);
    return response;
}
 
Example 19
Project: OpenJSharp   File: CorbaClientDelegateImpl.java   View source code 5 votes vote down vote up
public OutputStream request(org.omg.CORBA.Object self,
                            String operation,
                            boolean responseExpected)
{
    ClientInvocationInfo invocationInfo =
        orb.createOrIncrementInvocationInfo();
    Iterator contactInfoListIterator =
        invocationInfo.getContactInfoListIterator();
    if (contactInfoListIterator == null) {
        contactInfoListIterator = contactInfoList.iterator();
        invocationInfo.setContactInfoListIterator(contactInfoListIterator);
    }
    if (! contactInfoListIterator.hasNext()) {
        throw ((CorbaContactInfoListIterator)contactInfoListIterator)
            .getFailureException();
    }
    CorbaContactInfo contactInfo = (CorbaContactInfo) contactInfoListIterator.next();
    ClientRequestDispatcher subcontract = contactInfo.getClientRequestDispatcher();
    // Remember chosen subcontract for invoke and releaseReply.
    // NOTE: This is necessary since a stream is not available in
    // releaseReply if there is a client marshaling error or an
    // error in _invoke.
    invocationInfo.setClientRequestDispatcher(subcontract);
    return (OutputStream)
        subcontract.beginRequest(self, operation,
                                 !responseExpected, contactInfo);
}
 
Example 20
Project: OpenJSharp   File: CorbaClientDelegateImpl.java   View source code 5 votes vote down vote up
public InputStream invoke(org.omg.CORBA.Object self, OutputStream output)
    throws
        ApplicationException,
        RemarshalException
{
    ClientRequestDispatcher subcontract = getClientRequestDispatcher();
    return (InputStream)
        subcontract.marshalingComplete((Object)self, (OutputObject)output);
}
 
Example 21
Project: OpenJSharp   File: CorbaServerRequestDispatcherImpl.java   View source code 5 votes vote down vote up
protected CorbaMessageMediator handleDynamicResult(
    ServerRequestImpl sreq,
    CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult->: " + opAndId(req));
        }

        CorbaMessageMediator response = null ;

        // Check if ServerRequestImpl.result() has been called
        Any excany = sreq.checkResultCalled();

        if (excany == null) { // normal return
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling normal result");
            }

            // Marshal out/inout/return parameters into the ReplyMessage
            response = sendingReply(req);
            OutputStream os = (OutputStream) response.getOutputObject();
            sreq.marshalReplyParams(os);
        }  else {
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling error");
            }

            response = sendingReply(req, excany);
        }

        return response ;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult<-: " + opAndId(req));
        }
    }
}
 
Example 22
Project: openjdk-jdk10   File: Util.java   View source code 5 votes vote down vote up
/**
 * Writes any java.lang.Object as a CORBA any.
 * @param out the stream in which to write the any.
 * @param obj the object to write as an any.
 */
public static void writeAny(OutputStream out, Object obj) {

    if (utilDelegate != null) {
        utilDelegate.writeAny(out, obj);
    }
}
 
Example 23
Project: OpenJSharp   File: DynAnyConstructedImpl.java   View source code 5 votes vote down vote up
protected boolean initializeAnyFromComponents() {
    //System.out.println(this + " initializeAnyFromComponents");
    OutputStream out = any.create_output_stream();
    for (int i=0; i<components.length; i++) {
        if (components[i] instanceof DynAnyImpl) {
            ((DynAnyImpl)components[i]).writeAny(out);
        } else {
            // Not our implementation. Nothing we can do to prevent copying.
            components[i].to_any().write_value(out);
        }
    }
    any.read_value(out.create_input_stream(), any.type());
    return true;
}
 
Example 24
Project: OpenJSharp   File: DynSequenceImpl.java   View source code 5 votes vote down vote up
protected boolean initializeAnyFromComponents() {
    OutputStream out = any.create_output_stream();
    // Writing the length first is the only difference to supers implementation
    out.write_long(components.length);
    for (int i=0; i<components.length; i++) {
        if (components[i] instanceof DynAnyImpl) {
            ((DynAnyImpl)components[i]).writeAny(out);
        } else {
            // Not our implementation. Nothing we can do to prevent copying.
            components[i].to_any().write_value(out);
        }
    }
    any.read_value(out.create_input_stream(), any.type());
    return true;
}
 
Example 25
Project: OpenJSharp   File: Util.java   View source code 5 votes vote down vote up
/**
 * Writes any java.lang.Object as a CORBA any.
 * @param out the stream in which to write the any.
 * @param obj the object to write as an any.
 */
public void writeAny( org.omg.CORBA.portable.OutputStream out,
                     java.lang.Object obj)
{
    org.omg.CORBA.ORB orb = out.orb();

    // Create Any
    Any any = orb.create_any();

    // Make sure we have a connected object...
    java.lang.Object newObj = Utility.autoConnect(obj,orb,false);

    if (newObj instanceof org.omg.CORBA.Object) {
        any.insert_Object((org.omg.CORBA.Object)newObj);
    } else {
        if (newObj == null) {
            // Handle the null case, including backwards
            // compatibility issues
            any.insert_Value(null, createTypeCodeForNull(orb));
        } else {
            if (newObj instanceof Serializable) {
                // If they're our Any and ORB implementations,
                // we may want to do type code related versioning.
                TypeCode tc = createTypeCode((Serializable)newObj, any, orb);
                if (tc == null)
                    any.insert_Value((Serializable)newObj);
                else
                    any.insert_Value((Serializable)newObj, tc);
            } else if (newObj instanceof Remote) {
                ORBUtility.throwNotSerializableForCorba(newObj.getClass().getName());
            } else {
                ORBUtility.throwNotSerializableForCorba(newObj.getClass().getName());
            }
        }
    }

    out.write_any(any);
}
 
Example 26
Project: OpenJSharp   File: ORBUtility.java   View source code 5 votes vote down vote up
/**
 * Static method for writing a CORBA standard exception to an Any.
 * @param any The Any to write the SystemException into.
 */
public static void insertSystemException(SystemException ex, Any any) {
    OutputStream out = any.create_output_stream();
    ORB orb = (ORB)(out.orb());
    String name = ex.getClass().getName();
    String repID = ORBUtility.repositoryIdOf(name);
    out.write_string(repID);
    out.write_long(ex.minor);
    out.write_long(ex.completed.value());
    any.read_value(out.create_input_stream(),
        getSystemExceptionTypeCode(orb, repID, name));
}
 
Example 27
Project: openjdk-jdk10   File: IIOPOutputStream.java   View source code 5 votes vote down vote up
/**
 * Override the actions of the final method "writeObject()"
 * in ObjectOutputStream.
 * @since     JDK1.1.6
 */
public final void writeObjectOverride(Object obj)
    throws IOException
{
    writeObjectState.writeData(this);

    Util.writeAbstractObject((OutputStream)orbStream, obj);
}
 
Example 28
Project: OpenJSharp   File: Util.java   View source code 5 votes vote down vote up
/**
 * Writes any java.lang.Object as a CORBA any.
 * @param out the stream in which to write the any.
 * @param obj the object to write as an any.
 */
public static void writeAny(OutputStream out, Object obj) {

    if (utilDelegate != null) {
        utilDelegate.writeAny(out, obj);
    }
}
 
Example 29
Project: openjdk-jdk10   File: ObjectReferenceFactoryImpl.java   View source code 5 votes vote down vote up
/** Write the state to the OutputStream.
 */
public void _write( OutputStream os )
{
    org.omg.CORBA_2_3.portable.OutputStream ostr =
        (org.omg.CORBA_2_3.portable.OutputStream)os ;

    iorTemplates.write( ostr ) ;
}
 
Example 30
Project: openjdk-jdk10   File: StubAdapter.java   View source code 5 votes vote down vote up
public static OutputStream request( Object stub,
    String operation, boolean responseExpected )
{
    if (stub instanceof DynamicStub)
        return ((DynamicStub)stub).request( operation,
            responseExpected ) ;
    else if (stub instanceof ObjectImpl)
        return ((ObjectImpl)stub)._request( operation,
            responseExpected ) ;
    else
        throw wrapper.requestRequiresStub() ;
}
 
Example 31
Project: openjdk-jdk10   File: ORBUtility.java   View source code 5 votes vote down vote up
/**
 * Static method for writing a CORBA standard exception to a stream.
 * @param strm The OutputStream to use for marshaling.
 */
public static void writeSystemException(SystemException ex, OutputStream strm)
{
    String s;

    s = repositoryIdOf(ex.getClass().getName());
    strm.write_string(s);
    strm.write_long(ex.minor);
    strm.write_long(ex.completed.value());
}
 
Example 32
Project: openjdk-jdk10   File: AnyImpl.java   View source code 5 votes vote down vote up
/**
 * returns an output stream that an Any value can be marshaled into.
 *
 * @return          the OutputStream to marshal value of Any into
 */
public org.omg.CORBA.portable.OutputStream create_output_stream()
{
    //debug.log ("create_output_stream");
    final ORB finalorb = this.orb;
    return AccessController.doPrivileged(new PrivilegedAction<AnyOutputStream>() {
        @Override
        public AnyOutputStream run() {
            return new AnyOutputStream(finalorb);
        }
    });
}
 
Example 33
Project: openjdk-jdk10   File: ORBUtility.java   View source code 5 votes vote down vote up
/**
 * Static method for writing a CORBA standard exception to an Any.
 * @param any The Any to write the SystemException into.
 */
public static void insertSystemException(SystemException ex, Any any) {
    OutputStream out = any.create_output_stream();
    ORB orb = (ORB)(out.orb());
    String name = ex.getClass().getName();
    String repID = ORBUtility.repositoryIdOf(name);
    out.write_string(repID);
    out.write_long(ex.minor);
    out.write_long(ex.completed.value());
    any.read_value(out.create_input_stream(),
        getSystemExceptionTypeCode(orb, repID, name));
}
 
Example 34
Project: openjdk-jdk10   File: AnyImpl.java   View source code 5 votes vote down vote up
public Any extractAny(TypeCode memberType, ORB orb) {
    Any returnValue = orb.create_any();
    OutputStream out = returnValue.create_output_stream();
    TypeCodeImpl.convertToNative(orb, memberType).copy((InputStream)stream, out);
    returnValue.read_value(out.create_input_stream(), memberType);
    return returnValue;
}
 
Example 35
Project: openjdk-jdk10   File: AnyImpl.java   View source code 5 votes vote down vote up
static public Any extractAnyFromStream(TypeCode memberType, InputStream input, ORB orb) {
    Any returnValue = orb.create_any();
    OutputStream out = returnValue.create_output_stream();
    TypeCodeImpl.convertToNative(orb, memberType).copy(input, out);
    returnValue.read_value(out.create_input_stream(), memberType);
    return returnValue;
}
 
Example 36
Project: openjdk-jdk10   File: SpecialMethod.java   View source code 5 votes vote down vote up
public CorbaMessageMediator invoke(java.lang.Object servant,
                                   CorbaMessageMediator request,
                                   byte[] objectId,
                                   ObjectAdapter objectAdapter)
{
    boolean result = (servant == null) || (servant instanceof NullServant) ;
    CorbaMessageMediator response =
        request.getProtocolHandler().createResponse(request, null);
    ((OutputStream)response.getOutputObject()).write_boolean(result);
    return response;
}
 
Example 37
Project: openjdk-jdk10   File: SpecialMethod.java   View source code 5 votes vote down vote up
public CorbaMessageMediator invoke(java.lang.Object servant,
                                   CorbaMessageMediator request,
                                   byte[] objectId,
                                   ObjectAdapter objectAdapter)
{
    if ((servant == null) || (servant instanceof NullServant)) {
        ORB orb = (ORB)request.getBroker() ;
        ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
            CORBALogDomains.OA_INVOCATION ) ;

        return request.getProtocolHandler().createSystemExceptionResponse(
            request, wrapper.badSkeleton(), null);
    }

    String[] ids = objectAdapter.getInterfaces( servant, objectId );
    String clientId =
        ((InputStream)request.getInputObject()).read_string();
    boolean answer = false;
    for(int i = 0; i < ids.length; i++)
        if (ids[i].equals(clientId)) {
            answer = true;
            break;
        }

    CorbaMessageMediator response =
        request.getProtocolHandler().createResponse(request, null);
    ((OutputStream)response.getOutputObject()).write_boolean(answer);
    return response;
}
 
Example 38
Project: openjdk-jdk10   File: CorbaClientDelegateImpl.java   View source code 5 votes vote down vote up
public InputStream invoke(org.omg.CORBA.Object self, OutputStream output)
    throws
        ApplicationException,
        RemarshalException
{
    ClientRequestDispatcher subcontract = getClientRequestDispatcher();
    return (InputStream)
        subcontract.marshalingComplete((Object)self, (OutputObject)output);
}
 
Example 39
Project: openjdk-jdk10   File: CorbaServerRequestDispatcherImpl.java   View source code 5 votes vote down vote up
protected CorbaMessageMediator handleDynamicResult(
    ServerRequestImpl sreq,
    CorbaMessageMediator req)
{
    try {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult->: " + opAndId(req));
        }

        CorbaMessageMediator response = null ;

        // Check if ServerRequestImpl.result() has been called
        Any excany = sreq.checkResultCalled();

        if (excany == null) { // normal return
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling normal result");
            }

            // Marshal out/inout/return parameters into the ReplyMessage
            response = sendingReply(req);
            OutputStream os = (OutputStream) response.getOutputObject();
            sreq.marshalReplyParams(os);
        }  else {
            if (orb.subcontractDebugFlag) {
                dprint(".handleDynamicResult: " + opAndId(req)
                       + ": handling error");
            }

            response = sendingReply(req, excany);
        }

        return response ;
    } finally {
        if (orb.subcontractDebugFlag) {
            dprint(".handleDynamicResult<-: " + opAndId(req));
        }
    }
}
 
Example 40
Project: openjdk-jdk10   File: DynAnyConstructedImpl.java   View source code 5 votes vote down vote up
protected void writeAny(OutputStream out) {
    // If all we got is TypeCode representation (no value)
    // then we don't want to force creating a default value
    //System.out.println(this + " checkInitAny before writeAny");
    checkInitAny();
    super.writeAny(out);
}