public PubSubNamespace getPubSubNamespace() { return element.getNamespace(); }
public PubSubNamespace getPubSubNamespace() { return namespace.type.getNamespace(); }
public static ItemNamespace fromXmlns(String xmlns) { for (ItemNamespace itemNamespace : ItemNamespace.values()) { if (itemNamespace.type.getNamespace().getXmlns().equals(xmlns)) { return itemNamespace; } } throw new IllegalArgumentException("Invalid item namespace: " + xmlns); } }
public static SubscriptionsNamespace fromXmlns(String xmlns) { for (SubscriptionsNamespace subscriptionsNamespace : SubscriptionsNamespace.values()) { if (subscriptionsNamespace.type.getNamespace().getXmlns().equals(xmlns)) { return subscriptionsNamespace; } } throw new IllegalArgumentException("Invalid Subscription namespace: " + xmlns); } }
public static AffiliationNamespace fromXmlns(String xmlns) { for (AffiliationNamespace affiliationsNamespace : AffiliationNamespace.values()) { if (affiliationsNamespace.type.getNamespace().getXmlns().equals(xmlns)) { return affiliationsNamespace; } } throw new IllegalArgumentException("Invalid affiliations namespace: " + xmlns); } }
@SuppressWarnings("unchecked") public <PE extends ExtensionElement> PE getExtension(PubSubElementType elem) { return (PE) getExtension(elem.getElementName(), elem.getNamespace().getXmlns()); }
/** * Returns the default settings for Node configuration. * * @return configuration form containing the default settings. * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public ConfigureForm getDefaultConfiguration() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { // Errors will cause exceptions in getReply, so it only returns // on success. PubSub reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.DEFAULT), PubSubElementType.DEFAULT.getNamespace()); return NodeUtils.getFormFromPacket(reply, PubSubElementType.DEFAULT); }
/** * Delete the specified node. * * @param nodeId * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException * @return <code>true</code> if this node existed and was deleted and <code>false</code> if this node did not exist. */ public boolean deleteNode(String nodeId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { boolean res = true; try { sendPubsubPacket(Type.set, new NodeExtension(PubSubElementType.DELETE, nodeId), PubSubElementType.DELETE.getNamespace()); } catch (XMPPErrorException e) { if (e.getStanzaError().getCondition() == StanzaError.Condition.item_not_found) { res = false; } else { throw e; } } nodeMap.remove(nodeId); return res; }
/** * 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); } }
/** * Gets the subscriptions on the root node. * * @return List of exceptions * @throws XMPPErrorException * @throws NoResponseException * @throws NotConnectedException * @throws InterruptedException */ public List<Subscription> getSubscriptions() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { Stanza reply = sendPubsubPacket(Type.get, new NodeExtension(PubSubElementType.SUBSCRIPTIONS), null); SubscriptionsExtension subElem = reply.getExtension(PubSubElementType.SUBSCRIPTIONS.getElementName(), PubSubElementType.SUBSCRIPTIONS.getNamespace().getXmlns()); return subElem.getSubscriptions(); }
public String getNamespace() { return element.getNamespace().getXmlns(); }
public String getNamespace() { return element.getNamespace().getXmlns(); }
/** * Delete the specified node * * @param nodeId * @throws XMPPException */ public void deleteNode(String nodeId) throws XMPPException { sendPubsubPacket(Type.SET, new NodeExtension(PubSubElementType.DELETE, nodeId), PubSubElementType.DELETE.getNamespace()); nodeMap.remove(nodeId); }
/** * Delete the specified node * * @param nodeId * @throws XMPPException */ public void deleteNode(String nodeId) throws XMPPException { sendPubsubPacket(Type.SET, new NodeExtension(PubSubElementType.DELETE, nodeId), PubSubElementType.DELETE.getNamespace()); nodeMap.remove(nodeId); }
/** * Delete the specified node * * @param nodeId * @throws XMPPException */ public void deleteNode(String nodeId) throws XMPPException { sendPubsubPacket(Type.SET, new NodeExtension(PubSubElementType.DELETE, nodeId), PubSubElementType.DELETE.getNamespace()); nodeMap.remove(nodeId); }
public PacketExtension getExtension(PubSubElementType elem) { return getExtension(elem.getElementName(), elem.getNamespace().getXmlns()); }
PubSubElementType.PUBLISH.getNamespace().getXmlns(), new PubSubProvider());
/** * Returns the default settings for Node configuration. * * @return configuration form containing the default settings. */ 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); }
/** * Returns the default settings for Node configuration. * * @return configuration form containing the default settings. */ 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); }
/** * Purges the node of all items. * * <p>Note: Some implementations may keep the last item * sent. * * @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); }