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

The following examples show how to use org.omg.CORBA.ORB#get_primitive_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
public static TypeCode getPrimitiveTypeCodeForClass (ORB orb,
                                                     Class c,
                                                     ValueHandler vh) {

    if (c == Integer.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_long);
    } else if (c == Byte.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_octet);
    } else if (c == Long.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_longlong);
    } else if (c == Float.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_float);
    } else if (c == Double.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_double);
    } else if (c == Short.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_short);
    } else if (c == Character.TYPE) {
        return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
    } else if (c == Boolean.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_boolean);
    } else {
        // _REVISIT_ Not sure if this is right.
        return orb.get_primitive_tc (TCKind.tk_any);
    }
}
 
Example 2
Source File: ValueUtility.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public static TypeCode getPrimitiveTypeCodeForClass (ORB orb,
                                                     Class c,
                                                     ValueHandler vh) {

    if (c == Integer.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_long);
    } else if (c == Byte.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_octet);
    } else if (c == Long.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_longlong);
    } else if (c == Float.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_float);
    } else if (c == Double.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_double);
    } else if (c == Short.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_short);
    } else if (c == Character.TYPE) {
        return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
    } else if (c == Boolean.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_boolean);
    } else {
        // _REVISIT_ Not sure if this is right.
        return orb.get_primitive_tc (TCKind.tk_any);
    }
}
 
Example 3
Source File: ValueUtility.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public static TypeCode getPrimitiveTypeCodeForClass (ORB orb,
                                                     Class c,
                                                     ValueHandler vh) {

    if (c == Integer.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_long);
    } else if (c == Byte.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_octet);
    } else if (c == Long.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_longlong);
    } else if (c == Float.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_float);
    } else if (c == Double.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_double);
    } else if (c == Short.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_short);
    } else if (c == Character.TYPE) {
        return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
    } else if (c == Boolean.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_boolean);
    } else {
        // _REVISIT_ Not sure if this is right.
        return orb.get_primitive_tc (TCKind.tk_any);
    }
}
 
Example 4
Source File: ValueUtility.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public static TypeCode getPrimitiveTypeCodeForClass (ORB orb,
                                                     Class c,
                                                     ValueHandler vh) {

    if (c == Integer.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_long);
    } else if (c == Byte.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_octet);
    } else if (c == Long.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_longlong);
    } else if (c == Float.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_float);
    } else if (c == Double.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_double);
    } else if (c == Short.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_short);
    } else if (c == Character.TYPE) {
        return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
    } else if (c == Boolean.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_boolean);
    } else {
        // _REVISIT_ Not sure if this is right.
        return orb.get_primitive_tc (TCKind.tk_any);
    }
}
 
Example 5
Source File: ValueUtility.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public static TypeCode getPrimitiveTypeCodeForClass (ORB orb,
                                                     Class c,
                                                     ValueHandler vh) {

    if (c == Integer.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_long);
    } else if (c == Byte.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_octet);
    } else if (c == Long.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_longlong);
    } else if (c == Float.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_float);
    } else if (c == Double.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_double);
    } else if (c == Short.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_short);
    } else if (c == Character.TYPE) {
        return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
    } else if (c == Boolean.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_boolean);
    } else {
        // _REVISIT_ Not sure if this is right.
        return orb.get_primitive_tc (TCKind.tk_any);
    }
}
 
Example 6
Source File: ValueUtility.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public static TypeCode getPrimitiveTypeCodeForClass (ORB orb,
                                                     Class c,
                                                     ValueHandler vh) {

    if (c == Integer.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_long);
    } else if (c == Byte.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_octet);
    } else if (c == Long.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_longlong);
    } else if (c == Float.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_float);
    } else if (c == Double.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_double);
    } else if (c == Short.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_short);
    } else if (c == Character.TYPE) {
        return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
    } else if (c == Boolean.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_boolean);
    } else {
        // _REVISIT_ Not sure if this is right.
        return orb.get_primitive_tc (TCKind.tk_any);
    }
}
 
