/**
   * This constructor is to cater for local calls where portable interceptors are involved. These
   * calls are now handled locally rather than via the remote request mechanism so there will be no
   * request from which to obtain information
   *
   * @param bs
   */
  public ServerRequestInfoImpl(
      org.jacorb.orb.ORB orb,
      Collection<ServiceContext> contexts,
      Servant servant,
      byte[] objectId,
      String operation,
      boolean response_expected,
      short sync_scope) {
    super(orb);

    this.operation = operation;
    this.response_expected = response_expected;
    this.sync_scope = sync_scope;
    this.objectId = objectId;

    requestId = 0;
    request = null;

    if (servant != null) {
      setServant(servant);
    }

    if (contexts != null) {
      setRequestServiceContexts(contexts.toArray(new ServiceContext[contexts.size()]));
    }

    sending_exception = orb.create_any();
  }
示例#2
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);
  }
示例#3
0
  /**
   * Connect the manager to a remote repository.
   *
   * @param ior_url an url pointing to the IOR file of a remote repository.
   */
  public void connectTo(String ior_url) {
    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.setUserObject(m_imr_info);

    fetchServers();

    setRefreshInterval(m_current_refresh_interval);
  }
  public ServerRequestInfoImpl(org.jacorb.orb.ORB orb, ServerRequest request, Servant servant) {
    super(orb);

    this.request = request;
    operation = request.operation();
    response_expected = request.responseExpected();
    sync_scope = request.syncScope();
    requestId = request.requestId();
    objectId = request.objectId();

    if (servant != null) {
      setServant(servant);
    }

    setRequestServiceContexts(request.getServiceContext());

    sending_exception = orb.create_any();
  }
示例#5
0
  public Any decode_value(byte[] data, TypeCode tc) throws FormatMismatch, TypeMismatch {
    final CDRInputStream in = new CDRInputStream(orb, data);

    try {
      in.setGIOPMinor(giopMinor);

      in.openEncapsulatedArray();
      Any result = orb.create_any();
      result.read_value(in, tc);

      // not necessary, since stream is never used again
      // in.closeEncasupaltion();

      return result;
    } finally {
      in.close();
    }
  }
示例#6
0
  public Listener create_listener(ProtocolProperties props, int stacksize, short base_priority) {
    IIOPListener delegate =
        new IIOPListener() {
          @Override
          protected Connection createServerConnection(Socket socket, boolean is_ssl)
              throws IOException {
            return new WIOPConnection(super.createServerConnection(socket, is_ssl), tag);
          }
        };
    try {
      Iterator<ListenEndpoint> it =
          orb.getTransportManager().getListenEndpoints(Protocol.IIOP).iterator();
      delegate.setListenEndpoint(it.next());
      delegate.configure(configuration);
    } catch (ConfigurationException ce) {
      throw new org.omg.CORBA.INTERNAL("ConfigurationException: " + ce.getMessage());
    }

    return new WIOPListener(delegate, tag);
  }
示例#7
0
  /**
   * Fill the model of the combo box with host names. After fetching hosts from the repository, they
   * are "pinged" in order to see if they are still up.
   */
  private void buildHostSelectorModel() {
    HostInfo[] _hosts = m_admin.list_hosts();

    for (int _i = 0; _i < _hosts.length; _i++) {
      try {
        ServerStartupDaemon _ssd =
            ServerStartupDaemonHelper.narrow(m_orb.string_to_object(_hosts[_i].ior_string));
        _ssd.get_system_load();
        _ssd._release();

        // ssd is up and seems to work
        if (m_host_names.put(_hosts[_i].name, _hosts[_i].name) == null)
          m_host_selector_model.addElement(_hosts[_i].name);
      } catch (Exception _e) {
        // ignore
      }
    }

    for (int _i = 0; _i < m_servers.length; _i++)
      if (m_host_names.put(m_servers[_i].host, m_servers[_i].host) == null)
        m_host_selector_model.addElement(m_servers[_i].host);
  }
示例#8
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");
  }
示例#9
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);
  }