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

The following are top voted examples for showing how to use org.omg.CORBA.portable.IDLEntity. 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: RepositoryId.java   Source Code and License 6 votes vote down vote up
/**
 * Createa a repository ID for the type if it is either a java type
 * or an IDL type.
 * @param type The type to create rep. id for
 * @return The rep. id.
 **/
public static String createForAnyType(Class type) {
    try{
        if (type.isArray())
            return createSequenceRepID(type);
        else if (IDLEntity.class.isAssignableFrom(type))
            {
                try{
                    return getIdFromHelper(type);
                }
                catch(Throwable t) {
                    return createForIDLType(type, 1, 0);
                }
            }
        else return createForJavaType(type);
    }
    catch(com.sun.corba.se.impl.io.TypeMismatchException e){
        return null;
    }

}
 
Example 2
Project: openjdk-jdk10   File: RepositoryId.java   Source Code and License 6 votes vote down vote up
/**
 * Createa a repository ID for the type if it is either a java type
 * or an IDL type.
 * @param type The type to create rep. id for
 * @return The rep. id.
 **/
public static String createForAnyType(Class type) {
    try{
        if (type.isArray())
            return createSequenceRepID(type);
        else if (IDLEntity.class.isAssignableFrom(type))
            {
                try{
                    return getIdFromHelper(type);
                }
                catch(Throwable t) {
                    return createForIDLType(type, 1, 0);
                }
            }
        else return createForJavaType(type);
    }
    catch(com.sun.corba.se.impl.io.TypeMismatchException e){
        return null;
    }

}
 
Example 3
Project: openjdk9   File: RepositoryId.java   Source Code and License 6 votes vote down vote up
/**
 * Createa a repository ID for the type if it is either a java type
 * or an IDL type.
 * @param type The type to create rep. id for
 * @return The rep. id.
 **/
public static String createForAnyType(Class type) {
    try{
        if (type.isArray())
            return createSequenceRepID(type);
        else if (IDLEntity.class.isAssignableFrom(type))
            {
                try{
                    return getIdFromHelper(type);
                }
                catch(Throwable t) {
                    return createForIDLType(type, 1, 0);
                }
            }
        else return createForJavaType(type);
    }
    catch(com.sun.corba.se.impl.io.TypeMismatchException e){
        return null;
    }

}
 
Example 4
Project: lookaside_java-1.8.0-openjdk   File: RepositoryId.java   Source Code and License 6 votes vote down vote up
/**
 * Createa a repository ID for the type if it is either a java type
 * or an IDL type.
 * @param type The type to create rep. id for
 * @return The rep. id.
 **/
public static String createForAnyType(Class type) {
    try{
        if (type.isArray())
            return createSequenceRepID(type);
        else if (IDLEntity.class.isAssignableFrom(type))
            {
                try{
                    return getIdFromHelper(type);
                }
                catch(Throwable t) {
                    return createForIDLType(type, 1, 0);
                }
            }
        else return createForJavaType(type);
    }
    catch(com.sun.corba.se.impl.io.TypeMismatchException e){
        return null;
    }

}
 
Example 5
Project: jdk8u_corba   File: RepositoryId.java   Source Code and License 6 votes vote down vote up
/**
 * Createa a repository ID for the type if it is either a java type
 * or an IDL type.
 * @param type The type to create rep. id for
 * @return The rep. id.
 **/
public static String createForAnyType(Class type) {
    try{
        if (type.isArray())
            return createSequenceRepID(type);
        else if (IDLEntity.class.isAssignableFrom(type))
            {
                try{
                    return getIdFromHelper(type);
                }
                catch(Throwable t) {
                    return createForIDLType(type, 1, 0);
                }
            }
        else return createForJavaType(type);
    }
    catch(com.sun.corba.se.impl.io.TypeMismatchException e){
        return null;
    }

}
 
Example 6
Project: infobip-open-jdk-8   File: RepositoryId.java   Source Code and License 6 votes vote down vote up
/**
 * Createa a repository ID for the type if it is either a java type
 * or an IDL type.
 * @param type The type to create rep. id for
 * @return The rep. id.
 **/
public static String createForAnyType(Class type) {
    try{
        if (type.isArray())
            return createSequenceRepID(type);
        else if (IDLEntity.class.isAssignableFrom(type))
            {
                try{
                    return getIdFromHelper(type);
                }
                catch(Throwable t) {
                    return createForIDLType(type, 1, 0);
                }
            }
        else return createForJavaType(type);
    }
    catch(com.sun.corba.se.impl.io.TypeMismatchException e){
        return null;
    }

}
 
Example 7
Project: openjdk-source-code-learn   File: RepositoryId_1_3_1.java   Source Code and License 6 votes vote down vote up
/**
 * Createa a repository ID for the type if it is either a java type
 * or an IDL type.
 * @param type The type to create rep. id for
 * @return The rep. id.
 **/
public static String createForAnyType(Class type) {
    try{
        if (type.isArray())
            return createSequenceRepID(type);
        else if (IDLEntity.class.isAssignableFrom(type))
            {
                try{
                    return getIdFromHelper(type);
                }
                catch(Throwable t) {
                    return createForIDLType(type, 1, 0);
                }
            }
        else return createForJavaType(type);
    }
    catch(com.sun.corba.se.impl.io.TypeMismatchException e){
        return null;
    }

}
 
