Java Code Examples for org.omg.CORBA.TCKind#_tk_value

The following examples show how to use org.omg.CORBA.TCKind#_tk_value . 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: TypeCodeImpl.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
public String id()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        //return indirectType().id(); // same as _id
    case TCKind._tk_except:
    case TCKind._tk_objref:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_alias:
    case TCKind._tk_value:
    case TCKind._tk_value_box:
    case TCKind._tk_native:
    case TCKind._tk_abstract_interface:
        // exception and objref typecodes must have a repository id.
        // structs, unions, enums, and aliases may or may not.
        return _id;
    default:
        // all other typecodes throw the BadKind exception.
        throw new BadKind();
    }
}
 
Example 2
Source File: TypeCodeImpl.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public String id()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        //return indirectType().id(); // same as _id
    case TCKind._tk_except:
    case TCKind._tk_objref:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_alias:
    case TCKind._tk_value:
    case TCKind._tk_value_box:
    case TCKind._tk_native:
    case TCKind._tk_abstract_interface:
        // exception and objref typecodes must have a repository id.
        // structs, unions, enums, and aliases may or may not.
        return _id;
    default:
        // all other typecodes throw the BadKind exception.
        throw new BadKind();
    }
}
 
Example 3
Source File: TypeCodeImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
public String name()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().name();
    case TCKind._tk_except:
    case TCKind._tk_objref:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_alias:
    case TCKind._tk_value:
    case TCKind._tk_value_box:
    case TCKind._tk_native:
    case TCKind._tk_abstract_interface:
        return _name;
    default:
        throw new BadKind();
    }
}
 
Example 4
Source File: ValueUtility.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public static String getSignature(ValueMember member)
    throws ClassNotFoundException {

    // REVISIT.  Can the type be something that is
    // non-primitive yet not a value_box, value, or objref?
    // If so, should use ObjectStreamClass or throw
    // exception.

    if (member.type.kind().value() == TCKind._tk_value_box ||
        member.type.kind().value() == TCKind._tk_value ||
        member.type.kind().value() == TCKind._tk_objref) {
        Class c = RepositoryId.cache.getId(member.id).getClassFromType();
        return ObjectStreamClass.getSignature(c);

    } else {

        return primitiveConstants[member.type.kind().value()];
    }

}
 
Example 5
Source File: TypeCodeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public String member_name(int index)
    throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().member_name(index);
    case TCKind._tk_except:
    case TCKind._tk_struct:
    case TCKind._tk_union:
    case TCKind._tk_enum:
    case TCKind._tk_value:
        try {
            return _memberNames[index];
        } catch (ArrayIndexOutOfBoundsException e) {
            throw new org.omg.CORBA.TypeCodePackage.Bounds();
        }
    default:
        throw new BadKind();
    }
}
 
Example 6
Source File: ORBSingleton.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.CORBA.TypeCode create_value_tc(String id,
                                              String name,
                                              short type_modifier,
                                              TypeCode concrete_base,
                                              ValueMember[] members)
{
    return new TypeCodeImpl(this, TCKind._tk_value, id, name,
                            type_modifier, concrete_base, members);
}
 
Example 7
Source File: ORBImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public synchronized org.omg.CORBA.TypeCode create_value_tc(String id,
                                              String name,
                                              short type_modifier,
                                              TypeCode concrete_base,
                                              ValueMember[] members)
{
    checkShutdownState();
    return new TypeCodeImpl(this, TCKind._tk_value, id, name,
                            type_modifier, concrete_base, members);
}
 
