congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
FormNode
Code IndexAdd Tabnine to your IDE (free)

How to use
FormNode
in
org.jivesoftware.smackx.pubsub

Best Java code snippets using org.jivesoftware.smackx.pubsub.FormNode (Showing top 20 results out of 315)

origin: igniterealtime/Smack

  @Override
  protected FormNode createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends ExtensionElement> content) {
    return new FormNode(FormNodeType.valueOfFromElementName(currentElement, currentNamespace), attributeMap.get("node"), new Form((DataForm) content.iterator().next()));
  }
}
origin: igniterealtime/Smack

@Override
public CharSequence toXML(String enclosingNamespace) {
  if (configForm == null) {
    return super.toXML(enclosingNamespace);
  }
  else {
    StringBuilder builder = new StringBuilder("<");
    builder.append(getElementName());
    if (getNode() != null) {
      builder.append(" node='");
      builder.append(getNode());
      builder.append("'>");
    }
    else
      builder.append('>');
    builder.append(configForm.getDataFormToSend().toXML(null));
    builder.append("</");
    builder.append(getElementName() + '>');
    return builder.toString();
  }
}
origin: igniterealtime/Smack

  /**
   * Get a {@link ConfigureForm} from a packet.
   *
   * @param packet
   * @param elem
   * @return The configuration form
   */
  public static ConfigureForm getFormFromPacket(Stanza packet, PubSubElementType elem) {
    FormNode config = packet.getExtension(elem.getElementName(), elem.getNamespace().getXmlns());
    Form formReply = config.getForm();
    return new ConfigureForm(formReply);
  }
}
origin: igniterealtime/Smack

/**
 * Update the configuration with the contents of the new {@link Form}.
 *
 * @param submitForm
 * @throws XMPPErrorException
 * @throws NoResponseException
 * @throws NotConnectedException
 * @throws InterruptedException
 */
public void sendConfigurationForm(Form submitForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
  PubSub packet = createPubsubPacket(Type.set, new FormNode(FormNodeType.CONFIGURE_OWNER,
          getId(), submitForm));
  pubSubManager.getConnection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
}
origin: org.igniterealtime.smack/smackx

@Override
public String toXML()
{
  if (configForm == null)
  {
    return super.toXML();
  }
  else
  {
    StringBuilder builder = new StringBuilder("<");
    builder.append(getElementName());
    
    if (getNode() != null)
    {
      builder.append(" node='");
      builder.append(getNode());
      builder.append("'>");
    }
    else
      builder.append('>');
    builder.append(configForm.getDataFormToSend().toXML());
    builder.append("</");
    builder.append(getElementName() + '>');
    return builder.toString();
  }
}
origin: igniterealtime/Smack

/**
 * Get the options for configuring the specified subscription.
 *
 * @param jid JID the subscription is registered under
 * @param subscriptionId The subscription id
 *
 * @return The subscription option form
 * @throws XMPPErrorException
 * @throws NoResponseException
 * @throws NotConnectedException
 * @throws InterruptedException
 *
 */
public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
  PubSub packet = sendPubsubPacket(createPubsubPacket(Type.get, new OptionsExtension(jid, getId(), subscriptionId)));
  FormNode ext = packet.getExtension(PubSubElementType.OPTIONS);
  return new SubscribeForm(ext.getForm());
}
origin: igniterealtime/Smack

/**
 * Creates a node with specified configuration.
 *
 * Note: This is the only way to create a collection node.
 *
 * @param nodeId The name of the node, which must be unique within the
 * pubsub service
 * @param config The configuration for the node
 * @return The node that was created
 * @throws XMPPErrorException
 * @throws NoResponseException
 * @throws NotConnectedException
 * @throws InterruptedException
 */
public Node createNode(String nodeId, Form config) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
  PubSub request = PubSub.createPubsubPacket(pubSubService, Type.set, new NodeExtension(PubSubElementType.CREATE, nodeId));
  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().get(0).toString().equals(NodeType.leaf.toString());
  }
  // Errors will cause exceptions in getReply, so it only returns
  // on success.
  sendPubsubPacket(request);
  Node newNode = isLeafNode ? new LeafNode(this, nodeId) : new CollectionNode(this, nodeId);
  nodeMap.put(newNode.getId(), newNode);
  return newNode;
}
origin: tiandawu/IotXmpp

@Override
public String toXML()
{
  if (configForm == null)
  {
    return super.toXML();
  }
  else
  {
    StringBuilder builder = new StringBuilder("<");
    builder.append(getElementName());
    
    if (getNode() != null)
    {
      builder.append(" node='");
      builder.append(getNode());
      builder.append("'>");
    }
    else
      builder.append('>');
    builder.append(configForm.getDataFormToSend().toXML());
    builder.append("</");
    builder.append(getElementName() + '>');
    return builder.toString();
  }
}
origin: org.littleshoot/smack-xmpp-3-2-2

  /** 
   * Get a {@link ConfigureForm} from a packet.
   * 
   * @param packet
   * @param elem
   * @return The configuration form
   */
  public static ConfigureForm getFormFromPacket(Packet packet, PubSubElementType elem)
  {
    FormNode config = (FormNode)packet.getExtension(elem.getElementName(), elem.getNamespace().getXmlns());
    Form formReply = config.getForm();
    return new ConfigureForm(formReply);

  }
}
origin: igniterealtime/Smack

