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 }
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; } }
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); } }
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public void insert_wstring(String s) { //debug.log ("insert_wstring"); // Make sure type code information for bounded strings is not erased if (typeCode.kind() == TCKind.tk_wstring) { 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_wstring); } object = s; isInitialized = true; }
/** * 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, ""); }
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(); } }
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()]; } }
public TypeCodeImpl(ORB orb, int creationKind, String id, String name, StructMember[] members) // for structs and exceptions { this(orb); if ((creationKind == TCKind._tk_struct) || (creationKind == TCKind._tk_except)) { _kind = creationKind; setId(id); _name = name; _memberCount = members.length; _memberNames = new String[_memberCount]; _memberTypes = new TypeCodeImpl[_memberCount]; for (int i = 0 ; i < _memberCount ; i++) { _memberNames[i] = members[i].name; _memberTypes[i] = convertToNative(_orb, members[i].type); _memberTypes[i].setParent(this); } } // else initializes to null }
public TypeCodeImpl(ORB orb, int creationKind, String id, String name, TypeCode original_type) // for aliases and value boxes { this(orb) ; if ( creationKind == TCKind._tk_alias || creationKind == TCKind._tk_value_box ) { _kind = creationKind; setId(id); _name = name; _contentType = convertToNative(_orb, original_type); } // else initializes to null }
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(); } }
public Any member_label(int index) throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds { switch (_kind) { case tk_indirect: return indirectType().member_label(index); case TCKind._tk_union: try { // _REVISIT_ Why create a new Any for this? return new AnyImpl(_orb, _unionLabels[index]); } catch (ArrayIndexOutOfBoundsException e) { throw new org.omg.CORBA.TypeCodePackage.Bounds(); } default: throw new BadKind(); } }
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(); } }
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; }
public void unmarshalReply(InputStream is) { // First unmarshal the return value if it is not void if ( _result != null ) { Any returnAny = _result.value(); TypeCode returnType = returnAny.type(); if ( returnType.kind().value() != TCKind._tk_void ) returnAny.read_value(is, returnType); } // Now unmarshal the out/inout args try { for ( int i=0; i<_arguments.count() ; i++) { NamedValue nv = _arguments.item(i); switch( nv.flags() ) { case ARG_IN.value: break; case ARG_OUT.value: case ARG_INOUT.value: Any any = nv.value(); any.read_value(is, any.type()); break; } } } catch ( org.omg.CORBA.Bounds ex ) { // Cannot happen since we only iterate till _arguments.count() } }
public char get_wchar() 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_wchar) throw new TypeMismatch(); return any.extract_wchar(); }
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 }
public short fixed_scale() throws BadKind { switch (_kind) { case TCKind._tk_fixed: return _scale; default: throw new BadKind(); } }
/** * 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; }
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public void insert_float(float f) { //debug.log ("insert_float"); typeCode = orb.get_primitive_tc(TCKind._tk_float); value = Float.floatToIntBits(f); isInitialized = true; }
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public float extract_float() { //debug.log ("extract_float"); checkExtractBadOperation( TCKind._tk_float ) ; return Float.intBitsToFloat((int)value); }
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public double extract_double() { //debug.log ("extract_double"); checkExtractBadOperation( TCKind._tk_double ) ; return Double.longBitsToDouble(value); }
/** * 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; }
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public void insert_ulonglong(long l) { //debug.log ("insert_ulonglong"); typeCode = orb.get_primitive_tc(TCKind._tk_ulonglong); value = l; isInitialized = true; }
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(); }
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public void insert_boolean(boolean b) { //debug.log ("insert_boolean"); typeCode = orb.get_primitive_tc(TCKind._tk_boolean); value = (b)? 1:0; isInitialized = true; }
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public boolean extract_boolean() { //debug.log ("extract_boolean"); checkExtractBadOperation( TCKind._tk_boolean ) ; return (value == 0)? false: true; }
/** * 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; }
/** This is called from the ORB after the DynamicImplementation.invoke * returns. Here we set the result if result() has not already been called. * @return the exception if there is one (then ORB will not call * marshalReplyParams()) otherwise return null. */ public Any checkResultCalled() { // Two things to be checked (CORBA 2.2 spec, section 6.3): // 1. Unless it calls set_exception(), the DIR must call arguments() // exactly once, even if the operation signature contains // no parameters. // 2. Unless set_exception() is called, if the invoked operation has a // non-void result type, set_result() must be called exactly once // before the DIR returns. if ( _paramsCalled && _resultSet ) // normal invocation return return null; else if ( _paramsCalled && !_resultSet && !_exceptionSet ) { try { // Neither a result nor an exception has been set. // Assume that the return type is void. If this is not so, // the client will throw a MARSHAL exception while // unmarshaling the return value. TypeCode result_tc = _orb.get_primitive_tc( org.omg.CORBA.TCKind.tk_void); _resultAny = _orb.create_any(); _resultAny.type(result_tc); _resultSet = true; return null; } catch ( Exception ex ) { throw _wrapper.dsiResultException( CompletionStatus.COMPLETED_MAYBE, ex ) ; } } else if ( _exceptionSet ) return _exception; else { throw _wrapper.dsimethodNotcalled( CompletionStatus.COMPLETED_MAYBE ) ; } }
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public void insert_wchar(char c) { //debug.log ("insert_wchar"); typeCode = orb.get_primitive_tc(TCKind._tk_wchar); value = c; isInitialized = true; }
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(); }
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public byte extract_octet() { //debug.log ("extract_octet"); checkExtractBadOperation( TCKind._tk_octet ) ; return (byte)value; }
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public String extract_string() { //debug.log ("extract_string"); checkExtractBadOperation( TCKind._tk_string ) ; return (String)object; }
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public void insert_any(Any a) { //debug.log ("insert_any"); typeCode = orb.get_primitive_tc(TCKind._tk_any); object = a; stream = null; isInitialized = true; }
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()); }
/** * See the description of the <a href="#anyOps">general Any operations.</a> */ public TypeCode extract_TypeCode() { //debug.log ("extract_TypeCode"); checkExtractBadOperation( TCKind._tk_TypeCode ) ; return (TypeCode)object; }
/** * 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; }
public TCKind current_member_kind () throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, org.omg.DynamicAny.DynAnyPackage.InvalidValue { if (status == STATUS_DESTROYED) { throw wrapper.dynAnyDestroyed() ; } if( ! checkInitComponents() || index < 0 || index >= components.length) { throw new InvalidValue(); } return components[index].type().kind(); }