Example 8
Project: openjdk-source-code-learn   File: RepositoryId_1_3.java   Source Code and License 6 votes vote down vote up
/**
 * Createa a repository ID for the type if it is either a java type
 * or an IDL type.
 * @param type The type to create rep. id for
 * @return The rep. id.
 **/
public static String createForAnyType(Class type) {
    try{
        if (type.isArray())
            return createSequenceRepID(type);
        else if (IDLEntity.class.isAssignableFrom(type))
            {
                try{
                    return getIdFromHelper(type);
                }
                catch(Throwable t) {
                    return createForIDLType(type, 1, 0);
                }
            }
        else return createForJavaType(type);
    }
    catch(com.sun.corba.se.impl.io.TypeMismatchException e){
        return null;
    }

}
 
Example 9
Project: openjdk-source-code-learn   File: RepositoryId.java   Source Code and License 6 votes vote down vote up
/**
 * Createa a repository ID for the type if it is either a java type
 * or an IDL type.
 * @param type The type to create rep. id for
 * @return The rep. id.
 **/
public static String createForAnyType(Class type) {
    try{
        if (type.isArray())
            return createSequenceRepID(type);
        else if (IDLEntity.class.isAssignableFrom(type))
            {
                try{
                    return getIdFromHelper(type);
                }
                catch(Throwable t) {
                    return createForIDLType(type, 1, 0);
                }
            }
        else return createForJavaType(type);
    }
    catch(com.sun.corba.se.impl.io.TypeMismatchException e){
        return null;
    }

}
 
Example 10
Project: OLD-OpenJDK8   File: RepositoryId.java   Source Code and License 6 votes vote down vote up
/**
 * Createa a repository ID for the type if it is either a java type
 * or an IDL type.
 * @param type The type to create rep. id for
 * @return The rep. id.
 **/
public static String createForAnyType(Class type) {
    try{
        if (type.isArray())
            return createSequenceRepID(type);
        else if (IDLEntity.class.isAssignableFrom(type))
            {
                try{
                    return getIdFromHelper(type);
                }
                catch(Throwable t) {
                    return createForIDLType(type, 1, 0);
                }
            }
        else return createForJavaType(type);
    }
    catch(com.sun.corba.se.impl.io.TypeMismatchException e){
        return null;
    }

}
 
Example 11
Project: openjdk-orb   File: RepositoryId.java   Source Code and License 6 votes vote down vote up
/**
 * Createa a repository ID for the type if it is either a java type
 * or an IDL type.
 * @param type The type to create rep. id for
 * @return The rep. id.
 **/
public static String createForAnyType(Class type) {
    try{
        if (type.isArray())
            return createSequenceRepID(type);
        else if (IDLEntity.class.isAssignableFrom(type))
            {
                try{
                    return getIdFromHelper(type);
                }
                catch(Throwable t) {
                    return createForIDLType(type, 1, 0);
                }
            }
        else return createForJavaType(type);
    }
    catch(com.sun.corba.se.impl.io.TypeMismatchException e){
        return null;
    }

}
 
Example 12
Project: openjdk-icedtea7   File: RepositoryId.java   Source Code and License 6 votes vote down vote up
/**
 * Createa a repository ID for the type if it is either a java type
 * or an IDL type.
 * @param type The type to create rep. id for
 * @return The rep. id.
 **/
public static String createForAnyType(Class type) {
    try{
        if (type.isArray())
            return createSequenceRepID(type);
        else if (IDLEntity.class.isAssignableFrom(type))
            {
                try{
                    return getIdFromHelper(type);
                }
                catch(Throwable t) {
                    return createForIDLType(type, 1, 0);
                }
            }
        else return createForJavaType(type);
    }
    catch(com.sun.corba.se.impl.io.TypeMismatchException e){
        return null;
    }

}
 
Example 13
Project: OpenJSharp   File: StubFactoryFactoryDynamicBase.java   Source Code and License 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
Project: OpenJSharp   File: DynamicMethodMarshallerImpl.java   Source Code and License 5 votes vote down vote up
private static boolean isAbstractInterface( Class cls )
{
    // Either cls is an interface that extends IDLEntity, or else
    // cls does not extend java.rmi.Remote and all of its methods
    // throw RemoteException.
    if (IDLEntity.class.isAssignableFrom( cls ))
        return cls.isInterface() ;
    else
        return cls.isInterface() && allMethodsThrowRemoteException( cls ) ;
}
 
Example 15
Project: OpenJSharp   File: RepositoryId.java   Source Code and License 5 votes vote down vote up
public static boolean isAbstractBase(Class clazz) {
    return (clazz.isInterface() &&
            IDLEntity.class.isAssignableFrom(clazz) &&
            (!ValueBase.class.isAssignableFrom(clazz)) &&
            (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));

}
 