/**
 * The user subscribes to the node using the supplied jid and subscription
 * options.  The bare jid portion of this one must match the jid for the
 * connection.
 *
 * Please note that the {@link Subscription.State} should be checked
 * on return since more actions may be required by the caller.
 * {@link Subscription.State#pending} - The owner must approve the subscription
 * request before messages will be received.
 * {@link Subscription.State#unconfigured} - If the {@link Subscription#isConfigRequired()} is true,
 * the caller must configure the subscription before messages will be received.  If it is false
 * the caller can configure it but is not required to do so.
 *
 * @param jid The jid to subscribe as.
 * @param subForm
 *
 * @return The subscription
 * @throws XMPPErrorException
 * @throws NoResponseException
 * @throws NotConnectedException
 * @throws InterruptedException
 */
public Subscription subscribe(String jid, SubscribeForm subForm) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
  PubSub request = createPubsubPacket(Type.set, new SubscribeExtension(jid, getId()));
  request.addExtension(new FormNode(FormNodeType.OPTIONS, subForm));
  PubSub reply = sendPubsubPacket(request);
  return reply.getExtension(PubSubElementType.SUBSCRIPTION);
}
origin: org.littleshoot/smack-xmpp-3-2-2

@Override
public String toXML()
{
  if (configForm == null)
  {
    return super.toXML();
  }
  else
  {
    StringBuilder builder = new StringBuilder("<");
    builder.append(getElementName());
    
    if (getNode() != null)
    {
      builder.append(" node='");
      builder.append(getNode());
      builder.append("'>");
    }
    else
      builder.append('>');
    builder.append(configForm.getDataFormToSend().toXML());
    builder.append("</");
    builder.append(getElementName() + '>');
    return builder.toString();
  }
}
origin: tiandawu/IotXmpp

  /** 
   * Get a {@link ConfigureForm} from a packet.
   * 
   * @param packet
   * @param elem
   * @return The configuration form
   */
  public static ConfigureForm getFormFromPacket(Packet packet, PubSubElementType elem)
  {
    FormNode config = (FormNode)packet.getExtension(elem.getElementName(), elem.getNamespace().getXmlns());
    Form formReply = config.getForm();
    return new ConfigureForm(formReply);

  }
}
origin: jitsi/jitsi-videobridge

  new FormNode(FormNodeType.CONFIGURE_OWNER, nodeName ,cfg));
try
origin: org.igniterealtime.smack/smackx

  /** 
   * Get a {@link ConfigureForm} from a packet.
   * 
   * @param packet
   * @param elem
   * @return The configuration form
   */
  public static ConfigureForm getFormFromPacket(Packet packet, PubSubElementType elem)
  {
    FormNode config = (FormNode)packet.getExtension(elem.getElementName(), elem.getNamespace().getXmlns());
    Form formReply = config.getForm();
    return new ConfigureForm(formReply);

  }
}
origin: tiandawu/IotXmpp

  @Override
  protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
  {
    return new FormNode(FormNodeType.valueOfFromElementName(currentElement, currentNamespace), attributeMap.get("node"), new Form((DataForm)content.iterator().next()));
  }
}
origin: org.igniterealtime.smack/smackx

/**
 * Get the options for configuring the specified subscription.
 * 
 * @param jid JID the subscription is registered under
 * @param subscriptionId The subscription id
 * 
 * @return The subscription option form
 * 
 * @throws XMPPException
 */
public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId)
  throws XMPPException
{
  PubSub packet = (PubSub)sendPubsubPacket(Type.GET, new OptionsExtension(jid, getId(), subscriptionId));
  FormNode ext = (FormNode)packet.getExtension(PubSubElementType.OPTIONS);
  return new SubscribeForm(ext.getForm());
}
origin: org.igniterealtime.smack/smackx

  @Override
  protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
  {
    return new FormNode(FormNodeType.valueOfFromElementName(currentElement, currentNamespace), attributeMap.get("node"), new Form((DataForm)content.iterator().next()));
  }
}
origin: tiandawu/IotXmpp

/**
 * Get the options for configuring the specified subscription.
 * 
 * @param jid JID the subscription is registered under
 * @param subscriptionId The subscription id
 * 
 * @return The subscription option form
 * 
 * @throws XMPPException
 */
public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId)
  throws XMPPException
{
  PubSub packet = (PubSub)sendPubsubPacket(Type.GET, new OptionsExtension(jid, getId(), subscriptionId));
  FormNode ext = (FormNode)packet.getExtension(PubSubElementType.OPTIONS);
  return new SubscribeForm(ext.getForm());
}
origin: org.littleshoot/smack-xmpp-3-2-2

  @Override
  protected PacketExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
  {
    return new FormNode(FormNodeType.valueOfFromElementName(currentElement, currentNamespace), attributeMap.get("node"), new Form((DataForm)content.iterator().next()));
  }
}
origin: org.littleshoot/smack-xmpp-3-2-2

/**
 * Get the options for configuring the specified subscription.
 * 
 * @param jid JID the subscription is registered under
 * @param subscriptionId The subscription id
 * 
 * @return The subscription option form
 * 
 * @throws XMPPException
 */
public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId)
  throws XMPPException
{
  PubSub packet = (PubSub)sendPubsubPacket(Type.GET, new OptionsExtension(jid, getId(), subscriptionId));
  FormNode ext = (FormNode)packet.getExtension(PubSubElementType.OPTIONS);
  return new SubscribeForm(ext.getForm());
}
org.jivesoftware.smackx.pubsubFormNode

Javadoc

Generic packet extension which represents any pubsub form that is parsed from the incoming stream or being sent out to the server. Form types are defined in FormNodeType.

Most used methods

  • <init>
    Create a FormNode which contains the specified form.
  • getElementName
  • getForm
    Get the Form that is to be sent, or was retrieved from the server.
  • getNode

Popular in Java

  • Parsing JSON documents to java classes using gson
  • putExtra (Intent)
  • getExternalFilesDir (Context)
  • onCreateOptionsMenu (Activity)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Join (org.hibernate.mapping)
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now