Example #1
1
  private void configureCodeset() {
    String ncsc = configuration.getAttribute("jacorb.native_char_codeset", "");
    String ncsw = configuration.getAttribute("jacorb.native_wchar_codeset", "");

    if (ncsc != null && !("".equals(ncsc))) {
      CodeSet codeset = CodeSet.getCodeSet(ncsc);
      if (codeset != CodeSet.NULL_CODE_SET) {
        nativeCodeSetChar = codeset;

        logger.debug("Set default native char codeset to {} " + codeset);
      } else if (logger.isErrorEnabled()) {
        logger.error("Cannot set default NCSC to " + ncsc);
      }
    }
    // Fallback from above if we failed to set nativeCodeSetChar
    if (nativeCodeSetChar == null) {
      String sysenc = CodeSet.DEFAULT_PLATFORM_ENCODING;
      for (int i = 0; i < CodeSet.KNOWN_ENCODINGS.length; i++) {
        CodeSet codeset = CodeSet.KNOWN_ENCODINGS[i];
        if (codeset.supportsCharacterData(/* wide */ false) && sysenc.equals(codeset.getName())) {
          nativeCodeSetChar = codeset;

          logger.debug("Set default native char codeset to {}", codeset);
        }
      }

      if (nativeCodeSetChar == null) {
        // didn't match any supported char encodings, default to iso 8859-1
        if (logger.isWarnEnabled()) {
          logger.warn("Warning - unknown codeset (" + sysenc + ") - defaulting to ISO-8859-1");
        }
        nativeCodeSetChar = CodeSet.ISO8859_1_CODESET;
      }
    }

    if (ncsw != null && !("".equals(ncsw))) {
      CodeSet codeset = CodeSet.getCodeSet(ncsw);
      if (codeset != CodeSet.NULL_CODE_SET) {
        nativeCodeSetWchar = codeset;

        logger.debug("Set default native wchar codeset to {}", codeset);
      } else if (logger.isErrorEnabled()) {
        logger.error("Cannot set default NCSW to " + ncsw);
      }
    }

    localCodeSetComponentInfo = new CodeSetComponentInfo();
    localCodeSetComponentInfo.ForCharData =
        CodeSet.createCodeSetComponent(/* wide */ false, getTCSDefault());
    localCodeSetComponentInfo.ForWcharData =
        CodeSet.createCodeSetComponent(/* wide */ true, getTCSWDefault());
  }
  public AdminPropertySet(Configuration config) {
    super();

    try {
      int _maxConsumersDefault =
          config.getAttributeAsInteger(
              Attributes.MAX_NUMBER_CONSUMERS, Default.DEFAULT_MAX_NUMBER_CONSUMERS);
      Any _maxConsumersDefaultAny = sORB.create_any();
      _maxConsumersDefaultAny.insert_long(_maxConsumersDefault);

      //////////////////////////////

      int _maxSuppliersDefault =
          config.getAttributeAsInteger(
              Attributes.MAX_NUMBER_SUPPLIERS, Default.DEFAULT_MAX_NUMBER_SUPPLIERS);

      Any _maxSuppliersDefaultAny = sORB.create_any();
      _maxSuppliersDefaultAny.insert_long(_maxSuppliersDefault);

      //////////////////////////////

      int _maxQueueLength =
          config.getAttributeAsInteger(
              Attributes.MAX_QUEUE_LENGTH, Default.DEFAULT_MAX_QUEUE_LENGTH);

      Any _maxQueueLengthAny = sORB.create_any();
      _maxQueueLengthAny.insert_long(_maxQueueLength);

      //////////////////////////////

      boolean _rejectNewEvents =
          config
              .getAttribute(Attributes.REJECT_NEW_EVENTS, Default.DEFAULT_REJECT_NEW_EVENTS)
              .equals("on");

      Any _rejectNewEventsAny = sORB.create_any();
      _rejectNewEventsAny.insert_boolean(_rejectNewEvents);

      //////////////////////////////

      defaultProperties_ =
          new Property[] {
            new Property(MaxConsumers.value, _maxConsumersDefaultAny),
            new Property(MaxSuppliers.value, _maxSuppliersDefaultAny),
            new Property(MaxQueueLength.value, _maxQueueLengthAny),
            new Property(RejectNewEvents.value, _rejectNewEventsAny)
          };

      set_admin(defaultProperties_);
    } catch (ConfigurationException ex) {
      throw new INTERNAL("Configuration exception" + ex);
    }
  }
  protected void startService() throws Exception {
    Context ctx;
    ORB orb;
    POA rootPOA;

    try {
      ctx = new InitialContext();
    } catch (NamingException e) {
      throw new RuntimeException("Cannot get intial JNDI context: " + e);
    }
    try {
      orb = (ORB) ctx.lookup("java:/" + CorbaORBService.ORB_NAME);
    } catch (NamingException e) {
      throw new RuntimeException("Cannot lookup java:/" + CorbaORBService.ORB_NAME + ": " + e);
    }
    try {
      rootPOA = (POA) ctx.lookup("java:/" + CorbaORBService.POA_NAME);
    } catch (NamingException e) {
      throw new RuntimeException("Cannot lookup java:/" + CorbaORBService.POA_NAME + ": " + e);
    }

    // Create the naming server POA as a child of the root POA
    Policy[] policies = new Policy[2];
    policies[0] = rootPOA.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID);
    policies[1] = rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT);
    namingPOA = rootPOA.create_POA("Naming", null, policies);
    namingPOA.the_POAManager().activate();

    // initialize the static naming service variables.
    JBossNamingContextImpl.init(orb, rootPOA);

    // create and initialize the root context instance according to the configuration.
    JBossNamingContextImpl ns = new JBossNamingContextImpl();
    Configuration configuration = ((org.jacorb.orb.ORB) orb).getConfiguration();
    boolean doPurge = configuration.getAttribute("jacorb.naming.purge", "off").equals("on");
    boolean noPing = configuration.getAttribute("jacorb.naming.noping", "off").equals("on");
    ns.init(namingPOA, doPurge, noPing);

    // create and activate the root context.
    byte[] rootContextId = "root".getBytes();
    namingPOA.activate_object_with_id(rootContextId, ns);
    namingService =
        NamingContextExtHelper.narrow(
            namingPOA.create_reference_with_id(
                rootContextId, "IDL:omg.org/CosNaming/NamingContextExt:1.0"));

    // bind the root context to JNDI.
    bind(NAMING_NAME, "org.omg.CosNaming.NamingContextExt");
    getLog().info("CORBA Naming Started");
    getLog().debug("Naming: [" + orb.object_to_string(namingService) + "]");
  }
  public void configure(Configuration config) throws ConfigurationException {
    configuration = (org.jacorb.config.Configuration) config;
    orb = configuration.getORB();

    logger = configuration.getLogger(configuration.getLoggerName(getClass()));

    if (configuration.getAttributeAsBoolean("jacorb.debug.dump_outgoing_messages", false)) {
      b_out = new ByteArrayOutputStream();
    }

    finalTimeout =
        configuration.getAttributeAsInteger(
            "jacorb.connection.timeout_after_closeconnection", 20000);
  }
