Java Code Examples for com.sun.corba.se.impl.util.Utility

The following are top voted examples for showing how to use com.sun.corba.se.impl.util.Utility. 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: OpenJSharp   File: JavaStreamObjectCopierImpl.java   View source code 6 votes vote down vote up
public Object copy(Object obj) {
    if (obj instanceof Remote) {
        // Yes, so make sure it is connected and converted
        // to a stub (if needed)...
        return Utility.autoConnect(obj,orb,true);
    }

    try {
        ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ;
        ObjectOutputStream oos = new ObjectOutputStream( os ) ;
        oos.writeObject( obj ) ;

        byte[] arr = os.toByteArray() ;
        InputStream is = new ByteArrayInputStream( arr ) ;
        ObjectInputStream ois = new ObjectInputStream( is ) ;

        return ois.readObject();
    } catch (Exception exc) {
        System.out.println( "Failed with exception:" + exc ) ;
        return null ;
    }
}
 
Example 2
Project: OpenJSharp   File: PortableRemoteObject.java   View source code 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
Project: OpenJSharp   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
private void writeIDLValue(Serializable object, String repID)
{
    if (object instanceof StreamableValue) {
        ((StreamableValue)object)._write(parent);

    } else if (object instanceof CustomValue) {
        ((CustomValue)object).marshal(parent);

    } else {
        BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
        boolean isCustom = false;
        if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
            try {
                if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
                    isCustom = true;
            } catch(BadKind ex) {
                throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
                    ex ) ;
            }
        }
        if (isCustom)
            ((CustomMarshal)object).marshal(parent);
        else
            helper.write_value(parent, object);
    }
}
 
Example 4
Project: OpenJSharp   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 5
Project: openjdk-jdk10   File: JavaStreamObjectCopierImpl.java   View source code 6 votes vote down vote up
public Object copy(Object obj) {
    if (obj instanceof Remote) {
        // Yes, so make sure it is connected and converted
        // to a stub (if needed)...
        return Utility.autoConnect(obj,orb,true);
    }

    try {
        ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ;
        ObjectOutputStream oos = new ObjectOutputStream( os ) ;
        oos.writeObject( obj ) ;

        byte[] arr = os.toByteArray() ;
        InputStream is = new ByteArrayInputStream( arr ) ;
        ObjectInputStream ois = new ObjectInputStream( is ) ;

        return ois.readObject();
    } catch (Exception exc) {
        System.out.println( "Failed with exception:" + exc ) ;
        return null ;
    }
}
 
Example 6
Project: openjdk-jdk10   File: PortableRemoteObject.java   View source code 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 7
Project: openjdk-jdk10   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
private void writeIDLValue(Serializable object, String repID)
{
    if (object instanceof StreamableValue) {
        ((StreamableValue)object)._write(parent);

    } else if (object instanceof CustomValue) {
        ((CustomValue)object).marshal(parent);

    } else {
        BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
        boolean isCustom = false;
        if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
            try {
                if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
                    isCustom = true;
            } catch(BadKind ex) {
                throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
                    ex ) ;
            }
        }
        if (isCustom)
            ((CustomMarshal)object).marshal(parent);
        else
            helper.write_value(parent, object);
    }
}
 
Example 8
Project: openjdk-jdk10   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 9
Project: openjdk9   File: JavaStreamObjectCopierImpl.java   View source code 6 votes vote down vote up
public Object copy(Object obj) {
    if (obj instanceof Remote) {
        // Yes, so make sure it is connected and converted
        // to a stub (if needed)...
        return Utility.autoConnect(obj,orb,true);
    }

    try {
        ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ;
        ObjectOutputStream oos = new ObjectOutputStream( os ) ;
        oos.writeObject( obj ) ;

        byte[] arr = os.toByteArray() ;
        InputStream is = new ByteArrayInputStream( arr ) ;
        ObjectInputStream ois = new ObjectInputStream( is ) ;

        return ois.readObject();
    } catch (Exception exc) {
        System.out.println( "Failed with exception:" + exc ) ;
        return null ;
    }
}
 
Example 10
Project: openjdk9   File: PortableRemoteObject.java   View source code 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 11
Project: openjdk9   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
private void writeIDLValue(Serializable object, String repID)
{
    if (object instanceof StreamableValue) {
        ((StreamableValue)object)._write(parent);

    } else if (object instanceof CustomValue) {
        ((CustomValue)object).marshal(parent);

    } else {
        BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
        boolean isCustom = false;
        if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
            try {
                if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
                    isCustom = true;
            } catch(BadKind ex) {
                throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
                    ex ) ;
            }
        }
        if (isCustom)
            ((CustomMarshal)object).marshal(parent);
        else
            helper.write_value(parent, object);
    }
}
 