Example 16
Project: openjdk-jdk10   File: StubFactoryFactoryDynamicBase.java   Source Code and License 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 17
Project: openjdk-jdk10   File: DynamicMethodMarshallerImpl.java   Source Code and License 5 votes vote down vote up
private static boolean isAbstractInterface( Class cls )
{
    // Either cls is an interface that extends IDLEntity, or else
    // cls does not extend java.rmi.Remote and all of its methods
    // throw RemoteException.
    if (IDLEntity.class.isAssignableFrom( cls ))
        return cls.isInterface() ;
    else
        return cls.isInterface() && allMethodsThrowRemoteException( cls ) ;
}
 
Example 18
Project: openjdk-jdk10   File: RepositoryId.java   Source Code and License 5 votes vote down vote up
public static boolean isAbstractBase(Class clazz) {
    return (clazz.isInterface() &&
            IDLEntity.class.isAssignableFrom(clazz) &&
            (!ValueBase.class.isAssignableFrom(clazz)) &&
            (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));

}
 
Example 19
Project: openjdk9   File: StubFactoryFactoryDynamicBase.java   Source Code and License 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 20
Project: openjdk9   File: DynamicMethodMarshallerImpl.java   Source Code and License 5 votes vote down vote up
private static boolean isAbstractInterface( Class cls )
{
    // Either cls is an interface that extends IDLEntity, or else
    // cls does not extend java.rmi.Remote and all of its methods
    // throw RemoteException.
    if (IDLEntity.class.isAssignableFrom( cls ))
        return cls.isInterface() ;
    else
        return cls.isInterface() && allMethodsThrowRemoteException( cls ) ;
}
 
Example 21
Project: openjdk9   File: RepositoryId.java   Source Code and License 5 votes vote down vote up
public static boolean isAbstractBase(Class clazz) {
    return (clazz.isInterface() &&
            IDLEntity.class.isAssignableFrom(clazz) &&
            (!ValueBase.class.isAssignableFrom(clazz)) &&
            (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));

}
 
Example 22
Project: lookaside_java-1.8.0-openjdk   File: StubFactoryFactoryDynamicBase.java   Source Code and License 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 23
Project: lookaside_java-1.8.0-openjdk   File: DynamicMethodMarshallerImpl.java   Source Code and License 5 votes vote down vote up
private static boolean isAbstractInterface( Class cls )
{
    // Either cls is an interface that extends IDLEntity, or else
    // cls does not extend java.rmi.Remote and all of its methods
    // throw RemoteException.
    if (IDLEntity.class.isAssignableFrom( cls ))
        return cls.isInterface() ;
    else
        return cls.isInterface() && allMethodsThrowRemoteException( cls ) ;
}
 
Example 24
Project: lookaside_java-1.8.0-openjdk   File: RepositoryId.java   Source Code and License 5 votes vote down vote up
public static boolean isAbstractBase(Class clazz) {
    return (clazz.isInterface() &&
            IDLEntity.class.isAssignableFrom(clazz) &&
            (!ValueBase.class.isAssignableFrom(clazz)) &&
            (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));

}
 
Example 25
Project: jdk8u_corba   File: StubFactoryFactoryDynamicBase.java   Source Code and License 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
Project: jdk8u_corba   File: DynamicMethodMarshallerImpl.java   Source Code and License 5 votes vote down vote up
private static boolean isAbstractInterface( Class cls )
{
    // Either cls is an interface that extends IDLEntity, or else
    // cls does not extend java.rmi.Remote and all of its methods
    // throw RemoteException.
    if (IDLEntity.class.isAssignableFrom( cls ))
        return cls.isInterface() ;
    else
        return cls.isInterface() && allMethodsThrowRemoteException( cls ) ;
}
 
Example 27
Project: jdk8u_corba   File: RepositoryId.java   Source Code and License 5 votes vote down vote up
public static boolean isAbstractBase(Class clazz) {
    return (clazz.isInterface() &&
            IDLEntity.class.isAssignableFrom(clazz) &&
            (!ValueBase.class.isAssignableFrom(clazz)) &&
            (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));

}
 
Example 28
Project: javify   File: ObjectCreator.java   Source Code and License 5 votes vote down vote up
/**
 * Convert the class name to IDL or RMI name (repository id). If the class
 * inherits from IDLEntity, ValueBase or SystemException, returns repository
 * Id in the IDL:(..) form. If it does not, returns repository Id in the
 * RMI:(..) form.
 *
 * @param cx the class for that the name must be computed.
 *
 * @return the idl or rmi name.
 */
public static synchronized String getRepositoryId(Class cx)
{
  String name = (String) m_names.get(cx);
  if (name != null)
    return name;

  String cn = cx.getName();
  if (!(IDLEntity.class.isAssignableFrom(cx)
    || ValueBase.class.isAssignableFrom(cx) || SystemException.class.isAssignableFrom(cx)))
    {
      // Not an IDL entity.
      name = Util.createValueHandler().getRMIRepositoryID(cx);
    }
  else
    {
      if (cn.startsWith(JAVA_PREFIX))
        cn = OMG_PREFIX
          + cn.substring(JAVA_PREFIX.length()).replace('.', '/');
      else if (cn.startsWith(CLASSPATH_PREFIX))
        cn = OMG_PREFIX
          + cn.substring(CLASSPATH_PREFIX.length()).replace('.', '/');

      name = "IDL:" + cn + ":1.0";
    }
  m_names.put(cx, name);
  return name;
}
 
