javax.rmi.CORBA.Util Java Examples

The following examples show how to use javax.rmi.CORBA.Util. 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: PortableRemoteObject.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    if (StubAdapter.isStub(obj) ||
        obj instanceof java.rmi.server.RemoteStub) {
        throw new NoSuchObjectException(
            "Can only unexport a server object.");
    }

    Tie theTie = Util.getTie(obj);
    if (theTie != null) {
        Util.unexportObject(obj);
    } else {
        if (Utility.loadTie(obj) == null) {
            UnicastRemoteObject.unexportObject(obj,true);
        } else {
            throw new NoSuchObjectException("Object not exported.");
        }
    }
}
 
Example #2
Source File: PortableRemoteObject.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Deregisters a server object from the runtime, allowing the object to become
 * available for garbage collection.
 * @param obj the object to unexport.
 * @exception NoSuchObjectException if the remote object is not
 * currently exported.
 */
public void unexportObject(Remote obj)
    throws NoSuchObjectException {

    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    if (StubAdapter.isStub(obj) ||
        obj instanceof java.rmi.server.RemoteStub) {
        throw new NoSuchObjectException(
            "Can only unexport a server object.");
    }

    Tie theTie = Util.getTie(obj);
    if (theTie != null) {
        Util.unexportObject(obj);
    } else {
        if (Utility.loadTie(obj) == null) {
            UnicastRemoteObject.unexportObject(obj,true);
        } else {
            throw new NoSuchObjectException("Object not exported.");
        }
    }
}
 
Example #3
Source File: ORBUtility.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * Returns the maximum stream format version supported by our
 * ValueHandler.
 */
public static byte getMaxStreamFormatVersion() {
    ValueHandler vh;
    try {
        vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() {
            public ValueHandler run() throws Exception {
                return Util.createValueHandler();
            }
        });
    } catch (PrivilegedActionException e) {
        throw new InternalError(e.getMessage());
    }

    if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat))
        return ORBConstants.STREAM_FORMAT_VERSION_1;
    else
        return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion();
}
 
Example #4
Source File: ORBUtility.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the maximum stream format version supported by our
 * ValueHandler.
 */
public static byte getMaxStreamFormatVersion() {
    ValueHandler vh;
    try {
        vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() {
            public ValueHandler run() throws Exception {
                return Util.createValueHandler();
            }
        });
    } catch (PrivilegedActionException e) {
        throw new InternalError(e.getMessage());
    }

    if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat))
        return ORBConstants.STREAM_FORMAT_VERSION_1;
    else
        return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion();
}
 
Example #5
Source File: ORBUtility.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the maximum stream format version supported by our
 * ValueHandler.
 */
public static byte getMaxStreamFormatVersion() {
    ValueHandler vh;
    try {
        vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() {
            public ValueHandler run() throws Exception {
                return Util.createValueHandler();
            }
        });
    } catch (PrivilegedActionException e) {
        throw new InternalError(e.getMessage());
    }

    if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat))
        return ORBConstants.STREAM_FORMAT_VERSION_1;
    else
        return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion();
}
 
Example #6
Source File: ORBUtility.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Returns the maximum stream format version supported by our
 * ValueHandler.
 */
public static byte getMaxStreamFormatVersion() {
    ValueHandler vh;
    try {
        vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() {
            public ValueHandler run() throws Exception {
                return Util.createValueHandler();
            }
        });
    } catch (PrivilegedActionException e) {
        throw new InternalError(e.getMessage());
    }

    if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat))
        return ORBConstants.STREAM_FORMAT_VERSION_1;
    else
        return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion();
}
 
Example #7
Source File: FVDCodeBaseImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public String implementation (String x){
    try{
        // default to using the current ORB version in case the
        // vhandler is not set
        if (vhandler == null) {
            vhandler = ValueHandlerImpl.getInstance(false);
        }

        // Util.getCodebase may return null which would
        // cause a BAD_PARAM exception.
        String result = Util.getCodebase(vhandler.getClassFromType(x));
        if (result == null)
            return "";
        else
            return result;
    } catch(ClassNotFoundException cnfe){
        throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE,
            cnfe ) ;
    }
}
 