Example 12
Project: openjdk9   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 13
Project: lookaside_java-1.8.0-openjdk   File: JavaStreamObjectCopierImpl.java   View source code 6 votes vote down vote up
public Object copy(Object obj) {
    if (obj instanceof Remote) {
        // Yes, so make sure it is connected and converted
        // to a stub (if needed)...
        return Utility.autoConnect(obj,orb,true);
    }

    try {
        ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ;
        ObjectOutputStream oos = new ObjectOutputStream( os ) ;
        oos.writeObject( obj ) ;

        byte[] arr = os.toByteArray() ;
        InputStream is = new ByteArrayInputStream( arr ) ;
        ObjectInputStream ois = new ObjectInputStream( is ) ;

        return ois.readObject();
    } catch (Exception exc) {
        System.out.println( "Failed with exception:" + exc ) ;
        return null ;
    }
}
 
Example 14
Project: lookaside_java-1.8.0-openjdk   File: PortableRemoteObject.java   View source code 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 15
Project: lookaside_java-1.8.0-openjdk   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
private void writeIDLValue(Serializable object, String repID)
{
    if (object instanceof StreamableValue) {
        ((StreamableValue)object)._write(parent);

    } else if (object instanceof CustomValue) {
        ((CustomValue)object).marshal(parent);

    } else {
        BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
        boolean isCustom = false;
        if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
            try {
                if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
                    isCustom = true;
            } catch(BadKind ex) {
                throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
                    ex ) ;
            }
        }
        if (isCustom)
            ((CustomMarshal)object).marshal(parent);
        else
            helper.write_value(parent, object);
    }
}
 
Example 16
Project: lookaside_java-1.8.0-openjdk   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 17
Project: jdk8u_corba   File: JavaStreamObjectCopierImpl.java   View source code 6 votes vote down vote up
public Object copy(Object obj) {
    if (obj instanceof Remote) {
        // Yes, so make sure it is connected and converted
        // to a stub (if needed)...
        return Utility.autoConnect(obj,orb,true);
    }

    try {
        ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ;
        ObjectOutputStream oos = new ObjectOutputStream( os ) ;
        oos.writeObject( obj ) ;

        byte[] arr = os.toByteArray() ;
        InputStream is = new ByteArrayInputStream( arr ) ;
        ObjectInputStream ois = new ObjectInputStream( is ) ;

        return ois.readObject();
    } catch (Exception exc) {
        System.out.println( "Failed with exception:" + exc ) ;
        return null ;
    }
}
 
Example 18
Project: jdk8u_corba   File: PortableRemoteObject.java   View source code 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 19
Project: jdk8u_corba   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
private void writeIDLValue(Serializable object, String repID)
{
    if (object instanceof StreamableValue) {
        ((StreamableValue)object)._write(parent);

    } else if (object instanceof CustomValue) {
        ((CustomValue)object).marshal(parent);

    } else {
        BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
        boolean isCustom = false;
        if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
            try {
                if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
                    isCustom = true;
            } catch(BadKind ex) {
                throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
                    ex ) ;
            }
        }
        if (isCustom)
            ((CustomMarshal)object).marshal(parent);
        else
            helper.write_value(parent, object);
    }
}
 
Example 20
Project: jdk8u_corba   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 21
Project: infobip-open-jdk-8   File: JavaStreamObjectCopierImpl.java   View source code 6 votes vote down vote up
public Object copy(Object obj) {
    if (obj instanceof Remote) {
        // Yes, so make sure it is connected and converted
        // to a stub (if needed)...
        return Utility.autoConnect(obj,orb,true);
    }

    try {
        ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ;
        ObjectOutputStream oos = new ObjectOutputStream( os ) ;
        oos.writeObject( obj ) ;

        byte[] arr = os.toByteArray() ;
        InputStream is = new ByteArrayInputStream( arr ) ;
        ObjectInputStream ois = new ObjectInputStream( is ) ;

        return ois.readObject();
    } catch (Exception exc) {
        System.out.println( "Failed with exception:" + exc ) ;
        return null ;
    }
}
 