Example 29
Project: jvm-stm   File: ObjectCreator.java   Source Code and License 5 votes vote down vote up
/**
 * Convert the class name to IDL or RMI name (repository id). If the class
 * inherits from IDLEntity, ValueBase or SystemException, returns repository
 * Id in the IDL:(..) form. If it does not, returns repository Id in the
 * RMI:(..) form.
 * 
 * @param cx the class for that the name must be computed.
 * 
 * @return the idl or rmi name.
 */
public static synchronized String getRepositoryId(Class cx)
{
  String name = (String) m_names.get(cx);
  if (name != null)
    return name;

  String cn = cx.getName();
  if (!(IDLEntity.class.isAssignableFrom(cx)
    || ValueBase.class.isAssignableFrom(cx) || SystemException.class.isAssignableFrom(cx)))
    {
      // Not an IDL entity.
      name = Util.createValueHandler().getRMIRepositoryID(cx);
    }
  else
    {
      if (cn.startsWith(JAVA_PREFIX))
        cn = OMG_PREFIX
          + cn.substring(JAVA_PREFIX.length()).replace('.', '/');
      else if (cn.startsWith(CLASSPATH_PREFIX))
        cn = OMG_PREFIX
          + cn.substring(CLASSPATH_PREFIX.length()).replace('.', '/');

      name = "IDL:" + cn + ":1.0";
    }
  m_names.put(cx, name);
  return name;
}
 
Example 30
Project: infobip-open-jdk-8   File: StubFactoryFactoryDynamicBase.java   Source Code and License 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 31
Project: infobip-open-jdk-8   File: DynamicMethodMarshallerImpl.java   Source Code and License 5 votes vote down vote up
private static boolean isAbstractInterface( Class cls )
{
    // Either cls is an interface that extends IDLEntity, or else
    // cls does not extend java.rmi.Remote and all of its methods
    // throw RemoteException.
    if (IDLEntity.class.isAssignableFrom( cls ))
        return cls.isInterface() ;
    else
        return cls.isInterface() && allMethodsThrowRemoteException( cls ) ;
}
 
Example 32
Project: infobip-open-jdk-8   File: RepositoryId.java   Source Code and License 5 votes vote down vote up
public static boolean isAbstractBase(Class clazz) {
    return (clazz.isInterface() &&
            IDLEntity.class.isAssignableFrom(clazz) &&
            (!ValueBase.class.isAssignableFrom(clazz)) &&
            (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));

}
 
Example 33
Project: openjdk-source-code-learn   File: StubFactoryFactoryDynamicBase.java   Source Code and License 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 34
Project: openjdk-source-code-learn   File: DynamicMethodMarshallerImpl.java   Source Code and License 5 votes vote down vote up
private static boolean isAbstractInterface( Class cls )
{
    // Either cls is an interface that extends IDLEntity, or else
    // cls does not extend java.rmi.Remote and all of its methods
    // throw RemoteException.
    if (IDLEntity.class.isAssignableFrom( cls ))
        return cls.isInterface() ;
    else
        return cls.isInterface() && allMethodsThrowRemoteException( cls ) ;
}
 
Example 35
Project: openjdk-source-code-learn   File: RepositoryId_1_3_1.java   Source Code and License 5 votes vote down vote up
public static boolean isAbstractBase(Class clazz) {
    return (clazz.isInterface() &&
            IDLEntity.class.isAssignableFrom(clazz) &&
            (!ValueBase.class.isAssignableFrom(clazz)) &&
            (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));

}
 
Example 36
Project: openjdk-source-code-learn   File: RepositoryId_1_3.java   Source Code and License 5 votes vote down vote up
public static boolean isAbstractBase(Class clazz) {
    return (clazz.isInterface() &&
            IDLEntity.class.isAssignableFrom(clazz) &&
            (!ValueBase.class.isAssignableFrom(clazz)) &&
            (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));

}
 
Example 37
Project: openjdk-source-code-learn   File: RepositoryId.java   Source Code and License 5 votes vote down vote up
public static boolean isAbstractBase(Class clazz) {
    return (clazz.isInterface() &&
            IDLEntity.class.isAssignableFrom(clazz) &&
            (!ValueBase.class.isAssignableFrom(clazz)) &&
            (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));

}
 
Example 38
Project: OLD-OpenJDK8   File: StubFactoryFactoryDynamicBase.java   Source Code and License 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 39
Project: OLD-OpenJDK8   File: DynamicMethodMarshallerImpl.java   Source Code and License 5 votes vote down vote up
private static boolean isAbstractInterface( Class cls )
{
    // Either cls is an interface that extends IDLEntity, or else
    // cls does not extend java.rmi.Remote and all of its methods
    // throw RemoteException.
    if (IDLEntity.class.isAssignableFrom( cls ))
        return cls.isInterface() ;
    else
        return cls.isInterface() && allMethodsThrowRemoteException( cls ) ;
}
 
Example 40
Project: OLD-OpenJDK8   File: RepositoryId.java   Source Code and License 5 votes vote down vote up
public static boolean isAbstractBase(Class clazz) {
    return (clazz.isInterface() &&
            IDLEntity.class.isAssignableFrom(clazz) &&
            (!ValueBase.class.isAssignableFrom(clazz)) &&
            (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));

}
 