Example #8
Source File: StubFactoryFactoryDynamicBase.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public PresentationManager.StubFactory createStubFactory(
    String className, boolean isIDLStub, String remoteCodeBase,
    Class expectedClass, ClassLoader classLoader)
{
    Class cls = null ;

    try {
        cls = Util.loadClass( className, remoteCodeBase, classLoader ) ;
    } catch (ClassNotFoundException exc) {
        throw wrapper.classNotFound3(
            CompletionStatus.COMPLETED_MAYBE, exc, className ) ;
    }

    PresentationManager pm = ORB.getPresentationManager() ;

    if (IDLEntity.class.isAssignableFrom( cls ) &&
        !Remote.class.isAssignableFrom( cls )) {
        // IDL stubs must always use static factories.
        PresentationManager.StubFactoryFactory sff =
            pm.getStubFactoryFactory( false ) ;
        PresentationManager.StubFactory sf =
            sff.createStubFactory( className, true, remoteCodeBase,
                expectedClass, classLoader ) ;
        return sf ;
    } else {
        PresentationManager.ClassData classData = pm.getClassData( cls ) ;
        return makeDynamicStubFactory( pm, classData, classLoader ) ;
    }
}
 
Example #9
Source File: CDROutputStream_1_0.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private void writeValueBase(org.omg.CORBA.portable.ValueBase object,
                            Class clazz) {
    // _REVISIT_ could check to see whether chunking really needed
    mustChunk = true;

    // Write value_tag
    int indirection = writeValueTag(true, true, Util.getCodebase(clazz));

    // Get rep id
    String repId = ((ValueBase)object)._truncatable_ids()[0];

    // Write rep id
    write_repositoryId(repId);

    // Add indirection for object to indirection table
    updateIndirectionTable(indirection, object, object);

    // Write Value chunk
    start_block();
    end_flag--;
    chunkedValueNestingLevel--;
    writeIDLValue(object, repId);
    end_block();

    // Write end tag
    writeEndTag(true);
}
 
Example #10
Source File: ORBUtility.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the maximum stream format version supported by our
 * ValueHandler.
 */
public static byte getMaxStreamFormatVersion() {
    ValueHandler vh = Util.createValueHandler();

    if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat))
        return ORBConstants.STREAM_FORMAT_VERSION_1;
    else
        return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion();
}
 
Example #11
Source File: CDROutputStream_1_0.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void writeValueBase(org.omg.CORBA.portable.ValueBase object,
                            Class clazz) {
    // _REVISIT_ could check to see whether chunking really needed
    mustChunk = true;

    // Write value_tag
    int indirection = writeValueTag(true, true, Util.getCodebase(clazz));

    // Get rep id
    String repId = ((ValueBase)object)._truncatable_ids()[0];

    // Write rep id
    write_repositoryId(repId);

    // Add indirection for object to indirection table
    updateIndirectionTable(indirection, object, object);

    // Write Value chunk
    start_block();
    end_flag--;
    chunkedValueNestingLevel--;
    writeIDLValue(object, repId);
    end_block();

    // Write end tag
    writeEndTag(true);
}
 
Example #12
Source File: DynamicMethodMarshallerImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public Object[] copyArguments( Object[] args,
    ORB orb ) throws RemoteException
{
    if (needsArgumentCopy)
        return Util.copyObjects( args, orb ) ;
    else
        return args ;
}
 
Example #13
Source File: StubFactoryFactoryDynamicBase.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public PresentationManager.StubFactory createStubFactory(
    String className, boolean isIDLStub, String remoteCodeBase,
    Class expectedClass, ClassLoader classLoader)
{
    Class cls = null ;

    try {
        cls = Util.loadClass( className, remoteCodeBase, classLoader ) ;
    } catch (ClassNotFoundException exc) {
        throw wrapper.classNotFound3(
            CompletionStatus.COMPLETED_MAYBE, exc, className ) ;
    }

    PresentationManager pm = ORB.getPresentationManager() ;

    if (IDLEntity.class.isAssignableFrom( cls ) &&
        !Remote.class.isAssignableFrom( cls )) {
        // IDL stubs must always use static factories.
        PresentationManager.StubFactoryFactory sff =
            pm.getStubFactoryFactory( false ) ;
        PresentationManager.StubFactory sf =
            sff.createStubFactory( className, true, remoteCodeBase,
                expectedClass, classLoader ) ;
        return sf ;
    } else {
        PresentationManager.ClassData classData = pm.getClassData( cls ) ;
        return makeDynamicStubFactory( pm, classData, classLoader ) ;
    }
}
 