Example 7
Source File: CorbaUtils.java    From cxf with Apache License 2.0 6 votes vote down vote up
public static TypeCode getPrimitiveTypeCode(ORB orb, QName type) {
    TCKind kind = PRIMITIVE_TYPECODES.get(type);
    if (kind != null) {
        return orb.get_primitive_tc(kind);
    }

    // There is a possiblitity that the idl type will not have its namespace URI set if it has
    // been read directly from the WSDL file as a string. Try with the standard corba namespace URI.
    if (type.getNamespaceURI() == null) {
        QName uriIdltype = new QName(CorbaConstants.NU_WSDL_CORBA, type.getLocalPart(), type.getPrefix());

        kind = PRIMITIVE_TYPECODES.get(uriIdltype);
        if (kind != null) {
            return orb.get_primitive_tc(kind);
        }
    }
    return null;
}
 
Example 8
Source File: ValueUtility.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public static TypeCode getPrimitiveTypeCodeForClass (ORB orb,
                                                     Class c,
                                                     ValueHandler vh) {

    if (c == Integer.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_long);
    } else if (c == Byte.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_octet);
    } else if (c == Long.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_longlong);
    } else if (c == Float.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_float);
    } else if (c == Double.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_double);
    } else if (c == Short.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_short);
    } else if (c == Character.TYPE) {
        return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
    } else if (c == Boolean.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_boolean);
    } else {
        // _REVISIT_ Not sure if this is right.
        return orb.get_primitive_tc (TCKind.tk_any);
    }
}
 
Example 9
Source File: ValueUtility.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public static TypeCode getPrimitiveTypeCodeForClass (ORB orb,
                                                     Class c,
                                                     ValueHandler vh) {

    if (c == Integer.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_long);
    } else if (c == Byte.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_octet);
    } else if (c == Long.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_longlong);
    } else if (c == Float.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_float);
    } else if (c == Double.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_double);
    } else if (c == Short.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_short);
    } else if (c == Character.TYPE) {
        return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
    } else if (c == Boolean.TYPE) {
        return orb.get_primitive_tc (TCKind.tk_boolean);
    } else {
        // _REVISIT_ Not sure if this is right.
        return orb.get_primitive_tc (TCKind.tk_any);
    }
}
 
Example 10
Source File: SystemExceptionHelper.java    From cxf with Apache License 2.0 5 votes vote down vote up
public TypeCode _type() {
    if (typeCode == null) {
        ORB orb = ORB.init();
        StructMember[] smBuf = new StructMember[2];
        TypeCode minortc = orb.get_primitive_tc(TCKind.tk_long);
        smBuf[0] = new StructMember("minor", minortc, null);

        String[] csLabels = {"COMPLETED_YES", "COMPLETED_NO", "COMPLETED_MAYBE"};
        TypeCode completedtc = orb
            .create_enum_tc("IDL:omg.org/CORBA/CompletionStatus:1.0",
                          "CompletionStatus", csLabels);

        smBuf[1] = new StructMember("completed", completedtc, null);
        String id;
        String name;
        if (value == null) {
            name = "SystemException";
            id = "IDL:omg.org/CORBA/SystemException:1.0";
        } else {
            String className = value.getClass().getName();
            name = className.substring(className.lastIndexOf('.') + 1);
            id = "IDL:omg.org/CORBA/" + name + ":1.0";
        }

        typeCode = orb.create_exception_tc(id, name, smBuf);
    }
    return typeCode;
}
 
