예제 #1
0
  public EnumDef(
      Class c,
      org.omg.CORBA.Container _defined_in,
      org.omg.CORBA.Repository ir,
      ClassLoader loader) {
    def_kind = org.omg.CORBA.DefinitionKind.dk_Enum;
    defined_in = _defined_in;
    containing_repository = ir;
    version = "1.0";
    String classId = c.getName();
    myContainer = org.omg.CORBA.ContainedHelper.narrow(defined_in);

    if (classId.indexOf('.') > 0) {
      name(classId.substring(classId.lastIndexOf('.') + 1));
      String path = classId.substring(0, classId.lastIndexOf('.'));

      if (path.endsWith("Package")) {
        id(
            RepositoryID.toRepositoryID(
                path.substring(0, path.lastIndexOf("Package")) + "." + name, loader));
      } else {
        id(RepositoryID.toRepositoryID(path + "." + name, loader));
      }

      absolute_name = myContainer.absolute_name() + "::" + name;
    } else {
      name(classId);
      defined_in = containing_repository;
      id(RepositoryID.toRepositoryID(name, loader));
      absolute_name = "::" + name;
    }

    Field memberFields[] = c.getDeclaredFields();
    int member_size = (memberFields.length - 1) / 2;
    members = new String[member_size];
    // only every second field denotes an original enum member
    for (int i = 0; i < member_size; i++) {
      members[i] = memberFields[2 + (2 * i)].getName();
    }
    type = org.omg.CORBA.ORBSingleton.init().create_enum_tc(id, name, members);
  }
예제 #2
0
  protected void configure(Configuration config) throws ConfigurationException {
    configuration = config;

    logger = configuration.getLogger("org.jacorb.orb");

    doStrictCheckOnTypecodeCreation =
        configuration.getAttributeAsBoolean("jacorb.interop.strict_check_on_tc_creation", true);

    BufferManagerFactory bufferManagerFactory = newBufferManagerFactory(configuration);

    bufferManager =
        bufferManagerFactory.newBufferManager(
            ((ORBSingleton) org.omg.CORBA.ORBSingleton.init()).getBufferManager(), configuration);

    if (logger.isDebugEnabled()) {
      logger.debug("BufferManagerFactory: " + bufferManagerFactory);
      logger.debug("BufferManager: " + bufferManager);
      logger.debug(
          "jacorb.interop.strict_check_on_tc_creation set to " + doStrictCheckOnTypecodeCreation);
    }

    configureCodeset();
  }