Example 8
Source File: DynAnyUtil.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
static DynAny createMostDerivedDynAny(TypeCode typeCode, ORB orb)
    throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
{
    if (typeCode == null || ! DynAnyUtil.isConsistentType(typeCode))
        throw new org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode();

    switch (typeCode.kind().value()) {
        case TCKind._tk_sequence:
            return new DynSequenceImpl(orb, typeCode);
        case TCKind._tk_struct:
            return new DynStructImpl(orb, typeCode);
        case TCKind._tk_array:
            return new DynArrayImpl(orb, typeCode);
        case TCKind._tk_union:
            return new DynUnionImpl(orb, typeCode);
        case TCKind._tk_enum:
            return new DynEnumImpl(orb, typeCode);
        case TCKind._tk_fixed:
            return new DynFixedImpl(orb, typeCode);
        case TCKind._tk_value:
            return new DynValueImpl(orb, typeCode);
        case TCKind._tk_value_box:
            return new DynValueBoxImpl(orb, typeCode);
        default:
            return new DynAnyBasicImpl(orb, typeCode);
    }
}
 
Example 9
Source File: DynAnyBasicImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public java.io.Serializable get_val()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    int kind = any.type().kind().value();
    if (kind != TCKind._tk_value && kind != TCKind._tk_value_box)
        throw new TypeMismatch();
    return any.extract_Value();
}
 
Example 10
Source File: ORBSingleton.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.CORBA.TypeCode create_value_tc(String id,
                                              String name,
                                              short type_modifier,
                                              TypeCode concrete_base,
                                              ValueMember[] members)
{
    return new TypeCodeImpl(this, TCKind._tk_value, id, name,
                            type_modifier, concrete_base, members);
}
 
Example 11
Source File: DynAnyUtil.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static DynAny createMostDerivedDynAny(TypeCode typeCode, ORB orb)
    throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
{
    if (typeCode == null || ! DynAnyUtil.isConsistentType(typeCode))
        throw new org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode();

    switch (typeCode.kind().value()) {
        case TCKind._tk_sequence:
            return new DynSequenceImpl(orb, typeCode);
        case TCKind._tk_struct:
            return new DynStructImpl(orb, typeCode);
        case TCKind._tk_array:
            return new DynArrayImpl(orb, typeCode);
        case TCKind._tk_union:
            return new DynUnionImpl(orb, typeCode);
        case TCKind._tk_enum:
            return new DynEnumImpl(orb, typeCode);
        case TCKind._tk_fixed:
            return new DynFixedImpl(orb, typeCode);
        case TCKind._tk_value:
            return new DynValueImpl(orb, typeCode);
        case TCKind._tk_value_box:
            return new DynValueBoxImpl(orb, typeCode);
        default:
            return new DynAnyBasicImpl(orb, typeCode);
    }
}
 
Example 12
Source File: TypeCodeImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public short type_modifier() throws BadKind {
    switch (_kind) {
    case tk_indirect:
        return indirectType().type_modifier();
    case TCKind._tk_value:
        return _type_modifier;
    default:
        throw new BadKind();
    }
}
 
Example 13
Source File: TypeCodeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public TypeCodeImpl(ORB orb,
                    int creationKind,
                    String id,
                    String name,
                    short type_modifier,
                    TypeCode concrete_base,
                    ValueMember[] members)
                    // for value types
{
    this(orb) ;

    if (creationKind == TCKind._tk_value) {
        _kind               = creationKind;
        setId(id);
        _name               = name;
        _type_modifier      = type_modifier;
        if (concrete_base != null) {
            _concrete_base = convertToNative(_orb, concrete_base);
        }
        _memberCount        = members.length;

        _memberNames = new String[_memberCount];
        _memberTypes = new TypeCodeImpl[_memberCount];
        _memberAccess = new short[_memberCount];

        for (int i = 0 ; i < _memberCount ; i++) {
            _memberNames[i] = members[i].name;
            _memberTypes[i] = convertToNative(_orb, members[i].type);
            _memberTypes[i].setParent(this);
            _memberAccess[i] = members[i].access;
        }
    } // else initializes to null
}
 
Example 14
Source File: ORBSingleton.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public org.omg.CORBA.TypeCode create_value_tc(String id,
                                              String name,
                                              short type_modifier,
                                              TypeCode concrete_base,
                                              ValueMember[] members)
{
    return new TypeCodeImpl(this, TCKind._tk_value, id, name,
                            type_modifier, concrete_base, members);
}
 
