Java Code Examples for org.omg.CORBA.ORB#create_recursive_tc()

The following examples show how to use org.omg.CORBA.ORB#create_recursive_tc() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ValueUtility.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private static TypeCode createTypeCodeForClassInternal (ORB orb,
                                                        java.lang.Class c,
                                                        ValueHandler vh,
                                                        IdentityKeyValueStack createdIDs)
{
    // This wrapper method is the protection against infinite recursion.
    TypeCode tc = null;
    String id = (String)createdIDs.get(c);
    if (id != null) {
        return orb.create_recursive_tc(id);
    } else {
        id = vh.getRMIRepositoryID(c);
        if (id == null) id = "";
        // cache the rep id BEFORE creating a new typecode.
        // so that recursive tc can look up the rep id.
        createdIDs.push(c, id);
        tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
        createdIDs.pop();
        return tc;
    }
}
 
Example 2
Source File: ValueUtility.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static TypeCode createTypeCodeForClassInternal (ORB orb,
                                                        java.lang.Class c,
                                                        ValueHandler vh,
                                                        IdentityKeyValueStack createdIDs)
{
    // This wrapper method is the protection against infinite recursion.
    TypeCode tc = null;
    String id = (String)createdIDs.get(c);
    if (id != null) {
        return orb.create_recursive_tc(id);
    } else {
        id = vh.getRMIRepositoryID(c);
        if (id == null) id = "";
        // cache the rep id BEFORE creating a new typecode.
        // so that recursive tc can look up the rep id.
        createdIDs.push(c, id);
        tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
        createdIDs.pop();
        return tc;
    }
}
 
Example 3
Source File: ValueUtility.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static TypeCode createTypeCodeForClassInternal (ORB orb,
                                                        java.lang.Class c,
                                                        ValueHandler vh,
                                                        IdentityKeyValueStack createdIDs)
{
    // This wrapper method is the protection against infinite recursion.
    TypeCode tc = null;
    String id = (String)createdIDs.get(c);
    if (id != null) {
        return orb.create_recursive_tc(id);
    } else {
        id = vh.getRMIRepositoryID(c);
        if (id == null) id = "";
        // cache the rep id BEFORE creating a new typecode.
        // so that recursive tc can look up the rep id.
        createdIDs.push(c, id);
        tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
        createdIDs.pop();
        return tc;
    }
}
 
Example 4
Source File: ValueUtility.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private static TypeCode createTypeCodeForClassInternal (ORB orb,
                                                        java.lang.Class c,
                                                        ValueHandler vh,
                                                        IdentityKeyValueStack createdIDs)
{
    // This wrapper method is the protection against infinite recursion.
    TypeCode tc = null;
    String id = (String)createdIDs.get(c);
    if (id != null) {
        return orb.create_recursive_tc(id);
    } else {
        id = vh.getRMIRepositoryID(c);
        if (id == null) id = "";
        // cache the rep id BEFORE creating a new typecode.
        // so that recursive tc can look up the rep id.
        createdIDs.push(c, id);
        tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
        createdIDs.pop();
        return tc;
    }
}
 
Example 5
Source File: ValueUtility.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static TypeCode createTypeCodeForClassInternal (ORB orb,
                                                        java.lang.Class c,
                                                        ValueHandler vh,
                                                        IdentityKeyValueStack createdIDs)
{
    // This wrapper method is the protection against infinite recursion.
    TypeCode tc = null;
    String id = (String)createdIDs.get(c);
    if (id != null) {
        return orb.create_recursive_tc(id);
    } else {
        id = vh.getRMIRepositoryID(c);
        if (id == null) id = "";
        // cache the rep id BEFORE creating a new typecode.
        // so that recursive tc can look up the rep id.
        createdIDs.push(c, id);
        tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
        createdIDs.pop();
        return tc;
    }
}
 
Example 6
Source File: ValueUtility.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static TypeCode createTypeCodeForClassInternal (ORB orb,
                                                        java.lang.Class c,
                                                        ValueHandler vh,
                                                        IdentityKeyValueStack createdIDs)
{
    // This wrapper method is the protection against infinite recursion.
    TypeCode tc = null;
    String id = (String)createdIDs.get(c);
    if (id != null) {
        return orb.create_recursive_tc(id);
    } else {
        id = vh.getRMIRepositoryID(c);
        if (id == null) id = "";
        // cache the rep id BEFORE creating a new typecode.
        // so that recursive tc can look up the rep id.
        createdIDs.push(c, id);
        tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
        createdIDs.pop();
        return tc;
    }
}
 
Example 7
Source File: ValueUtility.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static TypeCode createTypeCodeForClassInternal (ORB orb,
                                                        java.lang.Class c,
                                                        ValueHandler vh,
                                                        IdentityKeyValueStack createdIDs)
{
    // This wrapper method is the protection against infinite recursion.
    TypeCode tc = null;
    String id = (String)createdIDs.get(c);
    if (id != null) {
        return orb.create_recursive_tc(id);
    } else {
        id = vh.getRMIRepositoryID(c);
        if (id == null) id = "";
        // cache the rep id BEFORE creating a new typecode.
        // so that recursive tc can look up the rep id.
        createdIDs.push(c, id);
        tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
        createdIDs.pop();
        return tc;
    }
}
 