Example 41
Project: JamVM-PH   File: ObjectCreator.java   Source Code and License 5 votes vote down vote up
/**
 * Convert the class name to IDL or RMI name (repository id). If the class
 * inherits from IDLEntity, ValueBase or SystemException, returns repository
 * Id in the IDL:(..) form. If it does not, returns repository Id in the
 * RMI:(..) form.
 * 
 * @param cx the class for that the name must be computed.
 * 
 * @return the idl or rmi name.
 */
public static synchronized String getRepositoryId(Class cx)
{
  String name = (String) m_names.get(cx);
  if (name != null)
    return name;

  String cn = cx.getName();
  if (!(IDLEntity.class.isAssignableFrom(cx)
    || ValueBase.class.isAssignableFrom(cx) || SystemException.class.isAssignableFrom(cx)))
    {
      // Not an IDL entity.
      name = Util.createValueHandler().getRMIRepositoryID(cx);
    }
  else
    {
      if (cn.startsWith(JAVA_PREFIX))
        cn = OMG_PREFIX
          + cn.substring(JAVA_PREFIX.length()).replace('.', '/');
      else if (cn.startsWith(CLASSPATH_PREFIX))
        cn = OMG_PREFIX
          + cn.substring(CLASSPATH_PREFIX.length()).replace('.', '/');

      name = "IDL:" + cn + ":1.0";
    }
  m_names.put(cx, name);
  return name;
}
 
Example 42
Project: openjdk-orb   File: StubFactoryFactoryDynamicBase.java   Source Code and License 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 43
Project: openjdk-orb   File: DynamicMethodMarshallerImpl.java   Source Code and License 5 votes vote down vote up
private static boolean isAbstractInterface( Class cls )
{
    // Either cls is an interface that extends IDLEntity, or else
    // cls does not extend java.rmi.Remote and all of its methods
    // throw RemoteException.
    if (IDLEntity.class.isAssignableFrom( cls ))
        return cls.isInterface() ;
    else
        return cls.isInterface() && allMethodsThrowRemoteException( cls ) ;
}
 
Example 44
Project: openjdk-orb   File: RepositoryId.java   Source Code and License 5 votes vote down vote up
public static boolean isAbstractBase(Class clazz) {
    return (clazz.isInterface() &&
            IDLEntity.class.isAssignableFrom(clazz) &&
            (!ValueBase.class.isAssignableFrom(clazz)) &&
            (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));

}
 
Example 45
Project: classpath   File: ObjectCreator.java   Source Code and License 5 votes vote down vote up
/**
 * Convert the class name to IDL or RMI name (repository id). If the class
 * inherits from IDLEntity, ValueBase or SystemException, returns repository
 * Id in the IDL:(..) form. If it does not, returns repository Id in the
 * RMI:(..) form.
 *
 * @param cx the class for that the name must be computed.
 *
 * @return the idl or rmi name.
 */
public static synchronized String getRepositoryId(Class cx)
{
  String name = (String) m_names.get(cx);
  if (name != null)
    return name;

  String cn = cx.getName();
  if (!(IDLEntity.class.isAssignableFrom(cx)
    || ValueBase.class.isAssignableFrom(cx) || SystemException.class.isAssignableFrom(cx)))
    {
      // Not an IDL entity.
      name = Util.createValueHandler().getRMIRepositoryID(cx);
    }
  else
    {
      if (cn.startsWith(JAVA_PREFIX))
        cn = OMG_PREFIX
          + cn.substring(JAVA_PREFIX.length()).replace('.', '/');
      else if (cn.startsWith(CLASSPATH_PREFIX))
        cn = OMG_PREFIX
          + cn.substring(CLASSPATH_PREFIX.length()).replace('.', '/');

      name = "IDL:" + cn + ":1.0";
    }
  m_names.put(cx, name);
  return name;
}
 
Example 46
Project: openjdk-icedtea7   File: StubFactoryFactoryDynamicBase.java   Source Code and License 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 47
Project: openjdk-icedtea7   File: DynamicMethodMarshallerImpl.java   Source Code and License 5 votes vote down vote up
private static boolean isAbstractInterface( Class cls )
{
    // Either cls is an interface that extends IDLEntity, or else
    // cls does not extend java.rmi.Remote and all of its methods
    // throw RemoteException.
    if (IDLEntity.class.isAssignableFrom( cls ))
        return cls.isInterface() ;
    else
        return cls.isInterface() && allMethodsThrowRemoteException( cls ) ;
}
 
Example 48
Project: openjdk-icedtea7   File: RepositoryId.java   Source Code and License 5 votes vote down vote up
public static boolean isAbstractBase(Class clazz) {
    return (clazz.isInterface() &&
            IDLEntity.class.isAssignableFrom(clazz) &&
            (!ValueBase.class.isAssignableFrom(clazz)) &&
            (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));

}
 