Example 11
Source File: ValueUtility.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, ValueHandler vh){

        // Create FullValueDescription
        FullValueDescription result = new FullValueDescription();
        Class className = osc.forClass();

        ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
        String repId = vhandler.createForAnyType(className);

        // Set FVD name
        result.name = vhandler.getUnqualifiedName(repId);
        if (result.name == null)
            result.name = "";

        // Set FVD id _REVISIT_ : Manglings
        result.id = vhandler.getRMIRepositoryID(className);
        if (result.id == null)
            result.id = "";

        // Set FVD is_abstract
        result.is_abstract = ObjectStreamClassCorbaExt.isAbstractInterface(className);

        // Set FVD is_custom
        result.is_custom = osc.hasWriteObject() || osc.isExternalizable();

        // Set FVD defined_in _REVISIT_ : Manglings
        result.defined_in = vhandler.getDefinedInId(repId);
        if (result.defined_in == null)
            result.defined_in = "";

        // Set FVD version
        result.version = vhandler.getSerialVersionUID(repId);
        if (result.version == null)
            result.version = "";

        // Skip FVD operations - N/A
        result.operations = new OperationDescription[0];

        // Skip FVD attributed - N/A
        result.attributes = new AttributeDescription[0];

        // Set FVD members
        // Maps classes to repositoryIDs strings. This is used to detect recursive types.
        IdentityKeyValueStack createdIDs = new IdentityKeyValueStack();
        // Stores all types created for resolving indirect types at the end.
        result.members = translateMembers(orb, osc, vh, createdIDs);

        // Skip FVD initializers - N/A
        result.initializers = new Initializer[0];

        Class interfaces[] = osc.forClass().getInterfaces();
        int abstractCount = 0;

        // Skip FVD supported_interfaces
        result.supported_interfaces =  new String[interfaces.length];
        for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
             interfaceIndex++) {
            result.supported_interfaces[interfaceIndex] =
                vhandler.createForAnyType(interfaces[interfaceIndex]);

            if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
                (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
                abstractCount++;
        }

        // Skip FVD abstract_base_values - N/A
        result.abstract_base_values = new String[abstractCount];
        for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
             interfaceIndex++) {
            if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
                (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
                result.abstract_base_values[interfaceIndex] =
                    vhandler.createForAnyType(interfaces[interfaceIndex]);

        }

        result.is_truncatable = false;

        // Set FVD base_value
        Class superClass = osc.forClass().getSuperclass();
        if (java.io.Serializable.class.isAssignableFrom(superClass))
            result.base_value = vhandler.getRMIRepositoryID(superClass);
        else
            result.base_value = "";

        // Set FVD type
        //result.type = createTypeCodeForClass(orb, osc.forClass());
        result.type = orb.get_primitive_tc(TCKind.tk_value); //11638

        return result;

    }
 
Example 12
Source File: ValueUtility.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private static ValueMember[] translateMembers (ORB orb,
                                               ObjectStreamClass osc,
                                               ValueHandler vh,
                                               IdentityKeyValueStack createdIDs)
{
    ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
    ObjectStreamField fields[] = osc.getFields();
    int fieldsLength = fields.length;
    ValueMember[] members = new ValueMember[fieldsLength];
    // Note : fields come out of ObjectStreamClass in correct order for
    // writing.  So, we will create the same order in the members array.
    for (int i = 0; i < fieldsLength; i++) {
        String valRepId = vhandler.getRMIRepositoryID(fields[i].getClazz());
        members[i] = new ValueMember();
        members[i].name = fields[i].getName();
        members[i].id = valRepId; // _REVISIT_ : Manglings
        members[i].defined_in = vhandler.getDefinedInId(valRepId);// _REVISIT_ : Manglings
        members[i].version = "1.0";
        members[i].type_def = new _IDLTypeStub(); // _REVISIT_ : IDLType implementation missing

        if (fields[i].getField() == null) {
            // When using serialPersistentFields, the class may
            // no longer have an actual Field that corresponds
            // to one of the items.  The Java to IDL spec
            // ptc-00-01-06 1.3.5.6 says that the IDL field
            // should be private in this case.
            members[i].access = PRIVATE_MEMBER;
        } else {
            int m = fields[i].getField().getModifiers();
            if (Modifier.isPublic(m))
                members[i].access = PUBLIC_MEMBER;
            else
                members[i].access = PRIVATE_MEMBER;
        }

        switch (fields[i].getTypeCode()) {
        case 'B':
            members[i].type = orb.get_primitive_tc(TCKind.tk_octet); //11638
            break;
        case 'C':
            members[i].type
                = orb.get_primitive_tc(vhandler.getJavaCharTCKind()); // 11638
            break;
        case 'F':
            members[i].type = orb.get_primitive_tc(TCKind.tk_float); //11638
            break;
        case 'D' :
            members[i].type = orb.get_primitive_tc(TCKind.tk_double); //11638
            break;
        case 'I':
            members[i].type = orb.get_primitive_tc(TCKind.tk_long); //11638
            break;
        case 'J':
            members[i].type = orb.get_primitive_tc(TCKind.tk_longlong); //11638
            break;
        case 'S':
            members[i].type = orb.get_primitive_tc(TCKind.tk_short); //11638
            break;
        case 'Z':
            members[i].type = orb.get_primitive_tc(TCKind.tk_boolean); //11638
            break;
    // case '[':
    //      members[i].type = orb.get_primitive_tc(TCKind.tk_value_box); //11638
    //      members[i].id = RepositoryId.createForAnyType(fields[i].getType());
    //      break;
        default:
            members[i].type = createTypeCodeForClassInternal(orb, fields[i].getClazz(), vhandler,
                              createdIDs);
            members[i].id = vhandler.createForAnyType(fields[i].getType());
            break;
        } // end switch

    } // end for loop

    return members;
}
 
