Esempio n. 1
0
  private void createClusterManagerElement() {
    ConfigElementFactory factory = new ConfigElementFactory(mBroker.getRepository().getAllLatest());
    ConfigElement cluster_manager = factory.create("Sample Cluster", "cluster_manager");
    for (Enumeration e = mNodesListModel.elements(); e.hasMoreElements(); ) {
      cluster_manager.addProperty("cluster_node", (String) e.nextElement());
    }

    cluster_manager.addProperty("plugin_path", "${VJ_BASE_DIR}/lib/gadgeteer/plugins/");
    cluster_manager.addProperty("plugin", "RemoteInputManager");
    cluster_manager.addProperty("plugin", "ApplicationDataManager");
    mBroker.add(mContext, cluster_manager);
  }
Esempio n. 2
0
  private void mAddNodeBtn_actionPerformed(ActionEvent e) {
    String host_name = mHostnameField.getText().trim();
    String element_name = "Node(" + host_name + ")";
    java.util.List elts = mBroker.getElements(mContext);
    java.util.List matches = ConfigUtilities.getElementsWithDefinition(elts, element_name);

    if (!host_name.equals("") && matches.size() == 0) {
      // Create a cluster_node element for the node
      ConfigElementFactory factory =
          new ConfigElementFactory(mBroker.getRepository().getAllLatest());
      ConfigElement element = factory.create(element_name, CLUSTER_NODE_TYPE);
      mBroker.add(mContext, element);
      element.setProperty("host_name", 0, host_name);
      element.setProperty("listen_port", 0, "7000");
    }
    mHostnameField.setText("");
  }