Example #5
0
  @Override
  public void configure(Configuration config) throws ConfigurationException {
    super.configure(config);

    socketTimeout = config.getAttributeAsInteger("jacorb.miop.timeout", MulticastUtil.SO_TIMEOUT);
    timeToLive =
        config.getAttributeAsInteger("jacorb.miop.time_to_live", MulticastUtil.TIME_TO_LIVE);
    incompleteMessagesThreshold =
        config.getAttributeAsInteger(
            "jacorb.miop.incomplete_messages_threshold",
            MulticastUtil.INCOMPLETE_MESSAGES_THRESHOULD);
    packetMaxSize =
        (short)
            config.getAttributeAsInteger(
                "jacorb.miop.packet_max_size", MulticastUtil.PACKET_MAX_SIZE);
  }
Example #6
0
  /**
   * in case a singleton orb is created the c'tor will access the JacORB configuration to configure
   * the orb. otherwise configure needs to be called to properly set up the created instance.
   *
   * @param isSingleton determine if a singleton orb is created.
   */
  protected ORBSingleton(boolean isSingleton) {
    super();

    try {
      if (isSingleton) {
        configuration = JacORBConfiguration.getConfiguration(null, null, null, false);

        // Don't call configure method as if this has been called from ORB::ctor
        // class construction order can cause issues.
        logger = configuration.getLogger("org.jacorb.orb.singleton");

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

        final BufferManagerFactory bufferManagerFactory = newBufferManagerFactory(configuration);
        bufferManager = bufferManagerFactory.newSingletonBufferManager(configuration);

        typeCodeCache = NullTypeCodeCache.getInstance();
        typeCodeCompactor = NullTypeCodeCompactor.getInstance();

        configureCodeset();

        if (logger.isDebugEnabled()) {
          logger.debug("BufferManagerFactory: " + bufferManagerFactory);
          logger.debug("BufferManager: " + bufferManager);
          logger.debug(
              "jacorb.interop.strict_check_on_tc_creation set to "
                  + doStrictCheckOnTypecodeCreation);
          ClassLoader omgcl = org.omg.CORBA.ORB.class.getClassLoader();
          ClassLoader thiscl = this.getClass().getClassLoader();

          if (omgcl != thiscl) {
            logger.debug(
                "OMG.ORB classloader ("
                    + omgcl
                    + ") does not match JacORB ORBSingleton classloader ("
                    + thiscl
                    + "). This may cause problems; see the ProgrammingGuide for further details");
          }
        }
      }
    } catch (ConfigurationException e) {
      throw new INTERNAL(e.toString());
    }
  }
 /** Creates a new <code>DefaultAcceptorExceptionListener</code> instance. */
 public void configure(Configuration configuration) {
   sslException = null;
   String exceptionClass = configuration.getAttribute("javax.net.ssl.SSLException", null);
   if (exceptionClass != null) {
     try {
       sslException = ObjectUtil.classForName(exceptionClass);
     } catch (ClassNotFoundException e) {
       // ignore
     }
   }
   logger = ((org.jacorb.config.Configuration) configuration).getLogger("org.jacorb.orb.iiop");
 }
