本文整理汇总了Java中org.jivesoftware.smackx.pubsub.ItemPublishEvent类的典型用法代码示例。如果您正苦于以下问题:Java ItemPublishEvent类的具体用法?Java ItemPublishEvent怎么用?Java ItemPublishEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ItemPublishEvent类属于org.jivesoftware.smackx.pubsub包,在下文中一共展示了ItemPublishEvent类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handlePublishedItems
import org.jivesoftware.smackx.pubsub.ItemPublishEvent; //导入依赖的package包/类
/**
* Item handler of this data handler implementation. Checks if received items are already cached,
* if not, it caches them. Ultimately it sends the items to the subscribed listeners.
*/
@Override
public void handlePublishedItems(ItemPublishEvent<PayloadItem<SimplePayload>> items){
String spaceId = getSpaceId(items.getNodeId());
if (spaceId == null) return;
List<String> toRequest = new ArrayList<String>();
for (PayloadItem<SimplePayload> item:items.getItems()){
if (item.getPayload() == null && !pendingPayloadRequests.containsKey(item.getId())){
toRequest.add(item.getId());
continue;
}
DataObject obj = parseItemToDataObject(item);
if (dataObjectFilter == null || dataObjectFilter.isDataObjectValid(obj)) {
if (!datawrapper.isDataObjectAlreadyCached(item.getId())){
datawrapper.saveDataObject(items.getNodeId(), obj, item.getId());
}
for (DataObjectListener listener:listeners){
listener.handleDataObject(obj, spaceId);
}
}
}
if (!toRequest.isEmpty()){
for (String id:toRequest){
try {
retrievePayload(items.getNodeId(), id);
} catch (Exception e) {
//Ignore
continue;
}
}
}
}
示例2: handlePublishedItems
import org.jivesoftware.smackx.pubsub.ItemPublishEvent; //导入依赖的package包/类
/**
* Called whenever an item is published to the node the listener
* is registered with.
*
* @param items The publishing details.
*/
void handlePublishedItems(ItemPublishEvent<T> items);
示例3: handlePublishedItems
import org.jivesoftware.smackx.pubsub.ItemPublishEvent; //导入依赖的package包/类
/**
* Called whenever an item is published to the node the listener is
* registered with.
*
* @param items
* The publishing details.
*/
void handlePublishedItems(ItemPublishEvent<T> items);