org.omg.CORBA.TCKind Java Examples

The following examples show how to use org.omg.CORBA.TCKind. 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 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 #2
Source File: TypeCodeImpl.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
int currentUnionMemberIndex(Any discriminatorValue) throws BadKind {
    if (_kind != TCKind._tk_union)
        throw new BadKind();

    try {
        for (int i=0; i<member_count(); i++) {
            if (member_label(i).equal(discriminatorValue)) {
                return i;
            }
        }
        if (_defaultIndex != -1) {
            return _defaultIndex;
        }
    } catch (BadKind bad) {
    } catch (org.omg.CORBA.TypeCodePackage.Bounds bounds) {
    }
    return -1;
}
 
Example #3
Source File: DynAnyBasicImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public org.omg.DynamicAny.DynAny get_dyn_any()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    try {
        return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
    } catch (InconsistentTypeCode ictc) {
        // The spec doesn't allow us to throw back this exception
        // incase the anys any if of type Principal, native or abstract interface.
        return null;
    }
}
 
Example #4
Source File: TypeCodeImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
void read_value_kind(InputStream is) {
    // unmarshal the kind
    _kind = is.read_long();

    // check validity of kind
    if ((_kind < 0 || _kind > typeTable.length) && _kind != tk_indirect) {
        throw wrapper.cannotMarshalBadTckind() ;
    }
    // Don't do any work if this is native
    if (_kind == TCKind._tk_native)
        throw wrapper.cannotMarshalNative() ;

    if (_kind == tk_indirect) {
        throw wrapper.recursiveTypecodeError() ;
    }
}
 
Example #5
Source File: Util.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * This is used to create the TypeCode for a null reference.
 * It also handles backwards compatibility with JDK 1.3.x.
 *
 * This method will not return null.
 */
private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb)
{
    if (orb instanceof ORB) {

        ORB ourORB = (ORB)orb;

        // Preserve backwards compatibility with Kestrel and Ladybird
        // by not fully implementing interop issue resolution 3857,
        // and returning a null TypeCode with a tk_value TCKind.
        // If we're not talking to Kestrel or Ladybird, fall through
        // to the abstract interface case (also used for foreign ORBs).
        if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) &&
            ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) {

            return orb.get_primitive_tc(TCKind.tk_value);
        }
    }

    // Use tk_abstract_interface as detailed in the resolution

    // REVISIT: Define this in IDL and get the ID in generated code
    String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";

    return orb.create_abstract_interface_tc(abstractBaseID, "");
}
 
Example #6
Source File: AnyImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_string(String s)
{
    //debug.log ("insert_string");
    // Make sure type code information for bounded strings is not erased
    if (typeCode.kind() == TCKind.tk_string) {
        int length = 0;
        try {
            length = typeCode.length();
        } catch (BadKind bad) {
            throw wrapper.badkindCannotOccur() ;
        }

        // Check if bounded strings length is not exceeded
        if (length != 0 && s != null && s.length() > length) {
            throw wrapper.badStringBounds( new Integer(s.length()),
                new Integer(length) ) ;
        }
    } else {
        typeCode = orb.get_primitive_tc(TCKind._tk_string);
    }
    object = s;
    isInitialized = true;
}
 
Example #7
Source File: AnyImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_string(String s)
{
    //debug.log ("insert_string");
    // Make sure type code information for bounded strings is not erased
    if (typeCode.kind() == TCKind.tk_string) {
        int length = 0;
        try {
            length = typeCode.length();
        } catch (BadKind bad) {
            throw wrapper.badkindCannotOccur() ;
        }

        // Check if bounded strings length is not exceeded
        if (length != 0 && s != null && s.length() > length) {
            throw wrapper.badStringBounds( new Integer(s.length()),
                new Integer(length) ) ;
        }
    } else {
        typeCode = orb.get_primitive_tc(TCKind._tk_string);
    }
    object = s;
    isInitialized = true;
}
 
Example #8
Source File: ValueUtility.java    From openjdk-jdk9 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 #9
Source File: DynAnyBasicImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void insert_string(String value)
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_string)
        throw new TypeMismatch();
    if (value == null)
        throw new InvalidValue();
    // Throw InvalidValue if this is a bounded string and the length is exceeded
    try {
        if (any.type().length() > 0 && any.type().length() < value.length())
            throw new InvalidValue();
    } catch (BadKind bad) { // impossible
    }
    any.insert_string(value);
}
 
Example #10
Source File: AnyImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void insert_Value(Serializable v)
{
    //debug.log ("insert_Value");
    object = v;

    TypeCode tc;

    if ( v == null ) {
        tc = orb.get_primitive_tc (TCKind.tk_value);
    } else {
        // See note in getPrimitiveTypeCodeForClass.  We
        // have to use the latest type code fixes in this
        // case since there is no way to know what ORB will
        // actually send this Any.  In RMI-IIOP, when using
        // Util.writeAny, we can do the versioning correctly,
        // and use the insert_Value(Serializable, TypeCode)
        // method.
        //
        // The ORB singleton uses the latest version.
        tc = createTypeCodeForClass (v.getClass(), (ORB)ORB.init());
    }

    typeCode = TypeCodeImpl.convertToNative(orb, tc);
    isInitialized = true;
}
 
