本文整理汇总了Java中org.jivesoftware.smackx.packet.DiscoverInfo.setTo方法的典型用法代码示例。如果您正苦于以下问题:Java DiscoverInfo.setTo方法的具体用法?Java DiscoverInfo.setTo怎么用?Java DiscoverInfo.setTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.smackx.packet.DiscoverInfo
的用法示例。
在下文中一共展示了DiscoverInfo.setTo方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNode
import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
* Retrieves the requested node, if it exists. It will throw an
* exception if it does not.
*
* @param id - The unique id of the node
* @return the node
* @throws XMPPException The node does not exist
*/
public Node getNode(String id)
throws XMPPException
{
Node node = nodeMap.get(id);
if (node == null)
{
DiscoverInfo info = new DiscoverInfo();
info.setTo(to);
info.setNode(id);
DiscoverInfo infoReply = (DiscoverInfo)SyncPacketSend.getReply(con, info);
if (infoReply.getIdentities().next().getType().equals(NodeType.leaf.toString()))
node = new LeafNode(con, id);
else
node = new CollectionNode(con, id);
node.setTo(to);
nodeMap.put(id, node);
}
return node;
}
示例2: discoverInfo
import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
* Returns the discovered information of a given XMPP entity addressed by its JID and
* note attribute. Use this message only when trying to query information which is not
* directly addressable.
*
* @param entityID the address of the XMPP entity.
* @param node the attribute that supplements the 'jid' attribute.
* @return the discovered information.
* @throws XMPPException if the operation failed for some reason.
*/
public DiscoverInfo discoverInfo(String entityID, String node) throws XMPPException {
// Discover the entity's info
DiscoverInfo disco = new DiscoverInfo();
disco.setType(IQ.Type.GET);
disco.setTo(entityID);
disco.setNode(node);
// Create a packet collector to listen for a response.
PacketCollector collector =
connection.createPacketCollector(new PacketIDFilter(disco.getPacketID()));
connection.sendPacket(disco);
// Wait up to 5 seconds for a result.
IQ result = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
// Stop queuing results
collector.cancel();
if (result == null) {
throw new XMPPException("No response from the server.");
}
if (result.getType() == IQ.Type.ERROR) {
throw new XMPPException(result.getError());
}
return (DiscoverInfo) result;
}
示例3: getNode
import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
* Retrieves the requested node, if it exists. It will throw an
* exception if it does not.
*
* @param id - The unique id of the node
* @return the node
* @throws XMPPException The node does not exist
*/
public <T extends Node> T getNode(String id)
throws XMPPException
{
Node node = nodeMap.get(id);
if (node == null)
{
DiscoverInfo info = new DiscoverInfo();
info.setTo(to);
info.setNode(id);
DiscoverInfo infoReply = (DiscoverInfo)SyncPacketSend.getReply(con, info);
if (infoReply.getIdentities().next().getType().equals(NodeType.leaf.toString()))
node = new LeafNode(con, id);
else
node = new CollectionNode(con, id);
node.setTo(to);
nodeMap.put(id, node);
}
return (T) node;
}
示例4: getNode
import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
* Retrieves the requested node, if it exists. It will throw an exception if
* it does not.
*
* @param id
* - The unique id of the node
* @return the node
* @throws XMPPException
* The node does not exist
*/
public Node getNode(String id) throws XMPPException {
Node node = nodeMap.get(id);
if (node == null) {
DiscoverInfo info = new DiscoverInfo();
info.setTo(to);
info.setNode(id);
DiscoverInfo infoReply = (DiscoverInfo) SyncPacketSend.getReply(
con, info);
if (infoReply.getIdentities().next().getType()
.equals(NodeType.leaf.toString()))
node = new LeafNode(con, id);
else
node = new CollectionNode(con, id);
node.setTo(to);
nodeMap.put(id, node);
}
return node;
}
示例5: discoverInfo
import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
* Returns the discovered information of a given XMPP entity addressed by its JID and
* note attribute. Use this message only when trying to query information which is not
* directly addressable.
*
* @see <a href="http://xmpp.org/extensions/xep-0030.html#info-basic">XEP-30 Basic Protocol</a>
* @see <a href="http://xmpp.org/extensions/xep-0030.html#info-nodes">XEP-30 Info Nodes</a>
*
* @param entityID the address of the XMPP entity.
* @param node the optional attribute that supplements the 'jid' attribute.
* @return the discovered information.
* @throws XMPPException if the operation failed for some reason.
*/
public DiscoverInfo discoverInfo(String entityID, String node) throws XMPPException {
// Discover the entity's info
DiscoverInfo disco = new DiscoverInfo();
disco.setType(IQ.Type.GET);
disco.setTo(entityID);
disco.setNode(node);
// Create a packet collector to listen for a response.
PacketCollector collector =
connection.createPacketCollector(new PacketIDFilter(disco.getPacketID()));
connection.sendPacket(disco);
// Wait up to 5 seconds for a result.
IQ result = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
// Stop queuing results
collector.cancel();
if (result == null) {
throw new XMPPException("No response from the server.");
}
if (result.getType() == IQ.Type.ERROR) {
throw new XMPPException(result.getError());
}
return (DiscoverInfo) result;
}
示例6: discoverInfo
import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
* Discover node information in standard {@link DiscoverInfo} format.
*
* @return The discovery information about the node.
*
* @throws XMPPException
*/
public DiscoverInfo discoverInfo()
throws XMPPException
{
DiscoverInfo info = new DiscoverInfo();
info.setTo(to);
info.setNode(getId());
return (DiscoverInfo)SyncPacketSend.getReply(con, info);
}
示例7: discoverInfo
import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
* Returns the discovered information of a given XMPP entity addressed by its JID and
* note attribute. Use this message only when trying to query information which is not
* directly addressable.
*
* @see <a href="http://xmpp.org/extensions/xep-0030.html#info-basic">XEP-30 Basic Protocol</a>
* @see <a href="http://xmpp.org/extensions/xep-0030.html#info-nodes">XEP-30 Info Nodes</a>
*
* @param entityID the address of the XMPP entity.
* @param node the optional attribute that supplements the 'jid' attribute.
* @return the discovered information.
* @throws XMPPException if the operation failed for some reason.
*/
public DiscoverInfo discoverInfo(String entityID, String node) throws XMPPException {
Connection connection = ServiceDiscoveryManager.this.connection.get();
if (connection == null) throw new XMPPException("Connection instance already gc'ed");
// Discover the entity's info
DiscoverInfo disco = new DiscoverInfo();
disco.setType(IQ.Type.GET);
disco.setTo(entityID);
disco.setNode(node);
// Create a packet collector to listen for a response.
PacketCollector collector =
connection.createPacketCollector(new PacketIDFilter(disco.getPacketID()));
connection.sendPacket(disco);
// Wait up to 5 seconds for a result.
IQ result = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
// Stop queuing results
collector.cancel();
if (result == null) {
throw new XMPPException("No response from the server.");
}
if (result.getType() == IQ.Type.ERROR) {
throw new XMPPException(result.getError());
}
return (DiscoverInfo) result;
}
示例8: discoverInfo
import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
* Returns the discovered information of a given XMPP entity addressed by
* its JID and note attribute. Use this message only when trying to query
* information which is not directly addressable.
*
* @param entityID
* the address of the XMPP entity.
* @param node
* the attribute that supplements the 'jid' attribute.
* @return the discovered information.
* @throws XMPPException
* if the operation failed for some reason.
*/
public DiscoverInfo discoverInfo(String entityID, String node)
throws XMPPException {
// Discover the entity's info
DiscoverInfo disco = new DiscoverInfo();
disco.setType(IQ.Type.GET);
disco.setTo(entityID);
disco.setNode(node);
// Create a packet collector to listen for a response.
PacketCollector collector = connection
.createPacketCollector(new PacketIDFilter(disco.getPacketID()));
connection.sendPacket(disco);
// Wait up to 5 seconds for a result.
IQ result = (IQ) collector.nextResult(SmackConfiguration
.getPacketReplyTimeout());
// Stop queuing results
collector.cancel();
if (result == null) {
throw new XMPPException("No response from the server.");
}
if (result.getType() == IQ.Type.ERROR) {
throw new XMPPException(result.getError());
}
return (DiscoverInfo) result;
}
示例9: discoverInfo
import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
* Returns the discovered information of a given XMPP entity addressed by its JID and
* note attribute. Use this message only when trying to query information which is not
* directly addressable.
*
* @param entityID the address of the XMPP entity.
* @param node the attribute that supplements the 'jid' attribute.
* @return the discovered information.
* @throws XMPPException if the operation failed for some reason.
*/
public DiscoverInfo discoverInfo(String entityID, String node) throws XMPPException {
// Discover the entity's info
DiscoverInfo disco = new DiscoverInfo();
disco.setType(IQ.Type.GET);
disco.setTo(entityID);
disco.setNode(node);
// Create a packet collector to listen for a response.
PacketCollector collector =
connection.createPacketCollector(new PacketIDFilter(disco.getPacketID()));
connection.sendPacket(disco);
// Wait up to 5 seconds for a result.
IQ result = (IQ) collector.nextResult(SmackConfiguration.getPacketReplyTimeout());
// Stop queuing results
collector.cancel();
if (result == null) {
throw new XMPPException("No response from the server.");
}
if (result.getType() == IQ.Type.ERROR) {
throw new XMPPException(result.getError());
}
return (DiscoverInfo) result;
}
示例10: cleanupDicsoverInfo
import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
private static void cleanupDicsoverInfo(DiscoverInfo info) {
info.setFrom(null);
info.setTo(null);
info.setPacketID(null);
}
示例11: cleanupDicsoverInfo
import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
private static void cleanupDicsoverInfo(DiscoverInfo info) {
info.setFrom(null);
info.setTo(null);
info.setPacketID(null);
}
示例12: discoverInfo
import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
* Discover node information in standard {@link DiscoverInfo} format.
*
* @return The discovery information about the node.
*
* @throws XMPPException
*/
public DiscoverInfo discoverInfo() throws XMPPException {
DiscoverInfo info = new DiscoverInfo();
info.setTo(to);
info.setNode(getId());
return (DiscoverInfo) SyncPacketSend.getReply(con, info);
}