public IQ parseIQ(XmlPullParser parser) throws Exception { DiscoverItems discoverItems = new DiscoverItems(); boolean done = false; DiscoverItems.Item item;
public IQ parseIQ(XmlPullParser parser) throws Exception { DiscoverItems discoverItems = new DiscoverItems(); boolean done = false; DiscoverItems.Item item;
public IQ parseIQ(XmlPullParser parser) throws Exception { DiscoverItems discoverItems = new DiscoverItems(); boolean done = false; DiscoverItems.Item item;
/** * Get all the nodes that currently exist as a child of the specified * collection node. If the service does not support collection nodes * then all nodes will be returned. * * To retrieve contents of the root collection node (if it exists), * or there is no root collection node, pass null as the nodeId. * * @param nodeId - The id of the collection node for which the child * nodes will be returned. * @return {@link DiscoverItems} representing the existing nodes * * @throws XMPPException */ public DiscoverItems discoverNodes(String nodeId) throws XMPPException { DiscoverItems items = new DiscoverItems(); if (nodeId != null) items.setNode(nodeId); items.setTo(to); DiscoverItems nodeItems = (DiscoverItems)SyncPacketSend.getReply(con, items); return nodeItems; }
/** * Get all the nodes that currently exist as a child of the specified * collection node. If the service does not support collection nodes * then all nodes will be returned. * * To retrieve contents of the root collection node (if it exists), * or there is no root collection node, pass null as the nodeId. * * @param nodeId - The id of the collection node for which the child * nodes will be returned. * @return {@link DiscoverItems} representing the existing nodes * * @throws XMPPException */ public DiscoverItems discoverNodes(String nodeId) throws XMPPException { DiscoverItems items = new DiscoverItems(); if (nodeId != null) items.setNode(nodeId); items.setTo(to); DiscoverItems nodeItems = (DiscoverItems)SyncPacketSend.getReply(con, items); return nodeItems; }
/** * Get all the nodes that currently exist as a child of the specified * collection node. If the service does not support collection nodes * then all nodes will be returned. * * To retrieve contents of the root collection node (if it exists), * or there is no root collection node, pass null as the nodeId. * * @param nodeId - The id of the collection node for which the child * nodes will be returned. * @return {@link DiscoverItems} representing the existing nodes * * @throws XMPPException */ public DiscoverItems discoverNodes(String nodeId) throws XMPPException { DiscoverItems items = new DiscoverItems(); if (nodeId != null) items.setNode(nodeId); items.setTo(to); DiscoverItems nodeItems = (DiscoverItems)SyncPacketSend.getReply(con, items); return nodeItems; }
/** * Get information on the items in the node in standard * {@link DiscoverItems} format. * * @return The item details in {@link DiscoverItems} format * * @throws XMPPException */ public DiscoverItems discoverItems() throws XMPPException { DiscoverItems items = new DiscoverItems(); items.setTo(to); items.setNode(getId()); return (DiscoverItems)SyncPacketSend.getReply(con, items); }
/** * Get information on the items in the node in standard * {@link DiscoverItems} format. * * @return The item details in {@link DiscoverItems} format * * @throws XMPPException */ public DiscoverItems discoverItems() throws XMPPException { DiscoverItems items = new DiscoverItems(); items.setTo(to); items.setNode(getId()); return (DiscoverItems)SyncPacketSend.getReply(con, items); }
/** * Get information on the items in the node in standard * {@link DiscoverItems} format. * * @return The item details in {@link DiscoverItems} format * * @throws XMPPException */ public DiscoverItems discoverItems() throws XMPPException { DiscoverItems items = new DiscoverItems(); items.setTo(to); items.setNode(getId()); return (DiscoverItems)SyncPacketSend.getReply(con, items); }
/** * 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); }
/** * 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); }
/** * 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); }
public void processPacket(Packet packet) { DiscoverItems discoverItems = (DiscoverItems) packet; // Send back the items defined in the client if the request is of type GET if (discoverItems != null && discoverItems.getType() == IQ.Type.GET) { DiscoverItems response = new DiscoverItems(); response.setType(IQ.Type.RESULT); response.setTo(discoverItems.getFrom()); response.setPacketID(discoverItems.getPacketID()); // Add the defined items related to the requested node. Look for // the NodeInformationProvider associated with the requested node. if (getNodeInformationProvider(discoverItems.getNode()) != null) { Iterator items = getNodeInformationProvider(discoverItems.getNode()).getNodeItems(); while (items.hasNext()) { response.addItem((DiscoverItems.Item) items.next()); } } else if(discoverItems.getNode() != null) { // Return an <item-not-found/> error since the client // doesn't contain the specified node response.setNode(discoverItems.getNode()); response.setType(IQ.Type.ERROR); response.setError(new XMPPError(404, "item-not-found")); } connection.sendPacket(response); } } };
DiscoverItems disco = new DiscoverItems(); disco.setType(IQ.Type.GET); disco.setTo(entityID);
DiscoverItems disco = new DiscoverItems(); disco.setType(IQ.Type.GET); disco.setTo(entityID);
DiscoverItems disco = new DiscoverItems(); disco.setType(IQ.Type.GET); disco.setTo(entityID);
DiscoverItems disco = new DiscoverItems(); disco.setType(IQ.Type.GET); disco.setTo(entityID);
DiscoverItems response = new DiscoverItems(); response.setType(IQ.Type.RESULT); response.setTo(discoverItems.getFrom());
DiscoverItems response = new DiscoverItems(); response.setType(IQ.Type.RESULT); response.setTo(discoverItems.getFrom());
public void processPacket(Packet packet) { DiscoverItems discoverItems = (DiscoverItems) packet; // Send back the items defined in the client if the request is of type GET if (discoverItems != null && discoverItems.getType() == IQ.Type.GET) { DiscoverItems response = new DiscoverItems(); response.setType(IQ.Type.RESULT); response.setTo(discoverItems.getFrom()); response.setPacketID(discoverItems.getPacketID()); response.setNode(discoverItems.getNode()); // Add the defined items related to the requested node. Look for // the NodeInformationProvider associated with the requested node. NodeInformationProvider nodeInformationProvider = getNodeInformationProvider(discoverItems.getNode()); if (nodeInformationProvider != null) { // Specified node was found, add node items response.addItems(nodeInformationProvider.getNodeItems()); // Add packet extensions response.addExtensions(nodeInformationProvider.getNodePacketExtensions()); } else if(discoverItems.getNode() != null) { // Return <item-not-found/> error since client doesn't contain // the specified node response.setType(IQ.Type.ERROR); response.setError(new XMPPError(XMPPError.Condition.item_not_found)); } connection.sendPacket(response); } } };