mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-16 07:51:08 +01:00
Rename PacketFilter (and implementing classes) and PacketExtension
to StanzaFilter and ExtensionElement.
This commit is contained in:
parent
2250ac20ed
commit
d4a6d8e653
233 changed files with 1175 additions and 895 deletions
|
|
@ -17,7 +17,7 @@
|
|||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
|
||||
/**
|
||||
* Represents a affiliation between a user and a node, where the {@link #type} defines
|
||||
|
|
@ -29,7 +29,7 @@ import org.jivesoftware.smack.packet.PacketExtension;
|
|||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
public class Affiliation implements PacketExtension
|
||||
public class Affiliation implements ExtensionElement
|
||||
{
|
||||
protected String node;
|
||||
protected Type type;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
|
||||
/**
|
||||
* Represents the <b>configuration</b> element of a pubsub message event which
|
||||
|
|
@ -49,11 +49,11 @@ public class ConfigurationEvent extends NodeExtension implements EmbeddedPacketE
|
|||
return form;
|
||||
}
|
||||
|
||||
public List<PacketExtension> getExtensions()
|
||||
public List<ExtensionElement> getExtensions()
|
||||
{
|
||||
if (getConfiguration() == null)
|
||||
return Collections.emptyList();
|
||||
else
|
||||
return Arrays.asList(((PacketExtension)getConfiguration().getDataFormToSend()));
|
||||
return Arrays.asList(((ExtensionElement)getConfiguration().getDataFormToSend()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ package org.jivesoftware.smackx.pubsub;
|
|||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
|
||||
/**
|
||||
* This interface defines {@link PacketExtension} implementations that contain other
|
||||
* This interface defines {@link ExtensionElement} implementations that contain other
|
||||
* extensions. This effectively extends the idea of an extension within one of the
|
||||
* top level {@link Stanza} types to consider any embedded element to be an extension
|
||||
* of its parent. This more easily enables the usage of some of Smacks parsing
|
||||
|
|
@ -37,12 +37,12 @@ import org.jivesoftware.smack.util.PacketParserUtils;
|
|||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
public interface EmbeddedPacketExtension extends PacketExtension
|
||||
public interface EmbeddedPacketExtension extends ExtensionElement
|
||||
{
|
||||
/**
|
||||
* Get the list of embedded {@link PacketExtension} objects.
|
||||
* Get the list of embedded {@link ExtensionElement} objects.
|
||||
*
|
||||
* @return List of embedded {@link PacketExtension}
|
||||
* @return List of embedded {@link ExtensionElement}
|
||||
*/
|
||||
List<PacketExtension> getExtensions();
|
||||
List<ExtensionElement> getExtensions();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.pubsub;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||
|
||||
/**
|
||||
|
|
@ -46,9 +46,9 @@ public class EventElement implements EmbeddedPacketExtension
|
|||
return type;
|
||||
}
|
||||
|
||||
public List<PacketExtension> getExtensions()
|
||||
public List<ExtensionElement> getExtensions()
|
||||
{
|
||||
return Arrays.asList(new PacketExtension[]{getEvent()});
|
||||
return Arrays.asList(new ExtensionElement[]{getEvent()});
|
||||
}
|
||||
|
||||
public NodeExtension getEvent()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.pubsub;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
|
||||
/**
|
||||
* This class is used to for multiple purposes.
|
||||
|
|
@ -36,7 +36,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten
|
|||
{
|
||||
protected ItemsElementType type;
|
||||
protected Boolean notify;
|
||||
protected List<? extends PacketExtension> items;
|
||||
protected List<? extends ExtensionElement> items;
|
||||
|
||||
public enum ItemsElementType
|
||||
{
|
||||
|
|
@ -83,7 +83,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten
|
|||
* @param nodeId The node to which the items are being sent or deleted
|
||||
* @param items The list of {@link Item} or {@link RetractItem}
|
||||
*/
|
||||
public ItemsExtension(ItemsElementType itemsType, String nodeId, List<? extends PacketExtension> items)
|
||||
public ItemsExtension(ItemsElementType itemsType, String nodeId, List<? extends ExtensionElement> items)
|
||||
{
|
||||
super(itemsType.getNodeElement(), nodeId);
|
||||
type = itemsType;
|
||||
|
|
@ -106,7 +106,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten
|
|||
* @param nodeId The node to which the items are being sent or deleted
|
||||
* @param items The list of {@link Item} or {@link RetractItem}
|
||||
*/
|
||||
public ItemsExtension(String nodeId, List<? extends PacketExtension> items, boolean notify)
|
||||
public ItemsExtension(String nodeId, List<? extends ExtensionElement> items, boolean notify)
|
||||
{
|
||||
super(ItemsElementType.retract.getNodeElement(), nodeId);
|
||||
type = ItemsElementType.retract;
|
||||
|
|
@ -125,9 +125,9 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<PacketExtension> getExtensions()
|
||||
public List<ExtensionElement> getExtensions()
|
||||
{
|
||||
return (List<PacketExtension>)getItems();
|
||||
return (List<ExtensionElement>)getItems();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -135,7 +135,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten
|
|||
*
|
||||
* return List of {@link Item}, {@link RetractItem}, or null
|
||||
*/
|
||||
public List<? extends PacketExtension> getItems()
|
||||
public List<? extends ExtensionElement> getItems()
|
||||
{
|
||||
return items;
|
||||
}
|
||||
|
|
@ -175,7 +175,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten
|
|||
else
|
||||
{
|
||||
builder.append("'>");
|
||||
for (PacketExtension item : items)
|
||||
for (ExtensionElement item : items)
|
||||
{
|
||||
builder.append(item.toXML());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
||||
import org.jivesoftware.smackx.pubsub.packet.PubSub;
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ public class LeafNode extends Node
|
|||
*/
|
||||
public <T extends Item> List<T> getItems() throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
{
|
||||
return getItems((List<PacketExtension>) null, (List<PacketExtension>) null);
|
||||
return getItems((List<ExtensionElement>) null, (List<ExtensionElement>) null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -169,8 +169,8 @@ public class LeafNode extends Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public <T extends Item> List<T> getItems(List<PacketExtension> additionalExtensions,
|
||||
List<PacketExtension> returnedExtensions) throws NoResponseException,
|
||||
public <T extends Item> List<T> getItems(List<ExtensionElement> additionalExtensions,
|
||||
List<ExtensionElement> returnedExtensions) throws NoResponseException,
|
||||
XMPPErrorException, NotConnectedException {
|
||||
PubSub request = createPubsubPacket(Type.get, new GetItemsRequest(getId()));
|
||||
request.addExtensions(additionalExtensions);
|
||||
|
|
@ -184,7 +184,7 @@ public class LeafNode extends Node
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T extends Item> List<T> getItems(PubSub request,
|
||||
List<PacketExtension> returnedExtensions) throws NoResponseException,
|
||||
List<ExtensionElement> returnedExtensions) throws NoResponseException,
|
||||
XMPPErrorException, NotConnectedException {
|
||||
PubSub result = con.createPacketCollectorAndSend(request).nextResultOrThrow();
|
||||
ItemsExtension itemsElem = result.getExtension(PubSubElementType.ITEMS);
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ import org.jivesoftware.smack.SmackException.NotConnectedException;
|
|||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
|
||||
import org.jivesoftware.smack.filter.OrFilter;
|
||||
import org.jivesoftware.smack.filter.PacketFilter;
|
||||
import org.jivesoftware.smack.filter.StanzaFilter;
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
import org.jivesoftware.smackx.delay.DelayInformationManager;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||
|
|
@ -164,7 +164,7 @@ abstract public class Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public List<Subscription> getSubscriptions(List<PacketExtension> additionalExtensions, Collection<PacketExtension> returnedExtensions)
|
||||
public List<Subscription> getSubscriptions(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
return getSubscriptions(additionalExtensions, returnedExtensions, null);
|
||||
}
|
||||
|
|
@ -206,18 +206,18 @@ abstract public class Node
|
|||
* Retrieve Subscriptions List</a>
|
||||
* @since 4.1
|
||||
*/
|
||||
public List<Subscription> getSubscriptionsAsOwner(List<PacketExtension> additionalExtensions,
|
||||
Collection<PacketExtension> returnedExtensions) throws NoResponseException, XMPPErrorException,
|
||||
public List<Subscription> getSubscriptionsAsOwner(List<ExtensionElement> additionalExtensions,
|
||||
Collection<ExtensionElement> returnedExtensions) throws NoResponseException, XMPPErrorException,
|
||||
NotConnectedException {
|
||||
return getSubscriptions(additionalExtensions, returnedExtensions, PubSubNamespace.OWNER);
|
||||
}
|
||||
|
||||
private List<Subscription> getSubscriptions(List<PacketExtension> additionalExtensions,
|
||||
Collection<PacketExtension> returnedExtensions, PubSubNamespace pubSubNamespace)
|
||||
private List<Subscription> getSubscriptions(List<ExtensionElement> additionalExtensions,
|
||||
Collection<ExtensionElement> returnedExtensions, PubSubNamespace pubSubNamespace)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
PubSub pubSub = createPubsubPacket(Type.get, new NodeExtension(PubSubElementType.SUBSCRIPTIONS, getId()), pubSubNamespace);
|
||||
if (additionalExtensions != null) {
|
||||
for (PacketExtension pe : additionalExtensions) {
|
||||
for (ExtensionElement pe : additionalExtensions) {
|
||||
pubSub.addExtension(pe);
|
||||
}
|
||||
}
|
||||
|
|
@ -257,11 +257,11 @@ abstract public class Node
|
|||
* @throws XMPPErrorException
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public List<Affiliation> getAffiliations(List<PacketExtension> additionalExtensions, Collection<PacketExtension> returnedExtensions)
|
||||
public List<Affiliation> getAffiliations(List<ExtensionElement> additionalExtensions, Collection<ExtensionElement> returnedExtensions)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
PubSub pubSub = createPubsubPacket(Type.get, new NodeExtension(PubSubElementType.AFFILIATIONS, getId()));
|
||||
if (additionalExtensions != null) {
|
||||
for (PacketExtension pe : additionalExtensions) {
|
||||
for (ExtensionElement pe : additionalExtensions) {
|
||||
pubSub.addExtension(pe);
|
||||
}
|
||||
}
|
||||
|
|
@ -476,12 +476,12 @@ abstract public class Node
|
|||
return super.toString() + " " + getClass().getName() + " id: " + id;
|
||||
}
|
||||
|
||||
protected PubSub createPubsubPacket(Type type, PacketExtension ext)
|
||||
protected PubSub createPubsubPacket(Type type, ExtensionElement ext)
|
||||
{
|
||||
return createPubsubPacket(type, ext, null);
|
||||
}
|
||||
|
||||
protected PubSub createPubsubPacket(Type type, PacketExtension ext, PubSubNamespace ns)
|
||||
protected PubSub createPubsubPacket(Type type, ExtensionElement ext, PubSubNamespace ns)
|
||||
{
|
||||
return PubSub.createPubsubPacket(to, type, ext, ns);
|
||||
}
|
||||
|
|
@ -554,7 +554,7 @@ abstract public class Node
|
|||
{
|
||||
EventElement event = (EventElement)packet.getExtension("event", PubSubNamespace.EVENT.getXmlns());
|
||||
|
||||
List<PacketExtension> extList = event.getExtensions();
|
||||
List<ExtensionElement> extList = event.getExtensions();
|
||||
|
||||
if (extList.get(0).getElementName().equals(PubSubElementType.PURGE_EVENT.getElementName()))
|
||||
{
|
||||
|
|
@ -608,7 +608,7 @@ abstract public class Node
|
|||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
class EventContentFilter implements PacketFilter
|
||||
class EventContentFilter implements StanzaFilter
|
||||
{
|
||||
private String firstElement;
|
||||
private String secondElement;
|
||||
|
|
@ -649,7 +649,7 @@ abstract public class Node
|
|||
|
||||
if (embedEvent instanceof EmbeddedPacketExtension)
|
||||
{
|
||||
List<PacketExtension> secondLevelList = ((EmbeddedPacketExtension)embedEvent).getExtensions();
|
||||
List<ExtensionElement> secondLevelList = ((EmbeddedPacketExtension)embedEvent).getExtensions();
|
||||
|
||||
if (secondLevelList.size() > 0 && secondLevelList.get(0).getElementName().equals(secondElement))
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
|
||||
/**
|
||||
* A class which represents a common element within the pubsub defined
|
||||
|
|
@ -26,7 +26,7 @@ import org.jivesoftware.smack.packet.PacketExtension;
|
|||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
public class NodeExtension implements PacketExtension
|
||||
public class NodeExtension implements ExtensionElement
|
||||
{
|
||||
private final PubSubElementType element;
|
||||
private final String node;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
import org.jivesoftware.smack.packet.Message;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
|
||||
|
||||
/**
|
||||
|
|
@ -43,14 +43,14 @@ import org.jivesoftware.smackx.pubsub.provider.ItemProvider;
|
|||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
public class PayloadItem<E extends PacketExtension> extends Item
|
||||
public class PayloadItem<E extends ExtensionElement> extends Item
|
||||
{
|
||||
private E payload;
|
||||
|
||||
/**
|
||||
* Create an <tt>Item</tt> with no id and a payload The id will be set by the server.
|
||||
*
|
||||
* @param payloadExt A {@link PacketExtension} which represents the payload data.
|
||||
* @param payloadExt A {@link ExtensionElement} which represents the payload data.
|
||||
*/
|
||||
public PayloadItem(E payloadExt)
|
||||
{
|
||||
|
|
@ -65,7 +65,7 @@ public class PayloadItem<E extends PacketExtension> extends Item
|
|||
* Create an <tt>Item</tt> with an id and payload.
|
||||
*
|
||||
* @param itemId The id of this item. It can be null if we want the server to set the id.
|
||||
* @param payloadExt A {@link PacketExtension} which represents the payload data.
|
||||
* @param payloadExt A {@link ExtensionElement} which represents the payload data.
|
||||
*/
|
||||
public PayloadItem(String itemId, E payloadExt)
|
||||
{
|
||||
|
|
@ -87,7 +87,7 @@ public class PayloadItem<E extends PacketExtension> extends Item
|
|||
*
|
||||
* @param itemId The id of this item.
|
||||
* @param nodeId The id of the node the item was published to.
|
||||
* @param payloadExt A {@link PacketExtension} which represents the payload data.
|
||||
* @param payloadExt A {@link ExtensionElement} which represents the payload data.
|
||||
*/
|
||||
public PayloadItem(String itemId, String nodeId, E payloadExt)
|
||||
{
|
||||
|
|
@ -102,7 +102,7 @@ public class PayloadItem<E extends PacketExtension> extends Item
|
|||
* Get the payload associated with this <tt>Item</tt>. Customising the payload
|
||||
* parsing from the server can be accomplished as described in {@link ItemProvider}.
|
||||
*
|
||||
* @return The payload as a {@link PacketExtension}.
|
||||
* @return The payload as a {@link ExtensionElement}.
|
||||
*/
|
||||
public E getPayload()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ import org.jivesoftware.smack.packet.EmptyResultIQ;
|
|||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.IQ.Type;
|
||||
import org.jivesoftware.smack.packet.Stanza;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smackx.disco.ServiceDiscoveryManager;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverInfo;
|
||||
import org.jivesoftware.smackx.disco.packet.DiscoverItems;
|
||||
|
|
@ -299,15 +299,15 @@ final public class PubSubManager
|
|||
return mgr.discoverInfo(to);
|
||||
}
|
||||
|
||||
private PubSub sendPubsubPacket(Type type, PacketExtension ext, PubSubNamespace ns)
|
||||
private PubSub sendPubsubPacket(Type type, ExtensionElement ext, PubSubNamespace ns)
|
||||
throws NoResponseException, XMPPErrorException, NotConnectedException {
|
||||
return sendPubsubPacket(con, to, type, Collections.singletonList(ext), ns);
|
||||
}
|
||||
|
||||
static PubSub sendPubsubPacket(XMPPConnection con, String to, Type type, List<PacketExtension> extList, PubSubNamespace ns) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
static PubSub sendPubsubPacket(XMPPConnection con, String to, Type type, List<ExtensionElement> extList, PubSubNamespace ns) throws NoResponseException, XMPPErrorException, NotConnectedException
|
||||
{
|
||||
PubSub pubSub = new PubSub(to, type, ns);
|
||||
for (PacketExtension pe : extList) {
|
||||
for (ExtensionElement pe : extList) {
|
||||
pubSub.addExtension(pe);
|
||||
}
|
||||
return sendPubsubPacket(con ,pubSub);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
||||
|
||||
/**
|
||||
|
|
@ -24,7 +24,7 @@ import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace;
|
|||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
public class RetractItem implements PacketExtension
|
||||
public class RetractItem implements ExtensionElement
|
||||
{
|
||||
private String id;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
package org.jivesoftware.smackx.pubsub;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
|
||||
/**
|
||||
* The default payload representation for {@link PayloadItem#getPayload()}. It simply
|
||||
|
|
@ -24,7 +24,7 @@ import org.jivesoftware.smack.packet.PacketExtension;
|
|||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
public class SimplePayload implements PacketExtension
|
||||
public class SimplePayload implements ExtensionElement
|
||||
{
|
||||
private final String elemName;
|
||||
private final String ns;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
package org.jivesoftware.smackx.pubsub.packet;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smackx.pubsub.PubSubElementType;
|
||||
|
||||
/**
|
||||
|
|
@ -56,7 +56,7 @@ public class PubSub extends IQ
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <PE extends PacketExtension> PE getExtension(PubSubElementType elem)
|
||||
public <PE extends ExtensionElement> PE getExtension(PubSubElementType elem)
|
||||
{
|
||||
return (PE) getExtension(elem.getElementName(), elem.getNamespace().getXmlns());
|
||||
}
|
||||
|
|
@ -86,7 +86,7 @@ public class PubSub extends IQ
|
|||
return xml;
|
||||
}
|
||||
|
||||
public static PubSub createPubsubPacket(String to, Type type, PacketExtension extension, PubSubNamespace ns) {
|
||||
public static PubSub createPubsubPacket(String to, Type type, ExtensionElement extension, PubSubNamespace ns) {
|
||||
PubSub pubSub = new PubSub(to, type, ns);
|
||||
pubSub.addExtension(extension);
|
||||
return pubSub;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.pubsub.provider;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
|
||||
import org.jivesoftware.smackx.pubsub.Affiliation;
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ import org.jivesoftware.smackx.pubsub.Affiliation;
|
|||
public class AffiliationProvider extends EmbeddedExtensionProvider<Affiliation>
|
||||
{
|
||||
@Override
|
||||
protected Affiliation createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
|
||||
protected Affiliation createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends ExtensionElement> content)
|
||||
{
|
||||
return new Affiliation(attributeMap.get("node"), Affiliation.Type.valueOf(attributeMap.get("affiliation")));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.pubsub.provider;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
|
||||
import org.jivesoftware.smackx.pubsub.Affiliation;
|
||||
import org.jivesoftware.smackx.pubsub.AffiliationsExtension;
|
||||
|
|
@ -33,7 +33,7 @@ import org.jivesoftware.smackx.pubsub.AffiliationsExtension;
|
|||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected AffiliationsExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
|
||||
protected AffiliationsExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends ExtensionElement> content)
|
||||
{
|
||||
return new AffiliationsExtension((List<Affiliation>)content);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.pubsub.provider;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
|
||||
import org.jivesoftware.smackx.pubsub.ConfigurationEvent;
|
||||
import org.jivesoftware.smackx.pubsub.ConfigureForm;
|
||||
|
|
@ -34,7 +34,7 @@ import org.jivesoftware.smackx.xdata.packet.DataForm;
|
|||
public class ConfigEventProvider extends EmbeddedExtensionProvider<ConfigurationEvent>
|
||||
{
|
||||
@Override
|
||||
protected ConfigurationEvent createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attMap, List<? extends PacketExtension> content)
|
||||
protected ConfigurationEvent createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attMap, List<? extends ExtensionElement> content)
|
||||
{
|
||||
if (content.size() == 0)
|
||||
return new ConfigurationEvent(attMap.get("node"));
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.pubsub.provider;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
|
||||
import org.jivesoftware.smackx.pubsub.EventElement;
|
||||
import org.jivesoftware.smackx.pubsub.EventElementType;
|
||||
|
|
@ -34,7 +34,7 @@ import org.jivesoftware.smackx.pubsub.NodeExtension;
|
|||
public class EventProvider extends EmbeddedExtensionProvider<EventElement>
|
||||
{
|
||||
@Override
|
||||
protected EventElement createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attMap, List<? extends PacketExtension> content)
|
||||
protected EventElement createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attMap, List<? extends ExtensionElement> content)
|
||||
{
|
||||
return new EventElement(EventElementType.valueOf(content.get(0).getElementName()), (NodeExtension)content.get(0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.pubsub.provider;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
|
||||
import org.jivesoftware.smackx.pubsub.FormNode;
|
||||
import org.jivesoftware.smackx.pubsub.FormNodeType;
|
||||
|
|
@ -35,7 +35,7 @@ import org.jivesoftware.smackx.xdata.packet.DataForm;
|
|||
public class FormNodeProvider extends EmbeddedExtensionProvider<FormNode>
|
||||
{
|
||||
@Override
|
||||
protected FormNode createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
|
||||
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()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ package org.jivesoftware.smackx.pubsub.provider;
|
|||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.SmackException;
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smack.provider.ProviderManager;
|
||||
import org.jivesoftware.smack.util.PacketParserUtils;
|
||||
import org.jivesoftware.smackx.pubsub.Item;
|
||||
|
|
@ -33,12 +33,12 @@ import org.xmlpull.v1.XmlPullParserException;
|
|||
/**
|
||||
* Parses an <b>item</b> element as is defined in both the {@link PubSubNamespace#BASIC} and
|
||||
* {@link PubSubNamespace#EVENT} namespaces. To parse the item contents, it will use whatever
|
||||
* {@link PacketExtensionProvider} is registered in <b>smack.providers</b> for its element name and namespace. If no
|
||||
* {@link ExtensionElementProvider} is registered in <b>smack.providers</b> for its element name and namespace. If no
|
||||
* provider is registered, it will return a {@link SimplePayload}.
|
||||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
public class ItemProvider extends PacketExtensionProvider<Item>
|
||||
public class ItemProvider extends ExtensionElementProvider<Item>
|
||||
{
|
||||
@Override
|
||||
public Item parse(XmlPullParser parser, int initialDepth)
|
||||
|
|
@ -57,7 +57,7 @@ public class ItemProvider extends PacketExtensionProvider<Item>
|
|||
String payloadElemName = parser.getName();
|
||||
String payloadNS = parser.getNamespace();
|
||||
|
||||
final PacketExtensionProvider<PacketExtension> extensionProvider = ProviderManager.getExtensionProvider(payloadElemName, payloadNS);
|
||||
final ExtensionElementProvider<ExtensionElement> extensionProvider = ProviderManager.getExtensionProvider(payloadElemName, payloadNS);
|
||||
if (extensionProvider == null)
|
||||
{
|
||||
CharSequence payloadText = PacketParserUtils.parseElement(parser, true);
|
||||
|
|
@ -65,7 +65,7 @@ public class ItemProvider extends PacketExtensionProvider<Item>
|
|||
}
|
||||
else
|
||||
{
|
||||
return new PayloadItem<PacketExtension>(id, node, extensionProvider.parse(parser));
|
||||
return new PayloadItem<ExtensionElement>(id, node, extensionProvider.parse(parser));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.pubsub.provider;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
|
||||
import org.jivesoftware.smackx.pubsub.ItemsExtension;
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ public class ItemsProvider extends EmbeddedExtensionProvider<ItemsExtension>
|
|||
{
|
||||
|
||||
@Override
|
||||
protected ItemsExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
|
||||
protected ItemsExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends ExtensionElement> content)
|
||||
{
|
||||
return new ItemsExtension(ItemsExtension.ItemsElementType.items, attributeMap.get("node"), content);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class PubSubProvider extends IQProvider<PubSub>
|
|||
int eventType = parser.next();
|
||||
switch (eventType) {
|
||||
case XmlPullParser.START_TAG:
|
||||
PacketParserUtils.addPacketExtension(pubsub, parser);
|
||||
PacketParserUtils.addExtensionElement(pubsub, parser);
|
||||
break;
|
||||
case XmlPullParser.END_TAG:
|
||||
if (parser.getDepth() == initialDepth) {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.pubsub.provider;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
|
||||
import org.jivesoftware.smackx.pubsub.RetractItem;
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ import org.jivesoftware.smackx.pubsub.RetractItem;
|
|||
public class RetractEventProvider extends EmbeddedExtensionProvider<RetractItem>
|
||||
{
|
||||
@Override
|
||||
protected RetractItem createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
|
||||
protected RetractItem createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends ExtensionElement> content)
|
||||
{
|
||||
return new RetractItem(attributeMap.get("id"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.pubsub.provider;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
|
||||
import org.jivesoftware.smackx.pubsub.NodeExtension;
|
||||
import org.jivesoftware.smackx.pubsub.PubSubElementType;
|
||||
|
|
@ -33,7 +33,7 @@ import org.jivesoftware.smackx.pubsub.PubSubElementType;
|
|||
public class SimpleNodeProvider extends EmbeddedExtensionProvider<NodeExtension>
|
||||
{
|
||||
@Override
|
||||
protected NodeExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
|
||||
protected NodeExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends ExtensionElement> content)
|
||||
{
|
||||
return new NodeExtension(PubSubElementType.valueOfFromElemName(currentElement, currentNamespace), attributeMap.get("node"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ package org.jivesoftware.smackx.pubsub.provider;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.provider.PacketExtensionProvider;
|
||||
import org.jivesoftware.smack.provider.ExtensionElementProvider;
|
||||
import org.jivesoftware.smackx.pubsub.Subscription;
|
||||
import org.xmlpull.v1.XmlPullParser;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
|
@ -29,7 +29,7 @@ import org.xmlpull.v1.XmlPullParserException;
|
|||
*
|
||||
* @author Robin Collier
|
||||
*/
|
||||
public class SubscriptionProvider extends PacketExtensionProvider<Subscription>
|
||||
public class SubscriptionProvider extends ExtensionElementProvider<Subscription>
|
||||
{
|
||||
@Override
|
||||
public Subscription parse(XmlPullParser parser, int initialDepth)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.pubsub.provider;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jivesoftware.smack.packet.PacketExtension;
|
||||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
import org.jivesoftware.smack.provider.EmbeddedExtensionProvider;
|
||||
import org.jivesoftware.smackx.pubsub.Subscription;
|
||||
import org.jivesoftware.smackx.pubsub.SubscriptionsExtension;
|
||||
|
|
@ -34,7 +34,7 @@ public class SubscriptionsProvider extends EmbeddedExtensionProvider<Subscriptio
|
|||
{
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected SubscriptionsExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends PacketExtension> content)
|
||||
protected SubscriptionsExtension createReturnExtension(String currentElement, String currentNamespace, Map<String, String> attributeMap, List<? extends ExtensionElement> content)
|
||||
{
|
||||
return new SubscriptionsExtension(attributeMap.get("node"), (List<Subscription>)content);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue