Ejemplo n.º 1
0
  /**
   * Publish the commands to an specific JID.
   *
   * @param jid the full JID to publish the commands to.
   * @throws XMPPException if the operation failed for some reason.
   */
  public void publishCommands(String jid) throws XMPPException {
    ServiceDiscoveryManager serviceDiscoveryManager =
        ServiceDiscoveryManager.getInstanceFor(connection);

    // Collects the commands to publish as items
    DiscoverItems discoverItems = new DiscoverItems();
    Collection<AdHocCommandInfo> xCommandsList = getRegisteredCommands();

    for (AdHocCommandInfo info : xCommandsList) {
      DiscoverItems.Item item = new DiscoverItems.Item(info.getOwnerJID());
      item.setName(info.getName());
      item.setNode(info.getNode());
      discoverItems.addItem(item);
    }

    serviceDiscoveryManager.publishItems(jid, discoNode, discoverItems);
  }
Ejemplo n.º 2
0
 /**
  * Publishes new items to a parent entity. The item elements to publish MUST have at least a 'jid'
  * attribute specifying the Entity ID of the item, and an action attribute which specifies the
  * action being taken for that item. Possible action values are: "update" and "remove".
  *
  * @param entityID the address of the XMPP entity.
  * @param discoverItems the DiscoveryItems to publish.
  * @throws XMPPException if the operation failed for some reason.
  */
 public void publishItems(String entityID, DiscoverItems discoverItems) throws XMPPException {
   publishItems(entityID, null, discoverItems);
 }