Example 49
Project: OpenJSharp   File: CDROutputStream_1_0.java   Source Code and License 4 votes vote down vote up
public void write_value(Serializable object, String repository_id) {

        // Handle null references
        if (object == null) {
            // Write null tag and return
            write_long(0);
            return;
        }

        // Handle shared references
        if (valueCache != null && valueCache.containsKey(object)) {
            writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
            return;
        }

        Class clazz = object.getClass();
        boolean oldMustChunk = mustChunk;

        if (mustChunk)
            mustChunk = true;

        if (inBlock)
            end_block();

        if (clazz.isArray()) {
            // Handle arrays
            writeArray(object, clazz);
        } else if (object instanceof org.omg.CORBA.portable.ValueBase) {
            // Handle IDL Value types
            writeValueBase((org.omg.CORBA.portable.ValueBase)object, clazz);
        } else if (shouldWriteAsIDLEntity(object)) {
            writeIDLEntity((IDLEntity)object);
        } else if (object instanceof java.lang.String) {
            writeWStringValue((String)object);
        } else if (object instanceof java.lang.Class) {
            writeClass(repository_id, (Class)object);
        } else {
            // RMI-IIOP value type
            writeRMIIIOPValueType(object, clazz);
        }

        mustChunk = oldMustChunk;

        // Check to see if we need to start another block for a
        // possible outer value
        if (mustChunk)
            start_block();

    }
 
Example 50
Project: OpenJSharp   File: CDROutputStream_1_0.java   Source Code and License 4 votes vote down vote up
private boolean shouldWriteAsIDLEntity(Serializable object)
{
    return ((object instanceof IDLEntity) && (!(object instanceof ValueBase)) &&
            (!(object instanceof org.omg.CORBA.Object)));

}
 
Example 51
Project: OpenJSharp   File: IDLJavaSerializationInputStream.java   Source Code and License 4 votes vote down vote up
public org.omg.CORBA.Object read_Object(java.lang.Class clz) {

        // In any case, we must first read the IOR.
        IOR ior = IORFactories.makeIOR(parent) ;
        if (ior.isNil()) {
            return null;
        }

        PresentationManager.StubFactoryFactory sff =
            ORB.getStubFactoryFactory();
        String codeBase = ior.getProfile().getCodebase();
        PresentationManager.StubFactory stubFactory = null;

        if (clz == null) {
            RepositoryId rid = RepositoryId.cache.getId(ior.getTypeId() );
            String className = rid.getClassName();
            boolean isIDLInterface = rid.isIDLType();

            if (className == null || className.equals( "" )) {
                stubFactory = null;
            } else {
                try {
                    stubFactory = sff.createStubFactory(className,
                        isIDLInterface, codeBase, (Class) null,
                        (ClassLoader) null);
                } catch (Exception exc) {
                    // Could not create stubFactory, so use null.
                    // XXX stubFactory handling is still too complex:
                    // Can we resolve the stubFactory question once in
                    // a single place?
                    stubFactory = null ;
                }
            }
        } else if (StubAdapter.isStubClass(clz)) {
            stubFactory = PresentationDefaults.makeStaticStubFactory(clz);
        } else {
            // clz is an interface class
            boolean isIDL = IDLEntity.class.isAssignableFrom(clz);

            stubFactory = sff.createStubFactory(
                 clz.getName(), isIDL, codeBase, clz, clz.getClassLoader());
        }

        return CDRInputStream_1_0.internalIORToObject(ior, stubFactory, orb);
    }
 
Example 52
Project: OpenJSharp   File: CDRInputStream_1_0.java   Source Code and License 4 votes vote down vote up
public org.omg.CORBA.Object read_Object(Class clz)
{
    // In any case, we must first read the IOR.
    IOR ior = IORFactories.makeIOR(parent) ;
    if (ior.isNil())
        return null ;

    PresentationManager.StubFactoryFactory sff = ORB.getStubFactoryFactory() ;
    String codeBase = ior.getProfile().getCodebase() ;
    PresentationManager.StubFactory stubFactory = null ;

    if (clz == null) {
        RepositoryId rid = RepositoryId.cache.getId( ior.getTypeId() ) ;
        String className = rid.getClassName() ;
        boolean isIDLInterface = rid.isIDLType() ;

        if (className == null || className.equals( "" ))
            stubFactory = null ;
        else
            try {
                stubFactory = sff.createStubFactory( className,
                    isIDLInterface, codeBase, (Class)null,
                    (ClassLoader)null );
            } catch (Exception exc) {
                // Could not create stubFactory, so use null.
                // XXX stubFactory handling is still too complex:
                // Can we resolve the stubFactory question once in
                // a single place?
                stubFactory = null ;
            }
    } else if (StubAdapter.isStubClass( clz )) {
        stubFactory = PresentationDefaults.makeStaticStubFactory(
            clz ) ;
    } else {
        // clz is an interface class
        boolean isIDL = IDLEntity.class.isAssignableFrom( clz ) ;

        stubFactory = sff.createStubFactory( clz.getName(),
            isIDL, codeBase, clz, clz.getClassLoader() ) ;
    }

    return internalIORToObject( ior, stubFactory, orb ) ;
}
 
