Exemplo n.º 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));
    }
  }
Exemplo n.º 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);
  }
Exemplo n.º 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("");
  }
Exemplo n.º 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("");
  }
Exemplo n.º 5
0
 public void onExited() {
   if (!mConfigContext.containsElement(mConfigElement)) {
     ConfigBroker broker = new ConfigBrokerProxy();
     broker.add(mConfigContext, mConfigElement);
   }
 }