Example #14
Source File: CDROutputStream_1_0.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example #15
Source File: CDROutputStream_1_0.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void writeClassBody(Class clz) {
    if (orb == null ||
        ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
        ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {

        write_value(Util.getCodebase(clz));
        write_value(repIdStrs.createForAnyType(clz));
    } else {

        write_value(repIdStrs.createForAnyType(clz));
        write_value(Util.getCodebase(clz));
    }
}
 
Example #16
Source File: PortableRemoteObject.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a stub for the given server object.
 * @param obj the server object for which a stub is required. Must either be a subclass
 * of PortableRemoteObject or have been previously the target of a call to
 * {@link #exportObject}.
 * @return the most derived stub for the object.
 * @exception NoSuchObjectException if a stub cannot be located for the given server object.
 */
public Remote toStub (Remote obj)
    throws NoSuchObjectException
{
    Remote result = null;
    if (obj == null) {
        throw new NullPointerException("invalid argument");
    }

    // If the class is already an IIOP stub then return it.
    if (StubAdapter.isStub( obj )) {
        return obj;
    }

    // If the class is already a JRMP stub then return it.
    if (obj instanceof java.rmi.server.RemoteStub) {
        return obj;
    }

    // Has it been exported to IIOP?
    Tie theTie = Util.getTie(obj);

    if (theTie != null) {
        result = Utility.loadStub(theTie,null,null,true);
    } else {
        if (Utility.loadTie(obj) == null) {
            result = java.rmi.server.RemoteObject.toStub(obj);
        }
    }

    if (result == null) {
        throw new NoSuchObjectException("object not exported");
    }

    return result;
}
 
Example #17
Source File: Utility.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static Class loadClassForClass (String className,
                                       String remoteCodebase,
                                       ClassLoader loader,
                                       Class relatedType,
                                       ClassLoader relatedTypeClassLoader)
    throws ClassNotFoundException
{
    if (relatedType == null)
        return Util.loadClass(className, remoteCodebase, loader);

    Class loadedClass = null;
    try {
        loadedClass = Util.loadClass(className, remoteCodebase, loader);
    } catch (ClassNotFoundException cnfe) {
        if (relatedType.getClassLoader() == null)
            throw cnfe;
    }

    // If no class was not loaded, or if the loaded class is not of the
    // correct type, make a further attempt to load the correct class
    // using the classloader of the related type.
    // _REVISIT_ Is this step necessary, or should the Util,loadClass
    // algorithm always produce a valid class if the setup is correct?
    // Does the OMG standard algorithm need to be changed to include
    // this step?
    if (loadedClass == null ||
        (loadedClass.getClassLoader() != null &&
         loadedClass.getClassLoader().loadClass(relatedType.getName()) !=
             relatedType))
    {
        if (relatedType.getClassLoader() != relatedTypeClassLoader)
            throw new IllegalArgumentException(
                "relatedTypeClassLoader not class loader of relatedType.");

        if (relatedTypeClassLoader != null)
            loadedClass = relatedTypeClassLoader.loadClass(className);
    }

    return loadedClass;
}
 
Example #18
Source File: IIOPOutputStream.java    From openjdk-8 with GNU General Public License v2.0 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 #19
Source File: Utility.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static Class loadClassForClass (String className,
                                       String remoteCodebase,
                                       ClassLoader loader,
                                       Class relatedType,
                                       ClassLoader relatedTypeClassLoader)
    throws ClassNotFoundException
{
    if (relatedType == null)
        return Util.loadClass(className, remoteCodebase, loader);

    Class loadedClass = null;
    try {
        loadedClass = Util.loadClass(className, remoteCodebase, loader);
    } catch (ClassNotFoundException cnfe) {
        if (relatedType.getClassLoader() == null)
            throw cnfe;
    }

    // If no class was not loaded, or if the loaded class is not of the
    // correct type, make a further attempt to load the correct class
    // using the classloader of the related type.
    // _REVISIT_ Is this step necessary, or should the Util,loadClass
    // algorithm always produce a valid class if the setup is correct?
    // Does the OMG standard algorithm need to be changed to include
    // this step?
    if (loadedClass == null ||
        (loadedClass.getClassLoader() != null &&
         loadedClass.getClassLoader().loadClass(relatedType.getName()) !=
             relatedType))
    {
        if (relatedType.getClassLoader() != relatedTypeClassLoader)
            throw new IllegalArgumentException(
                "relatedTypeClassLoader not class loader of relatedType.");

        if (relatedTypeClassLoader != null)
            loadedClass = relatedTypeClassLoader.loadClass(className);
    }

    return loadedClass;
}
 
Example #20
Source File: CDROutputStream_1_0.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example #21
Source File: Utility.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Get the helper for an IDLValue
 *
 * Throws MARSHAL exception if no helper found.
 */
public static BoxedValueHelper getHelper(Class clazz, String codebase,
    String repId)
{
    String className = null;
    if (clazz != null) {
        className = clazz.getName();
        if (codebase == null)
            codebase = Util.getCodebase(clazz);
    } else {
        if (repId != null)
            className = RepositoryId.cache.getId(repId).getClassName();
        if (className == null) // no repId or unrecognized repId
            throw wrapper.unableLocateValueHelper(
                CompletionStatus.COMPLETED_MAYBE);
    }

    try {
        ClassLoader clazzLoader =
            (clazz == null ? null : clazz.getClassLoader());
        Class helperClass =
            loadClassForClass(className+"Helper", codebase, clazzLoader,
            clazz, clazzLoader);
        return (BoxedValueHelper)helperClass.newInstance();

    } catch (ClassNotFoundException cnfe) {
        throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
            cnfe );
    } catch (IllegalAccessException iae) {
        throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
            iae );
    } catch (InstantiationException ie) {
        throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
            ie );
    } catch (ClassCastException cce) {
        throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
            cce );
    }
}
 