Example 53
Project: openjdk-jdk10   File: CDROutputStream_1_0.java   Source Code and License 4 votes vote down vote up
public void write_value(Serializable object, String repository_id) {

        // Handle null references
        if (object == null) {
            // Write null tag and return
            write_long(0);
            return;
        }

        // Handle shared references
        if (valueCache != null && valueCache.containsKey(object)) {
            writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
            return;
        }

        Class clazz = object.getClass();
        boolean oldMustChunk = mustChunk;

        if (mustChunk)
            mustChunk = true;

        if (inBlock)
            end_block();

        if (clazz.isArray()) {
            // Handle arrays
            writeArray(object, clazz);
        } else if (object instanceof org.omg.CORBA.portable.ValueBase) {
            // Handle IDL Value types
            writeValueBase((org.omg.CORBA.portable.ValueBase)object, clazz);
        } else if (shouldWriteAsIDLEntity(object)) {
            writeIDLEntity((IDLEntity)object);
        } else if (object instanceof java.lang.String) {
            writeWStringValue((String)object);
        } else if (object instanceof java.lang.Class) {
            writeClass(repository_id, (Class)object);
        } else {
            // RMI-IIOP value type
            writeRMIIIOPValueType(object, clazz);
        }

        mustChunk = oldMustChunk;

        // Check to see if we need to start another block for a
        // possible outer value
        if (mustChunk)
            start_block();

    }
 
Example 54
Project: openjdk-jdk10   File: CDROutputStream_1_0.java   Source Code and License 4 votes vote down vote up
private boolean shouldWriteAsIDLEntity(Serializable object)
{
    return ((object instanceof IDLEntity) && (!(object instanceof ValueBase)) &&
            (!(object instanceof org.omg.CORBA.Object)));

}
 
Example 55
Project: openjdk-jdk10   File: IDLJavaSerializationInputStream.java   Source Code and License 4 votes vote down vote up
public org.omg.CORBA.Object read_Object(java.lang.Class clz) {

        // In any case, we must first read the IOR.
        IOR ior = IORFactories.makeIOR(parent) ;
        if (ior.isNil()) {
            return null;
        }

        PresentationManager.StubFactoryFactory sff =
            ORB.getStubFactoryFactory();
        String codeBase = ior.getProfile().getCodebase();
        PresentationManager.StubFactory stubFactory = null;

        if (clz == null) {
            RepositoryId rid = RepositoryId.cache.getId(ior.getTypeId() );
            String className = rid.getClassName();
            boolean isIDLInterface = rid.isIDLType();

            if (className == null || className.equals( "" )) {
                stubFactory = null;
            } else {
                try {
                    stubFactory = sff.createStubFactory(className,
                        isIDLInterface, codeBase, (Class) null,
                        (ClassLoader) null);
                } catch (Exception exc) {
                    // Could not create stubFactory, so use null.
                    // XXX stubFactory handling is still too complex:
                    // Can we resolve the stubFactory question once in
                    // a single place?
                    stubFactory = null ;
                }
            }
        } else if (StubAdapter.isStubClass(clz)) {
            stubFactory = PresentationDefaults.makeStaticStubFactory(clz);
        } else {
            // clz is an interface class
            boolean isIDL = IDLEntity.class.isAssignableFrom(clz);

            stubFactory = sff.createStubFactory(
                 clz.getName(), isIDL, codeBase, clz, clz.getClassLoader());
        }

        return CDRInputStream_1_0.internalIORToObject(ior, stubFactory, orb);
    }
 
Example 56
Project: openjdk-jdk10   File: CDRInputStream_1_0.java   Source Code and License 4 votes vote down vote up
public org.omg.CORBA.Object read_Object(Class clz)
{
    // In any case, we must first read the IOR.
    IOR ior = IORFactories.makeIOR(parent) ;
    if (ior.isNil())
        return null ;

    PresentationManager.StubFactoryFactory sff = ORB.getStubFactoryFactory() ;
    String codeBase = ior.getProfile().getCodebase() ;
    PresentationManager.StubFactory stubFactory = null ;

    if (clz == null) {
        RepositoryId rid = RepositoryId.cache.getId( ior.getTypeId() ) ;
        String className = rid.getClassName() ;
        boolean isIDLInterface = rid.isIDLType() ;

        if (className == null || className.equals( "" ))
            stubFactory = null ;
        else
            try {
                stubFactory = sff.createStubFactory( className,
                    isIDLInterface, codeBase, (Class)null,
                    (ClassLoader)null );
            } catch (Exception exc) {
                // Could not create stubFactory, so use null.
                // XXX stubFactory handling is still too complex:
                // Can we resolve the stubFactory question once in
                // a single place?
                stubFactory = null ;
            }
    } else if (StubAdapter.isStubClass( clz )) {
        stubFactory = PresentationDefaults.makeStaticStubFactory(
            clz ) ;
    } else {
        // clz is an interface class
        boolean isIDL = IDLEntity.class.isAssignableFrom( clz ) ;

        stubFactory = sff.createStubFactory( clz.getName(),
            isIDL, codeBase, clz, clz.getClassLoader() ) ;
    }

    return internalIORToObject( ior, stubFactory, orb ) ;
}
 