Example 13
Source File: ValueUtility.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, ValueHandler vh){

        // Create FullValueDescription
        FullValueDescription result = new FullValueDescription();
        Class className = osc.forClass();

        ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
        String repId = vhandler.createForAnyType(className);

        // Set FVD name
        result.name = vhandler.getUnqualifiedName(repId);
        if (result.name == null)
            result.name = "";

        // Set FVD id _REVISIT_ : Manglings
        result.id = vhandler.getRMIRepositoryID(className);
        if (result.id == null)
            result.id = "";

        // Set FVD is_abstract
        result.is_abstract = ObjectStreamClassCorbaExt.isAbstractInterface(className);

        // Set FVD is_custom
        result.is_custom = osc.hasWriteObject() || osc.isExternalizable();

        // Set FVD defined_in _REVISIT_ : Manglings
        result.defined_in = vhandler.getDefinedInId(repId);
        if (result.defined_in == null)
            result.defined_in = "";

        // Set FVD version
        result.version = vhandler.getSerialVersionUID(repId);
        if (result.version == null)
            result.version = "";

        // Skip FVD operations - N/A
        result.operations = new OperationDescription[0];

        // Skip FVD attributed - N/A
        result.attributes = new AttributeDescription[0];

        // Set FVD members
        // Maps classes to repositoryIDs strings. This is used to detect recursive types.
        IdentityKeyValueStack createdIDs = new IdentityKeyValueStack();
        // Stores all types created for resolving indirect types at the end.
        result.members = translateMembers(orb, osc, vh, createdIDs);

        // Skip FVD initializers - N/A
        result.initializers = new Initializer[0];

        Class interfaces[] = osc.forClass().getInterfaces();
        int abstractCount = 0;

        // Skip FVD supported_interfaces
        result.supported_interfaces =  new String[interfaces.length];
        for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
             interfaceIndex++) {
            result.supported_interfaces[interfaceIndex] =
                vhandler.createForAnyType(interfaces[interfaceIndex]);

            if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
                (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
                abstractCount++;
        }

        // Skip FVD abstract_base_values - N/A
        result.abstract_base_values = new String[abstractCount];
        for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
             interfaceIndex++) {
            if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
                (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
                result.abstract_base_values[interfaceIndex] =
                    vhandler.createForAnyType(interfaces[interfaceIndex]);

        }

        result.is_truncatable = false;

        // Set FVD base_value
        Class superClass = osc.forClass().getSuperclass();
        if (java.io.Serializable.class.isAssignableFrom(superClass))
            result.base_value = vhandler.getRMIRepositoryID(superClass);
        else
            result.base_value = "";

        // Set FVD type
        //result.type = createTypeCodeForClass(orb, osc.forClass());
        result.type = orb.get_primitive_tc(TCKind.tk_value); //11638

        return result;

    }
 
Example 14
Source File: ValueUtility.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, ValueHandler vh){

        // Create FullValueDescription
        FullValueDescription result = new FullValueDescription();
        Class className = osc.forClass();

        ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
        String repId = vhandler.createForAnyType(className);

        // Set FVD name
        result.name = vhandler.getUnqualifiedName(repId);
        if (result.name == null)
            result.name = "";

        // Set FVD id _REVISIT_ : Manglings
        result.id = vhandler.getRMIRepositoryID(className);
        if (result.id == null)
            result.id = "";

        // Set FVD is_abstract
        result.is_abstract = ObjectStreamClassCorbaExt.isAbstractInterface(className);

        // Set FVD is_custom
        result.is_custom = osc.hasWriteObject() || osc.isExternalizable();

        // Set FVD defined_in _REVISIT_ : Manglings
        result.defined_in = vhandler.getDefinedInId(repId);
        if (result.defined_in == null)
            result.defined_in = "";

        // Set FVD version
        result.version = vhandler.getSerialVersionUID(repId);
        if (result.version == null)
            result.version = "";

        // Skip FVD operations - N/A
        result.operations = new OperationDescription[0];

        // Skip FVD attributed - N/A
        result.attributes = new AttributeDescription[0];

        // Set FVD members
        // Maps classes to repositoryIDs strings. This is used to detect recursive types.
        IdentityKeyValueStack createdIDs = new IdentityKeyValueStack();
        // Stores all types created for resolving indirect types at the end.
        result.members = translateMembers(orb, osc, vh, createdIDs);

        // Skip FVD initializers - N/A
        result.initializers = new Initializer[0];

        Class interfaces[] = osc.forClass().getInterfaces();
        int abstractCount = 0;

        // Skip FVD supported_interfaces
        result.supported_interfaces =  new String[interfaces.length];
        for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
             interfaceIndex++) {
            result.supported_interfaces[interfaceIndex] =
                vhandler.createForAnyType(interfaces[interfaceIndex]);

            if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
                (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
                abstractCount++;
        }

        // Skip FVD abstract_base_values - N/A
        result.abstract_base_values = new String[abstractCount];
        for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
             interfaceIndex++) {
            if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
                (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
                result.abstract_base_values[interfaceIndex] =
                    vhandler.createForAnyType(interfaces[interfaceIndex]);

        }

        result.is_truncatable = false;

        // Set FVD base_value
        Class superClass = osc.forClass().getSuperclass();
        if (java.io.Serializable.class.isAssignableFrom(superClass))
            result.base_value = vhandler.getRMIRepositoryID(superClass);
        else
            result.base_value = "";

        // Set FVD type
        //result.type = createTypeCodeForClass(orb, osc.forClass());
        result.type = orb.get_primitive_tc(TCKind.tk_value); //11638

        return result;

    }
 
