本文整理汇总了Java中org.jivesoftware.smackx.pubsub.LeafNode类的典型用法代码示例。如果您正苦于以下问题:Java LeafNode类的具体用法?Java LeafNode怎么用?Java LeafNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LeafNode类属于org.jivesoftware.smackx.pubsub包,在下文中一共展示了LeafNode类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeSpace
import org.jivesoftware.smackx.pubsub.LeafNode; //导入依赖的package包/类
/**
* Removes a space from the list of observed spaces.
* If the space is not in the list of observed spaces, nothing happens.
* @param spaceId Identifier of the space to observe.
*/
@Override
public void removeSpace(String spaceId) {
Space space = spaceHandler.getSpace(spaceId);
if (handledSpaces.remove(space)){
SpaceChannel channel = space.getPubSubChannel();
Map<String, String> properties = channel.getProperties();
datawrapper.deleteCachedDataObjectsForSpace(properties.get("node"));
if (getMode() == Mode.ONLINE){
try {
LeafNode node = (LeafNode) getNode(properties.get("node"), properties.get("domain"));
node.removeItemEventListener(this);
} catch (UnknownEntityException e) {
Log.d("DATAHANDLER", "An UnknownEntityException was thrown while removing a registered space.", e);
}
}
}
}
示例2: XMPPPublisher
import org.jivesoftware.smackx.pubsub.LeafNode; //导入依赖的package包/类
private void XMPPPublisher(String xmlString, String SCHEMA, String mtype, Node pubNode){
SimplePayload payload = new SimplePayload(mtype,SCHEMA, xmlString);
@SuppressWarnings({ "unchecked", "rawtypes" })
PayloadItem payloadItem = new PayloadItem(null, payload);
Log.i(appTAG, classTAG+": Message Published to:"+pubNode.getId());
try {
((LeafNode)pubNode).publish(payloadItem);
} catch (NotConnectedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
示例3: getRandomPubnode
import org.jivesoftware.smackx.pubsub.LeafNode; //导入依赖的package包/类
protected LeafNode getRandomPubnode(PubSubManager pubMgr, boolean persistItems, boolean deliverPayload) throws XMPPException
{
ConfigureForm form = new ConfigureForm(FormType.submit);
form.setPersistentItems(persistItems);
form.setDeliverPayloads(deliverPayload);
form.setAccessModel(AccessModel.open);
return (LeafNode)pubMgr.createNode("/test/Pubnode" + System.currentTimeMillis(), form);
}
示例4: publishAvatarData
import org.jivesoftware.smackx.pubsub.LeafNode; //导入依赖的package包/类
/**
* Publish an avatar data.
*
* @param id the id of the avatar data
* @param data the data of the avatar
*/
private void publishAvatarData(String id, byte[] data) {
AvatarExtension avatar = new AvatarExtension(data);
PayloadItem<AvatarExtension> item = new PayloadItem<AvatarExtension>(id, avatar);
LeafNode node = mPep.getPEPNode(AVATARDATA_NODE);
node.publish(item);
}
示例5: getAvatar
import org.jivesoftware.smackx.pubsub.LeafNode; //导入依赖的package包/类
@Override
public byte[] getAvatar() {
try {
LeafNode node = mPubsub.getPEPNode(AVATARDATANODE);
List<Item> items = node.getItems(Arrays.asList(mId));
PayloadItem<AvatarExtension> item = (PayloadItem<AvatarExtension>) items.get(0);
AvatarExtension avatar = item.getPayload();
return avatar.getData();
} catch (XMPPException e) {
return null;
}
}
示例6: getPubnode
import org.jivesoftware.smackx.pubsub.LeafNode; //导入依赖的package包/类
protected LeafNode getPubnode(boolean persistItems, boolean deliverPayload) throws XMPPException
{
return getRandomPubnode(getManager(), persistItems, deliverPayload);
}
示例7: getPEPNode
import org.jivesoftware.smackx.pubsub.LeafNode; //导入依赖的package包/类
/**
* Get a PepNode.
* This node is obtain without checking its existence as PEP should auto create it.
*
* @param nodeName the node name
* @return the node
*/
public LeafNode getPEPNode(String nodeName) {
LeafNode node = new LeafNode(con, nodeName);
node.setTo(to);
return node;
}
示例8: publishAvatarMetaData
import org.jivesoftware.smackx.pubsub.LeafNode; //导入依赖的package包/类
/**
* Send the metadata of the avatar you want to publish.
* By sending this metadata, you publish an avatar.
*
* @param id the id of the metadata item
* @param metadata the metadata to publish
*/
public void publishAvatarMetaData(String id, AvatarMetadataExtension metadata) {
PayloadItem<AvatarMetadataExtension> item = new PayloadItem<AvatarMetadataExtension>(id, metadata);
LeafNode node = mPep.getPEPNode(AVATARMETADATA_NODE);
node.publish(item);
}