Example #8
0
  private int getPortProperty(Configuration config, String name) throws ConfigurationException {
    int port = config.getAttributeAsInteger(name);

    // Check sensible port number
    if (port < 0) {
      port += 65536;
    }
    if ((port <= 0) || (port > 65535)) {
      throw new ConfigurationException("PortRangeFactory: " + name + " invalid port number");
    }

    return port;
  }
Example #9
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();
  }
Example #10
0
  /** The constructor. Connects to default repository and fetches the servers. */
  public ImRModel() {
    m_orb = (org.jacorb.orb.ORB) org.omg.CORBA.ORB.init(new String[0], null);
    configuration = m_orb.getConfiguration();
    logger = configuration.getLogger("org.jacorb.imr.model");

    try {
      m_admin = AdminHelper.narrow(m_orb.resolve_initial_references("ImplementationRepository"));
    } catch (org.omg.CORBA.ORBPackage.InvalidName in) {
      if (logger.isWarnEnabled()) logger.warn("Could not contact Impl. Repository!");
      return;
    }

    fetchImRInfo();

    m_top_node = new DefaultMutableTreeNode(m_imr_info);
    m_tree_model = new DefaultTreeModel(m_top_node, false);
    m_tree = new JTree(m_tree_model);

    m_server_model = new ImRServerTableModel(this);
    m_poa_model = new ImRPOATableModel();

    m_server_names = new Hashtable();

    m_server_nodes = new Vector();
    m_poa_nodes = new Vector();

    m_host_names = new Hashtable();
    m_host_selector_model = new DefaultComboBoxModel();
    m_host_selector = new JComboBox(m_host_selector_model);
    m_host_selector.setEditable(true);

    fetchServers();
    m_tree.expandRow(0);

    m_refresh_thread = new RefreshThread(m_current_refresh_interval);
  }
Example #11
0
 private BufferManagerFactory newBufferManagerFactory(
     final org.jacorb.config.Configuration configuration) throws ConfigurationException {
   return (BufferManagerFactory)
       configuration.getAttributeAsObject(
           BufferManagerFactory.PARAM_NAME, DefaultBufferManagerFactory.class.getName());
 }
Example #12
0
 public void configure(Configuration arg) throws ConfigurationException {
   orb = arg.getORB();
 }