Example #22
Source File: CDROutputStream_1_0.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void writeValueBase(org.omg.CORBA.portable.ValueBase object,
                            Class clazz) {
    // _REVISIT_ could check to see whether chunking really needed
    mustChunk = true;

    // Write value_tag
    int indirection = writeValueTag(true, true, Util.getCodebase(clazz));

    // Get rep id
    String repId = ((ValueBase)object)._truncatable_ids()[0];

    // Write rep id
    write_repositoryId(repId);

    // Add indirection for object to indirection table
    updateIndirectionTable(indirection, object, object);

    // Write Value chunk
    start_block();
    end_flag--;
    chunkedValueNestingLevel--;
    writeIDLValue(object, repId);
    end_block();

    // Write end tag
    writeEndTag(true);
}
 
Example #23
Source File: CDROutputStream_1_0.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void writeArray(Serializable array, Class clazz) {

        if (valueHandler == null)
            valueHandler = ORBUtility.createValueHandler(); //d11638

        // Write value_tag
        int indirection = writeValueTag(mustChunk, true,
                                        Util.getCodebase(clazz));

        // Write repository ID
        write_repositoryId(repIdStrs.createSequenceRepID(clazz));

        // Add indirection for object to indirection table
        updateIndirectionTable(indirection, array, array);

        // Write Value chunk
        if (mustChunk) {
            start_block();
            end_flag--;
            chunkedValueNestingLevel--;
        } else
            end_flag--;

        if (valueHandler instanceof ValueHandlerMultiFormat) {
            ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
            vh.writeValue(parent, array, streamFormatVersion);
        } else
            valueHandler.writeValue(parent, array);

        if (mustChunk)
            end_block();

        // Write end tag
        writeEndTag(mustChunk);
    }
 