Example 8
Source File: ValueUtility.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static TypeCode createTypeCodeForClassInternal (ORB orb,
                                                        java.lang.Class c,
                                                        ValueHandler vh,
                                                        IdentityKeyValueStack createdIDs)
{
    // This wrapper method is the protection against infinite recursion.
    TypeCode tc = null;
    String id = (String)createdIDs.get(c);
    if (id != null) {
        return orb.create_recursive_tc(id);
    } else {
        id = vh.getRMIRepositoryID(c);
        if (id == null) id = "";
        // cache the rep id BEFORE creating a new typecode.
        // so that recursive tc can look up the rep id.
        createdIDs.push(c, id);
        tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
        createdIDs.pop();
        return tc;
    }
}
 
Example 9
Source File: ValueUtility.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static TypeCode createTypeCodeForClassInternal (ORB orb,
                                                        java.lang.Class c,
                                                        ValueHandler vh,
                                                        IdentityKeyValueStack createdIDs)
{
    // This wrapper method is the protection against infinite recursion.
    TypeCode tc = null;
    String id = (String)createdIDs.get(c);
    if (id != null) {
        return orb.create_recursive_tc(id);
    } else {
        id = vh.getRMIRepositoryID(c);
        if (id == null) id = "";
        // cache the rep id BEFORE creating a new typecode.
        // so that recursive tc can look up the rep id.
        createdIDs.push(c, id);
        tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
        createdIDs.pop();
        return tc;
    }
}
 
Example 10
Source File: ValueUtility.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static TypeCode createTypeCodeForClassInternal (ORB orb,
                                                        java.lang.Class c,
                                                        ValueHandler vh,
                                                        IdentityKeyValueStack createdIDs)
{
    // This wrapper method is the protection against infinite recursion.
    TypeCode tc = null;
    String id = (String)createdIDs.get(c);
    if (id != null) {
        return orb.create_recursive_tc(id);
    } else {
        id = vh.getRMIRepositoryID(c);
        if (id == null) id = "";
        // cache the rep id BEFORE creating a new typecode.
        // so that recursive tc can look up the rep id.
        createdIDs.push(c, id);
        tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
        createdIDs.pop();
        return tc;
    }
}
 
Example 11
Source File: CorbaUtils.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static TypeCode getUnionTypeCode(ORB orb,
                                        Object obj,
                                        CorbaTypeMap typeMap,
                                        Stack<QName> seenTypes) {
    Union unionType = (Union)obj;

    if (seenTypes.contains(new QName(unionType.getName()))) {
        return orb.create_recursive_tc(unionType.getRepositoryID());
    }
    seenTypes.push(new QName(unionType.getName()));

    TypeCode discTC = getTypeCode(orb, unionType.getDiscriminator(), typeMap, seenTypes);
    Map<String, UnionMember> members = new LinkedHashMap<>();
    List<Unionbranch> branches = unionType.getUnionbranch();
    for (Iterator<Unionbranch> branchIter = branches.iterator(); branchIter.hasNext();) {
        Unionbranch branch = branchIter.next();
        List<CaseType> cases = branch.getCase();
        for (Iterator<CaseType> caseIter = cases.iterator(); caseIter.hasNext();) {
            CaseType cs = caseIter.next();
            if (!members.containsKey(cs.getLabel())) {
                UnionMember member = new UnionMember();
                member.name = branch.getName();
                member.type = getTypeCode(orb, branch.getIdltype(), typeMap, seenTypes);
                member.label = orb.create_any();
                // We need to insert the labels in a way that depends on the type of the
                // discriminator.  According to the CORBA specification, the following types
                // are permissable as discriminator types:
                //    * signed & unsigned short
                //    * signed & unsigned long
                //    * signed & unsigned long long
                //    * char
                //    * boolean
                //    * enum
                switch (discTC.kind().value()) {
                case TCKind._tk_short:
                    member.label.insert_short(Short.parseShort(cs.getLabel()));
                    break;
                case TCKind._tk_ushort:
                    member.label.insert_ushort(Short.parseShort(cs.getLabel()));
                    break;
                case TCKind._tk_long:
                    member.label.insert_long(Integer.parseInt(cs.getLabel()));
                    break;
                case TCKind._tk_ulong:
                    member.label.insert_ulong(Integer.parseInt(cs.getLabel()));
                    break;
                case TCKind._tk_longlong:
                    member.label.insert_longlong(Long.parseLong(cs.getLabel()));
                    break;
                case TCKind._tk_ulonglong:
                    member.label.insert_ulonglong(Long.parseLong(cs.getLabel()));
                    break;
                case TCKind._tk_char:
                    member.label.insert_char(cs.getLabel().charAt(0));
                    break;
                case TCKind._tk_boolean:
                    member.label.insert_boolean(Boolean.parseBoolean(cs.getLabel()));
                    break;
                case TCKind._tk_enum:
                    org.omg.CORBA.portable.OutputStream out =
                        member.label.create_output_stream();
                    Enum enumVal = (Enum)getCorbaType(unionType.getDiscriminator(), typeMap);
                    List<Enumerator> enumerators = enumVal.getEnumerator();
                    for (int i = 0; i < enumerators.size(); ++i) {
                        Enumerator e = enumerators.get(i);
                        if (e.getValue().equals(cs.getLabel())) {
                            out.write_long(i);
                        }
                    }
                    member.label.read_value(out.create_input_stream(), discTC);
                    break;
                default:
                    throw new CorbaBindingException("Unsupported discriminator type");
                }
                // Some orbs are strict on how the case labels are stored for
                // each member.  So we can't
                // simply insert the labels as strings
                members.put(cs.getLabel(), member);
            }
        }
    }
    seenTypes.pop();
    return orb.create_union_tc(unionType.getRepositoryID(),
                               getTypeCodeName(unionType.getName()),
                               discTC,
                               members.values().toArray(
                                   new UnionMember[members.size()]));
}