Example #1
0
 public WstringDef(org.omg.CORBA.TypeCode tc) {
   if (tc.kind() != org.omg.CORBA.TCKind.tk_wstring) {
     throw new INTF_REPOS(
         "Precondition volation: TypeCode must be of kind wstring, but is " + tc.kind().value());
   }
   def_kind = org.omg.CORBA.DefinitionKind.dk_Wstring;
   type = tc;
   try {
     bound(tc.length());
   } catch (Exception e) {
     throw new INTERNAL(e.toString());
   }
 }
Example #2
0
 public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type) {
   try {
     if (TypeCodeImpl.digits(value) > type.fixed_digits()
         || TypeCodeImpl.scale(value) > type.fixed_scale()) {
       throw wrapper.fixedNotMatch();
     }
   } catch (org.omg.CORBA.TypeCodePackage.BadKind bk) {
     // type isn't even of kind fixed
     throw wrapper.fixedBadTypecode(bk);
   }
   typeCode = TypeCodeImpl.convertToNative(orb, type);
   object = value;
   isInitialized = true;
 }
 public org.omg.DynamicAny.DynAny create_dyn_any_from_type_code(org.omg.CORBA.TypeCode type)
     throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode {
   try {
     switch (type.kind().value()) {
       case TCKind._tk_enum:
         return new DynEnum((org.jacorb.orb.ORB) _orb(), _this(), type).copy();
       case TCKind._tk_struct:
         return new DynStruct((org.jacorb.orb.ORB) _orb(), _this(), type).copy();
       case TCKind._tk_sequence:
         return new DynSequence((org.jacorb.orb.ORB) _orb(), _this(), type).copy();
       case TCKind._tk_union:
         return new DynUnion((org.jacorb.orb.ORB) _orb(), _this(), type).copy();
       case TCKind._tk_array:
         return new DynArray((org.jacorb.orb.ORB) _orb(), _this(), type).copy();
       default:
         return new DynAny((org.jacorb.orb.ORB) _orb(), _this(), type).copy();
     }
   } catch (org.omg.DynamicAny.DynAnyPackage.InvalidValue iv) {
     iv.printStackTrace();
   } catch (org.omg.DynamicAny.DynAnyPackage.TypeMismatch itc) {
     org.jacorb.util.Debug.output(3, itc);
     throw new org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode();
   }
   return null;
 }
Example #4
0
    public StructDef(Class c, 
                     String path,
                     org.omg.CORBA.Container _defined_in,
                     org.omg.CORBA.Repository ir)
    {
        def_kind = org.omg.CORBA.DefinitionKind.dk_Struct;
        containing_repository = ir;
        defined_in = _defined_in;
        this.path = path;
        Debug.assert( defined_in != null, "defined_in = null");
        Debug.assert( containing_repository != null, "containing_repository = null");

        try
        { 
            String classId = c.getName();
            myClass = c;
            version( "1.0" );
            full_name = classId.replace('.', '/');

            if( classId.indexOf('.') > 0 ) 
            {
                name( classId.substring( classId.lastIndexOf('.')+1 ) );
                absolute_name = 
                    org.omg.CORBA.ContainedHelper.narrow( defined_in ).absolute_name() + 
                    "::" + name;
            }             
            else 
            {
                name( classId );
                absolute_name = "::" + name;
            }
	
            helperClass = RepositoryImpl.loader.loadClass( classId + "Helper") ;
            id( (String)helperClass.getDeclaredMethod( "id", null ).invoke( null, null ));
            type = 
                TypeCodeUtil.getTypeCode( myClass, RepositoryImpl.loader, null, classId );
            
            members = new org.omg.CORBA.StructMember[ type.member_count() ];
            for( int i = 0; i < members.length; i++ )
            {
                org.omg.CORBA.TypeCode type_code = type.member_type(i);
                String member_name = type.member_name(i);
                members[i] = new org.omg.CORBA.StructMember( member_name, 
                                                             type_code,
                                                             null );
            }
            /* get directory for nested definitions' classes */
            File f = new File( path + fileSeparator + 
                               classId.replace('.', fileSeparator) + "Package" );

            if( f.exists() && f.isDirectory() )
                my_dir = f;
            org.jacorb.util.Debug.output(2, "StructDef: " + absolute_name );
        }
        catch ( Exception e )
        {
            e.printStackTrace();
            throw new org.omg.CORBA.INTF_REPOS( ErrorMsg.IR_Not_Implemented,
                                                org.omg.CORBA.CompletionStatus.COMPLETED_NO);
        }
    }