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


Java PubSub.getExtension方法代码示例

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


在下文中一共展示了PubSub.getExtension方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSubscriptions

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
private List<Subscription> getSubscriptions(List<ExtensionElement> additionalExtensions,
                Collection<ExtensionElement> returnedExtensions, PubSubNamespace pubSubNamespace)
                throws NoResponseException, XMPPErrorException, NotConnectedException {
    PubSub pubSub = createPubsubPacket(Type.get, new NodeExtension(PubSubElementType.SUBSCRIPTIONS, getId()), pubSubNamespace);
    if (additionalExtensions != null) {
        for (ExtensionElement pe : additionalExtensions) {
            pubSub.addExtension(pe);
        }
    }
    PubSub reply = sendPubsubPacket(pubSub);
    if (returnedExtensions != null) {
        returnedExtensions.addAll(reply.getExtensions());
    }
    SubscriptionsExtension subElem = (SubscriptionsExtension) reply.getExtension(PubSubElementType.SUBSCRIPTIONS);
    return subElem.getSubscriptions();
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:17,代码来源:Node.java

示例2: getAffiliations

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
/**
 * Get the affiliations of this node.
 * <p>
 * {@code additionalExtensions} can be used e.g. to add a "Result Set Management" extension.
 * {@code returnedExtensions} will be filled with the stanza(/packet) extensions found in the answer.
 * </p>
 *
 * @param additionalExtensions additional {@code PacketExtensions} add to the request
 * @param returnedExtensions a collection that will be filled with the returned packet
 *        extensions
 * @return List of {@link Affiliation}
 * @throws NoResponseException
 * @throws XMPPErrorException
 * @throws NotConnectedException
 */
public List<Affiliation> getAffiliations(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions)
                throws NoResponseException, XMPPErrorException, NotConnectedException {
    PubSub pubSub = createPubsubPacket(Type.get, new NodeExtension(PubSubElementType.AFFILIATIONS, getId()));
    if (additionalExtensions != null) {
        for (ExtensionElement pe : additionalExtensions) {
            pubSub.addExtension(pe);
        }
    }
    PubSub reply = sendPubsubPacket(pubSub);
    if (returnedExtensions != null) {
        returnedExtensions.addAll(reply.getExtensions());
    }
    AffiliationsExtension affilElem = (AffiliationsExtension) reply.getExtension(PubSubElementType.AFFILIATIONS);
    return affilElem.getAffiliations();
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:31,代码来源:Node.java

示例3: getItems

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
/**
 * Get the items specified from the node.  This would typically be
 * used when the server does not return the payload due to size 
 * constraints.  The user would be required to retrieve the payload 
 * after the items have been retrieved via {@link #getItems()} or an
 * event, that did not include the payload.
 * 
 * @param ids Item ids of the items to retrieve
 * 
 * @return The list of {@link Item} with payload
 * 
 * @throws XMPPException
 */
public <T extends Item> List<T> getItems(Collection<String> ids)
	throws XMPPException
{
	List<Item> itemList = new ArrayList<Item>(ids.size());
	
	for (String id : ids)
	{
		itemList.add(new Item(id));
	}
	PubSub request = createPubsubPacket(Type.GET, new ItemsExtension(ItemsExtension.ItemsElementType.items, getId(), itemList));
	
	PubSub result = (PubSub)SyncPacketSend.getReply(con, request);
	ItemsExtension itemsElem = (ItemsExtension)result.getExtension(PubSubElementType.ITEMS);
	return (List<T>)itemsElem.getItems();
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:29,代码来源:LeafNode.java

示例4: getItems

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
/**
 * Get the items specified from the node. This would typically be used when
 * the server does not return the payload due to size constraints. The user
 * would be required to retrieve the payload after the items have been
 * retrieved via {@link #getItems()} or an event, that did not include the
 * payload.
 * 
 * @param ids
 *            Item ids of the items to retrieve
 * 
 * @return The list of {@link Item} with payload
 * 
 * @throws XMPPException
 */
public <T extends Item> List<T> getItems(Collection<String> ids)
		throws XMPPException {
	List<Item> itemList = new ArrayList<Item>(ids.size());

	for (String id : ids) {
		itemList.add(new Item(id));
	}
	PubSub request = createPubsubPacket(Type.GET, new ItemsExtension(
			ItemsExtension.ItemsElementType.items, getId(), itemList));

	PubSub result = (PubSub) SyncPacketSend.getReply(con, request);
	ItemsExtension itemsElem = (ItemsExtension) result
			.getExtension(PubSubElementType.ITEMS);
	return (List<T>) itemsElem.getItems();
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:30,代码来源:LeafNode.java

示例5: createNode

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
/**
 * Creates an instant node, if supported.
 * 
 * @return The node that was created
 * @throws XMPPErrorException 
 * @throws NoResponseException 
 * @throws NotConnectedException 
 */
public LeafNode createNode() throws NoResponseException, XMPPErrorException, NotConnectedException
{
	PubSub reply = sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.CREATE), null);
	NodeExtension elem = reply.getExtension("create", PubSubNamespace.BASIC.getXmlns());
	
	LeafNode newNode = new LeafNode(con, elem.getNode());
	newNode.setTo(to);
	nodeMap.put(newNode.getId(), newNode);
	
	return newNode;
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:20,代码来源:PubSubManager.java

示例6: getItems

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private <T extends Item> List<T> getItems(PubSub request,
                List<ExtensionElement> returnedExtensions) throws NoResponseException,
                XMPPErrorException, NotConnectedException {
    PubSub result = con.createPacketCollectorAndSend(request).nextResultOrThrow();
    ItemsExtension itemsElem = result.getExtension(PubSubElementType.ITEMS);
    if (returnedExtensions != null) {
        returnedExtensions.addAll(result.getExtensions());
    }
    return (List<T>) itemsElem.getItems();
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:12,代码来源:LeafNode.java

示例7: subscriptionsOwnerResultTest

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
@Test
public void subscriptionsOwnerResultTest() throws Exception {
    // @formatter:off
    final String resultStanza = 
      "<iq from='pubsub.example.org' to='[email protected]/Smack' id='HaT4m-13' type='result'>" +
        "<pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>" + 
          "<subscriptions node='test'>" + 
            "<subscription jid='[email protected]/Smack' subscription='subscribed' subid='58C1A6F99F2A7'/>" +
            "<subscription jid='[email protected]/Smack' subscription='subscribed' subid='58C18F8917321'/>" +
          "</subscriptions>" +
        "</pubsub>" +
      "</iq>";
    // @formatter:on
    XmlPullParser parser = TestUtils.getIQParser(resultStanza);
    PubSub pubsubResult = (PubSub) PacketParserUtils.parseIQ(parser);
    SubscriptionsExtension subElem = pubsubResult.getExtension(PubSubElementType.SUBSCRIPTIONS);
    List<Subscription> subscriptions = subElem.getSubscriptions();
    assertEquals(2, subscriptions.size());

    Subscription sub1 = subscriptions.get(0);
    assertEquals("[email protected]/Smack", sub1.getJid());
    assertEquals(Subscription.State.subscribed, sub1.getState());
    assertEquals("58C1A6F99F2A7", sub1.getId());

    Subscription sub2 = subscriptions.get(1);
    assertEquals("[email protected]/Smack", sub2.getJid());
    assertEquals(Subscription.State.subscribed, sub2.getState());
    assertEquals("58C18F8917321", sub2.getId());
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:30,代码来源:PubSubProviderTest.java

示例8: createNode

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
/**
 * Creates an instant node, if supported.
 * 
 * @return The node that was created
 * @exception XMPPException
 */
public LeafNode createNode()
	throws XMPPException
{
	PubSub reply = (PubSub)sendPubsubPacket(Type.SET, new NodeExtension(PubSubElementType.CREATE));
	NodeExtension elem = (NodeExtension)reply.getExtension("create", PubSubNamespace.BASIC.getXmlns());
	
	LeafNode newNode = new LeafNode(con, elem.getNode());
	newNode.setTo(to);
	nodeMap.put(newNode.getId(), newNode);
	
	return newNode;
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:19,代码来源:PubSubManager.java

示例9: getAffiliations

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
/**
 * Gets the affiliations on the root node.
 * 
 * @return List of affiliations
 * 
 * @throws XMPPException
 */
public List<Affiliation> getAffiliations()
	throws XMPPException
{
	PubSub reply = (PubSub)sendPubsubPacket(Type.GET, new NodeExtension(PubSubElementType.AFFILIATIONS));
	AffiliationsExtension listElem = (AffiliationsExtension)reply.getExtension(PubSubElementType.AFFILIATIONS);
	return listElem.getAffiliations();
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:15,代码来源:PubSubManager.java

示例10: getSubscriptions

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
/**
 * Get the subscriptions currently associated with this node.
 * 
 * @return List of {@link Subscription}
 * 
 * @throws XMPPException
 */
public List<Subscription> getSubscriptions()
	throws XMPPException
{
	PubSub reply = (PubSub)sendPubsubPacket(Type.GET, new NodeExtension(PubSubElementType.SUBSCRIPTIONS, getId()));
	SubscriptionsExtension subElem = (SubscriptionsExtension)reply.getExtension(PubSubElementType.SUBSCRIPTIONS);
	return subElem.getSubscriptions();
}
 
开发者ID:ice-coffee,项目名称:EIM,代码行数:15,代码来源:Node.java

示例11: createNode

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
/**
 * Creates an instant node, if supported.
 * 
 * @return The node that was created
 * @exception XMPPException
 */
public LeafNode createNode() throws XMPPException {
	PubSub reply = (PubSub) sendPubsubPacket(Type.SET, new NodeExtension(
			PubSubElementType.CREATE));
	NodeExtension elem = (NodeExtension) reply.getExtension("create",
			PubSubNamespace.BASIC.getXmlns());

	LeafNode newNode = new LeafNode(con, elem.getNode());
	newNode.setTo(to);
	nodeMap.put(newNode.getId(), newNode);

	return newNode;
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:19,代码来源:PubSubManager.java

示例12: getAffiliations

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
/**
 * Gets the affiliations on the root node.
 * 
 * @return List of affiliations
 * 
 * @throws XMPPException
 */
public List<Affiliation> getAffiliations() throws XMPPException {
	PubSub reply = (PubSub) sendPubsubPacket(Type.GET, new NodeExtension(
			PubSubElementType.AFFILIATIONS));
	AffiliationsExtension listElem = (AffiliationsExtension) reply
			.getExtension(PubSubElementType.AFFILIATIONS);
	return listElem.getAffiliations();
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:15,代码来源:PubSubManager.java

示例13: getSubscriptions

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
/**
 * Get the subscriptions currently associated with this node.
 * 
 * @return List of {@link Subscription}
 * 
 * @throws XMPPException
 */
public List<Subscription> getSubscriptions() throws XMPPException {
	PubSub reply = (PubSub) sendPubsubPacket(Type.GET, new NodeExtension(
			PubSubElementType.SUBSCRIPTIONS, getId()));
	SubscriptionsExtension subElem = (SubscriptionsExtension) reply
			.getExtension(PubSubElementType.SUBSCRIPTIONS);
	return subElem.getSubscriptions();
}
 
开发者ID:ikantech,项目名称:xmppsupport_v2,代码行数:15,代码来源:Node.java

示例14: getItems

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
/**
 * Get the current items stored in the node.
 * 
 * @return List of {@link Item} in the node
 * 
 * @throws XMPPException
 */
public <T extends Item> List<T> getItems()
	throws XMPPException
{
	PubSub request = createPubsubPacket(Type.GET, new GetItemsRequest(getId()));
	
	PubSub result = (PubSub)SyncPacketSend.getReply(con, request);
	ItemsExtension itemsElem = (ItemsExtension)result.getExtension(PubSubElementType.ITEMS);
	return (List<T>)itemsElem.getItems();
}
 
开发者ID:jtietema,项目名称:telegraph,代码行数:17,代码来源:LeafNode.java

示例15: getAffiliations

import org.jivesoftware.smackx.pubsub.packet.PubSub; //导入方法依赖的package包/类
/**
 * Gets the affiliations on the root node.
 * 
 * @return List of affiliations
 * @throws XMPPErrorException 
 * @throws NoResponseException 
 * @throws NotConnectedException 
 * 
 */
public List<Affiliation> getAffiliations() throws NoResponseException, XMPPErrorException, NotConnectedException
{
	PubSub reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.AFFILIATIONS), null);
	AffiliationsExtension listElem = reply.getExtension(PubSubElementType.AFFILIATIONS);
	return listElem.getAffiliations();
}
 
开发者ID:TTalkIM,项目名称:Smack,代码行数:16,代码来源:PubSubManager.java


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