mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-12 22:11:07 +01:00
Merge branch '4.2' into master-paul-merged
This commit is contained in:
commit
431e5b3c67
434 changed files with 1770 additions and 1517 deletions
|
|
@ -17,8 +17,8 @@
|
|||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
/**
|
||||
* This enumeration represents the access models for the pubsub node
|
||||
* as defined in the pubsub specification section <a href="http://xmpp.org/extensions/xep-0060.html#registrar-formtypes-config">16.4.3</a>.
|
||||
* This enumeration represents the access models for the PubSub node
|
||||
* as defined in the PubSub specification section <a href="http://xmpp.org/extensions/xep-0060.html#registrar-formtypes-config">16.4.3</a>.
|
||||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ public class Affiliation implements ExtensionElement
|
|||
this.jid = jid;
|
||||
this.affiliation = affiliation;
|
||||
this.node = null;
|
||||
// This is usually the pubsub#owner namesapce, but see xep60 example 208 where just 'pubsub' is used
|
||||
// ("notification of affilliation change")
|
||||
// This is usually the pubsub#owner namespace, but see xep60 example 208 where just 'pubsub' is used
|
||||
// ("notification of affiliation change")
|
||||
this.namespace = namespace;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class AffiliationsExtension extends NodeExtension
|
|||
{
|
||||
// Can't use XmlStringBuilder(this), because we don't want the namespace to be included
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
xml.openElement(getElementName());
|
||||
xml.halfOpenElement(getElementName());
|
||||
xml.optAttribute("node", node);
|
||||
xml.rightAngleBracket();
|
||||
xml.append(items);
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.pubsub;
|
|||
|
||||
/**
|
||||
* This enumeration represents the children association policy for associating leaf nodes
|
||||
* with collection nodes as defined in the pubsub specification section <a href="http://xmpp.org/extensions/xep-0060.html#registrar-formtypes-config">16.4.3</a>.
|
||||
* with collection nodes as defined in the PubSub specification section <a href="http://xmpp.org/extensions/xep-0060.html#registrar-formtypes-config">16.4.3</a>.
|
||||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
public class CollectionNode extends Node
|
||||
{
|
||||
public class CollectionNode extends Node {
|
||||
|
||||
CollectionNode(PubSubManager pubSubManager, String nodeId)
|
||||
{
|
||||
super(pubSubManager, nodeId);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import java.util.List;
|
|||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
|
||||
/**
|
||||
* Represents the <b>configuration</b> element of a pubsub message event which
|
||||
* Represents the <b>configuration</b> element of a PubSub message event which
|
||||
* associates a configuration form to the node which was configured. The form
|
||||
* contains the current node configuration.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ public class ConfigureForm extends Form
|
|||
public void setChildrenAssociationPolicy(ChildrenAssociationPolicy policy)
|
||||
{
|
||||
addField(ConfigureNodeFields.children_association_policy, FormField.Type.list_single);
|
||||
List<String> values = new ArrayList<String>(1);
|
||||
List<String> values = new ArrayList<>(1);
|
||||
values.add(policy.toString());
|
||||
setAnswer(ConfigureNodeFields.children_association_policy.getFieldName(), values);
|
||||
}
|
||||
|
|
@ -711,7 +711,7 @@ public class ConfigureForm extends Form
|
|||
|
||||
private static List<String> getListSingle(String value)
|
||||
{
|
||||
List<String> list = new ArrayList<String>(1);
|
||||
List<String> list = new ArrayList<>(1);
|
||||
list.add(value);
|
||||
return list;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
|||
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||
|
||||
/**
|
||||
* Represents the top level element of a pubsub event extension. All types of pubsub events are
|
||||
* Represents the top level element of a PubSub event extension. All types of PubSub events are
|
||||
* represented by this class. The specific type can be found by {@link #getEventType()}. The
|
||||
* embedded event information, which is specific to the event type, can be retrieved by the {@link #getEvent()}
|
||||
* method.
|
||||
|
|
@ -45,8 +45,8 @@ public class EventElement implements EmbeddedPacketExtension
|
|||
*/
|
||||
public static final String NAMESPACE = PubSubNamespace.EVENT.getXmlns();
|
||||
|
||||
private EventElementType type;
|
||||
private NodeExtension ext;
|
||||
private final EventElementType type;
|
||||
private final NodeExtension ext;
|
||||
|
||||
public EventElement(EventElementType eventType, NodeExtension eventExt)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,14 +17,14 @@
|
|||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
/**
|
||||
* This enumeration defines the possible event types that are supported within pubsub
|
||||
* This enumeration defines the possible event types that are supported within PubSub
|
||||
* event messages.
|
||||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
public enum EventElementType
|
||||
{
|
||||
/** A node has been associated or dissassociated with a collection node. */
|
||||
/** A node has been associated or disassociated with a collection node. */
|
||||
collection,
|
||||
|
||||
/** A node has had its configuration changed. */
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.pubsub;
|
|||
import org.jivesoftware.smackx.xdata.Form;
|
||||
|
||||
/**
|
||||
* Generic stanza(/packet) extension which represents any pubsub form that is
|
||||
* Generic stanza(/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 {@link FormNodeType}.
|
||||
|
|
@ -28,7 +28,7 @@ import org.jivesoftware.smackx.xdata.Form;
|
|||
*/
|
||||
public class FormNode extends NodeExtension
|
||||
{
|
||||
private Form configForm;
|
||||
private final Form configForm;
|
||||
|
||||
/**
|
||||
* Create a {@link FormNode} which contains the specified form.
|
||||
|
|
|
|||
|
|
@ -21,12 +21,11 @@ import java.util.Locale;
|
|||
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||
|
||||
/**
|
||||
* The types of forms supported by the pubsub specification.
|
||||
* The types of forms supported by the PubSub specification.
|
||||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
public enum FormNodeType
|
||||
{
|
||||
public enum FormNodeType {
|
||||
/** Form for configuring an existing node. */
|
||||
CONFIGURE_OWNER,
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
|
|||
|
||||
/**
|
||||
* This class represents an item that has been, or will be published to a
|
||||
* pubsub node. An <tt>Item</tt> has several properties that are dependent
|
||||
* PubSub node. An <tt>Item</tt> has several properties that are dependent
|
||||
* on the configuration of the node to which it has been or will be published.
|
||||
*
|
||||
* <h3>An Item received from a node (via {@link LeafNode#getItems()} or {@link LeafNode#addItemEventListener(org.jivesoftware.smackx.pubsub.listener.ItemEventListener)}</h3>
|
||||
|
|
|
|||
|
|
@ -28,5 +28,5 @@ public enum ItemReply
|
|||
owner,
|
||||
|
||||
/** The item publisher. */
|
||||
publisher;
|
||||
publisher
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten
|
|||
private final PubSubElementType elem;
|
||||
private final String att;
|
||||
|
||||
private ItemsElementType(PubSubElementType nodeElement, String attribute)
|
||||
ItemsElementType(PubSubElementType nodeElement, String attribute)
|
||||
{
|
||||
elem = nodeElement;
|
||||
att = attribute;
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
|||
import org.jivesoftware.smackx.pubsub.packet.PubSub;
|
||||
|
||||
/**
|
||||
* The main class for the majority of pubsub functionality. In general
|
||||
* almost all pubsub capabilities are related to the concept of a node.
|
||||
* The main class for the majority of PubSub functionality. In general
|
||||
* almost all PubSub capabilities are related to the concept of a node.
|
||||
* All items are published to a node, and typically subscribed to by other
|
||||
* users. These users then retrieve events based on this subscription.
|
||||
*
|
||||
|
|
@ -73,7 +73,7 @@ public class LeafNode extends Node
|
|||
*/
|
||||
public <T extends Item> List<T> getItems() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
return getItems((List<ExtensionElement>) null, (List<ExtensionElement>) null);
|
||||
return getItems((List<ExtensionElement>) null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -112,7 +112,7 @@ public class LeafNode extends Node
|
|||
*/
|
||||
public <T extends Item> List<T> getItems(Collection<String> ids) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
List<Item> itemList = new ArrayList<Item>(ids.size());
|
||||
List<Item> itemList = new ArrayList<>(ids.size());
|
||||
|
||||
for (String id : ids)
|
||||
{
|
||||
|
|
@ -303,7 +303,7 @@ public class LeafNode extends Node
|
|||
@SuppressWarnings("unchecked")
|
||||
public <T extends Item> void publish(T item) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
Collection<T> items = new ArrayList<T>(1);
|
||||
Collection<T> items = new ArrayList<>(1);
|
||||
items.add((item == null ? (T) new Item() : item));
|
||||
publish(items);
|
||||
}
|
||||
|
|
@ -323,7 +323,7 @@ public class LeafNode extends Node
|
|||
*/
|
||||
public <T extends Item> void publish(Collection<T> items) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
PubSub packet = createPubsubPacket(Type.set, new PublishItem<T>(getId(), items));
|
||||
PubSub packet = createPubsubPacket(Type.set, new PublishItem<>(getId(), items));
|
||||
|
||||
pubSubManager.getConnection().createStanzaCollectorAndSend(packet).nextResultOrThrow();
|
||||
}
|
||||
|
|
@ -356,7 +356,7 @@ public class LeafNode extends Node
|
|||
*/
|
||||
public void deleteItem(String itemId) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
Collection<String> items = new ArrayList<String>(1);
|
||||
Collection<String> items = new ArrayList<>(1);
|
||||
items.add(itemId);
|
||||
deleteItem(items);
|
||||
}
|
||||
|
|
@ -372,7 +372,7 @@ public class LeafNode extends Node
|
|||
*/
|
||||
public void deleteItem(Collection<String> itemIds) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException
|
||||
{
|
||||
List<Item> items = new ArrayList<Item>(itemIds.size());
|
||||
List<Item> items = new ArrayList<>(itemIds.size());
|
||||
|
||||
for (String id : itemIds)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -49,16 +49,16 @@ abstract public class Node
|
|||
protected final PubSubManager pubSubManager;
|
||||
protected final String id;
|
||||
|
||||
protected ConcurrentHashMap<ItemEventListener<Item>, StanzaListener> itemEventToListenerMap = new ConcurrentHashMap<ItemEventListener<Item>, StanzaListener>();
|
||||
protected ConcurrentHashMap<ItemDeleteListener, StanzaListener> itemDeleteToListenerMap = new ConcurrentHashMap<ItemDeleteListener, StanzaListener>();
|
||||
protected ConcurrentHashMap<NodeConfigListener, StanzaListener> configEventToListenerMap = new ConcurrentHashMap<NodeConfigListener, StanzaListener>();
|
||||
protected ConcurrentHashMap<ItemEventListener<Item>, StanzaListener> itemEventToListenerMap = new ConcurrentHashMap<>();
|
||||
protected ConcurrentHashMap<ItemDeleteListener, StanzaListener> itemDeleteToListenerMap = new ConcurrentHashMap<>();
|
||||
protected ConcurrentHashMap<NodeConfigListener, StanzaListener> configEventToListenerMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Construct a node associated to the supplied connection with the specified
|
||||
* node id.
|
||||
*
|
||||
* @param connection The connection the node is associated with
|
||||
* @param nodeName The node id
|
||||
* @param pubSubManager The PubSubManager for the connection the node is associated with
|
||||
* @param nodeId The node id
|
||||
*/
|
||||
Node(PubSubManager pubSubManager, String nodeId)
|
||||
{
|
||||
|
|
@ -220,7 +220,7 @@ abstract public class Node
|
|||
if (returnedExtensions != null) {
|
||||
returnedExtensions.addAll(reply.getExtensions());
|
||||
}
|
||||
SubscriptionsExtension subElem = (SubscriptionsExtension) reply.getExtension(PubSubElementType.SUBSCRIPTIONS);
|
||||
SubscriptionsExtension subElem = reply.getExtension(PubSubElementType.SUBSCRIPTIONS);
|
||||
return subElem.getSubscriptions();
|
||||
}
|
||||
|
||||
|
|
@ -280,7 +280,7 @@ abstract public class Node
|
|||
/**
|
||||
* Retrieve the affiliation list for this node as owner.
|
||||
* <p>
|
||||
* Note that this is an <b>optional</b> PubSub feature ('pubusb#modify-affiliations').
|
||||
* Note that this is an <b>optional</b> PubSub feature ('pubsub#modify-affiliations').
|
||||
* </p>
|
||||
*
|
||||
* @param additionalExtensions optional additional extension elements add to the request.
|
||||
|
|
@ -314,7 +314,7 @@ abstract public class Node
|
|||
if (returnedExtensions != null) {
|
||||
returnedExtensions.addAll(reply.getExtensions());
|
||||
}
|
||||
AffiliationsExtension affilElem = (AffiliationsExtension) reply.getExtension(PubSubElementType.AFFILIATIONS);
|
||||
AffiliationsExtension affilElem = reply.getExtension(PubSubElementType.AFFILIATIONS);
|
||||
return affilElem.getAffiliations();
|
||||
}
|
||||
|
||||
|
|
@ -322,7 +322,7 @@ abstract public class Node
|
|||
* Modify the affiliations for this PubSub node as owner. The {@link Affiliation}s given must be created with the
|
||||
* {@link Affiliation#Affiliation(org.jxmpp.jid.BareJid, Affiliation.Type)} constructor.
|
||||
* <p>
|
||||
* Note that this is an <b>optional</b> PubSub feature ('pubusb#modify-affiliations').
|
||||
* Note that this is an <b>optional</b> PubSub feature ('pubsub#modify-affiliations').
|
||||
* </p>
|
||||
*
|
||||
* @param affiliations
|
||||
|
|
@ -574,12 +574,12 @@ abstract public class Node
|
|||
|
||||
private static List<String> getSubscriptionIds(Stanza packet)
|
||||
{
|
||||
HeadersExtension headers = (HeadersExtension) packet.getExtension("headers", "http://jabber.org/protocol/shim");
|
||||
HeadersExtension headers = packet.getExtension("headers", "http://jabber.org/protocol/shim");
|
||||
List<String> values = null;
|
||||
|
||||
if (headers != null)
|
||||
{
|
||||
values = new ArrayList<String>(headers.getHeaders().size());
|
||||
values = new ArrayList<>(headers.getHeaders().size());
|
||||
|
||||
for (Header header : headers.getHeaders())
|
||||
{
|
||||
|
|
@ -598,7 +598,7 @@ abstract public class Node
|
|||
public static class ItemEventTranslator implements StanzaListener
|
||||
{
|
||||
@SuppressWarnings("rawtypes")
|
||||
private ItemEventListener listener;
|
||||
private final ItemEventListener listener;
|
||||
|
||||
public ItemEventTranslator(@SuppressWarnings("rawtypes") ItemEventListener eventListener)
|
||||
{
|
||||
|
|
@ -609,7 +609,7 @@ abstract public class Node
|
|||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public void processStanza(Stanza packet)
|
||||
{
|
||||
EventElement event = (EventElement) packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
EventElement event = packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
ItemsExtension itemsElem = (ItemsExtension) event.getEvent();
|
||||
ItemPublishEvent eventItems = new ItemPublishEvent(itemsElem.getNode(), itemsElem.getItems(), getSubscriptionIds(packet), DelayInformationManager.getDelayTimestamp(packet));
|
||||
listener.handlePublishedItems(eventItems);
|
||||
|
|
@ -624,7 +624,7 @@ abstract public class Node
|
|||
*/
|
||||
public static class ItemDeleteTranslator implements StanzaListener
|
||||
{
|
||||
private ItemDeleteListener listener;
|
||||
private final ItemDeleteListener listener;
|
||||
|
||||
public ItemDeleteTranslator(ItemDeleteListener eventListener)
|
||||
{
|
||||
|
|
@ -635,7 +635,7 @@ abstract public class Node
|
|||
public void processStanza(Stanza packet)
|
||||
{
|
||||
// CHECKSTYLE:OFF
|
||||
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
EventElement event = packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
|
||||
List<ExtensionElement> extList = event.getExtensions();
|
||||
|
||||
|
|
@ -648,7 +648,7 @@ abstract public class Node
|
|||
ItemsExtension itemsElem = (ItemsExtension)event.getEvent();
|
||||
@SuppressWarnings("unchecked")
|
||||
Collection<RetractItem> pubItems = (Collection<RetractItem>) itemsElem.getItems();
|
||||
List<String> items = new ArrayList<String>(pubItems.size());
|
||||
List<String> items = new ArrayList<>(pubItems.size());
|
||||
|
||||
for (RetractItem item : pubItems)
|
||||
{
|
||||
|
|
@ -670,7 +670,7 @@ abstract public class Node
|
|||
*/
|
||||
public static class NodeConfigTranslator implements StanzaListener
|
||||
{
|
||||
private NodeConfigListener listener;
|
||||
private final NodeConfigListener listener;
|
||||
|
||||
public NodeConfigTranslator(NodeConfigListener eventListener)
|
||||
{
|
||||
|
|
@ -680,7 +680,7 @@ abstract public class Node
|
|||
@Override
|
||||
public void processStanza(Stanza packet)
|
||||
{
|
||||
EventElement event = (EventElement) packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
EventElement event = packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
ConfigurationEvent config = (ConfigurationEvent) event.getEvent();
|
||||
|
||||
listener.handleNodeConfiguration(config);
|
||||
|
|
@ -704,9 +704,9 @@ abstract public class Node
|
|||
this(elementName, null);
|
||||
}
|
||||
|
||||
EventContentFilter(String firstLevelEelement, String secondLevelElement)
|
||||
EventContentFilter(String firstLevelElement, String secondLevelElement)
|
||||
{
|
||||
firstElement = firstLevelEelement;
|
||||
firstElement = firstLevelElement;
|
||||
secondElement = secondLevelElement;
|
||||
allowEmpty = firstElement.equals(EventElementType.items.toString())
|
||||
&& "item".equals(secondLevelElement);
|
||||
|
|
|
|||
|
|
@ -24,5 +24,5 @@ package org.jivesoftware.smackx.pubsub;
|
|||
public enum NodeType
|
||||
{
|
||||
leaf,
|
||||
collection;
|
||||
collection
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
|
|||
*/
|
||||
public class PayloadItem<E extends ExtensionElement> extends Item
|
||||
{
|
||||
private E payload;
|
||||
private final E payload;
|
||||
|
||||
/**
|
||||
* Create an <tt>Item</tt> with no id and a payload The id will be set by the server.
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ public enum PubSubElementType
|
|||
private final String eName;
|
||||
private final PubSubNamespace nSpace;
|
||||
|
||||
private PubSubElementType(String elemName, PubSubNamespace ns)
|
||||
PubSubElementType(String elemName, PubSubNamespace ns)
|
||||
{
|
||||
eName = elemName;
|
||||
nSpace = ns;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public enum PubSubFeature implements CharSequence {
|
|||
access_open(Support.optional),
|
||||
access_presence(Support.optional),
|
||||
access_roster(Support.optional),
|
||||
acccess_whitelist(Support.optional),
|
||||
access_whitelist(Support.optional),
|
||||
auto_create(Support.optional),
|
||||
auto_subscribe(Support.recommended),
|
||||
collections(Support.optional),
|
||||
|
|
@ -78,7 +78,7 @@ public enum PubSubFeature implements CharSequence {
|
|||
private final String qualifiedFeature;
|
||||
private final Feature.Support support;
|
||||
|
||||
private PubSubFeature(Feature.Support support) {
|
||||
PubSubFeature(Feature.Support support) {
|
||||
this.feature = name().replace('_', '-');
|
||||
this.qualifiedFeature = PubSub.NAMESPACE + '#' + this.feature;
|
||||
this.support = support;
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ public final class PubSubManager extends Manager {
|
|||
* A map of node IDs to Nodes, used to cache those Nodes. This does only cache the type of Node,
|
||||
* i.e. {@link CollectionNode} or {@link LeafNode}.
|
||||
*/
|
||||
private final Map<String, Node> nodeMap = new ConcurrentHashMap<String, Node>();
|
||||
private final Map<String, Node> nodeMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Get a PubSub manager for the default PubSub service of the connection.
|
||||
|
|
@ -98,7 +98,7 @@ public final class PubSubManager extends Manager {
|
|||
LOGGER.log(Level.WARNING, "Could not determine PubSub service", e);
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
LOGGER.log(Level.FINE, "Interupted while trying to determine PubSub service", e);
|
||||
LOGGER.log(Level.FINE, "Interrupted while trying to determine PubSub service", e);
|
||||
}
|
||||
}
|
||||
if (pubSubService == null) {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class PublishItem<T extends Item> extends NodeExtension
|
|||
public PublishItem(String nodeId, T toPublish)
|
||||
{
|
||||
super(PubSubElementType.PUBLISH, nodeId);
|
||||
items = new ArrayList<T>(1);
|
||||
items = new ArrayList<>(1);
|
||||
items.add(toPublish);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,5 +31,5 @@ public enum PublishModel
|
|||
subscribers,
|
||||
|
||||
/** Anyone may publish. */
|
||||
open;
|
||||
open
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
|||
*/
|
||||
public class RetractItem implements ExtensionElement
|
||||
{
|
||||
private String id;
|
||||
private final String id;
|
||||
|
||||
/**
|
||||
* Construct a <tt>RetractItem</tt> with the specified id.
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ public class SubscribeForm extends Form
|
|||
*/
|
||||
public List<PresenceState> getShowValues()
|
||||
{
|
||||
ArrayList<PresenceState> result = new ArrayList<PresenceState>(5);
|
||||
ArrayList<PresenceState> result = new ArrayList<>(5);
|
||||
|
||||
for (String state : getFieldValues(SubscribeOptionFields.show_values))
|
||||
{
|
||||
|
|
@ -198,7 +198,7 @@ public class SubscribeForm extends Form
|
|||
*/
|
||||
public void setShowValues(Collection<PresenceState> stateValues)
|
||||
{
|
||||
ArrayList<String> values = new ArrayList<String>(stateValues.size());
|
||||
ArrayList<String> values = new ArrayList<>(stateValues.size());
|
||||
|
||||
for (PresenceState state : stateValues)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,8 +24,7 @@ import java.util.Locale;
|
|||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
public enum PubSubNamespace
|
||||
{
|
||||
public enum PubSubNamespace {
|
||||
BASIC(null),
|
||||
ERROR("errors"),
|
||||
EVENT("event"),
|
||||
|
|
@ -34,13 +33,11 @@ public enum PubSubNamespace
|
|||
private final String fragment;
|
||||
private final String fullNamespace;
|
||||
|
||||
private PubSubNamespace(String fragment)
|
||||
{
|
||||
PubSubNamespace(String fragment) {
|
||||
this.fragment = fragment;
|
||||
if (fragment != null) {
|
||||
fullNamespace = PubSub.NAMESPACE + '#' + fragment;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
fullNamespace = PubSub.NAMESPACE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ import org.jivesoftware.smackx.xdata.Form;
|
|||
import org.jivesoftware.smackx.xdata.packet.DataForm;
|
||||
|
||||
/**
|
||||
* Parses one of several elements used in pubsub that contain a form of some kind as a child element. The
|
||||
* Parses one of several elements used in PubSub that contain a form of some kind as a child element. The
|
||||
* elements and namespaces supported is defined in {@link FormNodeType}.
|
||||
*
|
||||
* @author Robin Collier
|
||||
|
|
|
|||
|
|
@ -59,11 +59,11 @@ public class ItemProvider extends ExtensionElementProvider<Item>
|
|||
if (extensionProvider == null)
|
||||
{
|
||||
CharSequence payloadText = PacketParserUtils.parseElement(parser, true);
|
||||
return new PayloadItem<SimplePayload>(id, node, new SimplePayload(payloadElemName, payloadNS, payloadText));
|
||||
return new PayloadItem<>(id, node, new SimplePayload(payloadElemName, payloadNS, payloadText));
|
||||
}
|
||||
else
|
||||
{
|
||||
return new PayloadItem<ExtensionElement>(id, node, extensionProvider.parse(parser));
|
||||
return new PayloadItem<>(id, node, extensionProvider.parse(parser));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
|||
import org.xmlpull.v1.XmlPullParser;
|
||||
|
||||
/**
|
||||
* Parses the root pubsub stanza(/packet) extensions of the {@link IQ} stanza(/packet) and returns
|
||||
* Parses the root PubSub stanza(/packet) extensions of the {@link IQ} stanza(/packet) and returns
|
||||
* a {@link PubSub} instance.
|
||||
*
|
||||
* @author Robin Collier
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ import org.jivesoftware.smackx.pubsub.NodeExtension;
|
|||
import org.jivesoftware.smackx.pubsub.PubSubElementType;
|
||||
|
||||
/**
|
||||
* Parses simple elements that only contain a <b>node</b> attribute. This is common amongst many of the
|
||||
* elements defined in the pubsub specification. For this common case a {@link NodeExtension} is returned.
|
||||
* Parses simple elements that only contain a <b>node</b> attribute. This is common amongst many of the
|
||||
* elements defined in the PubSub specification. For this common case a {@link NodeExtension} is returned.
|
||||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.xmlpull.v1.XmlPullParser;
|
|||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
/**
|
||||
* Parses the <b>subscription</b> element out of the pubsub IQ message from
|
||||
* Parses the <b>subscription</b> element out of the PubSub IQ message from
|
||||
* the server as specified in the <a href="http://xmpp.org/extensions/xep-0060.html#schemas-pubsub">subscription schema</a>.
|
||||
*
|
||||
* @author Robin Collier
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smackx.pubsub.Subscription;
|
|||
import org.jivesoftware.smackx.pubsub.SubscriptionsExtension;
|
||||
|
||||
/**
|
||||
* Parses the <b>subscriptions</b> element out of the pubsub IQ message from
|
||||
* Parses the <b>subscriptions</b> element out of the PubSub IQ message from
|
||||
* the server as specified in the <a href="http://xmpp.org/extensions/xep-0060.html#schemas-pubsub">subscriptions schema</a>.
|
||||
*
|
||||
* @author Robin Collier
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue