Package tigase.server

Examples of tigase.server.MessageReceiver


  private void createNewComponent(Packet packet, Packet result, boolean admin) {
    String new_comp_name = Command.getFieldValue(packet, "Component name");
    String new_comp_class = Command.getFieldValue(packet, "Component class");
    try {
      MessageReceiver mr =
        (MessageReceiver)Class.forName(new_comp_class).newInstance();
      mr.setName(new_comp_name);
      if (mr instanceof Configurable) {
        Map<String, Object> comp_props =
          ((Configurable)mr).getDefaults(defConfigParams);
        Map<String, Object> new_params =
          new LinkedHashMap<String, Object>(comp_props);
View Full Code Here


    Command.setStatus(result, Command.Status.executing);
    Command.addFieldValue(result, "Component name",  new_comp_name,  "hidden");
    Command.addFieldValue(result, "Component class", new_comp_class, "hidden");
    Command.addFieldValue(result, "Info1""Press:", "fixed");
    try {
      MessageReceiver mr =
        (MessageReceiver)Class.forName(new_comp_class).newInstance();
      Command.addFieldValue(result, "Info4",
        "Component name: " + new_comp_name
        + ", class: " + mr.getClass().getSimpleName(), "fixed");
      if (mr instanceof ConnectionManager) {
        String ports = Command.getFieldValue(packet, "TCP/IP ports");
        if (ports == null) {
          Command.addFieldValue(result, "Info2",
            "1. 'Next' to set more component parameters.", "fixed");
          Command.addFieldValue(result, "Info3",
            "2. 'Previous' to go back and select different component.", "fixed");
          Command.addAction(result, Command.Action.next);
          Command.addAction(result, Command.Action.prev);
          Command.addFieldValue(result, "Info4",
            "This component uses TCP/IP ports, please provide port numbers:",
            "fixed");
          Command.addFieldValue(result, "TCP/IP ports", "5557");
          return;
        } else {
          String[] ports_arr = ports.split(",");
          int[] ports_i = new int[ports_arr.length];
          try {
            for (int i = 0; i < ports_arr.length; i++) {
              ports_i[i] = Integer.decode(ports_arr[i].trim());
            } // end of for (int i = 0; i < ports_arr.length; i++)
            defConfigParams.put(new_comp_name + "/connections/ports", ports_i);
          } catch (Exception e) {
            Command.addFieldValue(result, "Info2",
              "1. 'Next' to set more component parameters.", "fixed");
            Command.addFieldValue(result, "Info3",
              "2. 'Previous' to go back and select different component.", "fixed");
          Command.addAction(result, Command.Action.next);
          Command.addAction(result, Command.Action.prev);
            Command.addFieldValue(result, "Info4",
              "Incorrect TCP/IP ports provided, please provide port numbers:",
              "fixed");
            Command.addFieldValue(result, "TCP/IP ports", ports);
            return;
          } // end of try-catch
        } // end of else
      }
      Command.addFieldValue(result, "Info2",
        "1. 'Finish' to create component with this parameters.", "fixed");
      Command.addFieldValue(result, "Info3",
        "2. 'Previous' to go back and select different component.", "fixed");
      Command.addAction(result, Command.Action.complete);
      Command.addAction(result, Command.Action.prev);
      mr.setName(new_comp_name);
      if (mr instanceof Configurable) {
        // Load defaults into sorted Map:
        Map<String, Object> comp_props =
          new TreeMap<String, Object>(((Configurable)mr).
            getDefaults(defConfigParams));
View Full Code Here

TOP

Related Classes of tigase.server.MessageReceiver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.