Example 15
Source File: ValueUtility.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private static ValueMember[] translateMembers (ORB orb,
                                               ObjectStreamClass osc,
                                               ValueHandler vh,
                                               IdentityKeyValueStack createdIDs)
{
    ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
    ObjectStreamField fields[] = osc.getFields();
    int fieldsLength = fields.length;
    ValueMember[] members = new ValueMember[fieldsLength];
    // Note : fields come out of ObjectStreamClass in correct order for
    // writing.  So, we will create the same order in the members array.
    for (int i = 0; i < fieldsLength; i++) {
        String valRepId = vhandler.getRMIRepositoryID(fields[i].getClazz());
        members[i] = new ValueMember();
        members[i].name = fields[i].getName();
        members[i].id = valRepId; // _REVISIT_ : Manglings
        members[i].defined_in = vhandler.getDefinedInId(valRepId);// _REVISIT_ : Manglings
        members[i].version = "1.0";
        members[i].type_def = new _IDLTypeStub(); // _REVISIT_ : IDLType implementation missing

        if (fields[i].getField() == null) {
            // When using serialPersistentFields, the class may
            // no longer have an actual Field that corresponds
            // to one of the items.  The Java to IDL spec
            // ptc-00-01-06 1.3.5.6 says that the IDL field
            // should be private in this case.
            members[i].access = PRIVATE_MEMBER;
        } else {
            int m = fields[i].getField().getModifiers();
            if (Modifier.isPublic(m))
                members[i].access = PUBLIC_MEMBER;
            else
                members[i].access = PRIVATE_MEMBER;
        }

        switch (fields[i].getTypeCode()) {
        case 'B':
            members[i].type = orb.get_primitive_tc(TCKind.tk_octet); //11638
            break;
        case 'C':
            members[i].type
                = orb.get_primitive_tc(vhandler.getJavaCharTCKind()); // 11638
            break;
        case 'F':
            members[i].type = orb.get_primitive_tc(TCKind.tk_float); //11638
            break;
        case 'D' :
            members[i].type = orb.get_primitive_tc(TCKind.tk_double); //11638
            break;
        case 'I':
            members[i].type = orb.get_primitive_tc(TCKind.tk_long); //11638
            break;
        case 'J':
            members[i].type = orb.get_primitive_tc(TCKind.tk_longlong); //11638
            break;
        case 'S':
            members[i].type = orb.get_primitive_tc(TCKind.tk_short); //11638
            break;
        case 'Z':
            members[i].type = orb.get_primitive_tc(TCKind.tk_boolean); //11638
            break;
    // case '[':
    //      members[i].type = orb.get_primitive_tc(TCKind.tk_value_box); //11638
    //      members[i].id = RepositoryId.createForAnyType(fields[i].getType());
    //      break;
        default:
            members[i].type = createTypeCodeForClassInternal(orb, fields[i].getClazz(), vhandler,
                              createdIDs);
            members[i].id = vhandler.createForAnyType(fields[i].getType());
            break;
        } // end switch

    } // end for loop

    return members;
}
 
