类org.omg.CORBA.TCKind源码实例Demo

下面列出了怎么用org.omg.CORBA.TCKind的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: openjdk-jdk8u-backup   文件: DynAnyBasicImpl.java
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;
    }
}
 
源代码2 项目: openjdk-jdk8u-backup   文件: AnyImpl.java
/**
 * 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;
}
 
源代码3 项目: openjdk-jdk9   文件: TypeCodeImpl.java
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() ;
    }
}
 
源代码4 项目: hottub   文件: AnyImpl.java
/**
 * 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;
}
 
源代码5 项目: openjdk-jdk9   文件: ValueUtility.java
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()];
    }

}
 
源代码6 项目: openjdk-jdk8u   文件: AnyImpl.java
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;
}
 
源代码7 项目: cxf   文件: CorbaUtils.java
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;
}
 
源代码8 项目: openjdk-jdk9   文件: TypeCodeImpl.java
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();
    }
}
 
源代码9 项目: openjdk-jdk8u-backup   文件: TypeCodeImpl.java
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() ;
    }
}
 
源代码10 项目: openjdk-8   文件: ValueUtility.java
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()];
    }

}
 
源代码11 项目: openjdk-8   文件: TypeCodeImpl.java
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
}
 
源代码12 项目: openjdk-8-source   文件: AnyImpl.java
/**
 * 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;
}
 
源代码13 项目: openjdk-8-source   文件: DynAnyBasicImpl.java
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);
}
 
源代码14 项目: JDKSourceCode1.8   文件: Util.java
/**
 * 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, "");
}
 
源代码15 项目: jdk1.8-source-analysis   文件: TypeCodeImpl.java
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;
}
 
源代码16 项目: jdk1.8-source-analysis   文件: DynAnyUtil.java
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);
    }
}
 
源代码17 项目: openjdk-8-source   文件: DynAnyBasicImpl.java
public org.omg.CORBA.Any get_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();
    return any.extract_any();
}
 
源代码18 项目: jdk1.8-source-analysis   文件: AnyImpl.java
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_short(short s)
{
    //debug.log ("insert_short");
    typeCode = orb.get_primitive_tc(TCKind._tk_short);
    value = s;
    isInitialized = true;
}
 
源代码19 项目: jdk8u60   文件: AnyImpl.java
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public void insert_short(short s)
{
    //debug.log ("insert_short");
    typeCode = orb.get_primitive_tc(TCKind._tk_short);
    value = s;
    isInitialized = true;
}
 
源代码20 项目: jdk1.8-source-analysis   文件: AnyImpl.java
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public int extract_long()
{
    //debug.log ("extract_long");
    checkExtractBadOperationList( new int[] { TCKind._tk_long, TCKind._tk_enum } ) ;
    return (int)value;
}
 
源代码21 项目: openjdk-jdk8u-backup   文件: DynAnyBasicImpl.java
public void insert_float(float 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_float)
        throw new TypeMismatch();
    any.insert_float(value);
}
 
源代码22 项目: jdk8u60   文件: DynAnyBasicImpl.java
public int get_ulong()
    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_ulong)
        throw new TypeMismatch();
    return any.extract_ulong();
}
 
源代码23 项目: openjdk-8-source   文件: AnyImpl.java
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public long extract_longlong()
{
    //debug.log ("extract_longlong");
    checkExtractBadOperation( TCKind._tk_longlong ) ;
    return value;
}
 
源代码24 项目: jdk1.8-source-analysis   文件: DynAnyBasicImpl.java
public long get_longlong()
    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_longlong)
        throw new TypeMismatch();
    return any.extract_longlong();
}
 
源代码25 项目: jdk8u60   文件: AnyImpl.java
/**
 * Note that the Serializable really should be an IDLEntity of
 * some kind.  It shouldn't just be an RMI-IIOP type.  Currently,
 * we accept and will produce RMI repIds with the latest
 * calculations if given a non-IDLEntity Serializable.
 */
public Serializable extract_Value()
{
    //debug.log ("extract_Value");
    checkExtractBadOperationList( new int[] { TCKind._tk_value,
        TCKind._tk_value_box, TCKind._tk_abstract_interface } ) ;
    return (Serializable)object;
}
 
源代码26 项目: openjdk-jdk8u-backup   文件: AnyImpl.java
/**
 * See the description of the <a href="#anyOps">general Any operations.</a>
 */
public int extract_ulong()
{
    //debug.log ("extract_ulong");
    checkExtractBadOperation( TCKind._tk_ulong ) ;
    return (int)value;
}
 
源代码27 项目: openjdk-8   文件: DynAnyBasicImpl.java
public String get_string()
    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();
    return any.extract_string();
}
 
源代码28 项目: openjdk-jdk8u-backup   文件: AnyImpl.java
/**
 * sets the type of the element to be contained in the Any.
 *
 * @param tc                the TypeCode for the element in the Any
 */
public void type(TypeCode tc)
{
    //debug.log ("type2");
    // set the typecode
    typeCode = TypeCodeImpl.convertToNative(orb, tc);

    stream = null;
    value = 0;
    object = null;
    // null is the only legal value this Any can have after resetting the type code
    isInitialized = (tc.kind().value() == TCKind._tk_null);
}
 
源代码29 项目: openjdk-jdk8u   文件: TypeCodeImpl.java
public TypeCodeImpl(ORB orb,
                    int creationKind,
                    int bound)
                    // for strings
{
    this(orb) ;

    if (bound < 0)
        throw wrapper.negativeBounds() ;

    if ((creationKind == TCKind._tk_string) || (creationKind == TCKind._tk_wstring)) {
        _kind               = creationKind;
        _length             = bound;
    } // else initializes to null
}
 
源代码30 项目: openjdk-jdk8u-backup   文件: TypeCodeImpl.java
public TypeCodeImpl(ORB orb,
                    int creationKind,
                    int bound,
                    TypeCode element_type)
                    // for sequences and arrays
{
    this(orb) ;

    if ( creationKind == TCKind._tk_sequence || creationKind == TCKind._tk_array ) {
        _kind               = creationKind;
        _length             = bound;
        _contentType        = convertToNative(_orb, element_type);
    } // else initializes to null
}
 
 类所在包
 类方法
 同包方法