Example #24
Source File: RepositoryId.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public final Class getClassFromType()
    throws ClassNotFoundException {
    if (clazz != null)
        return clazz;

    Class specialCase = (Class)kSpecialCasesClasses.get(getClassName());

    if (specialCase != null){
        clazz = specialCase;
        return specialCase;
    }
    else
        {
            try{
                return Util.loadClass(getClassName(), null, null);
            }
            catch(ClassNotFoundException cnfe){
                if (defaultServerURL != null) {
                    try{
                        return getClassFromType(defaultServerURL);
                    }
                    catch(MalformedURLException mue){
                        throw cnfe;
                    }
                }
                else throw cnfe;
            }
        }

}
 
Example #25
Source File: StubFactoryFactoryDynamicBase.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public PresentationManager.StubFactory createStubFactory(
    String className, boolean isIDLStub, String remoteCodeBase,
    Class expectedClass, ClassLoader classLoader)
{
    Class cls = null ;

    try {
        cls = Util.loadClass( className, remoteCodeBase, classLoader ) ;
    } catch (ClassNotFoundException exc) {
        throw wrapper.classNotFound3(
            CompletionStatus.COMPLETED_MAYBE, exc, className ) ;
    }

    PresentationManager pm = ORB.getPresentationManager() ;

    if (IDLEntity.class.isAssignableFrom( cls ) &&
        !Remote.class.isAssignableFrom( cls )) {
        // IDL stubs must always use static factories.
        PresentationManager.StubFactoryFactory sff =
            pm.getStubFactoryFactory( false ) ;
        PresentationManager.StubFactory sf =
            sff.createStubFactory( className, true, remoteCodeBase,
                expectedClass, classLoader ) ;
        return sf ;
    } else {
        PresentationManager.ClassData classData = pm.getClassData( cls ) ;
        return makeDynamicStubFactory( pm, classData, classLoader ) ;
    }
}
 
Example #26
Source File: ObjectStreamTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Test(dataProvider = "Objects", enabled = true, dependsOnMethods = {"factCheck"})
void WriteValueObjectStreamTest01(Serializable value) throws Exception {
    ORB orb = (ORB) ORB.init(new String[0], null);

    OutputStream out = (OutputStream) orb.create_output_stream();
    Util.writeAny(out, value);

    InputStream in = (InputStream) out.create_input_stream();
    Object actual = Util.readAny(in);

    checkEquals(actual, value);
}
 
Example #27
Source File: StubFactoryFactoryDynamicBase.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public PresentationManager.StubFactory createStubFactory(
    String className, boolean isIDLStub, String remoteCodeBase,
    Class expectedClass, ClassLoader classLoader)
{
    Class cls = null ;

    try {
        cls = Util.loadClass( className, remoteCodeBase, classLoader ) ;
    } catch (ClassNotFoundException exc) {
        throw wrapper.classNotFound3(
            CompletionStatus.COMPLETED_MAYBE, exc, className ) ;
    }

    PresentationManager pm = ORB.getPresentationManager() ;

    if (IDLEntity.class.isAssignableFrom( cls ) &&
        !Remote.class.isAssignableFrom( cls )) {
        // IDL stubs must always use static factories.
        PresentationManager.StubFactoryFactory sff =
            pm.getStubFactoryFactory( false ) ;
        PresentationManager.StubFactory sf =
            sff.createStubFactory( className, true, remoteCodeBase,
                expectedClass, classLoader ) ;
        return sf ;
    } else {
        PresentationManager.ClassData classData = pm.getClassData( cls ) ;
        return makeDynamicStubFactory( pm, classData, classLoader ) ;
    }
}
 
Example #28
Source File: ORBUtility.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Return default ValueHandler
 */
public static ValueHandler createValueHandler() {
    ValueHandler vh;
    try {
        vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() {
            public ValueHandler run() throws Exception {
    return Util.createValueHandler();
}
        });
    } catch (PrivilegedActionException e) {
        throw new InternalError(e.getMessage());
    }
    return vh;
}
 
Example #29
Source File: IIOPOutputStream.java    From jdk8u60 with GNU General Public License v2.0 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 #30
Source File: DynamicMethodMarshallerImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public Object[] copyArguments( Object[] args,
    ORB orb ) throws RemoteException
{
    if (needsArgumentCopy)
        return Util.copyObjects( args, orb ) ;
    else
        return args ;
}