Example 22
Project: infobip-open-jdk-8   File: PortableRemoteObject.java   View source code 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 23
Project: infobip-open-jdk-8   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
private void writeIDLValue(Serializable object, String repID)
{
    if (object instanceof StreamableValue) {
        ((StreamableValue)object)._write(parent);

    } else if (object instanceof CustomValue) {
        ((CustomValue)object).marshal(parent);

    } else {
        BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
        boolean isCustom = false;
        if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
            try {
                if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
                    isCustom = true;
            } catch(BadKind ex) {
                throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
                    ex ) ;
            }
        }
        if (isCustom)
            ((CustomMarshal)object).marshal(parent);
        else
            helper.write_value(parent, object);
    }
}
 
Example 24
Project: infobip-open-jdk-8   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 25
Project: openjdk-source-code-learn   File: JavaStreamObjectCopierImpl.java   View source code 6 votes vote down vote up
public Object copy(Object obj) {
    if (obj instanceof Remote) {
        // Yes, so make sure it is connected and converted
        // to a stub (if needed)...
        return Utility.autoConnect(obj,orb,true);
    }

    try {
        ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ;
        ObjectOutputStream oos = new ObjectOutputStream( os ) ;
        oos.writeObject( obj ) ;

        byte[] arr = os.toByteArray() ;
        InputStream is = new ByteArrayInputStream( arr ) ;
        ObjectInputStream ois = new ObjectInputStream( is ) ;

        return ois.readObject();
    } catch (Exception exc) {
        System.out.println( "Failed with exception:" + exc ) ;
        return null ;
    }
}
 
Example 26
Project: openjdk-source-code-learn   File: PortableRemoteObject.java   View source code 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 27
Project: openjdk-source-code-learn   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
private void writeIDLValue(Serializable object, String repID)
{
    if (object instanceof StreamableValue) {
        ((StreamableValue)object)._write(parent);

    } else if (object instanceof CustomValue) {
        ((CustomValue)object).marshal(parent);

    } else {
        BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
        boolean isCustom = false;
        if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
            try {
                if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
                    isCustom = true;
            } catch(BadKind ex) {
                throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
                    ex ) ;
            }
        }
        if (isCustom)
            ((CustomMarshal)object).marshal(parent);
        else
            helper.write_value(parent, object);
    }
}
 
Example 28
Project: openjdk-source-code-learn   File: RepositoryId_1_3_1.java   View source code 6 votes vote down vote up
private static String getIdFromHelper(Class clazz){
    try {
        Class helperClazz = Utility.loadClassForClass(clazz.getName()+"Helper", null,
                                clazz.getClassLoader(), clazz, clazz.getClassLoader());
        Method idMethod = helperClazz.getDeclaredMethod("id", kNoParamTypes);
        return (String)idMethod.invoke(null, kNoArgs);
    }
    catch(java.lang.ClassNotFoundException cnfe)
        {
            throw new org.omg.CORBA.MARSHAL(cnfe.toString());
        }
    catch(java.lang.NoSuchMethodException nsme)
        {
            throw new org.omg.CORBA.MARSHAL(nsme.toString());
        }
    catch(java.lang.reflect.InvocationTargetException ite)
        {
            throw new org.omg.CORBA.MARSHAL(ite.toString());
        }
    catch(java.lang.IllegalAccessException iae)
        {
            throw new org.omg.CORBA.MARSHAL(iae.toString());
}
}
 
Example 29
Project: openjdk-source-code-learn   File: RepositoryId_1_3.java   View source code 6 votes vote down vote up
private static String getIdFromHelper(Class clazz){
    try {
        Class helperClazz = Utility.loadClassForClass(clazz.getName()+"Helper", null,
                                clazz.getClassLoader(), clazz, clazz.getClassLoader());
        Method idMethod = helperClazz.getDeclaredMethod("id", kNoParamTypes);
        return (String)idMethod.invoke(null, kNoArgs);
    }
    catch(java.lang.ClassNotFoundException cnfe)
        {
            throw new org.omg.CORBA.MARSHAL(cnfe.toString());
        }
    catch(java.lang.NoSuchMethodException nsme)
        {
            throw new org.omg.CORBA.MARSHAL(nsme.toString());
        }
    catch(java.lang.reflect.InvocationTargetException ite)
        {
            throw new org.omg.CORBA.MARSHAL(ite.toString());
        }
    catch(java.lang.IllegalAccessException iae)
        {
            throw new org.omg.CORBA.MARSHAL(iae.toString());
}
}
 