Example 57
Project: openjdk9   File: CDROutputStream_1_0.java   Source Code and License 4 votes vote down vote up
public void write_value(Serializable object, String repository_id) {

        // Handle null references
        if (object == null) {
            // Write null tag and return
            write_long(0);
            return;
        }

        // Handle shared references
        if (valueCache != null && valueCache.containsKey(object)) {
            writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
            return;
        }

        Class clazz = object.getClass();
        boolean oldMustChunk = mustChunk;

        if (mustChunk)
            mustChunk = true;

        if (inBlock)
            end_block();

        if (clazz.isArray()) {
            // Handle arrays
            writeArray(object, clazz);
        } else if (object instanceof org.omg.CORBA.portable.ValueBase) {
            // Handle IDL Value types
            writeValueBase((org.omg.CORBA.portable.ValueBase)object, clazz);
        } else if (shouldWriteAsIDLEntity(object)) {
            writeIDLEntity((IDLEntity)object);
        } else if (object instanceof java.lang.String) {
            writeWStringValue((String)object);
        } else if (object instanceof java.lang.Class) {
            writeClass(repository_id, (Class)object);
        } else {
            // RMI-IIOP value type
            writeRMIIIOPValueType(object, clazz);
        }

        mustChunk = oldMustChunk;

        // Check to see if we need to start another block for a
        // possible outer value
        if (mustChunk)
            start_block();

    }
 
Example 58
Project: openjdk9   File: CDROutputStream_1_0.java   Source Code and License 4 votes vote down vote up
private boolean shouldWriteAsIDLEntity(Serializable object)
{
    return ((object instanceof IDLEntity) && (!(object instanceof ValueBase)) &&
            (!(object instanceof org.omg.CORBA.Object)));

}
 
Example 59
Project: openjdk9   File: CDROutputStream_1_0.java   Source Code and License 4 votes vote down vote up
private void writeIDLEntity(IDLEntity object) {

        // _REVISIT_ could check to see whether chunking really needed
        mustChunk = true;

        String repository_id = repIdStrs.createForJavaType(object);
        Class clazz = object.getClass();
        String codebase = Util.getCodebase(clazz);

        // Write value_tag
        int indirection = writeValueTag(true, true, codebase);
        updateIndirectionTable(indirection, object, object);

        // Write rep. id
        write_repositoryId(repository_id);

        // Write Value chunk
        end_flag--;
        chunkedValueNestingLevel--;
        start_block();

        // Write the IDLEntity using reflection
        try {
            ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader());
            final Class helperClass = Utility.loadClassForClass(clazz.getName()+"Helper", codebase,
                                                   clazzLoader, clazz, clazzLoader);
            final Class argTypes[] = {org.omg.CORBA.portable.OutputStream.class, clazz};
            // getDeclaredMethod requires RuntimePermission accessDeclaredMembers
            // if a different class loader is used (even though the javadoc says otherwise)
            Method writeMethod = null;
            try {
                writeMethod = (Method)AccessController.doPrivileged(
                    new PrivilegedExceptionAction() {
                        public java.lang.Object run() throws NoSuchMethodException {
                            return helperClass.getDeclaredMethod(kWriteMethod, argTypes);
                        }
                    }
                );
            } catch (PrivilegedActionException pae) {
                // this gets caught below
                throw (NoSuchMethodException)pae.getException();
            }
            java.lang.Object args[] = {parent, object};
            writeMethod.invoke(null, args);
        } catch (ClassNotFoundException cnfe) {
            throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, cnfe ) ;
        } catch(NoSuchMethodException nsme) {
            throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, nsme ) ;
        } catch(IllegalAccessException iae) {
            throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, iae ) ;
        } catch(InvocationTargetException ite) {
            throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, ite ) ;
        }
        end_block();

        // Write end tag
        writeEndTag(true);
    }
 
Example 60
Project: openjdk9   File: IDLJavaSerializationInputStream.java   Source Code and License 4 votes vote down vote up
public org.omg.CORBA.Object read_Object(java.lang.Class clz) {

        // In any case, we must first read the IOR.
        IOR ior = IORFactories.makeIOR(parent) ;
        if (ior.isNil()) {
            return null;
        }

        PresentationManager.StubFactoryFactory sff =
            ORB.getStubFactoryFactory();
        String codeBase = ior.getProfile().getCodebase();
        PresentationManager.StubFactory stubFactory = null;

        if (clz == null) {
            RepositoryId rid = RepositoryId.cache.getId(ior.getTypeId() );
            String className = rid.getClassName();
            boolean isIDLInterface = rid.isIDLType();

            if (className == null || className.equals( "" )) {
                stubFactory = null;
            } else {
                try {
                    stubFactory = sff.createStubFactory(className,
                        isIDLInterface, codeBase, (Class) null,
                        (ClassLoader) null);
                } catch (Exception exc) {
                    // Could not create stubFactory, so use null.
                    // XXX stubFactory handling is still too complex:
                    // Can we resolve the stubFactory question once in
                    // a single place?
                    stubFactory = null ;
                }
            }
        } else if (StubAdapter.isStubClass(clz)) {
            stubFactory = PresentationDefaults.makeStaticStubFactory(clz);
        } else {
            // clz is an interface class
            boolean isIDL = IDLEntity.class.isAssignableFrom(clz);

            stubFactory = sff.createStubFactory(
                 clz.getName(), isIDL, codeBase, clz, clz.getClassLoader());
        }

        return CDRInputStream_1_0.internalIORToObject(ior, stubFactory, orb);
    }