Java 类org.jivesoftware.smackx.pubsub.LeafNode 实例源码

项目:msf-spaces-sdk-android    文件:DataHandler.java   
/**
 * 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);
            }
        }
    }
}
项目:Android_Resource_Controller    文件:MessagePublisher.java   
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();
    }

}
项目:Smack    文件:PubSubTestCase.java   
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);
}
项目:java-bells    文件:PubSubTestCase.java   
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);
}
项目:Beem    文件:AvatarManager.java   
/**
    * 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);
   }
项目:Beem    文件:XmppAvatarRetriever.java   
@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;
}
   }
项目:beem-fork-xmpp    文件:AvatarManager.java   
/**
    * 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);
   }
项目:beem-fork-xmpp    文件:XmppAvatarRetriever.java   
@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;
}
   }
项目:Smack    文件:SingleUserTestCase.java   
protected LeafNode getPubnode(boolean persistItems, boolean deliverPayload) throws XMPPException
{
    return getRandomPubnode(getManager(), persistItems, deliverPayload);
}
项目:java-bells    文件:SingleUserTestCase.java   
protected LeafNode getPubnode(boolean persistItems, boolean deliverPayload) throws XMPPException
{
    return getRandomPubnode(getManager(), persistItems, deliverPayload);
}
项目:Beem    文件:PepSubManager.java   
/**
    * 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;
   }
项目:Beem    文件:AvatarManager.java   
/**
    * 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);
   }
项目:beem-fork-xmpp    文件:PepSubManager.java   
/**
    * 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;
   }
项目:beem-fork-xmpp    文件:AvatarManager.java   
/**
    * 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);
   }