Package org.jivesoftware.smackx.pubsub.packet

Examples of org.jivesoftware.smackx.pubsub.packet.PubSub


   *
   * For synchronous calls use {@link #send() send()}.
   */
  public void publish()
  {
    PubSub packet = createPubsubPacket(Type.SET, new NodeExtension(PubSubElementType.PUBLISH, getId()));
   
    con.sendPacket(packet);
  }
View Full Code Here


   *
   * @param items - The collection of items being sent
   */
  public <T extends Item> void publish(Collection<T> items)
  {
    PubSub packet = createPubsubPacket(Type.SET, new PublishItem<T>(getId(), items));
   
    con.sendPacket(packet);
  }
View Full Code Here

   * @throws XMPPException
   */
  public void send()
    throws XMPPException
  {
    PubSub packet = createPubsubPacket(Type.SET, new NodeExtension(PubSubElementType.PUBLISH, getId()));
   
    SyncPacketSend.getReply(con, packet);
  }
View Full Code Here

   * @throws XMPPException
   */
  public <T extends Item> void send(Collection<T> items)
    throws XMPPException
  {
    PubSub packet = createPubsubPacket(Type.SET, new PublishItem<T>(getId(), items));
   
    SyncPacketSend.getReply(con, packet);
  }
View Full Code Here

   * @throws XMPPException
   */
  public void deleteAllItems()
    throws XMPPException
  {
    PubSub request = createPubsubPacket(Type.SET, new NodeExtension(PubSubElementType.PURGE_OWNER, getId()), PubSubElementType.PURGE_OWNER.getNamespace());
   
    SyncPacketSend.getReply(con, request);
  }
View Full Code Here

   
    for (String id : itemIds)
    {
      items.add(new Item(id));
    }
    PubSub request = createPubsubPacket(Type.SET, new ItemsExtension(ItemsExtension.ItemsElementType.retract, getId(), items));
    SyncPacketSend.getReply(con, request);
  }
View Full Code Here

   * @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);
   
View Full Code Here

   * @exception XMPPException
   */
  public Node createNode(String name, Form config)
    throws XMPPException
  {
    PubSub request = createPubsubPacket(to, Type.SET, new NodeExtension(PubSubElementType.CREATE, name));
    boolean isLeafNode = true;
   
    if (config != null)
    {
      request.addExtension(new FormNode(FormNodeType.CONFIGURE, config));
      FormField nodeTypeField = config.getField(ConfigureNodeFields.node_type.getFieldName());
     
      if (nodeTypeField != null)
        isLeafNode = nodeTypeField.getValues().next().equals(NodeType.leaf.toString());
    }
View Full Code Here

   * @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();
  }
View Full Code Here

  public ConfigureForm getDefaultConfiguration()
    throws XMPPException
  {
    // Errors will cause exceptions in getReply, so it only returns
    // on success.
    PubSub reply = (PubSub)sendPubsubPacket(Type.GET, new NodeExtension(PubSubElementType.DEFAULT), PubSubElementType.DEFAULT.getNamespace());
    return NodeUtils.getFormFromPacket(reply, PubSubElementType.DEFAULT);
  }
View Full Code Here

TOP

Related Classes of org.jivesoftware.smackx.pubsub.packet.PubSub

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.