Example 16
Source File: CorbaUtils.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static TypeCode getTypeCode(ORB orb,
                                   QName type,
                                   CorbaType obj,
                                   CorbaTypeMap typeMap,
                                   Stack<QName> seenTypes) {
    if (type == null) {
        throw new CorbaBindingException("corba:typemap type or elemtype information required"
                + (obj == null ? "" : " for " + obj)
                + (seenTypes.empty() ? "" : ", Enclosing type: " + seenTypes.elementAt(0)));
    }

    TypeCode tc = null;
    // first see if it is a primitive
    tc = getPrimitiveTypeCode(orb, type);
    if (tc == null && type.equals(CorbaConstants.NT_CORBA_ANY)) {
        // Anys are handled in a special way
        tc = orb.get_primitive_tc(TCKind.from_int(TCKind._tk_any));
    } else if (tc == null) {
        if (typeMap == null) {
            throw new CorbaBindingException("Unable to locate typemap for namespace \""
                                            + type.getNamespaceURI() + "\"");
        }

        tc = typeMap.getTypeCode(type);

        if (tc == null) {
            if (obj == null) {
                obj = typeMap.getType(type.getLocalPart());
                if (obj == null) {
                    throw new CorbaBindingException("Unable to locate object definition");
                }
            }
            tc = getComplexTypeCode(orb, type, obj, typeMap, seenTypes);
            if (tc != null) {
                typeMap.addTypeCode(type, tc);
            }
        }
    }
    if (tc == null) {
        throw new CorbaBindingException("Corba type node with qname " + type + " is not supported");
    }
    return tc;
}
 
Example 17
Source File: ValueUtility.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, ValueHandler vh){

        // Create FullValueDescription
        FullValueDescription result = new FullValueDescription();
        Class className = osc.forClass();

        ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
        String repId = vhandler.createForAnyType(className);

        // Set FVD name
        result.name = vhandler.getUnqualifiedName(repId);
        if (result.name == null)
            result.name = "";

        // Set FVD id _REVISIT_ : Manglings
        result.id = vhandler.getRMIRepositoryID(className);
        if (result.id == null)
            result.id = "";

        // Set FVD is_abstract
        result.is_abstract = ObjectStreamClassCorbaExt.isAbstractInterface(className);

        // Set FVD is_custom
        result.is_custom = osc.hasWriteObject() || osc.isExternalizable();

        // Set FVD defined_in _REVISIT_ : Manglings
        result.defined_in = vhandler.getDefinedInId(repId);
        if (result.defined_in == null)
            result.defined_in = "";

        // Set FVD version
        result.version = vhandler.getSerialVersionUID(repId);
        if (result.version == null)
            result.version = "";

        // Skip FVD operations - N/A
        result.operations = new OperationDescription[0];

        // Skip FVD attributed - N/A
        result.attributes = new AttributeDescription[0];

        // Set FVD members
        // Maps classes to repositoryIDs strings. This is used to detect recursive types.
        IdentityKeyValueStack createdIDs = new IdentityKeyValueStack();
        // Stores all types created for resolving indirect types at the end.
        result.members = translateMembers(orb, osc, vh, createdIDs);

        // Skip FVD initializers - N/A
        result.initializers = new Initializer[0];

        Class interfaces[] = osc.forClass().getInterfaces();
        int abstractCount = 0;

        // Skip FVD supported_interfaces
        result.supported_interfaces =  new String[interfaces.length];
        for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
             interfaceIndex++) {
            result.supported_interfaces[interfaceIndex] =
                vhandler.createForAnyType(interfaces[interfaceIndex]);

            if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
                (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
                abstractCount++;
        }

        // Skip FVD abstract_base_values - N/A
        result.abstract_base_values = new String[abstractCount];
        for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
             interfaceIndex++) {
            if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
                (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
                result.abstract_base_values[interfaceIndex] =
                    vhandler.createForAnyType(interfaces[interfaceIndex]);

        }

        result.is_truncatable = false;

        // Set FVD base_value
        Class superClass = osc.forClass().getSuperclass();
        if (java.io.Serializable.class.isAssignableFrom(superClass))
            result.base_value = vhandler.getRMIRepositoryID(superClass);
        else
            result.base_value = "";

        // Set FVD type
        //result.type = createTypeCodeForClass(orb, osc.forClass());
        result.type = orb.get_primitive_tc(TCKind.tk_value); //11638

        return result;

    }
 