Example 15
Source File: TypeCodeImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public short type_modifier() throws BadKind {
    switch (_kind) {
    case tk_indirect:
        return indirectType().type_modifier();
    case TCKind._tk_value:
        return _type_modifier;
    default:
        throw new BadKind();
    }
}
 
Example 16
Source File: TypeCodeImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public TypeCodeImpl(ORB orb, int creationKind)
// for primitive types
{
    this(orb);

    // private API. dont bother checking that
    //     (creationKind < 0 || creationKind > typeTable.length)

    _kind = creationKind;

    // do initialization for special cases
    switch (_kind) {
    case TCKind._tk_objref:
        {
            // this is being used to create typecode for CORBA::Object
            setId("IDL:omg.org/CORBA/Object:1.0");
            _name = "Object";
            break;
        }

    case TCKind._tk_string:
    case TCKind._tk_wstring:
        {
            _length =0;
            break;
        }

    case TCKind._tk_value:
        {
            _concrete_base = null;
            break;
        }
    }
}
 
Example 17
Source File: ORB.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected ORB()
{
    // Initialize logging first, since it is needed nearly
    // everywhere (for example, in TypeCodeImpl).
    wrapperMap = new ConcurrentHashMap();
    wrapper = ORBUtilSystemException.get( this,
        CORBALogDomains.RPC_PRESENTATION ) ;
    omgWrapper = OMGSystemException.get( this,
        CORBALogDomains.RPC_PRESENTATION ) ;

    typeCodeMap = new HashMap();

    primitiveTypeCodeConstants = new TypeCodeImpl[] {
        new TypeCodeImpl(this, TCKind._tk_null),
        new TypeCodeImpl(this, TCKind._tk_void),
        new TypeCodeImpl(this, TCKind._tk_short),
        new TypeCodeImpl(this, TCKind._tk_long),
        new TypeCodeImpl(this, TCKind._tk_ushort),
        new TypeCodeImpl(this, TCKind._tk_ulong),
        new TypeCodeImpl(this, TCKind._tk_float),
        new TypeCodeImpl(this, TCKind._tk_double),
        new TypeCodeImpl(this, TCKind._tk_boolean),
        new TypeCodeImpl(this, TCKind._tk_char),
        new TypeCodeImpl(this, TCKind._tk_octet),
        new TypeCodeImpl(this, TCKind._tk_any),
        new TypeCodeImpl(this, TCKind._tk_TypeCode),
        new TypeCodeImpl(this, TCKind._tk_Principal),
        new TypeCodeImpl(this, TCKind._tk_objref),
        null,       // tk_struct
        null,       // tk_union
        null,       // tk_enum
        new TypeCodeImpl(this, TCKind._tk_string),
        null,       // tk_sequence
        null,       // tk_array
        null,       // tk_alias
        null,       // tk_except
        new TypeCodeImpl(this, TCKind._tk_longlong),
        new TypeCodeImpl(this, TCKind._tk_ulonglong),
        new TypeCodeImpl(this, TCKind._tk_longdouble),
        new TypeCodeImpl(this, TCKind._tk_wchar),
        new TypeCodeImpl(this, TCKind._tk_wstring),
        new TypeCodeImpl(this, TCKind._tk_fixed),
        new TypeCodeImpl(this, TCKind._tk_value),
        new TypeCodeImpl(this, TCKind._tk_value_box),
        new TypeCodeImpl(this, TCKind._tk_native),
        new TypeCodeImpl(this, TCKind._tk_abstract_interface)
    } ;

    monitoringManager =
        MonitoringFactories.getMonitoringManagerFactory( ).
            createMonitoringManager(
            MonitoringConstants.DEFAULT_MONITORING_ROOT,
            MonitoringConstants.DEFAULT_MONITORING_ROOT_DESCRIPTION);
}
 