Example 30
Project: openjdk-source-code-learn   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 31
Project: OLD-OpenJDK8   File: JavaStreamObjectCopierImpl.java   View source code 6 votes vote down vote up
public Object copy(Object obj) {
    if (obj instanceof Remote) {
        // Yes, so make sure it is connected and converted
        // to a stub (if needed)...
        return Utility.autoConnect(obj,orb,true);
    }

    try {
        ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ;
        ObjectOutputStream oos = new ObjectOutputStream( os ) ;
        oos.writeObject( obj ) ;

        byte[] arr = os.toByteArray() ;
        InputStream is = new ByteArrayInputStream( arr ) ;
        ObjectInputStream ois = new ObjectInputStream( is ) ;

        return ois.readObject();
    } catch (Exception exc) {
        System.out.println( "Failed with exception:" + exc ) ;
        return null ;
    }
}
 
Example 32
Project: OLD-OpenJDK8   File: PortableRemoteObject.java   View source code 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 33
Project: OLD-OpenJDK8   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
private void writeIDLValue(Serializable object, String repID)
{
    if (object instanceof StreamableValue) {
        ((StreamableValue)object)._write(parent);

    } else if (object instanceof CustomValue) {
        ((CustomValue)object).marshal(parent);

    } else {
        BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
        boolean isCustom = false;
        if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
            try {
                if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
                    isCustom = true;
            } catch(BadKind ex) {
                throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
                    ex ) ;
            }
        }
        if (isCustom)
            ((CustomMarshal)object).marshal(parent);
        else
            helper.write_value(parent, object);
    }
}
 
Example 34
Project: OLD-OpenJDK8   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 35
Project: openjdk-orb   File: JavaStreamObjectCopierImpl.java   View source code 6 votes vote down vote up
public Object copy(Object obj) {
    if (obj instanceof Remote) {
        // Yes, so make sure it is connected and converted
        // to a stub (if needed)...
        return Utility.autoConnect(obj,orb,true);
    }

    try {
        ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ;
        ObjectOutputStream oos = new ObjectOutputStream( os ) ;
        oos.writeObject( obj ) ;

        byte[] arr = os.toByteArray() ;
        InputStream is = new ByteArrayInputStream( arr ) ;
        ObjectInputStream ois = new ObjectInputStream( is ) ;

        return ois.readObject();
    } catch (Exception exc) {
        System.out.println( "Failed with exception:" + exc ) ;
        return null ;
    }
}
 
Example 36
Project: openjdk-orb   File: PortableRemoteObject.java   View source code 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 37
Project: openjdk-orb   File: CDROutputStream_1_0.java   View source code 6 votes vote down vote up
private void writeIDLValue(Serializable object, String repID)
{
    if (object instanceof StreamableValue) {
        ((StreamableValue)object)._write(parent);

    } else if (object instanceof CustomValue) {
        ((CustomValue)object).marshal(parent);

    } else {
        BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
        boolean isCustom = false;
        if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
            try {
                if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
                    isCustom = true;
            } catch(BadKind ex) {
                throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
                    ex ) ;
            }
        }
        if (isCustom)
            ((CustomMarshal)object).marshal(parent);
        else
            helper.write_value(parent, object);
    }
}
 
Example 38
Project: openjdk-orb   File: ORBImpl.java   View source code 6 votes vote down vote up
/**
 * Finds and returns a value factory for the given repository ID.
 * The value factory returned was previously registered by a call to
 * {@link #register_value_factory} or is the default factory.
 *
 * @param repositoryID the repository ID.
 * @return the value factory.
 * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory.
 **/
public synchronized ValueFactory lookup_value_factory(String repositoryID)
{
    checkShutdownState();

    ValueFactory factory =
        (ValueFactory)valueFactoryCache.get(repositoryID);

    if (factory == null) {
        try {
            factory = Utility.getFactory(null, null, null, repositoryID);
        } catch(org.omg.CORBA.MARSHAL ex) {
            throw wrapper.unableFindValueFactory( ex ) ;
        }
    }

    return factory ;
}
 
Example 39
Project: openjdk-icedtea7   File: JavaStreamObjectCopierImpl.java   View source code 6 votes vote down vote up
public Object copy(Object obj) {
    if (obj instanceof Remote) {
        // Yes, so make sure it is connected and converted
        // to a stub (if needed)...
        return Utility.autoConnect(obj,orb,true);
    }

    try {
        ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ;
        ObjectOutputStream oos = new ObjectOutputStream( os ) ;
        oos.writeObject( obj ) ;

        byte[] arr = os.toByteArray() ;
        InputStream is = new ByteArrayInputStream( arr ) ;
        ObjectInputStream ois = new ObjectInputStream( is ) ;

        return ois.readObject();
    } catch (Exception exc) {
        System.out.println( "Failed with exception:" + exc ) ;
        return null ;
    }
}
 
Example 40
Project: openjdk-icedtea7   File: PortableRemoteObject.java   View source code 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.");
        }
    }
}