Пример #1
0
  private void mRemoveNode() {
    String old_node = (String) lstNodes.getSelectedValue();

    java.util.List remove_list =
        ConfigUtilities.getElementsWithDefinition(mBroker.getElements(mContext), old_node);
    for (int i = 0; i < remove_list.size(); i++) {
      mBroker.remove(mContext, (ConfigElement) remove_list.get(i));
    }
  }
Пример #2
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);
  }
Пример #3
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("");
  }
Пример #4
0
  public void init(Map whiteboard) {
    mWhiteBoard = whiteboard;

    // Get handle to broker
    mBroker = new ConfigBrokerProxy();

    // Create a context
    mContext = (ConfigContext) mWhiteBoard.get("context");

    mNodesListModel = new ConfigPtrListModel(mContext);
    mNodesListModel.addElementType(CLUSTER_NODE_TYPE);
    mBroker.addConfigListener(mNodesListModel);
    lstNodes.setModel(mNodesListModel);

    mHostnameField.setText("");
  }