Example #11
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 #12
Source File: TypeCodeImpl.java    From openjdk-jdk9 with GNU General Public License v2.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 #13
Source File: AnyImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_Object(org.omg.CORBA.Object o)
{
    //debug.log ("insert_Object");
    if ( o == null ) {
        typeCode = orb.get_primitive_tc(TCKind._tk_objref);
    } else {
        if (StubAdapter.isStub(o)) {
            String[] ids = StubAdapter.getTypeIds( o ) ;
            typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], "");
        } else {
            throw wrapper.badInsertobjParam(
                CompletionStatus.COMPLETED_MAYBE, o.getClass().getName() ) ;
        }
    }

    object = o;
    isInitialized = true;
}
 
Example #14
Source File: TypeCodeImpl.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public TypeCodeImpl(ORB orb,
                    int creationKind,
                    short digits,
                    short scale)
                    // for fixed
{
    this(orb) ;

    //if (digits < 1 || digits > 31)
    //throw new BAD_TYPECODE();

    if (creationKind == TCKind._tk_fixed) {
        _kind               = creationKind;
        _digits             = digits;
        _scale              = scale;
    } // else initializes to null
}
 
Example #15
Source File: TypeCodeImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
void read_value_kind(InputStream is) {
    // unmarshal the kind
    _kind = is.read_long();

    // check validity of kind
    if ((_kind < 0 || _kind > typeTable.length) && _kind != tk_indirect) {
        throw wrapper.cannotMarshalBadTckind() ;
    }
    // Don't do any work if this is native
    if (_kind == TCKind._tk_native)
        throw wrapper.cannotMarshalNative() ;

    if (_kind == tk_indirect) {
        throw wrapper.recursiveTypecodeError() ;
    }
}
 
Example #16
Source File: DynAnyUtil.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static DynAny createMostDerivedDynAny(Any any, ORB orb, boolean copyValue)
    throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
{
    if (any == null || ! DynAnyUtil.isConsistentType(any.type()))
        throw new org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode();

    switch (any.type().kind().value()) {
        case TCKind._tk_sequence:
            return new DynSequenceImpl(orb, any, copyValue);
        case TCKind._tk_struct:
            return new DynStructImpl(orb, any, copyValue);
        case TCKind._tk_array:
            return new DynArrayImpl(orb, any, copyValue);
        case TCKind._tk_union:
            return new DynUnionImpl(orb, any, copyValue);
        case TCKind._tk_enum:
            return new DynEnumImpl(orb, any, copyValue);
        case TCKind._tk_fixed:
            return new DynFixedImpl(orb, any, copyValue);
        case TCKind._tk_value:
            return new DynValueImpl(orb, any, copyValue);
        case TCKind._tk_value_box:
            return new DynValueBoxImpl(orb, any, copyValue);
        default:
            return new DynAnyBasicImpl(orb, any, copyValue);
    }
}
 
Example #17
Source File: DynAnyBasicImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public String get_wstring()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_wstring)
        throw new TypeMismatch();
    return any.extract_wstring();
}
 
Example #18
Source File: DynAnyBasicImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void insert_char(char value)
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_char)
        throw new TypeMismatch();
    any.insert_char(value);
}
 
Example #19
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,
                    int bound,
                    int offset)
                    // for recursive sequences
{
    this(orb) ;

    if (creationKind == TCKind._tk_sequence) {
        _kind               = creationKind;
        _length             = bound;
        _parentOffset       = offset;
    } // else initializes to null
}
 
Example #20
Source File: DynAnyBasicImpl.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public double get_double()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_double)
        throw new TypeMismatch();
    return any.extract_double();
}
 
Example #21
Source File: AnyImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_longlong(long l)
{
    //debug.log ("insert_longlong");
    typeCode = orb.get_primitive_tc(TCKind._tk_longlong);
    value = l;
    isInitialized = true;
}
 
Example #22
Source File: TypeCodeImpl.java    From openjdk-jdk9 with GNU General Public License v2.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 #23
Source File: TypeCodeImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public TypeCode discriminator_type()
    throws BadKind
{
    switch (_kind) {
    case tk_indirect:
        return indirectType().discriminator_type();
    case TCKind._tk_union:
        return _discriminator;
    default:
        throw new BadKind();
    }
}
 
Example #24
Source File: DynAnyBasicImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public org.omg.CORBA.TypeCode get_typecode()
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_TypeCode)
        throw new TypeMismatch();
    return any.extract_TypeCode();
}
 
Example #25
Source File: DynAnyBasicImpl.java    From JDKSourceCode1.8 with MIT License 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 #26
Source File: AnyImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_char(char c)
{
    //debug.log ("insert_char");
    typeCode = orb.get_primitive_tc(TCKind._tk_char);
    value = c;
    isInitialized = true;
}
 
Example #27
Source File: AnyImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @deprecated
 */
@Deprecated
public void insert_Principal(Principal p)
{
    typeCode = orb.get_primitive_tc(TCKind._tk_Principal);
    object = p;
    isInitialized = true;
}
 
Example #28
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 #29
Source File: DynAnyBasicImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void insert_dyn_any (org.omg.DynamicAny.DynAny value)
    throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
           org.omg.DynamicAny.DynAnyPackage.InvalidValue
{
    if (status == STATUS_DESTROYED) {
        throw wrapper.dynAnyDestroyed() ;
    }
    if (any.type().kind().value() != TCKind._tk_any)
        throw new TypeMismatch();
    // _REVISIT_ Copy value here?
    any.insert_any(value.to_any());
}
 
Example #30
Source File: AnyImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_longlong(long l)
{
    //debug.log ("insert_longlong");
    typeCode = orb.get_primitive_tc(TCKind._tk_longlong);
    value = l;
    isInitialized = true;
}