Example 18
Source File: ValueUtility.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, ValueHandler vh){

        // Create FullValueDescription
        FullValueDescription result = new FullValueDescription();
        Class className = osc.forClass();

        ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
        String repId = vhandler.createForAnyType(className);

        // Set FVD name
        result.name = vhandler.getUnqualifiedName(repId);
        if (result.name == null)
            result.name = "";

        // Set FVD id _REVISIT_ : Manglings
        result.id = vhandler.getRMIRepositoryID(className);
        if (result.id == null)
            result.id = "";

        // Set FVD is_abstract
        result.is_abstract = ObjectStreamClassCorbaExt.isAbstractInterface(className);

        // Set FVD is_custom
        result.is_custom = osc.hasWriteObject() || osc.isExternalizable();

        // Set FVD defined_in _REVISIT_ : Manglings
        result.defined_in = vhandler.getDefinedInId(repId);
        if (result.defined_in == null)
            result.defined_in = "";

        // Set FVD version
        result.version = vhandler.getSerialVersionUID(repId);
        if (result.version == null)
            result.version = "";

        // Skip FVD operations - N/A
        result.operations = new OperationDescription[0];

        // Skip FVD attributed - N/A
        result.attributes = new AttributeDescription[0];

        // Set FVD members
        // Maps classes to repositoryIDs strings. This is used to detect recursive types.
        IdentityKeyValueStack createdIDs = new IdentityKeyValueStack();
        // Stores all types created for resolving indirect types at the end.
        result.members = translateMembers(orb, osc, vh, createdIDs);

        // Skip FVD initializers - N/A
        result.initializers = new Initializer[0];

        Class interfaces[] = osc.forClass().getInterfaces();
        int abstractCount = 0;

        // Skip FVD supported_interfaces
        result.supported_interfaces =  new String[interfaces.length];
        for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
             interfaceIndex++) {
            result.supported_interfaces[interfaceIndex] =
                vhandler.createForAnyType(interfaces[interfaceIndex]);

            if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
                (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
                abstractCount++;
        }

        // Skip FVD abstract_base_values - N/A
        result.abstract_base_values = new String[abstractCount];
        for (int interfaceIndex = 0; interfaceIndex < interfaces.length;
             interfaceIndex++) {
            if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) ||
                (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers())))
                result.abstract_base_values[interfaceIndex] =
                    vhandler.createForAnyType(interfaces[interfaceIndex]);

        }

        result.is_truncatable = false;

        // Set FVD base_value
        Class superClass = osc.forClass().getSuperclass();
        if (java.io.Serializable.class.isAssignableFrom(superClass))
            result.base_value = vhandler.getRMIRepositoryID(superClass);
        else
            result.base_value = "";

        // Set FVD type
        //result.type = createTypeCodeForClass(orb, osc.forClass());
        result.type = orb.get_primitive_tc(TCKind.tk_value); //11638

        return result;

    }
 
Example 19
Source File: ValueUtility.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private static ValueMember[] translateMembers (ORB orb,
                                               ObjectStreamClass osc,
                                               ValueHandler vh,
                                               IdentityKeyValueStack createdIDs)
{
    ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
    ObjectStreamField fields[] = osc.getFields();
    int fieldsLength = fields.length;
    ValueMember[] members = new ValueMember[fieldsLength];
    // Note : fields come out of ObjectStreamClass in correct order for
    // writing.  So, we will create the same order in the members array.
    for (int i = 0; i < fieldsLength; i++) {
        String valRepId = vhandler.getRMIRepositoryID(fields[i].getClazz());
        members[i] = new ValueMember();
        members[i].name = fields[i].getName();
        members[i].id = valRepId; // _REVISIT_ : Manglings
        members[i].defined_in = vhandler.getDefinedInId(valRepId);// _REVISIT_ : Manglings
        members[i].version = "1.0";
        members[i].type_def = new _IDLTypeStub(); // _REVISIT_ : IDLType implementation missing

        if (fields[i].getField() == null) {
            // When using serialPersistentFields, the class may
            // no longer have an actual Field that corresponds
            // to one of the items.  The Java to IDL spec
            // ptc-00-01-06 1.3.5.6 says that the IDL field
            // should be private in this case.
            members[i].access = PRIVATE_MEMBER;
        } else {
            int m = fields[i].getField().getModifiers();
            if (Modifier.isPublic(m))
                members[i].access = PUBLIC_MEMBER;
            else
                members[i].access = PRIVATE_MEMBER;
        }

        switch (fields[i].getTypeCode()) {
        case 'B':
            members[i].type = orb.get_primitive_tc(TCKind.tk_octet); //11638
            break;
        case 'C':
            members[i].type
                = orb.get_primitive_tc(vhandler.getJavaCharTCKind()); // 11638
            break;
        case 'F':
            members[i].type = orb.get_primitive_tc(TCKind.tk_float); //11638
            break;
        case 'D' :
            members[i].type = orb.get_primitive_tc(TCKind.tk_double); //11638
            break;
        case 'I':
            members[i].type = orb.get_primitive_tc(TCKind.tk_long); //11638
            break;
        case 'J':
            members[i].type = orb.get_primitive_tc(TCKind.tk_longlong); //11638
            break;
        case 'S':
            members[i].type = orb.get_primitive_tc(TCKind.tk_short); //11638
            break;
        case 'Z':
            members[i].type = orb.get_primitive_tc(TCKind.tk_boolean); //11638
            break;
    // case '[':
    //      members[i].type = orb.get_primitive_tc(TCKind.tk_value_box); //11638
    //      members[i].id = RepositoryId.createForAnyType(fields[i].getType());
    //      break;
        default:
            members[i].type = createTypeCodeForClassInternal(orb, fields[i].getClazz(), vhandler,
                              createdIDs);
            members[i].id = vhandler.createForAnyType(fields[i].getType());
            break;
        } // end switch

    } // end for loop

    return members;
}
 
