Beispiel #1
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);
  }
Beispiel #2
0
  public MyInterceptor(ORB orb, int slot_id, Codec codec) {
    this.slot_id = slot_id;
    this.codec = codec;

    logger = orb.getConfiguration().getLogger("org.jacorb.test");
  }
Beispiel #3
0
  /** entry point from the command line */
  public static void main(String args[]) throws Exception {
    final org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
    final org.jacorb.orb.ORB jorb = (org.jacorb.orb.ORB) orb;
    final Logger logger = jorb.getConfiguration().getLogger("jacorb.print_ior");

    boolean urlForm = false;
    boolean corbalocForm = false;
    String iorString = null;
    String file = null;

    if (args.length < 2 || args.length > 3) {
      usage();
    }

    for (int i = 0; i < args.length; i++) {
      if ("-u".equals(args[i])) {
        urlForm = true;
      } else if ("-c".equals(args[i])) {
        corbalocForm = true;
      } else if ("-i".equals(args[i])) {
        iorString = args[i + 1];
        ++i;
      } else if ("-f".equals(args[i])) {
        file = args[i + 1];
        ++i;
      } else {
        usage();
      }
    }

    if (logger.isDebugEnabled()) {
      logger.debug(
          "Under "
              + System.getProperty("os.name")
              + " the encoding name is "
              + System.getProperty("file.encoding")
              + " and the canonical encoding name is "
              + (new java.io.OutputStreamWriter(new ByteArrayOutputStream())).getEncoding());
    }

    PrintWriter out = new PrintWriter(System.out, true);

    try {
      if (file != null) {
        final LineNumberReader in = new LineNumberReader(new BufferedReader(new FileReader(file)));
        try {
          String line = null;
          while ((line = in.readLine()) != null) {
            iorString = line;
          }
        } finally {
          in.close();
        }
      }

      if (iorString.startsWith("IOR:")) {
        final ParsedIOR pior = new ParsedIOR(jorb, iorString);
        if (urlForm) {
          out.println(CorbaLoc.parseKey(pior.get_object_key()));
        } else if (corbalocForm) {
          out.println(printCorbalocIOR(orb, iorString));
        } else {
          printIOR(jorb, pior, out);
        }
      } else {
        out.println("Sorry, we only unparse IORs in the standard IOR URL scheme");
      }
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      out.flush();
    }

    orb.shutdown(true);
  }