当前位置: 首页>>代码示例>>Java>>正文


Java DiscoverInfo.setNode方法代码示例

本文整理汇总了Java中org.jivesoftware.smackx.packet.DiscoverInfo.setNode方法的典型用法代码示例。如果您正苦于以下问题:Java DiscoverInfo.setNode方法的具体用法?Java DiscoverInfo.setNode怎么用?Java DiscoverInfo.setNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jivesoftware.smackx.packet.DiscoverInfo的用法示例。


在下文中一共展示了DiscoverInfo.setNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:31,代码来源:PubSubManager.java

示例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;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:36,代码来源:ServiceDiscoveryManager.java

示例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;
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:31,代码来源:PubSubManager.java

示例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;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:32,代码来源:PubSubManager.java

示例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;
}
 
开发者ID:bejayoharen,项目名称:java-bells,代码行数:39,代码来源:ServiceDiscoveryManager.java

示例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);
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:16,代码来源:Node.java

示例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;
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:42,代码来源:ServiceDiscoveryManager.java

示例8: getOwnDiscoverInfo

import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
 * Get a DiscoverInfo for the current entity caps node.
 * 
 * @return a DiscoverInfo for the current entity caps node
 */
public DiscoverInfo getOwnDiscoverInfo() {
	DiscoverInfo di = new DiscoverInfo();
	di.setType(IQ.Type.RESULT);
	di.setNode(getNode() + "#" + getCapsVersion());

	// Add discover info
	sdm.addDiscoverInfoTo(di);

	return di;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:16,代码来源:EntityCapsManager.java

示例9: getOwnDiscoverInfo

import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
 * Get a DiscoverInfo for the current entity caps node.
 * 
 * @return a DiscoverInfo for the current entity caps node
 */
public DiscoverInfo getOwnDiscoverInfo() {
	DiscoverInfo di = new DiscoverInfo();
	di.setType(IQ.Type.RESULT);
	di.setNode(capsManager.getNode() + "#" + getEntityCapsVersion());

	// Add discover info
	addDiscoverInfoTo(di);

	return di;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:16,代码来源:ServiceDiscoveryManager.java

示例10: 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;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:41,代码来源:ServiceDiscoveryManager.java

示例11: getOwnDiscoverInfo

import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
 * Get a DiscoverInfo for the current entity caps node.
 *
 * @return a DiscoverInfo for the current entity caps node
 */
public DiscoverInfo getOwnDiscoverInfo() {
    DiscoverInfo di = new DiscoverInfo();
    di.setType(IQ.Type.RESULT);
    di.setNode(getNode() + "#" + getCapsVersion());

    // Add discover info
    sdm.addDiscoverInfoTo(di);

    return di;
}
 
开发者ID:jtietema,项目名称:telegraph,代码行数:16,代码来源:EntityCapsManager.java

示例12: getOwnDiscoverInfo

import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
 * Get a DiscoverInfo for the current entity caps node.
 *
 * @return a DiscoverInfo for the current entity caps node
 */
public DiscoverInfo getOwnDiscoverInfo() {
    DiscoverInfo di = new DiscoverInfo();
    di.setType(IQ.Type.RESULT);
    di.setNode(capsManager.getNode() + "#" + getEntityCapsVersion());

    // Add discover info
    addDiscoverInfoTo(di);

    return di;
}
 
开发者ID:jtietema,项目名称:telegraph,代码行数:16,代码来源:ServiceDiscoveryManager.java

示例13: 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;
}
 
开发者ID:phoenixNirvana,项目名称:NewCommunication-Android,代码行数:37,代码来源:ServiceDiscoveryManager.java

示例14: parseIQ

import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
public IQ parseIQ(XmlPullParser parser) throws Exception {
    DiscoverInfo discoverInfo = new DiscoverInfo();
    boolean done = false;
    DiscoverInfo.Feature feature = null;
    DiscoverInfo.Identity identity = null;
    String category = "";
    String name = "";
    String type = "";
    String variable = "";
    discoverInfo.setNode(parser.getAttributeValue("", "node"));
    while (!done) {
        int eventType = parser.next();
        if (eventType == XmlPullParser.START_TAG) {
            if (parser.getName().equals("identity")) {
                // Initialize the variables from the parsed XML
                category = parser.getAttributeValue("", "category");
                name = parser.getAttributeValue("", "name");
                type = parser.getAttributeValue("", "type");
            }
            else if (parser.getName().equals("feature")) {
                // Initialize the variables from the parsed XML
                variable = parser.getAttributeValue("", "var");
            }
            // Otherwise, it must be a packet extension.
            else {
                discoverInfo.addExtension(PacketParserUtils.parsePacketExtension(parser
                        .getName(), parser.getNamespace(), parser));
            }
        } else if (eventType == XmlPullParser.END_TAG) {
            if (parser.getName().equals("identity")) {
                // Create a new identity and add it to the discovered info.
                identity = new DiscoverInfo.Identity(category, name);
                identity.setType(type);
                discoverInfo.addIdentity(identity);
            }
            if (parser.getName().equals("feature")) {
                // Create a new feature and add it to the discovered info.
                discoverInfo.addFeature(variable);
            }
            if (parser.getName().equals("query")) {
                done = true;
            }
        }
    }

    return discoverInfo;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:48,代码来源:DiscoverInfoProvider.java

示例15: updateLocalEntityCaps

import org.jivesoftware.smackx.packet.DiscoverInfo; //导入方法依赖的package包/类
/**
 * Updates the local user Entity Caps information with the data provided
 * 
 * If we are connected and there was already a presence send, another
 * presence is send to inform others about your new Entity Caps node string.
 * 
 * @param discoverInfo
 *            the local users discover info (mostly the service discovery
 *            features)
 * @param identityType
 *            the local users identity type
 * @param identityName
 *            the local users identity name
 * @param extendedInfo
 *            the local users extended info
 */
public void updateLocalEntityCaps() {
    Connection connection = weakRefConnection.get();

    DiscoverInfo discoverInfo = new DiscoverInfo();
    discoverInfo.setType(IQ.Type.RESULT);
    discoverInfo.setNode(getLocalNodeVer());
    if (connection != null)
        discoverInfo.setFrom(connection.getUser());
    sdm.addDiscoverInfoTo(discoverInfo);

    currentCapsVersion = generateVerificationString(discoverInfo, "sha-1");
    addDiscoverInfoByNode(ENTITY_NODE + '#' + currentCapsVersion, discoverInfo);
    if (lastLocalCapsVersions.size() > 10) {
        String oldCapsVersion = lastLocalCapsVersions.poll();
        sdm.removeNodeInformationProvider(ENTITY_NODE + '#' + oldCapsVersion);
    }
    lastLocalCapsVersions.add(currentCapsVersion);

    caps.put(currentCapsVersion, discoverInfo);
    if (connection != null)
        jidCaps.put(connection.getUser(), new NodeVerHash(ENTITY_NODE, currentCapsVersion, "sha-1"));

    final List<Identity> identities = new LinkedList<Identity>(ServiceDiscoveryManager.getInstanceFor(connection).getIdentities());
    sdm.setNodeInformationProvider(ENTITY_NODE + '#' + currentCapsVersion, new NodeInformationProvider() {
        List<String> features = sdm.getFeaturesList();
        List<PacketExtension> packetExtensions = sdm.getExtendedInfoAsList();

        @Override
        public List<Item> getNodeItems() {
            return null;
        }

        @Override
        public List<String> getNodeFeatures() {
            return features;
        }

        @Override
        public List<Identity> getNodeIdentities() {
            return identities;
        }

        @Override
        public List<PacketExtension> getNodePacketExtensions() {
            return packetExtensions;
        }
    });

    // Send an empty presence, and let the packet intercepter
    // add a <c/> node to it.
    // See http://xmpp.org/extensions/xep-0115.html#advertise
    // We only send a presence packet if there was already one send
    // to respect ConnectionConfiguration.isSendPresence()
    if (connection != null && connection.isAuthenticated() && presenceSend) {
        Presence presence = new Presence(Presence.Type.available);
        connection.sendPacket(presence);
    }
}
 
开发者ID:CJC-ivotten,项目名称:androidPN-client.,代码行数:75,代码来源:EntityCapsManager.java


注:本文中的org.jivesoftware.smackx.packet.DiscoverInfo.setNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。