Example 20
Source File: ValueUtility.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
private static ValueMember[] translateMembers (ORB orb,
                                               ObjectStreamClass osc,
                                               ValueHandler vh,
                                               IdentityKeyValueStack createdIDs)
{
    ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
    ObjectStreamField fields[] = osc.getFields();
    int fieldsLength = fields.length;
    ValueMember[] members = new ValueMember[fieldsLength];
    // Note : fields come out of ObjectStreamClass in correct order for
    // writing.  So, we will create the same order in the members array.
    for (int i = 0; i < fieldsLength; i++) {
        String valRepId = vhandler.getRMIRepositoryID(fields[i].getClazz());
        members[i] = new ValueMember();
        members[i].name = fields[i].getName();
        members[i].id = valRepId; // _REVISIT_ : Manglings
        members[i].defined_in = vhandler.getDefinedInId(valRepId);// _REVISIT_ : Manglings
        members[i].version = "1.0";
        members[i].type_def = new _IDLTypeStub(); // _REVISIT_ : IDLType implementation missing

        if (fields[i].getField() == null) {
            // When using serialPersistentFields, the class may
            // no longer have an actual Field that corresponds
            // to one of the items.  The Java to IDL spec
            // ptc-00-01-06 1.3.5.6 says that the IDL field
            // should be private in this case.
            members[i].access = PRIVATE_MEMBER;
        } else {
            int m = fields[i].getField().getModifiers();
            if (Modifier.isPublic(m))
                members[i].access = PUBLIC_MEMBER;
            else
                members[i].access = PRIVATE_MEMBER;
        }

        switch (fields[i].getTypeCode()) {
        case 'B':
            members[i].type = orb.get_primitive_tc(TCKind.tk_octet); //11638
            break;
        case 'C':
            members[i].type
                = orb.get_primitive_tc(vhandler.getJavaCharTCKind()); // 11638
            break;
        case 'F':
            members[i].type = orb.get_primitive_tc(TCKind.tk_float); //11638
            break;
        case 'D' :
            members[i].type = orb.get_primitive_tc(TCKind.tk_double); //11638
            break;
        case 'I':
            members[i].type = orb.get_primitive_tc(TCKind.tk_long); //11638
            break;
        case 'J':
            members[i].type = orb.get_primitive_tc(TCKind.tk_longlong); //11638
            break;
        case 'S':
            members[i].type = orb.get_primitive_tc(TCKind.tk_short); //11638
            break;
        case 'Z':
            members[i].type = orb.get_primitive_tc(TCKind.tk_boolean); //11638
            break;
    // case '[':
    //      members[i].type = orb.get_primitive_tc(TCKind.tk_value_box); //11638
    //      members[i].id = RepositoryId.createForAnyType(fields[i].getType());
    //      break;
        default:
            members[i].type = createTypeCodeForClassInternal(orb, fields[i].getClazz(), vhandler,
                              createdIDs);
            members[i].id = vhandler.createForAnyType(fields[i].getType());
            break;
        } // end switch

    } // end for loop

    return members;
}