Example 18
Source File: TypeCodeImpl.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
private void printStream(PrintStream s, int level) {
    if (_kind == tk_indirect) {
        s.print("indirect " + _id);
        return;
    }

    switch (_kind) {
        case TCKind._tk_null:
        case TCKind._tk_void:
        case TCKind._tk_short:
        case TCKind._tk_long:
        case TCKind._tk_ushort:
        case TCKind._tk_ulong:
        case TCKind._tk_float:
        case TCKind._tk_double:
        case TCKind._tk_boolean:
        case TCKind._tk_char:
        case TCKind._tk_octet:
        case TCKind._tk_any:
        case TCKind._tk_TypeCode:
        case TCKind._tk_Principal:
        case TCKind._tk_objref:
        case TCKind._tk_longlong:
        case TCKind._tk_ulonglong:
        case TCKind._tk_longdouble:
        case TCKind._tk_wchar:
        case TCKind._tk_native:
            s.print(kindNames[_kind] + " " + _name);
            break;

        case TCKind._tk_struct:
        case TCKind._tk_except:
        case TCKind._tk_value:
            s.println(kindNames[_kind] + " " + _name + " = {");
            for(int i=0; i<_memberCount; i++) {
                // memberName might differ from the name of the member.
                s.print(indent(level + 1));
                if (_memberTypes[i] != null)
                    _memberTypes[i].printStream(s, level + 1);
                else
                    s.print("<unknown type>");
                s.println(" " + _memberNames[i] + ";");
            }
            s.print(indent(level) + "}");
            break;

        case TCKind._tk_union:
            s.print("union " + _name + "...");
            break;

        case TCKind._tk_enum:
            s.print("enum " + _name + "...");
            break;

        case TCKind._tk_string:
            if (_length == 0)
                s.print("unbounded string " + _name);
            else
                s.print("bounded string(" + _length + ") " + _name);
            break;

        case TCKind._tk_sequence:
        case TCKind._tk_array:
            s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {");
            s.print(indent(level + 1));
            if (lazy_content_type() != null) {
                lazy_content_type().printStream(s, level + 1);
            }
            s.println(indent(level) + "}");
            break;

        case TCKind._tk_alias:
            s.print("alias " + _name + " = " +
                (_contentType != null ? _contentType._name : "<unresolved>"));
            break;

        case TCKind._tk_wstring:
            s.print("wstring[" + _length + "] " + _name);
            break;

        case TCKind._tk_fixed:
            s.print("fixed(" + _digits + ", " + _scale + ") " + _name);
            break;

        case TCKind._tk_value_box:
            s.print("valueBox " + _name + "...");
            break;

        case TCKind._tk_abstract_interface:
            s.print("abstractInterface " + _name + "...");
            break;

        default:
            s.print("<unknown type>");
            break;
    }
}
 
Example 19
Source File: ORB.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected ORB()
{
    // Initialize logging first, since it is needed nearly
    // everywhere (for example, in TypeCodeImpl).
    wrapperMap = new ConcurrentHashMap();
    wrapper = ORBUtilSystemException.get( this,
        CORBALogDomains.RPC_PRESENTATION ) ;
    omgWrapper = OMGSystemException.get( this,
        CORBALogDomains.RPC_PRESENTATION ) ;

    typeCodeMap = new HashMap();

    primitiveTypeCodeConstants = new TypeCodeImpl[] {
        new TypeCodeImpl(this, TCKind._tk_null),
        new TypeCodeImpl(this, TCKind._tk_void),
        new TypeCodeImpl(this, TCKind._tk_short),
        new TypeCodeImpl(this, TCKind._tk_long),
        new TypeCodeImpl(this, TCKind._tk_ushort),
        new TypeCodeImpl(this, TCKind._tk_ulong),
        new TypeCodeImpl(this, TCKind._tk_float),
        new TypeCodeImpl(this, TCKind._tk_double),
        new TypeCodeImpl(this, TCKind._tk_boolean),
        new TypeCodeImpl(this, TCKind._tk_char),
        new TypeCodeImpl(this, TCKind._tk_octet),
        new TypeCodeImpl(this, TCKind._tk_any),
        new TypeCodeImpl(this, TCKind._tk_TypeCode),
        new TypeCodeImpl(this, TCKind._tk_Principal),
        new TypeCodeImpl(this, TCKind._tk_objref),
        null,       // tk_struct
        null,       // tk_union
        null,       // tk_enum
        new TypeCodeImpl(this, TCKind._tk_string),
        null,       // tk_sequence
        null,       // tk_array
        null,       // tk_alias
        null,       // tk_except
        new TypeCodeImpl(this, TCKind._tk_longlong),
        new TypeCodeImpl(this, TCKind._tk_ulonglong),
        new TypeCodeImpl(this, TCKind._tk_longdouble),
        new TypeCodeImpl(this, TCKind._tk_wchar),
        new TypeCodeImpl(this, TCKind._tk_wstring),
        new TypeCodeImpl(this, TCKind._tk_fixed),
        new TypeCodeImpl(this, TCKind._tk_value),
        new TypeCodeImpl(this, TCKind._tk_value_box),
        new TypeCodeImpl(this, TCKind._tk_native),
        new TypeCodeImpl(this, TCKind._tk_abstract_interface)
    } ;

    monitoringManager =
        MonitoringFactories.getMonitoringManagerFactory( ).
            createMonitoringManager(
            MonitoringConstants.DEFAULT_MONITORING_ROOT,
            MonitoringConstants.DEFAULT_MONITORING_ROOT_DESCRIPTION);
}
 
Example 20
Source File: IIOPInputStream.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private final void inputRemoteMembersForReadFields(java.util.Map fieldToValueMap)
    throws InvalidClassException, StreamCorruptedException,
           ClassNotFoundException, IOException {

    // Must have this local variable since defaultReadObjectFVDMembers
    // may get mangled by recursion.
    ValueMember fields[] = defaultReadObjectFVDMembers;

    try {

        for (int i = 0; i < fields.length; i++) {

            switch (fields[i].type.kind().value()) {

            case TCKind._tk_octet:
                byte byteValue = orbStream.read_octet();
                fieldToValueMap.put(fields[i].name, new Byte(byteValue));
                break;
            case TCKind._tk_boolean:
                boolean booleanValue = orbStream.read_boolean();
                fieldToValueMap.put(fields[i].name, new Boolean(booleanValue));
                break;
            case TCKind._tk_char:
                // Backwards compatibility.  Older Sun ORBs sent
                // _tk_char even though they read and wrote wchars
                // correctly.
                //
                // Fall through to the _tk_wchar case.
            case TCKind._tk_wchar:
                char charValue = orbStream.read_wchar();
                fieldToValueMap.put(fields[i].name, new Character(charValue));
                break;
            case TCKind._tk_short:
                short shortValue = orbStream.read_short();
                fieldToValueMap.put(fields[i].name, new Short(shortValue));
                break;
            case TCKind._tk_long:
                int intValue = orbStream.read_long();
                fieldToValueMap.put(fields[i].name, new Integer(intValue));
                break;
            case TCKind._tk_longlong:
                long longValue = orbStream.read_longlong();
                fieldToValueMap.put(fields[i].name, new Long(longValue));
                break;
            case TCKind._tk_float:
                float floatValue = orbStream.read_float();
                fieldToValueMap.put(fields[i].name, new Float(floatValue));
                break;
            case TCKind._tk_double:
                double doubleValue = orbStream.read_double();
                fieldToValueMap.put(fields[i].name, new Double(doubleValue));
                break;
            case TCKind._tk_value:
            case TCKind._tk_objref:
            case TCKind._tk_value_box:
                Object objectValue = null;
                try {
                    objectValue = inputObjectField(fields[i],
                                                   cbSender);

                } catch (IndirectionException cdrie) {
                    // The CDR stream had never seen the given offset before,
                    // so check the recursion manager (it will throw an
                    // IOException if it doesn't have a reference, either).
                    objectValue = activeRecursionMgr.getObject(cdrie.offset);
                }

                fieldToValueMap.put(fields[i].name, objectValue);
                break;
            default:
                // XXX I18N, logging needed.
                throw new StreamCorruptedException("Unknown kind: "
                                                   + fields[i].type.kind().value());
            }
        }
    } catch (Throwable t) {
        StreamCorruptedException result = new StreamCorruptedException(t.getMessage());
        result.initCause(t);
        throw result;
    }
}