diff --git a/documentation/debugging.md b/documentation/debugging.md index e5bf0df36..800b15afc 100644 --- a/documentation/debugging.md +++ b/documentation/debugging.md @@ -42,9 +42,9 @@ connection. The window will contain the following information: * XMPPConnection tabs -- each tab shows debugging information related to the connection. * Smack info tab -- shows information about Smack (e.g. Smack version, installed components, etc.). The connection tab will contain the following information: - * All Packets -- shows sent and received packets information parsed by Smack. - * Raw Sent Packets -- raw XML traffic generated by Smack and sent to the server. - * Raw Received Packets -- raw XML traffic sent by the server to the client. + * All Stanzas -- shows sent and received packets information parsed by Smack. + * Raw Sent Stanzas -- raw XML traffic generated by Smack and sent to the server. + * Raw Received Stanzas -- raw XML traffic sent by the server to the client. * Ad-hoc message -- allows to send ad-hoc packets of any type. * Information -- shows connection state and statistics. @@ -57,6 +57,6 @@ contain the following information: * Client Traffic (red text) -- raw XML traffic generated by Smack and sent to the server. * Server Traffic (blue text) -- raw XML traffic sent by the server to the client. - * Interpreted Packets (green text) -- shows XML packets from the server as parsed by Smack. Right click on any of the panes to bring up a menu with the choices to copy of the contents to the system clipboard or to clear the contents of the pane. + * Interpreted Stanzas (green text) -- shows XML packets from the server as parsed by Smack. Right click on any of the panes to bring up a menu with the choices to copy of the contents to the system clipboard or to clear the contents of the pane. Copyright (C) Jive Software 2002-2008 diff --git a/documentation/developer/stanzas.md b/documentation/developer/stanzas.md index e770e01e6..15883256f 100644 --- a/documentation/developer/stanzas.md +++ b/documentation/developer/stanzas.md @@ -1,7 +1,7 @@ PacketExtension =============== -The static `from(Packet)` Method +The static `from(Stanza)` Method -------------------------------- Every PacketExtension class must have a static `from()` method that retrieves that extension for a given Stanza (if any). @@ -9,7 +9,7 @@ Every PacketExtension class must have a static `from()` method that retrieves th Sample Code ```java -public static RSMSet from(Packet) { +public static RSMSet from(Stanza) { return packet.getExtension(ELEMENT, NAMESPACE); } ``` diff --git a/documentation/extensions/hoxt.md b/documentation/extensions/hoxt.md index b89f5a7d2..55bb17f3a 100644 --- a/documentation/extensions/hoxt.md +++ b/documentation/extensions/hoxt.md @@ -89,7 +89,7 @@ req.setTo("juliet@capulet.com/balcony"); // send it connection.sendIqWithResponseCallback(req, new PacketListener() { - public void processPacket(Packet packet) { + public void processPacket(Stanza packet) { HttpOverXmppResp resp = (HttpOverXmppResp) iq; // check HTTP response code if (resp.getStatusCode() == 200) { diff --git a/documentation/extensions/invitation.md b/documentation/extensions/invitation.md index 30f968ee7..222494503 100644 --- a/documentation/extensions/invitation.md +++ b/documentation/extensions/invitation.md @@ -1,7 +1,7 @@ Group Chat Invitations ====================== -The group chat invitation packet extension is used to invite other users to a +The group chat invitation extension is used to invite other users to a group chat room. * Inviting Other Users @@ -20,7 +20,7 @@ appropriately, as in the following code example: Message message = new Message("user@chat.example.com"); message.setBody("Join me for a group chat!"); message.addExtension(new GroupChatInvitation("room@chat.example.com")); -con.sendPacket(message); +con.sendStanza(message); ``` The XML generated for the invitation portion of the code above would be: @@ -32,11 +32,11 @@ The XML generated for the invitation portion of the code above would be: Listening for Invitations ------------------------- -To listen for group chat invitations, use a PacketExtensionFilter for the `x` +To listen for group chat invitations, use a StanzaExtensionFilter for the `x` element name and `jabber:x:conference` namespace, as in the following code example: ``` -PacketFilter filter = new PacketExtensionFilter("x", "jabber:x:conference"); +StanzaFilter filter = new StanzaExtensionFilter("x", "jabber:x:conference"); // Create a packet collector or packet listeners using the filter... ``` diff --git a/documentation/extensions/properties.md b/documentation/extensions/properties.md index 9a8e5d9a8..b4a54e281 100644 --- a/documentation/extensions/properties.md +++ b/documentation/extensions/properties.md @@ -1,4 +1,4 @@ -Packet Properties +Stanza Properties ================= Smack provides an easy mechanism for attaching arbitrary properties to @@ -20,7 +20,7 @@ jpe.setProperty("favoriteColor", new Color(0, 0, 255)); // Add an int as a property._ jpe.setProperty("favoriteNumber", 4); // Add the JivePropertiesExtension to the message packet_ -message.addPacketExtension(jpe); +message.addStanzaExtension(jpe); chat.sendMessage(message); ``` @@ -39,8 +39,8 @@ int favoriteNumber = ((Integer)jpe.getProperty("favoriteNumber")).intValue(); ``` For convenience `JivePropertiesManager` contains two helper methods namely -`addProperty(Packet packet, String name, Object value)` and -`getProperty(Packet packet, String name)`. +`addProperty(Stanza packet, String name, Object value)` and +`getProperty(Stanza packet, String name)`. Objects as Properties --------------------- diff --git a/documentation/extensions/xhtml.md b/documentation/extensions/xhtml.md index d24ef791b..d98fd5063 100644 --- a/documentation/extensions/xhtml.md +++ b/documentation/extensions/xhtml.md @@ -98,7 +98,7 @@ done. The last step is to send the message as you do with any other message. An XHTML message is like any regular message, therefore to send the message you can follow the usual steps you do in order to send a message. For example, to send a message as part of a chat just use the message **#send(Message)** of -_**Chat**_ or you can use the message **#send(Packet)** of +_**Chat**_ or you can use the message **#send(Stanza)** of _**XMPPConnection**_. **Example** @@ -143,7 +143,7 @@ XHTML bodies of any received message. ``` // Create a listener for the chat and display any XHTML content PacketListener packetListener = new PacketListener() { -public void processPacket(Packet packet) { +public void processPacket(Stanza packet) { Message message = (Message) packet; // Obtain the XHTML bodies of the message List bodies = XHTMLManager.getBodies(message); diff --git a/documentation/gettingstarted.md b/documentation/gettingstarted.md index e019064ed..d9ad4d84b 100644 --- a/documentation/gettingstarted.md +++ b/documentation/gettingstarted.md @@ -83,7 +83,7 @@ Retrieve the roster using the `Roster.getInstanceFor(XMPPConnection)` method. Th class allows you to find all the roster entries, the groups they belong to, and the current presence status of each entry. -Reading and Writing Packets +Reading and Writing Stanzas Each message to the XMPP server from a client is called a packet and is sent as XML. The `org.jivesoftware.smack.packet` package contains classes that @@ -102,7 +102,7 @@ con.sendPacket(presence); ``` Smack provides two ways to read incoming packets: `PacketListener`, and -`PacketCollector`. Both use `PacketFilter` instances to determine which +`PacketCollector`. Both use `StanzaFilter` instances to determine which packets should be processed. A packet listener is used for event style programming, while a packet collector has a result queue of packets that you can do polling and blocking operations on. So, a packet listener is useful diff --git a/documentation/index.md b/documentation/index.md index 385563d9f..c390866ea 100644 --- a/documentation/index.md +++ b/documentation/index.md @@ -7,7 +7,7 @@ * [Managing Connections](connections.html) * [Messaging Basics](messaging.html) * [Roster and Presence](roster.html) - * [Processing Incoming Packets](processing.html) + * [Processing Incoming Stanzas](processing.html) * [Provider Architecture](providers.html) * [Debugging with Smack](debugging.html) diff --git a/documentation/processing.md b/documentation/processing.md index 6d3b41c7e..5c7e387e5 100644 --- a/documentation/processing.md +++ b/documentation/processing.md @@ -1,4 +1,4 @@ -Processing Incoming Packets +Processing Incoming Stanzas =========================== [Back](index.html) @@ -9,7 +9,7 @@ constructs: * `org.jivesoftware.smack.PacketCollector` -- a class that lets you synchronously wait for new packets. * `org.jivesoftware.smack.PacketListener` -- an interface for asynchronously notifying you of incoming packets. A packet listener is used for event style programming, while a packet collector has a result queue of packets that you can do polling and blocking operations on. So, a packet listener is useful when you want to take some action whenever a packet happens to come in, while a packet collector is useful when you want to wait for a specific packet to arrive. Packet collectors and listeners can be created using an `XMPPConnection` instance. -The `org.jivesoftware.smack.filter.PacketFilter` interface determines which +The `org.jivesoftware.smack.filter.StanzaFilter` interface determines which specific packets will be delivered to a `PacketCollector` or `PacketListener`. Many pre-defined filters can be found in the `org.jivesoftware.smack.filter` package. @@ -20,7 +20,7 @@ and a packet listener: ``` // Create a packet filter to listen for new messages from a particular // user. We use an AndFilter to combine two other filters._ -PacketFilter filter = new AndFilter(new PacketTypeFilter(Message.class), +StanzaFilter filter = new AndFilter(new StanzaTypeFilter(Message.class), new FromContainsFilter("mary@jivesoftware.com")); // Assume we've created an XMPPConnection name "connection". @@ -38,19 +38,19 @@ PacketListener myListener = new PacketListener() { connection.addPacketListener(myListener, filter); ``` -Standard Packet Filters +Standard Stanza Filters ----------------------- A rich set of packet filters are included with Smack, or you can create your -own filters by coding to the `PacketFilter` interface. The default set of +own filters by coding to the `StanzaFilter` interface. The default set of filters includes: - * `PacketTypeFilter` -- filters for packets that are a particular Class type. + * `StanzaTypeFilter` -- filters for packets that are a particular Class type. * `StanzaIdFilter` -- filters for packets with a particular packet ID. * `ThreadFilter` -- filters for message packets with a particular thread ID. * `ToContainsFilter` -- filters for packets that are sent to a particular address. * `FromContainsFilter` -- filters for packets that are sent to a particular address. - * `PacketExtensionFilter` -- filters for packets that have a particular packet extension. + * `StanzaExtensionFilter` -- filters for packets that have a particular packet extension. * `AndFilter` -- implements the logical AND operation over two filters. * `OrFilter` -- implements the logical OR operation over two filters. * `NotFilter` -- implements the logical NOT operation on a filter. diff --git a/documentation/providers.md b/documentation/providers.md index a37c7be0c..e1356319a 100644 --- a/documentation/providers.md +++ b/documentation/providers.md @@ -1,4 +1,4 @@ -Provider Architecture: Packet Extensions and Custom IQ's +Provider Architecture: Stanza Extensions and Custom IQ's ======================================================== [Back](index.html) @@ -73,7 +73,7 @@ an XMPP time packet resembles the following: ### Introspection -_Time Packet_ +_Time Stanza_ @@ -190,7 +190,7 @@ public class MyIQProvider extends IQProvider { ### DiscoItemsProvider -_Disco Items Packet_ +_Disco Items Stanza_ @@ -264,11 +264,11 @@ _Disco Items IQProvider_ Extension Providers ------------------- -Packet extension providers are responsible for parsing packet extensions, +Stanza extension providers are responsible for parsing packet extensions, which are child elements in a custom namespace of IQ, message and presence packets. -_Pubsub Subscription Packet_ +_Pubsub Subscription Stanza_ diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/IQTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/IQTest.java index bd4aa6e8f..49184a875 100644 --- a/smack-core/src/integration-test/java/org/jivesoftware/smack/IQTest.java +++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/IQTest.java @@ -20,7 +20,7 @@ package org.jivesoftware.smack; import org.jivesoftware.smack.filter.AndFilter; import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.filter.PacketIDFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.test.SmackTestCase; import org.jivesoftware.smackx.packet.Version; @@ -51,7 +51,7 @@ public class IQTest extends SmackTestCase { }; PacketFilter filter = new AndFilter(new PacketIDFilter(iq.getStanzaId()), - new PacketTypeFilter(IQ.class)); + new StanzaTypeFilter(IQ.class)); PacketCollector collector = getConnection(0).createPacketCollector(filter); // Send the iq packet with an invalid namespace getConnection(0).sendPacket(iq); diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/PacketReaderTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/PacketReaderTest.java index c6f4f8775..aa5d345eb 100644 --- a/smack-core/src/integration-test/java/org/jivesoftware/smack/PacketReaderTest.java +++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/PacketReaderTest.java @@ -19,7 +19,7 @@ package org.jivesoftware.smack; import org.jivesoftware.smack.filter.FromMatchesFilter; import org.jivesoftware.smack.filter.PacketIDFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.packet.*; import org.jivesoftware.smack.test.SmackTestCase; @@ -143,7 +143,7 @@ public class PacketReaderTest extends SmackTestCase { message.setBody("HELLO"); getConnection(1).sendPacket(message); } - }, new PacketTypeFilter(Message.class)); + }, new StanzaTypeFilter(Message.class)); // User0 listen for replies from user1 PacketCollector collector = getConnection(0).createPacketCollector( diff --git a/smack-core/src/integration-test/java/org/jivesoftware/smack/filter/PacketTypeFilterTest.java b/smack-core/src/integration-test/java/org/jivesoftware/smack/filter/PacketTypeFilterTest.java index 18898b136..3a2261b03 100644 --- a/smack-core/src/integration-test/java/org/jivesoftware/smack/filter/PacketTypeFilterTest.java +++ b/smack-core/src/integration-test/java/org/jivesoftware/smack/filter/PacketTypeFilterTest.java @@ -21,9 +21,9 @@ import junit.framework.TestCase; import org.jivesoftware.smack.packet.*; /** - * Test cases for the PacketTypeFilter class. + * Test cases for the StanzaTypeFilter class. */ -public class PacketTypeFilterTest extends TestCase { +public class StanzaTypeFilterTest extends TestCase { private class InnerClassDummy { public class DummyPacket extends Packet { @@ -48,20 +48,20 @@ public class PacketTypeFilterTest extends TestCase { } /** - * Test case for the constructor of PacketTypeFilter objects. + * Test case for the constructor of StanzaTypeFilter objects. */ public void testConstructor() { - // We dont need to test this since PacketTypeFilter(Class packetType) only excepts Packets + // We dont need to test this since StanzaTypeFilter(Class packetType) only excepts Packets // Test a class that is not a subclass of Packet // try { - // new PacketTypeFilter(Dummy.class); + // new StanzaTypeFilter(Dummy.class); // fail("Parameter must be a subclass of Packet."); // } // catch (IllegalArgumentException e) {} // Test a class that is a subclass of Packet try { - new PacketTypeFilter(MockPacket.class); + new StanzaTypeFilter(MockPacket.class); } catch (IllegalArgumentException e) { fail(); @@ -69,7 +69,7 @@ public class PacketTypeFilterTest extends TestCase { // Test another class which is a subclass of Packet try { - new PacketTypeFilter(IQ.class); + new StanzaTypeFilter(IQ.class); } catch (IllegalArgumentException e) { fail(); @@ -77,7 +77,7 @@ public class PacketTypeFilterTest extends TestCase { // Test an internal class which is a subclass of Packet try { - new PacketTypeFilter(InnerClassDummy.DummyPacket.class); + new StanzaTypeFilter(InnerClassDummy.DummyPacket.class); } catch (IllegalArgumentException e) { fail(); @@ -85,7 +85,7 @@ public class PacketTypeFilterTest extends TestCase { // Test an internal static class which is a static subclass of Packet try { - new PacketTypeFilter(StaticInnerClassDummy.StaticDummyPacket.class); + new StanzaTypeFilter(StaticInnerClassDummy.StaticDummyPacket.class); } catch (IllegalArgumentException e) { fail(); @@ -93,19 +93,19 @@ public class PacketTypeFilterTest extends TestCase { } /** - * Test case to test the accept() method of PacketTypeFilter objects. + * Test case to test the accept() method of StanzaTypeFilter objects. */ public void testAccept() { Packet packet = new MockPacket(); - PacketTypeFilter filter = new PacketTypeFilter(MockPacket.class); + StanzaTypeFilter filter = new PacketTypeFilter(MockPacket.class); assertTrue(filter.accept(packet)); packet = (new InnerClassDummy()).getInnerInstance(); - filter = new PacketTypeFilter(InnerClassDummy.DummyPacket.class); + filter = new StanzaTypeFilter(InnerClassDummy.DummyPacket.class); assertTrue(filter.accept(packet)); packet = StaticInnerClassDummy.getInnerInstance(); - filter = new PacketTypeFilter(StaticInnerClassDummy.StaticDummyPacket.class); + filter = new StanzaTypeFilter(StaticInnerClassDummy.StaticDummyPacket.class); assertTrue(filter.accept(packet)); } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java index c7d77c850..3343291bd 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java @@ -56,7 +56,7 @@ import org.jivesoftware.smack.compress.packet.Compress; import org.jivesoftware.smack.compression.XMPPInputOutputStream; import org.jivesoftware.smack.debugger.SmackDebugger; import org.jivesoftware.smack.filter.IQReplyFilter; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.filter.StanzaIdFilter; import org.jivesoftware.smack.iqrequest.IQRequestHandler; import org.jivesoftware.smack.packet.Bind; @@ -64,7 +64,7 @@ import org.jivesoftware.smack.packet.ErrorIQ; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Mechanisms; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.packet.Session; import org.jivesoftware.smack.packet.StartTls; @@ -72,7 +72,7 @@ import org.jivesoftware.smack.packet.PlainStreamElement; import org.jivesoftware.smack.packet.XMPPError; import org.jivesoftware.smack.parsing.ParsingExceptionCallback; import org.jivesoftware.smack.parsing.UnparsablePacket; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ProviderManager; import org.jivesoftware.smack.util.DNSUtil; import org.jivesoftware.smack.util.Objects; @@ -154,7 +154,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { protected final Lock connectionLock = new ReentrantLock(); - protected final Map streamFeatures = new HashMap(); + protected final Map streamFeatures = new HashMap(); /** * The full JID of the authenticated user, as returned by the resource binding response of the server. @@ -716,14 +716,14 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { @Override public PacketCollector createPacketCollectorAndSend(IQ packet) throws NotConnectedException { - PacketFilter packetFilter = new IQReplyFilter(packet, this); + StanzaFilter packetFilter = new IQReplyFilter(packet, this); // Create the packet collector before sending the packet PacketCollector packetCollector = createPacketCollectorAndSend(packetFilter, packet); return packetCollector; } @Override - public PacketCollector createPacketCollectorAndSend(PacketFilter packetFilter, Stanza packet) + public PacketCollector createPacketCollectorAndSend(StanzaFilter packetFilter, Stanza packet) throws NotConnectedException { // Create the packet collector before sending the packet PacketCollector packetCollector = createPacketCollector(packetFilter); @@ -739,8 +739,8 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { } @Override - public PacketCollector createPacketCollector(PacketFilter packetFilter) { - PacketCollector.Configuration configuration = PacketCollector.newConfiguration().setPacketFilter(packetFilter); + public PacketCollector createPacketCollector(StanzaFilter packetFilter) { + PacketCollector.Configuration configuration = PacketCollector.newConfiguration().setStanzaFilter(packetFilter); return createPacketCollector(configuration); } @@ -759,7 +759,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { @Override @Deprecated - public void addPacketListener(PacketListener packetListener, PacketFilter packetFilter) { + public void addPacketListener(PacketListener packetListener, StanzaFilter packetFilter) { addAsyncPacketListener(packetListener, packetFilter); } @@ -770,7 +770,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { } @Override - public void addSyncPacketListener(PacketListener packetListener, PacketFilter packetFilter) { + public void addSyncPacketListener(PacketListener packetListener, StanzaFilter packetFilter) { if (packetListener == null) { throw new NullPointerException("Packet listener is null."); } @@ -788,7 +788,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { } @Override - public void addAsyncPacketListener(PacketListener packetListener, PacketFilter packetFilter) { + public void addAsyncPacketListener(PacketListener packetListener, StanzaFilter packetFilter) { if (packetListener == null) { throw new NullPointerException("Packet listener is null."); } @@ -806,7 +806,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { } @Override - public void addPacketSendingListener(PacketListener packetListener, PacketFilter packetFilter) { + public void addPacketSendingListener(PacketListener packetListener, StanzaFilter packetFilter) { if (packetListener == null) { throw new NullPointerException("Packet listener is null."); } @@ -862,7 +862,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { @Override public void addPacketInterceptor(PacketListener packetInterceptor, - PacketFilter packetFilter) { + StanzaFilter packetFilter) { if (packetInterceptor == null) { throw new NullPointerException("Packet interceptor is null."); } @@ -1244,7 +1244,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { protected static class ListenerWrapper { private final PacketListener packetListener; - private final PacketFilter packetFilter; + private final StanzaFilter packetFilter; /** * Create a class which associates a packet filter with a listener. @@ -1252,7 +1252,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { * @param packetListener the packet listener. * @param packetFilter the associated filter or null if it listen for all packets. */ - public ListenerWrapper(PacketListener packetListener, PacketFilter packetFilter) { + public ListenerWrapper(PacketListener packetListener, StanzaFilter packetFilter) { this.packetListener = packetListener; this.packetFilter = packetFilter; } @@ -1272,7 +1272,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { protected static class InterceptorWrapper { private final PacketListener packetInterceptor; - private final PacketFilter packetFilter; + private final StanzaFilter packetFilter; /** * Create a class which associates a packet filter with an interceptor. @@ -1280,7 +1280,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { * @param packetInterceptor the interceptor. * @param packetFilter the associated filter or null if it intercepts all packets. */ - public InterceptorWrapper(PacketListener packetInterceptor, PacketFilter packetFilter) { + public InterceptorWrapper(PacketListener packetInterceptor, StanzaFilter packetFilter) { this.packetInterceptor = packetInterceptor; this.packetFilter = packetFilter; } @@ -1339,7 +1339,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG && parser.getDepth() == initialDepth + 1) { - PacketExtension streamFeature = null; + ExtensionElement streamFeature = null; String name = parser.getName(); String namespace = parser.getNamespace(); switch (name) { @@ -1359,7 +1359,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { streamFeature = PacketParserUtils.parseCompressionFeature(parser); break; default: - PacketExtensionProvider provider = ProviderManager.getStreamFeatureProvider(name, namespace); + ExtensionElementProvider provider = ProviderManager.getStreamFeatureProvider(name, namespace); if (provider != null) { streamFeature = provider.parse(parser); } @@ -1401,7 +1401,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { @SuppressWarnings("unchecked") @Override - public F getFeature(String element, String namespace) { + public F getFeature(String element, String namespace) { return (F) streamFeatures.get(XmppStringUtils.generateKey(element, namespace)); } @@ -1410,19 +1410,19 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { return getFeature(element, namespace) != null; } - private void addStreamFeature(PacketExtension feature) { + private void addStreamFeature(ExtensionElement feature) { String key = XmppStringUtils.generateKey(feature.getElementName(), feature.getNamespace()); streamFeatures.put(key, feature); } @Override - public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter, + public void sendStanzaWithResponseCallback(Stanza stanza, StanzaFilter replyFilter, PacketListener callback) throws NotConnectedException { sendStanzaWithResponseCallback(stanza, replyFilter, callback, null); } @Override - public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter, + public void sendStanzaWithResponseCallback(Stanza stanza, StanzaFilter replyFilter, PacketListener callback, ExceptionCallback exceptionCallback) throws NotConnectedException { sendStanzaWithResponseCallback(stanza, replyFilter, callback, exceptionCallback, @@ -1430,7 +1430,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { } @Override - public void sendStanzaWithResponseCallback(Stanza stanza, final PacketFilter replyFilter, + public void sendStanzaWithResponseCallback(Stanza stanza, final StanzaFilter replyFilter, final PacketListener callback, final ExceptionCallback exceptionCallback, long timeout) throws NotConnectedException { Objects.requireNonNull(stanza, "stanza must not be null"); @@ -1487,12 +1487,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { public void sendIqWithResponseCallback(IQ iqRequest, final PacketListener callback, final ExceptionCallback exceptionCallback, long timeout) throws NotConnectedException { - PacketFilter replyFilter = new IQReplyFilter(iqRequest, this); + StanzaFilter replyFilter = new IQReplyFilter(iqRequest, this); sendStanzaWithResponseCallback(iqRequest, replyFilter, callback, exceptionCallback, timeout); } @Override - public void addOneTimeSyncCallback(final PacketListener callback, final PacketFilter packetFilter) { + public void addOneTimeSyncCallback(final PacketListener callback, final StanzaFilter packetFilter) { final PacketListener packetListener = new PacketListener() { @Override public void processPacket(Stanza packet) throws NotConnectedException { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java b/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java index 49ce54f64..83d81bd6d 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/PacketCollector.java @@ -24,7 +24,7 @@ import java.util.logging.Logger; import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.XMPPException.XMPPErrorException; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.Stanza; /** @@ -38,14 +38,14 @@ import org.jivesoftware.smack.packet.Stanza; * older packets are automatically dropped. The default number is retrieved by * {@link SmackConfiguration#getPacketCollectorSize()}. * - * @see XMPPConnection#createPacketCollector(PacketFilter) + * @see XMPPConnection#createPacketCollector(StanzaFilter) * @author Matt Tucker */ public class PacketCollector { private static final Logger LOGGER = Logger.getLogger(PacketCollector.class.getName()); - private final PacketFilter packetFilter; + private final StanzaFilter packetFilter; private final ArrayBlockingQueue resultQueue; /** @@ -89,11 +89,23 @@ public class PacketCollector { * filter is used to determine what packets are queued as results. * * @return the packet filter. + * @deprecated use {@link #getStanzaFilter()} instead. */ - public PacketFilter getPacketFilter() { - return packetFilter; + @Deprecated + public StanzaFilter getPacketFilter() { + return getStanzaFilter(); } + /** + * Returns the stanza filter associated with this stanza collector. The stanza + * filter is used to determine what stanzas are queued as results. + * + * @return the stanza filter. + */ + public StanzaFilter getStanzaFilter() { + return packetFilter; + } + /** * Polls to see if a packet is currently available and returns it, or * immediately returns null if no packets are currently in the @@ -266,7 +278,7 @@ public class PacketCollector { } public static class Configuration { - private PacketFilter packetFilter; + private StanzaFilter packetFilter; private int size = SmackConfiguration.getPacketCollectorSize(); private PacketCollector collectorToReset; @@ -279,9 +291,22 @@ public class PacketCollector { * * @param packetFilter * @return a reference to this configuration. + * @deprecated use {@link #setStanzaFilter(StanzaFilter)} instead. */ - public Configuration setPacketFilter(PacketFilter packetFilter) { - this.packetFilter = packetFilter; + @Deprecated + public Configuration setPacketFilter(StanzaFilter packetFilter) { + return setStanzaFilter(packetFilter); + } + + /** + * Set the stanza filter used by this collector. If null, then all stanzas will + * get collected by this collector. + * + * @param stanzaFilter + * @return a reference to this configuration. + */ + public Configuration setStanzaFilter(StanzaFilter stanzaFilter) { + this.packetFilter = stanzaFilter; return this; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/PacketListener.java b/smack-core/src/main/java/org/jivesoftware/smack/PacketListener.java index 56d6b93e2..fbe392883 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/PacketListener.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/PacketListener.java @@ -30,10 +30,10 @@ import org.jivesoftware.smack.packet.Stanza; * Additionally you are able to intercept Packets that are going to be send and * make modifications to them. You can register a PacketListener as interceptor * by using {@link XMPPConnection#addPacketInterceptor(PacketListener, - * org.jivesoftware.smack.filter.PacketFilter)} + * org.jivesoftware.smack.filter.StanzaFilter)} *

* - * @see XMPPConnection#addAsyncPacketListener(PacketListener, org.jivesoftware.smack.filter.PacketFilter) + * @see XMPPConnection#addAsyncPacketListener(PacketListener, org.jivesoftware.smack.filter.StanzaFilter) * @author Matt Tucker */ public interface PacketListener { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/SmackException.java b/smack-core/src/main/java/org/jivesoftware/smack/SmackException.java index 789f6a0ff..261a46807 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/SmackException.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/SmackException.java @@ -19,7 +19,7 @@ package org.jivesoftware.smack; import java.util.ArrayList; import java.util.List; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.util.dns.HostAddress; /** @@ -65,9 +65,9 @@ public class SmackException extends Exception { */ private static final long serialVersionUID = -6523363748984543636L; - private final PacketFilter filter; + private final StanzaFilter filter; - private NoResponseException(String message, PacketFilter filter) { + private NoResponseException(String message, StanzaFilter filter) { super(message); this.filter = filter; } @@ -77,20 +77,20 @@ public class SmackException extends Exception { * * @return the used filter or null. */ - public PacketFilter getFilter() { + public StanzaFilter getFilter() { return filter; } public static NoResponseException newWith(XMPPConnection connection) { - return newWith(connection, (PacketFilter) null); + return newWith(connection, (StanzaFilter) null); } public static NoResponseException newWith(XMPPConnection connection, PacketCollector collector) { - return newWith(connection, collector.getPacketFilter()); + return newWith(connection, collector.getStanzaFilter()); } - public static NoResponseException newWith(XMPPConnection connection, PacketFilter filter) { + public static NoResponseException newWith(XMPPConnection connection, StanzaFilter filter) { final long replyTimeout = connection.getPacketReplyTimeout(); final StringBuilder sb = new StringBuilder(256); sb.append("No response received within reply timeout. Timeout was " diff --git a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java index fd93de2d1..183b9b1fc 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/XMPPConnection.java @@ -20,11 +20,11 @@ package org.jivesoftware.smack; import org.jivesoftware.smack.SmackException.NoResponseException; import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.filter.IQReplyFilter; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.iqrequest.IQRequestHandler; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.PlainStreamElement; /** @@ -211,7 +211,7 @@ public interface XMPPConnection { * @param packet the packet to send right after the collector got created * @return a new packet collector. */ - public PacketCollector createPacketCollectorAndSend(PacketFilter packetFilter, Stanza packet) + public PacketCollector createPacketCollectorAndSend(StanzaFilter packetFilter, Stanza packet) throws NotConnectedException; /** @@ -222,7 +222,7 @@ public interface XMPPConnection { *

* Note: If you send a Packet right after using this method, then * consider using - * {@link #createPacketCollectorAndSend(PacketFilter, Stanza)} instead. + * {@link #createPacketCollectorAndSend(StanzaFilter, Stanza)} instead. * Otherwise make sure cancel the PacketCollector in every case, e.g. even * if an exception is thrown, or otherwise you may leak the PacketCollector. *

@@ -230,13 +230,13 @@ public interface XMPPConnection { * @param packetFilter the packet filter to use. * @return a new packet collector. */ - public PacketCollector createPacketCollector(PacketFilter packetFilter); + public PacketCollector createPacketCollector(StanzaFilter packetFilter); /** * Create a new packet collector with the given packet collector configuration. *

* Please make sure to cancel the collector when it is no longer required. See also - * {@link #createPacketCollector(PacketFilter)}. + * {@link #createPacketCollector(StanzaFilter)}. *

* * @param configuration the packet collector configuration. @@ -257,17 +257,17 @@ public interface XMPPConnection { *

* This method has been deprecated. It is important to differentiate between using an asynchronous packet listener * (preferred where possible) and a synchronous packet lister. Refer - * {@link #addAsyncPacketListener(PacketListener, PacketFilter)} and - * {@link #addSyncPacketListener(PacketListener, PacketFilter)} for more information. + * {@link #addAsyncPacketListener(PacketListener, StanzaFilter)} and + * {@link #addSyncPacketListener(PacketListener, StanzaFilter)} for more information. *

* * @param packetListener the packet listener to notify of new received packets. * @param packetFilter the packet filter to use. - * @deprecated use {@link #addAsyncPacketListener(PacketListener, PacketFilter)} or - * {@link #addSyncPacketListener(PacketListener, PacketFilter)}. + * @deprecated use {@link #addAsyncPacketListener(PacketListener, StanzaFilter)} or + * {@link #addSyncPacketListener(PacketListener, StanzaFilter)}. */ @Deprecated - public void addPacketListener(PacketListener packetListener, PacketFilter packetFilter); + public void addPacketListener(PacketListener packetListener, StanzaFilter packetFilter); /** * Removes a packet listener for received packets from this connection. @@ -286,17 +286,17 @@ public interface XMPPConnection { *

* Important: This packet listeners will be called in the same single thread that processes all * incoming stanzas. Only use this kind of packet filter if it does not perform any XMPP activity that waits for a - * response. Consider using {@link #addAsyncPacketListener(PacketListener, PacketFilter)} when possible, i.e. when + * response. Consider using {@link #addAsyncPacketListener(PacketListener, StanzaFilter)} when possible, i.e. when * the invocation order doesn't have to be the same as the order of the arriving packets. If the order of the * arriving packets, consider using a {@link PacketCollector} when possible. *

* * @param packetListener the packet listener to notify of new received packets. * @param packetFilter the packet filter to use. - * @see #addPacketInterceptor(PacketListener, PacketFilter) + * @see #addPacketInterceptor(PacketListener, StanzaFilter) * @since 4.1 */ - public void addSyncPacketListener(PacketListener packetListener, PacketFilter packetFilter); + public void addSyncPacketListener(PacketListener packetListener, StanzaFilter packetFilter); /** * Removes a packet listener for received packets from this connection. @@ -312,17 +312,17 @@ public interface XMPPConnection { * when an incoming packet is received. A packet filter determines which packets will be delivered to the listener. * If the same packet listener is added again with a different filter, only the new filter will be used. *

- * Unlike {@link #addAsyncPacketListener(PacketListener, PacketFilter)} packet listeners added with this method will be + * Unlike {@link #addAsyncPacketListener(PacketListener, StanzaFilter)} packet listeners added with this method will be * invoked asynchronously in their own thread. Use this method if the order of the packet listeners must not depend * on the order how the stanzas where received. *

* * @param packetListener the packet listener to notify of new received packets. * @param packetFilter the packet filter to use. - * @see #addPacketInterceptor(PacketListener, PacketFilter) + * @see #addPacketInterceptor(PacketListener, StanzaFilter) * @since 4.1 */ - public void addAsyncPacketListener(PacketListener packetListener, PacketFilter packetFilter); + public void addAsyncPacketListener(PacketListener packetListener, StanzaFilter packetFilter); /** * Removes an asynchronous packet listener for received packets from this connection. @@ -344,7 +344,7 @@ public interface XMPPConnection { * @param packetListener the packet listener to notify of sent packets. * @param packetFilter the packet filter to use. */ - public void addPacketSendingListener(PacketListener packetListener, PacketFilter packetFilter); + public void addPacketSendingListener(PacketListener packetListener, StanzaFilter packetFilter); /** * Removes a packet listener for sending packets from this connection. @@ -360,12 +360,12 @@ public interface XMPPConnection { * will be delivered to the interceptor. * *

- * NOTE: For a similar functionality on incoming packets, see {@link #addAsyncPacketListener(PacketListener, PacketFilter)}. + * NOTE: For a similar functionality on incoming packets, see {@link #addAsyncPacketListener(PacketListener, StanzaFilter)}. * * @param packetInterceptor the packet interceptor to notify of packets about to be sent. * @param packetFilter the packet filter to use. */ - public void addPacketInterceptor(PacketListener packetInterceptor, PacketFilter packetFilter); + public void addPacketInterceptor(PacketListener packetInterceptor, StanzaFilter packetFilter); /** * Removes a packet interceptor. @@ -439,7 +439,7 @@ public interface XMPPConnection { * @param namespace * @return a packet extensions of the feature or null */ - public F getFeature(String element, String namespace); + public F getFeature(String element, String namespace); /** * Return true if the server supports the given stream feature. @@ -463,7 +463,7 @@ public interface XMPPConnection { * @param callback the callback invoked if there is a response (required) * @throws NotConnectedException */ - public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter, + public void sendStanzaWithResponseCallback(Stanza stanza, StanzaFilter replyFilter, PacketListener callback) throws NotConnectedException; /** @@ -480,7 +480,7 @@ public interface XMPPConnection { * @param exceptionCallback the callback invoked if there is an exception (optional) * @throws NotConnectedException */ - public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter, PacketListener callback, + public void sendStanzaWithResponseCallback(Stanza stanza, StanzaFilter replyFilter, PacketListener callback, ExceptionCallback exceptionCallback) throws NotConnectedException; /** @@ -498,7 +498,7 @@ public interface XMPPConnection { * @param timeout the timeout in milliseconds to wait for a response * @throws NotConnectedException */ - public void sendStanzaWithResponseCallback(Stanza stanza, PacketFilter replyFilter, + public void sendStanzaWithResponseCallback(Stanza stanza, StanzaFilter replyFilter, final PacketListener callback, final ExceptionCallback exceptionCallback, long timeout) throws NotConnectedException; @@ -554,7 +554,7 @@ public interface XMPPConnection { * @param callback the callback invoked once the packet filter matches a stanza. * @param packetFilter the filter to match stanzas or null to match all. */ - public void addOneTimeSyncCallback(PacketListener callback, PacketFilter packetFilter); + public void addOneTimeSyncCallback(PacketListener callback, StanzaFilter packetFilter); /** * Register an IQ request handler with this connection. diff --git a/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Compress.java b/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Compress.java index bb2ccd68c..c9a041a33 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Compress.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/compress/packet/Compress.java @@ -20,7 +20,7 @@ import java.util.Collections; import java.util.List; import org.jivesoftware.smack.packet.FullStreamElement; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; public class Compress extends FullStreamElement { @@ -53,7 +53,7 @@ public class Compress extends FullStreamElement { return xml; } - public static class Feature implements PacketExtension { + public static class Feature implements ExtensionElement { public static final String ELEMENT = "compression"; public final List methods; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/AbstractListFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/AbstractListFilter.java index 897ae24b6..f4f7ceae3 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/AbstractListFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/AbstractListFilter.java @@ -27,18 +27,18 @@ import org.jivesoftware.smack.util.Objects; /** * */ -public abstract class AbstractListFilter implements PacketFilter { +public abstract class AbstractListFilter implements StanzaFilter { /** * The list of filters. */ - protected final List filters; + protected final List filters; /** * Creates an empty filter. */ protected AbstractListFilter() { - filters = new ArrayList(); + filters = new ArrayList(); } /** @@ -46,12 +46,12 @@ public abstract class AbstractListFilter implements PacketFilter { * * @param filters the filters to add. */ - protected AbstractListFilter(PacketFilter... filters) { + protected AbstractListFilter(StanzaFilter... filters) { Objects.requireNonNull(filters, "Parameter must not be null."); - for(PacketFilter filter : filters) { + for(StanzaFilter filter : filters) { Objects.requireNonNull(filter, "Parameter must not be null."); } - this.filters = new ArrayList(Arrays.asList(filters)); + this.filters = new ArrayList(Arrays.asList(filters)); } /** @@ -60,7 +60,7 @@ public abstract class AbstractListFilter implements PacketFilter { * * @param filter a filter to add to the filter list. */ - public void addFilter(PacketFilter filter) { + public void addFilter(StanzaFilter filter) { Objects.requireNonNull(filter, "Parameter must not be null."); filters.add(filter); } @@ -70,8 +70,8 @@ public abstract class AbstractListFilter implements PacketFilter { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(": ("); - for (Iterator it = filters.iterator(); it.hasNext();) { - PacketFilter filter = it.next(); + for (Iterator it = filters.iterator(); it.hasNext();) { + StanzaFilter filter = it.next(); sb.append(filter.toString()); if (it.hasNext()) { sb.append(", "); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/AndFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/AndFilter.java index 7006852fe..94fda8a5a 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/AndFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/AndFilter.java @@ -25,11 +25,11 @@ import org.jivesoftware.smack.packet.Stanza; * * @author Matt Tucker */ -public class AndFilter extends AbstractListFilter implements PacketFilter { +public class AndFilter extends AbstractListFilter implements StanzaFilter { /** * Creates an empty AND filter. Filters should be added using the - * {@link #addFilter(PacketFilter)} method. + * {@link #addFilter(StanzaFilter)} method. */ public AndFilter() { super(); @@ -40,12 +40,12 @@ public class AndFilter extends AbstractListFilter implements PacketFilter { * * @param filters the filters to add. */ - public AndFilter(PacketFilter... filters) { + public AndFilter(StanzaFilter... filters) { super(filters); } public boolean accept(Stanza packet) { - for (PacketFilter filter : filters) { + for (StanzaFilter filter : filters) { if (!filter.accept(packet)) { return false; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/FlexiblePacketTypeFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/FlexibleStanzaTypeFilter.java similarity index 56% rename from smack-core/src/main/java/org/jivesoftware/smack/filter/FlexiblePacketTypeFilter.java rename to smack-core/src/main/java/org/jivesoftware/smack/filter/FlexibleStanzaTypeFilter.java index 454d8caa3..c49cbc33d 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/FlexiblePacketTypeFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/FlexibleStanzaTypeFilter.java @@ -1,6 +1,6 @@ /** * - * Copyright 2014 Florian Schmaus + * Copyright 2014-2015 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,39 +23,36 @@ import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.util.Objects; /** - * Filters for packets of a particular type and allows a custom method to further filter the packets. + * Filters for stanzas of a particular type and allows a custom method to further filter the packets. * * @author Florian Schmaus */ -public abstract class FlexiblePacketTypeFilter

implements PacketFilter { +public abstract class FlexibleStanzaTypeFilter implements StanzaFilter { - protected final Class

packetType; + protected final Class stanzaType; - public FlexiblePacketTypeFilter(Class

packetType) { - this.packetType = Objects.requireNonNull(packetType, "Type must not be null"); + public FlexibleStanzaTypeFilter(Class packetType) { + this.stanzaType = Objects.requireNonNull(packetType, "Type must not be null"); } @SuppressWarnings("unchecked") - public FlexiblePacketTypeFilter() { - packetType = (Class

) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; + public FlexibleStanzaTypeFilter() { + stanzaType = (Class) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]; } @Override @SuppressWarnings("unchecked") - public boolean accept(Stanza packet) { - if (packetType.isInstance(packet)) { - return acceptSpecific((P) packet); + public final boolean accept(Stanza packet) { + if (stanzaType.isInstance(packet)) { + return acceptSpecific((S) packet); } return false; } - protected abstract boolean acceptSpecific(P packet); + protected abstract boolean acceptSpecific(S packet); @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(getClass().getSimpleName()); - sb.append(" (" + packetType.toString() + ')'); - return sb.toString(); + return getClass().getSimpleName() + ": " + stanzaType.toString(); } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java index 3b48d0f13..8bf88b7e7 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/FromMatchesFilter.java @@ -30,7 +30,7 @@ import org.jxmpp.util.XmppStringUtils; * * @author Gaston Dombiak */ -public class FromMatchesFilter implements PacketFilter { +public class FromMatchesFilter implements StanzaFilter { private final String address; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/IQReplyFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/IQReplyFilter.java index 0c3064e65..ef639b073 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/IQReplyFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/IQReplyFilter.java @@ -48,10 +48,10 @@ import org.jxmpp.util.XmppStringUtils; * @author Lars Noschinski * */ -public class IQReplyFilter implements PacketFilter { +public class IQReplyFilter implements StanzaFilter { private static final Logger LOGGER = Logger.getLogger(IQReplyFilter.class.getName()); - private final PacketFilter iqAndIdFilter; + private final StanzaFilter iqAndIdFilter; private final OrFilter fromFilter; private final String to; private final String local; @@ -98,8 +98,8 @@ public class IQReplyFilter implements PacketFilter { server = conn.getServiceName().toLowerCase(Locale.US); packetId = iqPacket.getStanzaId(); - PacketFilter iqFilter = new OrFilter(IQTypeFilter.ERROR, IQTypeFilter.RESULT); - PacketFilter idFilter = new StanzaIdFilter(iqPacket); + StanzaFilter iqFilter = new OrFilter(IQTypeFilter.ERROR, IQTypeFilter.RESULT); + StanzaFilter idFilter = new StanzaIdFilter(iqPacket); iqAndIdFilter = new AndFilter(iqFilter, idFilter); fromFilter = new OrFilter(); fromFilter.addFilter(FromMatchesFilter.createFull(to)); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/IQTypeFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/IQTypeFilter.java index dc2c38b10..a7d3aa02f 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/IQTypeFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/IQTypeFilter.java @@ -27,13 +27,13 @@ import org.jivesoftware.smack.util.Objects; * @author Alexander Wenckus * */ -public class IQTypeFilter extends FlexiblePacketTypeFilter { +public class IQTypeFilter extends FlexibleStanzaTypeFilter { - public static final PacketFilter GET = new IQTypeFilter(Type.get); - public static final PacketFilter SET = new IQTypeFilter(Type.set); - public static final PacketFilter RESULT = new IQTypeFilter(Type.result); - public static final PacketFilter ERROR = new IQTypeFilter(Type.error); - public static final PacketFilter GET_OR_SET = new OrFilter(GET, SET); + public static final StanzaFilter GET = new IQTypeFilter(Type.get); + public static final StanzaFilter SET = new IQTypeFilter(Type.set); + public static final StanzaFilter RESULT = new IQTypeFilter(Type.result); + public static final StanzaFilter ERROR = new IQTypeFilter(Type.error); + public static final StanzaFilter GET_OR_SET = new OrFilter(GET, SET); private final IQ.Type type; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/MessageTypeFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/MessageTypeFilter.java index 74df7bfed..4305a384e 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/MessageTypeFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/MessageTypeFilter.java @@ -27,15 +27,15 @@ import org.jivesoftware.smack.packet.Message.Type; * @see org.jivesoftware.smack.packet.Message.Type * @author Ward Harold */ -public class MessageTypeFilter extends FlexiblePacketTypeFilter { +public class MessageTypeFilter extends FlexibleStanzaTypeFilter { - public static final PacketFilter NORMAL = new MessageTypeFilter(Type.normal); - public static final PacketFilter CHAT = new MessageTypeFilter(Type.chat); - public static final PacketFilter GROUPCHAT = new MessageTypeFilter(Type.groupchat); - public static final PacketFilter HEADLINE = new MessageTypeFilter(Type.headline); - public static final PacketFilter ERROR = new MessageTypeFilter(Type.error); - public static final PacketFilter NORMAL_OR_CHAT = new OrFilter(NORMAL, CHAT); - public static final PacketFilter NORMAL_OR_CHAT_OR_HEADLINE = new OrFilter(NORMAL_OR_CHAT, + public static final StanzaFilter NORMAL = new MessageTypeFilter(Type.normal); + public static final StanzaFilter CHAT = new MessageTypeFilter(Type.chat); + public static final StanzaFilter GROUPCHAT = new MessageTypeFilter(Type.groupchat); + public static final StanzaFilter HEADLINE = new MessageTypeFilter(Type.headline); + public static final StanzaFilter ERROR = new MessageTypeFilter(Type.error); + public static final StanzaFilter NORMAL_OR_CHAT = new OrFilter(NORMAL, CHAT); + public static final StanzaFilter NORMAL_OR_CHAT_OR_HEADLINE = new OrFilter(NORMAL_OR_CHAT, HEADLINE); private final Message.Type type; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/MessageWithBodiesFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/MessageWithBodiesFilter.java index 201e5546d..47ab3ab52 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/MessageWithBodiesFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/MessageWithBodiesFilter.java @@ -22,9 +22,9 @@ import org.jivesoftware.smack.packet.Message; /** * Filters message stanzas which have at least one body */ -public class MessageWithBodiesFilter extends FlexiblePacketTypeFilter { +public class MessageWithBodiesFilter extends FlexibleStanzaTypeFilter { - public static final PacketFilter INSTANCE = new MessageWithBodiesFilter(); + public static final StanzaFilter INSTANCE = new MessageWithBodiesFilter(); private MessageWithBodiesFilter() { super(Message.class); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/MessageWithSubjectFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/MessageWithSubjectFilter.java index c484aa2e8..cd3106261 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/MessageWithSubjectFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/MessageWithSubjectFilter.java @@ -22,9 +22,9 @@ import org.jivesoftware.smack.packet.Message; /** * Filters message stanzas which have at least one body */ -public class MessageWithSubjectFilter extends FlexiblePacketTypeFilter { +public class MessageWithSubjectFilter extends FlexibleStanzaTypeFilter { - public static final PacketFilter INSTANCE = new MessageWithSubjectFilter(); + public static final StanzaFilter INSTANCE = new MessageWithSubjectFilter(); private MessageWithSubjectFilter() { super(Message.class); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/NotFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/NotFilter.java index 76d63ce9c..27c363e6b 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/NotFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/NotFilter.java @@ -26,16 +26,16 @@ import org.jivesoftware.smack.util.Objects; * * @author Matt Tucker */ -public class NotFilter implements PacketFilter { +public class NotFilter implements StanzaFilter { - private final PacketFilter filter; + private final StanzaFilter filter; /** * Creates a NOT filter using the specified filter. * * @param filter the filter. */ - public NotFilter(PacketFilter filter) { + public NotFilter(StanzaFilter filter) { this.filter = Objects.requireNonNull(filter, "Parameter must not be null."); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/OrFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/OrFilter.java index b1d96eeef..4d4b1cb5b 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/OrFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/OrFilter.java @@ -25,11 +25,11 @@ import org.jivesoftware.smack.packet.Stanza; * * @author Matt Tucker */ -public class OrFilter extends AbstractListFilter implements PacketFilter { +public class OrFilter extends AbstractListFilter implements StanzaFilter { /** * Creates an empty OR filter. Filters should be added using the - * {@link #addFilter(PacketFilter)} method. + * {@link #addFilter(StanzaFilter)} method. */ public OrFilter() { super(); @@ -40,13 +40,13 @@ public class OrFilter extends AbstractListFilter implements PacketFilter { * * @param filters the filters to add. */ - public OrFilter(PacketFilter... filters) { + public OrFilter(StanzaFilter... filters) { super(filters); } @Override public boolean accept(Stanza packet) { - for (PacketFilter filter : filters) { + for (StanzaFilter filter : filters) { if (filter.accept(packet)) { return true; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketExtensionFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketExtensionFilter.java index c0deb6183..71d98c718 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketExtensionFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketExtensionFilter.java @@ -18,15 +18,17 @@ package org.jivesoftware.smack.filter; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.StringUtils; /** * Filters for packets with a particular type of packet extension. * * @author Matt Tucker + * @deprecated use {@link StanzaExtensionFilter} instead. */ -public class PacketExtensionFilter implements PacketFilter { +@Deprecated +public class PacketExtensionFilter implements StanzaFilter { private final String elementName; private final String namespace; @@ -61,7 +63,7 @@ public class PacketExtensionFilter implements PacketFilter { * * @param packetExtension */ - public PacketExtensionFilter(PacketExtension packetExtension) { + public PacketExtensionFilter(ExtensionElement packetExtension) { this(packetExtension.getElementName(), packetExtension.getNamespace()); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketFilter.java index 5aecfa2a2..b910a065b 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketFilter.java @@ -17,8 +17,6 @@ package org.jivesoftware.smack.filter; -import org.jivesoftware.smack.packet.Stanza; - /** * Defines a way to filter packets for particular attributes. Packet filters are used when * constructing packet listeners or collectors -- the filter defines what packets match the criteria @@ -45,14 +43,9 @@ import org.jivesoftware.smack.packet.Stanza; * @see org.jivesoftware.smack.PacketCollector * @see org.jivesoftware.smack.PacketListener * @author Matt Tucker + * @deprecated use {@link StanzaFilter} */ -public interface PacketFilter { +@Deprecated +public interface PacketFilter extends StanzaFilter { - /** - * Tests whether or not the specified packet should pass the filter. - * - * @param packet the packet to test. - * @return true if and only if packet passes the filter. - */ - public boolean accept(Stanza packet); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketIDFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketIDFilter.java index e51d9c156..136a5e842 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketIDFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketIDFilter.java @@ -27,7 +27,7 @@ import org.jivesoftware.smack.util.StringUtils; * @deprecated use {@link StanzaIdFilter} instead. */ @Deprecated -public class PacketIDFilter implements PacketFilter { +public class PacketIDFilter implements StanzaFilter { private final String packetID; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketTypeFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketTypeFilter.java index 5a32e784c..bac9eab06 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketTypeFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/PacketTypeFilter.java @@ -31,8 +31,10 @@ import org.jivesoftware.smack.packet.Presence; * * * @author Matt Tucker + * @deprecated use {@link StanzaTypeFilter} instead. */ -public class PacketTypeFilter implements PacketFilter { +@Deprecated +public class PacketTypeFilter implements StanzaFilter { public static final PacketTypeFilter PRESENCE = new PacketTypeFilter(Presence.class); public static final PacketTypeFilter MESSAGE = new PacketTypeFilter(Message.class); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/PresenceTypeFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/PresenceTypeFilter.java index d67635609..9a5ac3888 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/PresenceTypeFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/PresenceTypeFilter.java @@ -24,7 +24,7 @@ import org.jivesoftware.smack.util.Objects; * A filter for Presence types. Returns true only if the stanza is an Presence packet and it matches the type provided in the * constructor. */ -public class PresenceTypeFilter extends FlexiblePacketTypeFilter { +public class PresenceTypeFilter extends FlexibleStanzaTypeFilter { public static final PresenceTypeFilter AVAILABLE = new PresenceTypeFilter(Type.available); public static final PresenceTypeFilter UNAVAILABLE = new PresenceTypeFilter(Type.unavailable); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaExtensionFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaExtensionFilter.java new file mode 100644 index 000000000..e8fb46d46 --- /dev/null +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaExtensionFilter.java @@ -0,0 +1,76 @@ +/** + * + * Copyright 2003-2007 Jive Software. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jivesoftware.smack.filter; + +import org.jivesoftware.smack.packet.Stanza; +import org.jivesoftware.smack.packet.ExtensionElement; +import org.jivesoftware.smack.util.StringUtils; + +/** + * Filters for stanzas with a particular type of stanza extension. + * + * @author Matt Tucker + */ +public class StanzaExtensionFilter implements StanzaFilter { + + private final String elementName; + private final String namespace; + + /** + * Creates a new stanza extension filter. Stanzas will pass the filter if + * they have a stanza extension that matches the specified element name + * and namespace. + * + * @param elementName the XML element name of the stanza extension. + * @param namespace the XML namespace of the stanza extension. + */ + public StanzaExtensionFilter(String elementName, String namespace) { + StringUtils.requireNotNullOrEmpty(namespace, "namespace must not be null or empty"); + + this.elementName = elementName; + this.namespace = namespace; + } + + /** + * Creates a new stanza extension filter. Stanzas will pass the filter if they have a stanza + * extension that matches the specified namespace. + * + * @param namespace the XML namespace of the stanza extension. + */ + public StanzaExtensionFilter(String namespace) { + this(null, namespace); + } + + /** + * Creates a new stanza extension filter for the given stanza extension. + * + * @param packetExtension + */ + public StanzaExtensionFilter(ExtensionElement packetExtension) { + this(packetExtension.getElementName(), packetExtension.getNamespace()); + } + + public boolean accept(Stanza packet) { + return packet.hasExtension(elementName, namespace); + } + + @Override + public String toString() { + return getClass().getSimpleName() + ": element=" + elementName + " namespace=" + namespace; + } +} diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaFilter.java new file mode 100644 index 000000000..77c2a9950 --- /dev/null +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaFilter.java @@ -0,0 +1,58 @@ +/** + * + * Copyright 2003-2007 Jive Software. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jivesoftware.smack.filter; + +import org.jivesoftware.smack.packet.Stanza; + +/** + * Defines a way to filter stanzas for particular attributes. Stanza filters are used when + * constructing stanza listeners or collectors -- the filter defines what stanzas match the criteria + * of the collector or listener for further stanza processing. + *

+ * Several simple filters are pre-defined. These filters can be logically combined for more complex + * stanza filtering by using the {@link org.jivesoftware.smack.filter.AndFilter AndFilter} and + * {@link org.jivesoftware.smack.filter.OrFilter OrFilter} filters. It's also possible to define + * your own filters by implementing this interface. The code example below creates a trivial filter + * for stanzas with a specific ID (real code should use {@link StanzaIdFilter} instead). + * + *

+ * // Use an anonymous inner class to define a stanza filter that returns
+ * // all stanzas that have a stanza ID of "RS145".
+ * StanzaFilter myFilter = new StanzaFilter() {
+ *     public boolean accept(Stanza stanza) {
+ *         return "RS145".equals(stanza.getStanzaId());
+ *     }
+ * };
+ * // Create a new stanza collector using the filter we created.
+ * PacketCollector myCollector = connection.createPacketCollector(myFilter);
+ * 
+ * + * @see org.jivesoftware.smack.PacketCollector + * @see org.jivesoftware.smack.PacketListener + * @author Matt Tucker + */ +public interface StanzaFilter { + + /** + * Tests whether or not the specified stanza should pass the filter. + * + * @param stanza the packet to test. + * @return true if and only if stanza passes the filter. + */ + public boolean accept(Stanza stanza); +} diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaIdFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaIdFilter.java index bf123726b..3cc9740a1 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaIdFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaIdFilter.java @@ -25,7 +25,7 @@ import org.jivesoftware.smack.util.StringUtils; * * @author Matt Tucker */ -public class StanzaIdFilter implements PacketFilter { +public class StanzaIdFilter implements StanzaFilter { private final String stanzaId; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaTypeFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaTypeFilter.java new file mode 100644 index 000000000..c3c706e39 --- /dev/null +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/StanzaTypeFilter.java @@ -0,0 +1,62 @@ +/** + * + * Copyright 2003-2007 Jive Software. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jivesoftware.smack.filter; + +import org.jivesoftware.smack.packet.Message; +import org.jivesoftware.smack.packet.Stanza; +import org.jivesoftware.smack.packet.Presence; +import org.jivesoftware.smack.packet.IQ; + +/** + * Filters for Stanzas of a particular type. The type is given as a Class object, so + * example types would: + *
    + *
  • Message.class + *
  • IQ.class + *
  • Presence.class + *
+ * + * @author Matt Tucker + */ +public final class StanzaTypeFilter implements StanzaFilter { + + public static final StanzaTypeFilter PRESENCE = new StanzaTypeFilter(Presence.class); + public static final StanzaTypeFilter MESSAGE = new StanzaTypeFilter(Message.class); + public static final StanzaTypeFilter IQ = new StanzaTypeFilter(IQ.class); + + private final Class packetType; + + /** + * Creates a new packet type filter that will filter for packets that are the + * same type as packetType. + * + * @param packetType the Class type. + */ + public StanzaTypeFilter(Class packetType) { + this.packetType = packetType; + } + + public boolean accept(Stanza packet) { + return packetType.isInstance(packet); + } + + @Override + public String toString() { + return getClass().getSimpleName() + ": " + packetType.getName(); + } +} diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/ThreadFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/ThreadFilter.java index da1c3d7dd..3cae484c8 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/ThreadFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/ThreadFilter.java @@ -25,7 +25,7 @@ import org.jivesoftware.smack.util.StringUtils; * * @author Matt Tucker */ -public class ThreadFilter extends FlexiblePacketTypeFilter implements PacketFilter { +public class ThreadFilter extends FlexibleStanzaTypeFilter implements StanzaFilter { private final String thread; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/filter/ToFilter.java b/smack-core/src/main/java/org/jivesoftware/smack/filter/ToFilter.java index a691537b2..1563771f7 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/filter/ToFilter.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/filter/ToFilter.java @@ -20,7 +20,7 @@ import java.util.Locale; import org.jivesoftware.smack.packet.Stanza; -public class ToFilter implements PacketFilter { +public class ToFilter implements StanzaFilter { private final String to; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java index cb0276d8c..f950cc81d 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/AbstractError.java @@ -28,18 +28,18 @@ public class AbstractError { private final String textNamespace; protected final Map descriptiveTexts; - private final List extensions; + private final List extensions; protected AbstractError(Map descriptiveTexts) { this(descriptiveTexts, null); } - protected AbstractError(Map descriptiveTexts, List extensions) { + protected AbstractError(Map descriptiveTexts, List extensions) { this(descriptiveTexts, null, extensions); } - protected AbstractError(Map descriptiveTexts, String textNamespace, List extensions) { + protected AbstractError(Map descriptiveTexts, String textNamespace, List extensions) { if (descriptiveTexts != null) { this.descriptiveTexts = descriptiveTexts; } else { @@ -91,7 +91,7 @@ public class AbstractError { * @param namespace the XML element namespace of the packet extension. * @return the extension, or null if it doesn't exist. */ - public PE getExtension(String elementName, String namespace) { + public PE getExtension(String elementName, String namespace) { return PacketUtil.extensionElementFrom(extensions, elementName, namespace); } @@ -104,7 +104,7 @@ public class AbstractError { xml.escape(text); xml.closeElement("text"); } - for (PacketExtension packetExtension : extensions) { + for (ExtensionElement packetExtension : extensions) { xml.append(packetExtension.toXML()); } } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Bind.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Bind.java index df59cc5f6..1a863d684 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Bind.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Bind.java @@ -68,7 +68,7 @@ public class Bind extends IQ { return xml; } - public static class Feature implements PacketExtension { + public static class Feature implements ExtensionElement { public static final Feature INSTANCE = new Feature(); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultPacketExtension.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultExtensionElement.java similarity index 92% rename from smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultPacketExtension.java rename to smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultExtensionElement.java index 45f32c0b9..dc3b64788 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultPacketExtension.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/DefaultExtensionElement.java @@ -25,7 +25,7 @@ import java.util.Map; import org.jivesoftware.smack.util.XmlStringBuilder; /** - * Default implementation of the PacketExtension interface. Unless a PacketExtensionProvider + * Default implementation of the ExtensionElement interface. Unless a ExtensionElementProvider * is registered with {@link org.jivesoftware.smack.provider.ProviderManager ProviderManager}, * instances of this class will be returned when getting packet extensions.

* @@ -42,11 +42,11 @@ import org.jivesoftware.smack.util.XmlStringBuilder; * In this case, getValue("color") would return "blue", and getValue("food") would * return "pizza". This parsing mechanism mechanism is very simplistic and will not work * as desired in all cases (for example, if some of the elements have attributes. In those - * cases, a custom PacketExtensionProvider should be used. + * cases, a custom ExtensionElementProvider should be used. * * @author Matt Tucker */ -public class DefaultPacketExtension implements PacketExtension { +public class DefaultExtensionElement implements ExtensionElement { private String elementName; private String namespace; @@ -58,7 +58,7 @@ public class DefaultPacketExtension implements PacketExtension { * @param elementName the name of the element of the XML sub-document. * @param namespace the namespace of the element. */ - public DefaultPacketExtension(String elementName, String namespace) { + public DefaultExtensionElement(String elementName, String namespace) { this.elementName = elementName; this.namespace = namespace; } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Element.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Element.java index 17b38280d..e78df0523 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Element.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Element.java @@ -18,7 +18,7 @@ package org.jivesoftware.smack.packet; /** - * Interface to represent a XML element. This is similar to {@link PacketExtension}, but does not + * Interface to represent a XML element. This is similar to {@link ExtensionElement}, but does not * carry a namespace and is usually included as child element of an packet extension. */ public interface Element { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/ExtensionElement.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/ExtensionElement.java new file mode 100644 index 000000000..0f79fbe66 --- /dev/null +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/ExtensionElement.java @@ -0,0 +1,46 @@ +/** + * + * Copyright 2003-2007 Jive Software. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.jivesoftware.smack.packet; + +/** + * Interface to represent extension elements. + *

+ * An extension element is an XML subdocument + * with a root element name and namespace. Extension elements are used to provide + * extended functionality beyond what is in the base XMPP specification. Examples of + * extensions elements include message events, message properties, and extra presence data. + * IQ stanzas have limited support for extension elements. + *

+ * This class is used primarily for extended content in XMPP Stanzas, to act as so called "extension elements". For more + * information see RFC 6120 § 8.4 Extended Content. + *

+ * + * @see DefaultExtensionElement + * @see org.jivesoftware.smack.provider.ExtensionElementProvider + * @author Matt Tucker + */ +public interface ExtensionElement extends NamedElement { + + /** + * Returns the root element XML namespace. + * + * @return the namespace. + */ + public String getNamespace(); + +} diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/FullStreamElement.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/FullStreamElement.java index f9a831732..6eaf908f3 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/FullStreamElement.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/FullStreamElement.java @@ -23,6 +23,6 @@ package org.jivesoftware.smack.packet; * * @author Florian Schmaus */ -public abstract class FullStreamElement implements PlainStreamElement, PacketExtension { +public abstract class FullStreamElement implements PlainStreamElement, ExtensionElement { } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java index 386795fc2..5e21aeb62 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/IQ.java @@ -302,7 +302,7 @@ public abstract class IQ extends Stanza { this(iq.getChildElementName(), iq.getChildElementNamespace()); } - public IQChildElementXmlStringBuilder(PacketExtension pe) { + public IQChildElementXmlStringBuilder(ExtensionElement pe) { this(pe.getElementName(), pe.getNamespace()); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Mechanisms.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Mechanisms.java index 17657f7a7..ae6a82a1a 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Mechanisms.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Mechanisms.java @@ -23,7 +23,7 @@ import java.util.List; import org.jivesoftware.smack.util.XmlStringBuilder; -public class Mechanisms implements PacketExtension { +public class Mechanisms implements ExtensionElement { public static final String ELEMENT = "mechanisms"; public static final String NAMESPACE = "urn:ietf:params:xml:ns:xmpp-sasl"; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/NamedElement.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/NamedElement.java index 6a1f52ba4..1f2571601 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/NamedElement.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/NamedElement.java @@ -18,7 +18,7 @@ package org.jivesoftware.smack.packet; /** - * Interface to represent a XML element. This is similar to {@link PacketExtension}, but does not + * Interface to represent a XML element. This is similar to {@link ExtensionElement}, but does not * carry a namespace and is usually included as child element of an packet extension. */ public interface NamedElement extends Element { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java index 55f301ed4..c0d59328b 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Packet.java @@ -132,7 +132,7 @@ public interface Packet extends TopLevelStreamElement { * * @return the packet extensions. */ - public List getExtensions(); + public List getExtensions(); /** * Return a set of all extensions with the given element name and namespace. @@ -145,7 +145,7 @@ public interface Packet extends TopLevelStreamElement { * @return a set of all matching extensions. * @since 4.1 */ - public Set getExtensions(String elementName, String namespace); + public Set getExtensions(String elementName, String namespace); /** * Returns the first extension of this packet that has the given namespace. @@ -156,7 +156,7 @@ public interface Packet extends TopLevelStreamElement { * @param namespace the namespace of the extension that is desired. * @return the packet extension with the given namespace. */ - public PacketExtension getExtension(String namespace); + public ExtensionElement getExtension(String namespace); /** * Returns the first packet extension that matches the specified element name and @@ -173,20 +173,20 @@ public interface Packet extends TopLevelStreamElement { * @param namespace the XML element namespace of the packet extension. * @return the extension, or null if it doesn't exist. */ - public PE getExtension(String elementName, String namespace); + public PE getExtension(String elementName, String namespace); /** * Adds a packet extension to the packet. Does nothing if extension is null. * * @param extension a packet extension. */ - public void addExtension(PacketExtension extension); + public void addExtension(ExtensionElement extension); /** * Adds a collection of packet extensions to the packet. Does nothing if extensions is null. * * @param extensions a collection of packet extensions */ - public void addExtensions(Collection extensions); + public void addExtensions(Collection extensions); /** * Check if a packet extension with the given element and namespace exists. @@ -215,7 +215,7 @@ public interface Packet extends TopLevelStreamElement { * @param namespace * @return the removed packet extension or null. */ - public PacketExtension removeExtension(String elementName, String namespace); + public ExtensionElement removeExtension(String elementName, String namespace); /** * Removes a packet extension from the packet. @@ -223,7 +223,7 @@ public interface Packet extends TopLevelStreamElement { * @param extension the packet extension to remove. * @return the removed packet extension or null. */ - public PacketExtension removeExtension(PacketExtension extension); + public ExtensionElement removeExtension(ExtensionElement extension); @Override // NOTE When Smack is using Java 8, then this method should be moved in Element as "Default Method". diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/PacketExtension.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/PacketExtension.java index 738c6b8e3..04108ebb5 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/PacketExtension.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/PacketExtension.java @@ -18,27 +18,24 @@ package org.jivesoftware.smack.packet; /** - * Interface to represent packet extensions. A packet extension is an XML subdocument - * with a root element name and namespace. Packet extensions are used to provide + * Interface to represent extension elements. + *

+ * An extension element is an XML subdocument + * with a root element name and namespace. Extension elements are used to provide * extended functionality beyond what is in the base XMPP specification. Examples of - * packet extensions include message events, message properties, and extra presence data. - * IQ packets cannot contain packet extensions. + * extensions elements include message events, message properties, and extra presence data. + * IQ stanzas have limited support for extension elements. *

* This class is used primarily for extended content in XMPP Stanzas, to act as so called "extension elements". For more * information see RFC 6120 § 8.4 Extended Content. *

* - * @see DefaultPacketExtension - * @see org.jivesoftware.smack.provider.PacketExtensionProvider + * @see DefaultExtensionElement + * @see org.jivesoftware.smack.provider.ExtensionElementProvider * @author Matt Tucker + * @deprecated use {@link ExtensionElement} instead. */ -public interface PacketExtension extends NamedElement { - - /** - * Returns the root element XML namespace. - * - * @return the namespace. - */ - public String getNamespace(); +@Deprecated +public interface PacketExtension extends ExtensionElement { } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Session.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Session.java index 6f7ba502f..ea74d4fdb 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Session.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Session.java @@ -42,7 +42,7 @@ public class Session extends SimpleIQ { setType(IQ.Type.set); } - public static class Feature implements PacketExtension { + public static class Feature implements ExtensionElement { public static final String OPTIONAL_ELEMENT = "optional"; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java index 790b921f5..b3319d681 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java @@ -54,7 +54,7 @@ public abstract class Stanza implements TopLevelStreamElement, Packet { protected static final String DEFAULT_LANGUAGE = java.util.Locale.getDefault().getLanguage().toLowerCase(Locale.US); - private final MultiMap packetExtensions = new MultiMap<>(); + private final MultiMap packetExtensions = new MultiMap<>(); private String id = null; private String to = null; @@ -88,7 +88,7 @@ public abstract class Stanza implements TopLevelStreamElement, Packet { error = p.error; // Copy extensions - for (PacketExtension pe : p.getExtensions()) { + for (ExtensionElement pe : p.getExtensions()) { addExtension(pe); } } @@ -234,7 +234,7 @@ public abstract class Stanza implements TopLevelStreamElement, Packet { * * @return a list of all extension elements of this stanza. */ - public List getExtensions() { + public List getExtensions() { synchronized (packetExtensions) { // No need to create a new list, values() will already create a new one for us return packetExtensions.values(); @@ -252,7 +252,7 @@ public abstract class Stanza implements TopLevelStreamElement, Packet { * @return a set of all matching extensions. * @since 4.1 */ - public Set getExtensions(String elementName, String namespace) { + public Set getExtensions(String elementName, String namespace) { requireNotNullOrEmpty(elementName, "elementName must not be null or empty"); requireNotNullOrEmpty(namespace, "namespace must not be null or empty"); String key = XmppStringUtils.generateKey(elementName, namespace); @@ -268,32 +268,32 @@ public abstract class Stanza implements TopLevelStreamElement, Packet { * @param namespace the namespace of the extension that is desired. * @return the packet extension with the given namespace. */ - public PacketExtension getExtension(String namespace) { + public ExtensionElement getExtension(String namespace) { return PacketUtil.extensionElementFrom(getExtensions(), null, namespace); } /** - * Returns the first packet extension that matches the specified element name and + * Returns the first extension that matches the specified element name and * namespace, or null if it doesn't exist. If the provided elementName is null, - * only the namespace is matched. Packet extensions are + * only the namespace is matched. Extensions are * are arbitrary XML sub-documents in standard XMPP packets. By default, a - * DefaultPacketExtension instance will be returned for each extension. However, - * PacketExtensionProvider instances can be registered with the + * {@link DefaultExtensionElement} instance will be returned for each extension. However, + * ExtensionElementProvider instances can be registered with the * {@link org.jivesoftware.smack.provider.ProviderManager ProviderManager} * class to handle custom parsing. In that case, the type of the Object * will be determined by the provider. * - * @param elementName the XML element name of the packet extension. (May be null) - * @param namespace the XML element namespace of the packet extension. + * @param elementName the XML element name of the extension. (May be null) + * @param namespace the XML element namespace of the extension. * @return the extension, or null if it doesn't exist. */ @SuppressWarnings("unchecked") - public PE getExtension(String elementName, String namespace) { + public PE getExtension(String elementName, String namespace) { if (namespace == null) { return null; } String key = XmppStringUtils.generateKey(elementName, namespace); - PacketExtension packetExtension; + ExtensionElement packetExtension; synchronized (packetExtensions) { packetExtension = packetExtensions.getFirst(key); } @@ -308,7 +308,7 @@ public abstract class Stanza implements TopLevelStreamElement, Packet { * * @param extension a packet extension. */ - public void addExtension(PacketExtension extension) { + public void addExtension(ExtensionElement extension) { if (extension == null) return; String key = XmppStringUtils.generateKey(extension.getElementName(), extension.getNamespace()); synchronized (packetExtensions) { @@ -321,9 +321,9 @@ public abstract class Stanza implements TopLevelStreamElement, Packet { * * @param extensions a collection of packet extensions */ - public void addExtensions(Collection extensions) { + public void addExtensions(Collection extensions) { if (extensions == null) return; - for (PacketExtension packetExtension : extensions) { + for (ExtensionElement packetExtension : extensions) { addExtension(packetExtension); } } @@ -356,7 +356,7 @@ public abstract class Stanza implements TopLevelStreamElement, Packet { */ public boolean hasExtension(String namespace) { synchronized (packetExtensions) { - for (PacketExtension packetExtension : packetExtensions.values()) { + for (ExtensionElement packetExtension : packetExtensions.values()) { if (packetExtension.getNamespace().equals(namespace)) { return true; } @@ -372,7 +372,7 @@ public abstract class Stanza implements TopLevelStreamElement, Packet { * @param namespace * @return the removed packet extension or null. */ - public PacketExtension removeExtension(String elementName, String namespace) { + public ExtensionElement removeExtension(String elementName, String namespace) { String key = XmppStringUtils.generateKey(elementName, namespace); synchronized (packetExtensions) { return packetExtensions.remove(key); @@ -385,7 +385,7 @@ public abstract class Stanza implements TopLevelStreamElement, Packet { * @param extension the packet extension to remove. * @return the removed packet extension or null. */ - public PacketExtension removeExtension(PacketExtension extension) { + public ExtensionElement removeExtension(ExtensionElement extension) { return removeExtension(extension.getElementName(), extension.getNamespace()); } @@ -405,7 +405,7 @@ public abstract class Stanza implements TopLevelStreamElement, Packet { protected final XmlStringBuilder getExtensionsXML() { XmlStringBuilder xml = new XmlStringBuilder(); // Add in all standard extension sub-packets. - for (PacketExtension extension : getExtensions()) { + for (ExtensionElement extension : getExtensions()) { xml.append(extension.toXML()); } return xml; diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java index b83150928..7029f923b 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/StreamError.java @@ -104,7 +104,7 @@ public class StreamError extends AbstractError implements PlainStreamElement { private final Condition condition; private final String conditionText; - public StreamError(Condition condition, String conditionText, Map descriptiveTexts, List extensions) { + public StreamError(Condition condition, String conditionText, Map descriptiveTexts, List extensions) { super(descriptiveTexts, extensions); // Some implementations may send the condition as non-empty element containing the empty string, that is // , in this case the parser may calls this constructor with the empty string diff --git a/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java b/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java index 251883127..e76bb393a 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/packet/XMPPError.java @@ -99,7 +99,7 @@ public class XMPPError extends AbstractError { this(condition, null, null, null, null, null); } - public XMPPError(Condition condition, PacketExtension applicationSpecificCondition) { + public XMPPError(Condition condition, ExtensionElement applicationSpecificCondition) { this(condition, null, null, null, null, Arrays.asList(applicationSpecificCondition)); } @@ -115,7 +115,7 @@ public class XMPPError extends AbstractError { * @param extensions list of packet extensions */ public XMPPError(Condition condition, String conditionText, String errorGenerator, Type type, Map descriptiveTexts, - List extensions) { + List extensions) { super(descriptiveTexts, NAMESPACE, extensions); this.condition = condition; // Some implementations may send the condition as non-empty element containing the empty string, that is diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/EmbeddedExtensionProvider.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/EmbeddedExtensionProvider.java index e843fd619..0ecb625b2 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/EmbeddedExtensionProvider.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/EmbeddedExtensionProvider.java @@ -23,7 +23,7 @@ import java.util.List; import java.util.Map; import org.jivesoftware.smack.SmackException; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.PacketParserUtils; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -61,7 +61,7 @@ import org.xmlpull.v1.XmlPullParserException; * ItemsProvider extends {@link EmbeddedExtensionProvider} * ItemProvider extends {@link EmbeddedExtensionProvider} * and - * AtomProvider extends {@link PacketExtensionProvider} + * AtomProvider extends {@link ExtensionElementProvider} * * These classes are then registered in the meta-inf/smack.providers file * as follows. @@ -81,7 +81,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Robin Collier */ -public abstract class EmbeddedExtensionProvider extends PacketExtensionProvider { +public abstract class EmbeddedExtensionProvider extends ExtensionElementProvider { @Override public final PE parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, @@ -95,13 +95,13 @@ public abstract class EmbeddedExtensionProvider exte attMap.put(parser.getAttributeName(i), parser.getAttributeValue(i)); } - List extensions = new ArrayList<>(); + List extensions = new ArrayList<>(); int event; do { event = parser.next(); if (event == XmlPullParser.START_TAG) - PacketParserUtils.addPacketExtension(extensions, parser); + PacketParserUtils.addExtensionElement(extensions, parser); } while (!(event == XmlPullParser.END_TAG && parser.getDepth() == initialDepth)); @@ -109,5 +109,5 @@ public abstract class EmbeddedExtensionProvider exte } protected abstract PE createReturnExtension(String currentElement, String currentNamespace, - Map attributeMap, List content); + Map attributeMap, List content); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/PacketExtensionProvider.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/ExtensionElementProvider.java similarity index 77% rename from smack-core/src/main/java/org/jivesoftware/smack/provider/PacketExtensionProvider.java rename to smack-core/src/main/java/org/jivesoftware/smack/provider/ExtensionElementProvider.java index ca14527b1..b36b3316f 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/PacketExtensionProvider.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/ExtensionElementProvider.java @@ -18,15 +18,15 @@ package org.jivesoftware.smack.provider; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; /** - * An abstract class for parsing custom packets extensions. Each PacketExtensionProvider must + * An abstract class for parsing custom extensions elements. Each ExtensionElementProvider must * be registered with the ProviderManager class for it to be used. Every implementation * of this abstract class must have a public, no-argument constructor. * * @author Matt Tucker */ -public abstract class PacketExtensionProvider extends Provider { +public abstract class ExtensionElementProvider extends Provider { } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/ExtensionProviderInfo.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/ExtensionProviderInfo.java index acc4d54b9..9605b7439 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/ExtensionProviderInfo.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/ExtensionProviderInfo.java @@ -16,7 +16,7 @@ */ package org.jivesoftware.smack.provider; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; /** * Defines the information required to register a packet extension Provider with the {@link ProviderManager} when using the @@ -28,13 +28,13 @@ import org.jivesoftware.smack.packet.PacketExtension; public final class ExtensionProviderInfo extends AbstractProviderInfo { /** - * Defines an extension provider which implements the PacketExtensionProvider interface. + * Defines an extension provider which implements the ExtensionElementProvider interface. * * @param elementName Element that provider parses. * @param namespace Namespace that provider parses. * @param extProvider The provider implementation. */ - public ExtensionProviderInfo(String elementName, String namespace, PacketExtensionProvider extProvider) { + public ExtensionProviderInfo(String elementName, String namespace, ExtensionElementProvider extProvider) { super(elementName, namespace, extProvider); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/IntrospectionProvider.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/IntrospectionProvider.java index 7d57233d0..88549db4f 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/IntrospectionProvider.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/IntrospectionProvider.java @@ -21,7 +21,7 @@ import java.lang.reflect.InvocationTargetException; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.ParserUtils; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -51,7 +51,7 @@ public class IntrospectionProvider{ } } - public static abstract class PacketExtensionIntrospectionProvider extends PacketExtensionProvider { + public static abstract class PacketExtensionIntrospectionProvider extends ExtensionElementProvider { private final Class elementClass; protected PacketExtensionIntrospectionProvider(Class elementClass) { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java index cde78857d..2090401cc 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderFileLoader.java @@ -25,12 +25,12 @@ import java.util.logging.Level; import java.util.logging.Logger; import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.xmlpull.v1.XmlPullParserFactory; import org.xmlpull.v1.XmlPullParser; /** - * Loads the {@link IQProvider} and {@link PacketExtensionProvider} information from a standard provider file in preparation + * Loads the {@link IQProvider} and {@link ExtensionElementProvider} information from a standard provider file in preparation * for loading into the {@link ProviderManager}. * * @author Robin Collier @@ -95,8 +95,8 @@ public class ProviderFileLoader implements ProviderLoader { // a PacketExtension, add the class object itself and // then we'll use reflection later to create instances // of the class. - if (PacketExtensionProvider.class.isAssignableFrom(provider)) { - extProviders.add(new ExtensionProviderInfo(elementName, namespace, (PacketExtensionProvider) provider.newInstance())); + if (ExtensionElementProvider.class.isAssignableFrom(provider)) { + extProviders.add(new ExtensionProviderInfo(elementName, namespace, (ExtensionElementProvider) provider.newInstance())); } else { exceptions.add(new IllegalArgumentException(className @@ -106,7 +106,7 @@ public class ProviderFileLoader implements ProviderLoader { case "streamFeatureProvider": sfProviders.add(new StreamFeatureProviderInfo(elementName, namespace, - (PacketExtensionProvider) provider.newInstance())); + (ExtensionElementProvider) provider.newInstance())); break; default: LOGGER.warning("Unknown provider type: " + typeName); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java index 5e22d2115..360d29f82 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/ProviderManager.java @@ -24,7 +24,7 @@ import java.util.concurrent.ConcurrentHashMap; import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.StringUtils; import org.jxmpp.util.XmppStringUtils; @@ -109,9 +109,9 @@ import org.jxmpp.util.XmppStringUtils; */ public final class ProviderManager { - private static final Map> extensionProviders = new ConcurrentHashMap>(); + private static final Map> extensionProviders = new ConcurrentHashMap>(); private static final Map> iqProviders = new ConcurrentHashMap>(); - private static final Map> streamFeatureProviders = new ConcurrentHashMap>(); + private static final Map> streamFeatureProviders = new ConcurrentHashMap>(); static { // Ensure that Smack is initialized by calling getVersion, so that user @@ -138,7 +138,7 @@ public final class ProviderManager { if (loader.getStreamFeatureProviderInfo() != null) { for (StreamFeatureProviderInfo info : loader.getStreamFeatureProviderInfo()) { addStreamFeatureProvider(info.getElementName(), info.getNamespace(), - (PacketExtensionProvider) info.getProvider()); + (ExtensionElementProvider) info.getProvider()); } } } @@ -238,7 +238,7 @@ public final class ProviderManager { * @param namespace namespace associated with extension provider. * @return the extenion provider. */ - public static PacketExtensionProvider getExtensionProvider(String elementName, String namespace) { + public static ExtensionElementProvider getExtensionProvider(String elementName, String namespace) { String key = getKey(elementName, namespace); return extensionProviders.get(key); } @@ -259,8 +259,8 @@ public final class ProviderManager { validate(elementName, namespace); // First remove existing providers String key = removeExtensionProvider(elementName, namespace); - if (provider instanceof PacketExtensionProvider) { - extensionProviders.put(key, (PacketExtensionProvider) provider); + if (provider instanceof ExtensionElementProvider) { + extensionProviders.put(key, (ExtensionElementProvider) provider); } else { throw new IllegalArgumentException("Provider must be a PacketExtensionProvider"); } @@ -288,18 +288,18 @@ public final class ProviderManager { * * @return all PacketExtensionProvider instances. */ - public static List> getExtensionProviders() { - List> providers = new ArrayList<>(extensionProviders.size()); + public static List> getExtensionProviders() { + List> providers = new ArrayList<>(extensionProviders.size()); providers.addAll(extensionProviders.values()); return providers; } - public static PacketExtensionProvider getStreamFeatureProvider(String elementName, String namespace) { + public static ExtensionElementProvider getStreamFeatureProvider(String elementName, String namespace) { String key = getKey(elementName, namespace); return streamFeatureProviders.get(key); } - public static void addStreamFeatureProvider(String elementName, String namespace, PacketExtensionProvider provider) { + public static void addStreamFeatureProvider(String elementName, String namespace, ExtensionElementProvider provider) { validate(elementName, namespace); String key = getKey(elementName, namespace); streamFeatureProviders.put(key, provider); diff --git a/smack-core/src/main/java/org/jivesoftware/smack/provider/StreamFeatureProviderInfo.java b/smack-core/src/main/java/org/jivesoftware/smack/provider/StreamFeatureProviderInfo.java index 040b98752..1e48e51f9 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/provider/StreamFeatureProviderInfo.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/provider/StreamFeatureProviderInfo.java @@ -16,7 +16,7 @@ */ package org.jivesoftware.smack.provider; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; /** * @@ -31,7 +31,7 @@ public final class StreamFeatureProviderInfo extends AbstractProviderInfo { * @param extProvider The provider implementation. */ public StreamFeatureProviderInfo(String elementName, String namespace, - PacketExtensionProvider extProvider) { + ExtensionElementProvider extProvider) { super(elementName, namespace, extProvider); } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java index 54f994609..cebc9934b 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java @@ -30,13 +30,13 @@ import java.util.logging.Logger; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.compress.packet.Compress; -import org.jivesoftware.smack.packet.DefaultPacketExtension; +import org.jivesoftware.smack.packet.DefaultExtensionElement; import org.jivesoftware.smack.packet.EmptyResultIQ; import org.jivesoftware.smack.packet.ErrorIQ; import org.jivesoftware.smack.packet.IQ; 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.Presence; import org.jivesoftware.smack.packet.Session; import org.jivesoftware.smack.packet.StartTls; @@ -44,7 +44,7 @@ import org.jivesoftware.smack.packet.StreamError; import org.jivesoftware.smack.packet.UnparsedIQ; import org.jivesoftware.smack.packet.XMPPError; import org.jivesoftware.smack.provider.IQProvider; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.provider.ProviderManager; import org.jivesoftware.smack.sasl.packet.SaslStreamElements.SASLFailure; import org.xmlpull.v1.XmlPullParser; @@ -284,7 +284,7 @@ public class PacketParserUtils { message.setError(parseError(parser)); break; default: - PacketParserUtils.addPacketExtension(message, parser, elementName, namespace); + PacketParserUtils.addExtensionElement(message, parser, elementName, namespace); break; } break; @@ -574,7 +574,7 @@ public class PacketParserUtils { // Be extra robust: Skip PacketExtensions that cause Exceptions, instead of // failing completely here. See SMACK-390 for more information. try { - PacketParserUtils.addPacketExtension(presence, parser, elementName, namespace); + PacketParserUtils.addExtensionElement(presence, parser, elementName, namespace); } catch (Exception e) { LOGGER.log(Level.WARNING, "Failed to parse extension packet in Presence packet.", e); } @@ -797,7 +797,7 @@ public class PacketParserUtils { public static StreamError parseStreamError(XmlPullParser parser) throws IOException, XmlPullParserException, SmackException { final int initialDepth = parser.getDepth(); - List extensions = new ArrayList(); + List extensions = new ArrayList(); Map descriptiveTexts = null; StreamError.Condition condition = null; String conditionText = null; @@ -824,7 +824,7 @@ public class PacketParserUtils { } break; default: - PacketParserUtils.addPacketExtension(extensions, parser, name, namespace); + PacketParserUtils.addExtensionElement(extensions, parser, name, namespace); break; } break; @@ -853,7 +853,7 @@ public class PacketParserUtils { Map descriptiveTexts = null; XMPPError.Condition condition = null; String conditionText = null; - List extensions = new ArrayList(); + List extensions = new ArrayList(); // Parse the error header XMPPError.Type errorType = XMPPError.Type.fromString(parser.getAttributeValue("", "type")); @@ -880,7 +880,7 @@ public class PacketParserUtils { } break; default: - PacketParserUtils.addPacketExtension(extensions, parser, name, namespace); + PacketParserUtils.addExtensionElement(extensions, parser, name, namespace); } break; case XmlPullParser.END_TAG: @@ -893,26 +893,36 @@ public class PacketParserUtils { } /** - * Parses a packet extension sub-packet. + * @deprecated use {@link #parseExtensionElement(String, String, XmlPullParser)} instead. + */ + @Deprecated + public static ExtensionElement parsePacketExtension(String elementName, String namespace, + XmlPullParser parser) throws XmlPullParserException, + IOException, SmackException { + return parseExtensionElement(elementName, namespace, parser); + } + + /** + * Parses an extension element. * - * @param elementName the XML element name of the packet extension. + * @param elementName the XML element name of the extension element. * @param namespace the XML namespace of the packet extension. * @param parser the XML parser, positioned at the starting element of the extension. - * @return a PacketExtension. + * @return an extension element. */ - public static PacketExtension parsePacketExtension(String elementName, String namespace, + public static ExtensionElement parseExtensionElement(String elementName, String namespace, XmlPullParser parser) throws XmlPullParserException, IOException, SmackException { ParserUtils.assertAtStartTag(parser); // See if a provider is registered to handle the extension. - PacketExtensionProvider provider = ProviderManager.getExtensionProvider(elementName, namespace); + ExtensionElementProvider provider = ProviderManager.getExtensionProvider(elementName, namespace); if (provider != null) { return provider.parse(parser); } final int initialDepth = parser.getDepth(); // No providers registered, so use a default extension. - DefaultPacketExtension extension = new DefaultPacketExtension(elementName, namespace); + DefaultExtensionElement extension = new DefaultExtensionElement(elementName, namespace); outerloop: while (true) { int eventType = parser.next(); switch (eventType) { @@ -1005,27 +1015,53 @@ public class PacketParserUtils { return null; } + @Deprecated public static void addPacketExtension(Stanza packet, XmlPullParser parser) throws XmlPullParserException, IOException, SmackException { - ParserUtils.assertAtStartTag(parser); - addPacketExtension(packet, parser, parser.getName(), parser.getNamespace()); + addExtensionElement(packet, parser); } + @Deprecated public static void addPacketExtension(Stanza packet, XmlPullParser parser, String elementName, String namespace) throws XmlPullParserException, IOException, SmackException { - PacketExtension packetExtension = parsePacketExtension(elementName, namespace, parser); + addExtensionElement(packet, parser, elementName, namespace); + } + + @Deprecated + public static void addPacketExtension(Collection collection, XmlPullParser parser) + throws XmlPullParserException, IOException, SmackException { + addExtensionElement(collection, parser, parser.getName(), parser.getNamespace()); + } + + @Deprecated + public static void addPacketExtension(Collection collection, XmlPullParser parser, + String elementName, String namespace) throws XmlPullParserException, IOException, SmackException { + addExtensionElement(collection, parser, elementName, namespace); + } + + + public static void addExtensionElement(Stanza packet, XmlPullParser parser) + throws XmlPullParserException, IOException, SmackException { + ParserUtils.assertAtStartTag(parser); + addExtensionElement(packet, parser, parser.getName(), parser.getNamespace()); + } + + public static void addExtensionElement(Stanza packet, XmlPullParser parser, String elementName, + String namespace) throws XmlPullParserException, IOException, SmackException { + ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser); packet.addExtension(packetExtension); } - public static void addPacketExtension(Collection collection, XmlPullParser parser) - throws XmlPullParserException, IOException, SmackException { - addPacketExtension(collection, parser, parser.getName(), parser.getNamespace()); + public static void addExtensionElement(Collection collection, + XmlPullParser parser) throws XmlPullParserException, IOException, + SmackException { + addExtensionElement(collection, parser, parser.getName(), parser.getNamespace()); } - public static void addPacketExtension(Collection collection, XmlPullParser parser, - String elementName, String namespace) throws XmlPullParserException, IOException, SmackException { - PacketExtension packetExtension = parsePacketExtension(elementName, namespace, parser); + public static void addExtensionElement(Collection collection, + XmlPullParser parser, String elementName, String namespace) + throws XmlPullParserException, IOException, SmackException { + ExtensionElement packetExtension = parseExtensionElement(elementName, namespace, parser); collection.add(packetExtension); } - } diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketUtil.java b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketUtil.java index 3b3b30a77..97673f74c 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/PacketUtil.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/PacketUtil.java @@ -18,7 +18,7 @@ package org.jivesoftware.smack.util; import java.util.Collection; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; public class PacketUtil { @@ -32,8 +32,8 @@ public class PacketUtil { * @deprecated use {@link #extensionElementFrom(Collection, String, String)} instead */ @Deprecated - public static PE packetExtensionfromCollection( - Collection collection, String element, + public static PE packetExtensionfromCollection( + Collection collection, String element, String namespace) { return extensionElementFrom(collection, element, namespace); } @@ -47,9 +47,9 @@ public class PacketUtil { * @return the extension element */ @SuppressWarnings("unchecked") - public static PE extensionElementFrom(Collection collection, + public static PE extensionElementFrom(Collection collection, String element, String namespace) { - for (PacketExtension packetExtension : collection) { + for (ExtensionElement packetExtension : collection) { if ((element == null || packetExtension.getElementName().equals( element)) && packetExtension.getNamespace().equals(namespace)) { diff --git a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java index 0f7ebe138..43c86325b 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/util/XmlStringBuilder.java @@ -20,7 +20,7 @@ import java.util.Collection; import org.jivesoftware.smack.packet.Element; import org.jivesoftware.smack.packet.NamedElement; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; public class XmlStringBuilder implements Appendable, CharSequence { public static final String RIGHT_ANGLE_BRACKET = Character.toString('>'); @@ -31,7 +31,7 @@ public class XmlStringBuilder implements Appendable, CharSequence { sb = new LazyStringBuilder(); } - public XmlStringBuilder(PacketExtension pe) { + public XmlStringBuilder(ExtensionElement pe) { this(); prelude(pe); } @@ -244,7 +244,7 @@ public class XmlStringBuilder implements Appendable, CharSequence { return this; } - public XmlStringBuilder prelude(PacketExtension pe) { + public XmlStringBuilder prelude(ExtensionElement pe) { return prelude(pe.getElementName(), pe.getNamespace()); } diff --git a/smack-core/src/test/java/org/jivesoftware/smack/PacketCollectorTest.java b/smack-core/src/test/java/org/jivesoftware/smack/PacketCollectorTest.java index e2e3b633b..41c0abbd5 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/PacketCollectorTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/PacketCollectorTest.java @@ -19,7 +19,7 @@ package org.jivesoftware.smack; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.Stanza; import org.junit.Test; @@ -175,7 +175,7 @@ public class PacketCollectorTest assertNull(collector.pollResult()); } - class OKEverything implements PacketFilter + class OKEverything implements StanzaFilter { @Override public boolean accept(Stanza packet) @@ -187,9 +187,9 @@ public class PacketCollectorTest class TestPacketCollector extends PacketCollector { - protected TestPacketCollector(XMPPConnection conection, PacketFilter packetFilter, int size) + protected TestPacketCollector(XMPPConnection conection, StanzaFilter packetFilter, int size) { - super(conection, PacketCollector.newConfiguration().setPacketFilter(packetFilter).setSize(size)); + super(conection, PacketCollector.newConfiguration().setStanzaFilter(packetFilter).setSize(size)); } } diff --git a/smack-core/src/test/java/org/jivesoftware/smack/packet/StreamErrorTest.java b/smack-core/src/test/java/org/jivesoftware/smack/packet/StreamErrorTest.java index 905fb773e..a596614d2 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/packet/StreamErrorTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/packet/StreamErrorTest.java @@ -99,7 +99,7 @@ public class StreamErrorTest { assertNotNull(error); assertEquals(Condition.conflict, error.getCondition()); assertEquals("Replaced by new connection", error.getDescriptiveText()); - PacketExtension appSpecificElement = error.getExtension("appSpecificElement", "myns"); + ExtensionElement appSpecificElement = error.getExtension("appSpecificElement", "myns"); assertNotNull(appSpecificElement); } diff --git a/smack-core/src/test/java/org/jivesoftware/smack/parsing/ParsingExceptionTest.java b/smack-core/src/test/java/org/jivesoftware/smack/parsing/ParsingExceptionTest.java index 9b568816b..a82f4ff58 100644 --- a/smack-core/src/test/java/org/jivesoftware/smack/parsing/ParsingExceptionTest.java +++ b/smack-core/src/test/java/org/jivesoftware/smack/parsing/ParsingExceptionTest.java @@ -20,8 +20,8 @@ import static org.junit.Assert.assertThat; import static org.jivesoftware.smack.test.util.CharsequenceEquals.equalsCharSequence; 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.test.util.TestUtils; import org.jivesoftware.smack.util.PacketParserUtils; @@ -72,12 +72,12 @@ public class ParsingExceptionTest { assertThat(MESSAGE_EXCEPTION_ELEMENT + EXTENSION2 + "
", equalsCharSequence(content)); } - static class ThrowException extends PacketExtensionProvider { + static class ThrowException extends ExtensionElementProvider { public static final String ELEMENT = "exception"; public static final String NAMESPACE = "http://smack.jivesoftware.org/exception"; @Override - public PacketExtension parse(XmlPullParser parser, int initialDepth) throws SmackException { + public ExtensionElement parse(XmlPullParser parser, int initialDepth) throws SmackException { throw new SmackException("Test Exception"); } diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/packet/CarbonExtension.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/packet/CarbonExtension.java index f890d5631..64be4a00b 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/packet/CarbonExtension.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/packet/CarbonExtension.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.carbons.packet; import org.jivesoftware.smack.packet.Message; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smackx.forward.packet.Forwarded; @@ -32,7 +32,7 @@ import org.jivesoftware.smackx.forward.packet.Forwarded; * * @author Georg Lukas */ -public class CarbonExtension implements PacketExtension { +public class CarbonExtension implements ExtensionElement { public static final String NAMESPACE = Carbon.NAMESPACE; private final Direction dir; @@ -131,7 +131,7 @@ public class CarbonExtension implements PacketExtension { * Packet extension indicating that a message may not be carbon-copied. Adding this * extension to any message will disallow that message from being copied. */ - public static class Private implements PacketExtension { + public static class Private implements ExtensionElement { public static final Private INSTANCE = new Private(); public static final String ELEMENT = "private"; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/provider/CarbonManagerProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/provider/CarbonManagerProvider.java index 2d3c86c6b..65c90ef63 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/provider/CarbonManagerProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/carbons/provider/CarbonManagerProvider.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.carbons.provider; import java.io.IOException; import org.jivesoftware.smack.SmackException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.carbons.packet.CarbonExtension; import org.jivesoftware.smackx.carbons.packet.CarbonExtension.Direction; import org.jivesoftware.smackx.forward.packet.Forwarded; @@ -28,13 +28,13 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; /** - * This class implements the {@link PacketExtensionProvider} to parse + * This class implements the {@link ExtensionElementProvider} to parse * carbon copied messages from a packet. It will return a {@link CarbonExtension} packet extension. * * @author Georg Lukas * */ -public class CarbonManagerProvider extends PacketExtensionProvider { +public class CarbonManagerProvider extends ExtensionElementProvider { private static final ForwardedProvider FORWARDED_PROVIDER = new ForwardedProvider(); diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/packet/ClientStateIndication.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/packet/ClientStateIndication.java index 790a90259..890a862c9 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/packet/ClientStateIndication.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/packet/ClientStateIndication.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.csi.packet; import org.jivesoftware.smack.packet.FullStreamElement; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; /** * @@ -73,7 +73,7 @@ public class ClientStateIndication { } } - public static class Feature implements PacketExtension { + public static class Feature implements ExtensionElement { public static final Feature INSTANCE = new Feature(); public static final String ELEMENT = "csi"; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/provider/ClientStateIndicationFeatureProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/provider/ClientStateIndicationFeatureProvider.java index c6c98eb46..95685e0af 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/provider/ClientStateIndicationFeatureProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/csi/provider/ClientStateIndicationFeatureProvider.java @@ -19,12 +19,12 @@ package org.jivesoftware.smackx.csi.provider; import java.io.IOException; import org.jivesoftware.smack.SmackException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.csi.packet.ClientStateIndication; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -public class ClientStateIndicationFeatureProvider extends PacketExtensionProvider { +public class ClientStateIndicationFeatureProvider extends ExtensionElementProvider { @Override public ClientStateIndication.Feature parse(XmlPullParser parser, int initialDepth) diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/Base64BinaryChunk.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/Base64BinaryChunk.java index 7292b98d3..b4e747ac6 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/Base64BinaryChunk.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/packet/Base64BinaryChunk.java @@ -16,7 +16,7 @@ */ package org.jivesoftware.smackx.hoxt.packet; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smackx.hoxt.HOXTManager; /** @@ -26,7 +26,7 @@ import org.jivesoftware.smackx.hoxt.HOXTManager; * @author Andriy Tsykholyas * @see XEP-0332: HTTP over XMPP transport */ -public class Base64BinaryChunk implements PacketExtension { +public class Base64BinaryChunk implements ExtensionElement { public static final String ELEMENT_CHUNK = "chunk"; public static final String ATTRIBUTE_STREAM_ID = "streamId"; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/provider/Base64BinaryChunkProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/provider/Base64BinaryChunkProvider.java index 5f160aeb7..fd6578749 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/provider/Base64BinaryChunkProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/hoxt/provider/Base64BinaryChunkProvider.java @@ -18,7 +18,7 @@ package org.jivesoftware.smackx.hoxt.provider; import java.io.IOException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.hoxt.packet.Base64BinaryChunk; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -29,7 +29,7 @@ import org.xmlpull.v1.XmlPullParserException; * @author Andriy Tsykholyas * @see XEP-0332: HTTP over XMPP transport */ -public class Base64BinaryChunkProvider extends PacketExtensionProvider { +public class Base64BinaryChunkProvider extends ExtensionElementProvider { @Override public Base64BinaryChunk parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/json/packet/AbstractJsonPacketExtension.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/json/packet/AbstractJsonPacketExtension.java index 6cbccbfb0..616c6ea4d 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/json/packet/AbstractJsonPacketExtension.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/json/packet/AbstractJsonPacketExtension.java @@ -16,10 +16,10 @@ */ package org.jivesoftware.smackx.json.packet; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; -public abstract class AbstractJsonPacketExtension implements PacketExtension { +public abstract class AbstractJsonPacketExtension implements ExtensionElement { private final String json; diff --git a/smack-experimental/src/main/java/org/jivesoftware/smackx/json/provider/AbstractJsonExtensionProvider.java b/smack-experimental/src/main/java/org/jivesoftware/smackx/json/provider/AbstractJsonExtensionProvider.java index 4e2c37d14..821557017 100644 --- a/smack-experimental/src/main/java/org/jivesoftware/smackx/json/provider/AbstractJsonExtensionProvider.java +++ b/smack-experimental/src/main/java/org/jivesoftware/smackx/json/provider/AbstractJsonExtensionProvider.java @@ -19,13 +19,13 @@ package org.jivesoftware.smackx.json.provider; import java.io.IOException; import org.jivesoftware.smack.SmackException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smackx.json.packet.AbstractJsonPacketExtension; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -public abstract class AbstractJsonExtensionProvider extends PacketExtensionProvider { +public abstract class AbstractJsonExtensionProvider extends ExtensionElementProvider { @Override public AbstractJsonPacketExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, diff --git a/smack-experimental/src/test/java/org/jivesoftware/smackx/hoxt/provider/Base64BinaryChunkProviderTest.java b/smack-experimental/src/test/java/org/jivesoftware/smackx/hoxt/provider/Base64BinaryChunkProviderTest.java index a96bcca5b..a4b00dd23 100644 --- a/smack-experimental/src/test/java/org/jivesoftware/smackx/hoxt/provider/Base64BinaryChunkProviderTest.java +++ b/smack-experimental/src/test/java/org/jivesoftware/smackx/hoxt/provider/Base64BinaryChunkProviderTest.java @@ -20,7 +20,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smackx.hoxt.packet.Base64BinaryChunk; import org.junit.Test; @@ -39,7 +39,7 @@ public class Base64BinaryChunkProviderTest { Base64BinaryChunkProvider provider = new Base64BinaryChunkProvider(); XmlPullParser parser = PacketParserUtils.getParserFor(string); - PacketExtension extension = provider.parse(parser); + ExtensionElement extension = provider.parse(parser); assertTrue(extension instanceof Base64BinaryChunk); Base64BinaryChunk chunk = (Base64BinaryChunk) extension; @@ -57,7 +57,7 @@ public class Base64BinaryChunkProviderTest { Base64BinaryChunkProvider provider = new Base64BinaryChunkProvider(); XmlPullParser parser = PacketParserUtils.getParserFor(string); - PacketExtension extension = provider.parse(parser); + ExtensionElement extension = provider.parse(parser); assertTrue(extension instanceof Base64BinaryChunk); Base64BinaryChunk chunk = (Base64BinaryChunk) extension; diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/GroupChatInvitationTest.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/GroupChatInvitationTest.java index 991650801..89f48278c 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/GroupChatInvitationTest.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/GroupChatInvitationTest.java @@ -21,7 +21,7 @@ import org.jivesoftware.smack.*; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.test.SmackTestCase; import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.filter.PacketExtensionFilter; +import org.jivesoftware.smack.filter.StanzaExtensionFilter; /** * @@ -67,7 +67,7 @@ public class GroupChatInvitationTest extends SmackTestCase { protected void setUp() throws Exception { super.setUp(); // Register listener for groupchat invitations. - PacketFilter filter = new PacketExtensionFilter("x", "jabber:x:conference"); + PacketFilter filter = new StanzaExtensionFilter("x", "jabber:x:conference"); collector = getConnection(1).createPacketCollector(filter); } diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/entitycaps/EntityCapsTest.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/entitycaps/EntityCapsTest.java index 94115dbce..4439062c5 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/entitycaps/EntityCapsTest.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/entitycaps/EntityCapsTest.java @@ -5,7 +5,7 @@ import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.TCPConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.filter.AndFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.filter.IQTypeFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Packet; @@ -90,7 +90,7 @@ public class EntityCapsTest extends SmackTestCase { discoInfoSend = true; } - }, new AndFilter(new PacketTypeFilter(DiscoverInfo.class), new IQTypeFilter(IQ.Type.get))); + }, new AndFilter(new StanzaTypeFilter(DiscoverInfo.class), new IQTypeFilter(IQ.Type.get))); // add a bogus feature so that con1 ver won't match con0's sdm1.addFeature(DISCOVER_TEST_FEATURE); diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/packet/MessageEventTest.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/packet/MessageEventTest.java index 4006051e6..57f180ae9 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/packet/MessageEventTest.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/packet/MessageEventTest.java @@ -83,7 +83,7 @@ public class MessageEventTest extends SmackTestCase { // Create a Listener that listens for Messages with the extension "jabber:x:roster" // This listener will listen on the conn2 and answer an ACK if everything is ok - PacketFilter packetFilter = new PacketExtensionFilter("x", "jabber:x:event"); + PacketFilter packetFilter = new StanzaExtensionFilter("x", "jabber:x:event"); PacketListener packetListener = new PacketListener() { public void processPacket(Packet packet) { Message message = (Message) packet; diff --git a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/packet/XHTMLExtensionTest.java b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/packet/XHTMLExtensionTest.java index a301bb131..4054e3cc5 100644 --- a/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/packet/XHTMLExtensionTest.java +++ b/smack-extensions/src/integration-test/java/org/jivesoftware/smackx/packet/XHTMLExtensionTest.java @@ -22,7 +22,7 @@ import java.util.Iterator; import org.jivesoftware.smack.Chat; import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.PacketListener; -import org.jivesoftware.smack.filter.PacketExtensionFilter; +import org.jivesoftware.smack.filter.StanzaExtensionFilter; import org.jivesoftware.smack.filter.PacketFilter; import org.jivesoftware.smack.filter.ThreadFilter; import org.jivesoftware.smack.packet.Message; @@ -143,7 +143,7 @@ public class XHTMLExtensionTest extends SmackTestCase { //"http://jabber.org/protocol/xhtml-im" // This listener will listen on the conn2 and answer an ACK if everything is ok PacketFilter packetFilter = - new PacketExtensionFilter("html", "http://jabber.org/protocol/xhtml-im"); + new StanzaExtensionFilter("html", "http://jabber.org/protocol/xhtml-im"); PacketListener packetListener = new PacketListener() { @Override public void processPacket(Packet packet) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/address/packet/MultipleAddresses.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/address/packet/MultipleAddresses.java index 18b1d4265..9fe631d5d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/address/packet/MultipleAddresses.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/address/packet/MultipleAddresses.java @@ -18,7 +18,7 @@ package org.jivesoftware.smackx.address.packet; import org.jivesoftware.smack.packet.NamedElement; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; import java.util.ArrayList; @@ -29,7 +29,7 @@ import java.util.List; * * @author Gaston Dombiak */ -public class MultipleAddresses implements PacketExtension { +public class MultipleAddresses implements ExtensionElement { public static final String NAMESPACE = "http://jabber.org/protocol/address"; public static final String ELEMENT = "addresses"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/address/provider/MultipleAddressesProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/address/provider/MultipleAddressesProvider.java index 77e3d6313..352ca10a1 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/address/provider/MultipleAddressesProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/address/provider/MultipleAddressesProvider.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.address.provider; import java.io.IOException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.address.packet.MultipleAddresses; import org.jivesoftware.smackx.address.packet.MultipleAddresses.Type; import org.xmlpull.v1.XmlPullParser; @@ -30,7 +30,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Gaston Dombiak */ -public class MultipleAddressesProvider extends PacketExtensionProvider { +public class MultipleAddressesProvider extends ExtensionElementProvider { @Override public MultipleAddresses parse(XmlPullParser parser, diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/packet/AMPExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/packet/AMPExtension.java index 44dddd566..55f803896 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/packet/AMPExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/packet/AMPExtension.java @@ -20,12 +20,12 @@ import java.util.Collections; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smackx.amp.AMPDeliverCondition; import org.jivesoftware.smackx.amp.AMPExpireAtCondition; import org.jivesoftware.smackx.amp.AMPMatchResourceCondition; -public class AMPExtension implements PacketExtension { +public class AMPExtension implements ExtensionElement { public static final String NAMESPACE = "http://jabber.org/protocol/amp"; public static final String ELEMENT = "amp"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/provider/AMPExtensionProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/provider/AMPExtensionProvider.java index 0d1d3c379..b47d8ea04 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/provider/AMPExtensionProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/amp/provider/AMPExtensionProvider.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.amp.provider; import java.io.IOException; import java.util.logging.Logger; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.amp.AMPDeliverCondition; import org.jivesoftware.smackx.amp.AMPExpireAtCondition; import org.jivesoftware.smackx.amp.AMPMatchResourceCondition; @@ -28,7 +28,7 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -public class AMPExtensionProvider extends PacketExtensionProvider { +public class AMPExtensionProvider extends ExtensionElementProvider { private static final Logger LOGGER = Logger.getLogger(AMPExtensionProvider.class.getName()); /** diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/attention/packet/AttentionExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/attention/packet/AttentionExtension.java index d7b667635..a812fdd26 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/attention/packet/AttentionExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/attention/packet/AttentionExtension.java @@ -16,8 +16,8 @@ */ package org.jivesoftware.smackx.attention.packet; -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.xmlpull.v1.XmlPullParser; /** @@ -30,7 +30,7 @@ import org.xmlpull.v1.XmlPullParser; * @see XEP-0224: Attention */ -public class AttentionExtension implements PacketExtension { +public class AttentionExtension implements ExtensionElement { /** * The XML element name of an 'attention' extension. @@ -73,14 +73,14 @@ public class AttentionExtension implements PacketExtension { } /** - * A {@link PacketExtensionProvider} for the {@link AttentionExtension}. As + * A {@link ExtensionElementProvider} for the {@link AttentionExtension}. As * Attention elements have no state/information other than the element name * and namespace, this implementation simply returns new instances of * {@link AttentionExtension}. * * @author Guus der Kinderen, guus.der.kinderen@gmail.com s */ - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { @Override public AttentionExtension parse(XmlPullParser parser, int initialDepth) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java index c4fb9e3b7..233c40075 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/DataListener.java @@ -19,8 +19,8 @@ package org.jivesoftware.smackx.bytestreams.ibb; import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.filter.AndFilter; -import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smackx.bytestreams.ibb.packet.Data; @@ -44,8 +44,8 @@ class DataListener implements PacketListener { private final InBandBytestreamManager manager; /* packet filter for all In-Band Bytestream data packets */ - private final PacketFilter dataFilter = new AndFilter( - new PacketTypeFilter(Data.class)); + private final StanzaFilter dataFilter = new AndFilter( + new StanzaTypeFilter(Data.class)); /** * Constructor. @@ -70,7 +70,7 @@ class DataListener implements PacketListener { * * @return the packet filter for In-Band Bytestream data packets */ - protected PacketFilter getFilter() { + protected StanzaFilter getFilter() { return this.dataFilter; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java index f5a0a1719..77f9ac148 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/InBandBytestreamSession.java @@ -28,8 +28,8 @@ import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smack.filter.AndFilter; -import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Stanza; @@ -279,7 +279,7 @@ public class InBandBytestreamSession implements BytestreamSession { * * @return the data packet filter */ - protected abstract PacketFilter getDataPacketFilter(); + protected abstract StanzaFilter getDataPacketFilter(); public synchronized int read() throws IOException { checkClosed(); @@ -489,12 +489,12 @@ public class InBandBytestreamSession implements BytestreamSession { }; } - protected PacketFilter getDataPacketFilter() { + protected StanzaFilter getDataPacketFilter() { /* * filter all IQ stanzas having type 'SET' (represented by Data class), containing a * data packet extension, matching session ID and recipient */ - return new AndFilter(new PacketTypeFilter(Data.class), new IBBDataPacketFilter()); + return new AndFilter(new StanzaTypeFilter(Data.class), new IBBDataPacketFilter()); } } @@ -536,12 +536,12 @@ public class InBandBytestreamSession implements BytestreamSession { } @Override - protected PacketFilter getDataPacketFilter() { + protected StanzaFilter getDataPacketFilter() { /* * filter all message stanzas containing a data packet extension, matching session ID * and recipient */ - return new AndFilter(new PacketTypeFilter(Message.class), new IBBDataPacketFilter()); + return new AndFilter(new StanzaTypeFilter(Message.class), new IBBDataPacketFilter()); } } @@ -551,7 +551,7 @@ public class InBandBytestreamSession implements BytestreamSession { * containing an In-Band Bytestream data packet extension whose session ID matches this sessions * ID. */ - private class IBBDataPacketFilter implements PacketFilter { + private class IBBDataPacketFilter implements StanzaFilter { public boolean accept(Stanza packet) { // sender equals remote peer diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtension.java index 71534f8c9..11e1a0a2a 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/packet/DataPacketExtension.java @@ -16,7 +16,7 @@ */ package org.jivesoftware.smackx.bytestreams.ibb.packet; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder; import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smack.util.stringencoder.Base64; @@ -27,7 +27,7 @@ import org.jivesoftware.smack.util.stringencoder.Base64; * * @author Henning Staib */ -public class DataPacketExtension implements PacketExtension { +public class DataPacketExtension implements ExtensionElement { /** * The element name of the data packet extension. diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/provider/DataPacketProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/provider/DataPacketProvider.java index a3375ba08..b30c29418 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/provider/DataPacketProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/bytestreams/ibb/provider/DataPacketProvider.java @@ -46,7 +46,7 @@ public class DataPacketProvider { } } - public static class PacketExtensionProvider extends org.jivesoftware.smack.provider.PacketExtensionProvider { + public static class PacketExtensionProvider extends org.jivesoftware.smack.provider.ExtensionElementProvider { @Override public DataPacketExtension parse(XmlPullParser parser, diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java index 9bf3370c5..a5879ae4a 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/EntityCapsManager.java @@ -27,13 +27,13 @@ import org.jivesoftware.smack.XMPPConnectionRegistry; import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.Presence; import org.jivesoftware.smack.filter.NotFilter; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.filter.AndFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; -import org.jivesoftware.smack.filter.PacketExtensionFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; +import org.jivesoftware.smack.filter.StanzaExtensionFilter; import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.stringencoder.Base64; import org.jivesoftware.smackx.caps.cache.EntityCapsPersistentCache; @@ -90,11 +90,11 @@ public class EntityCapsManager extends Manager { private static Map instances = new WeakHashMap<>(); - private static final PacketFilter PRESENCES_WITH_CAPS = new AndFilter(new PacketTypeFilter(Presence.class), new PacketExtensionFilter( + private static final StanzaFilter PRESENCES_WITH_CAPS = new AndFilter(new StanzaTypeFilter(Presence.class), new StanzaExtensionFilter( ELEMENT, NAMESPACE)); - private static final PacketFilter PRESENCES_WITHOUT_CAPS = new AndFilter(new PacketTypeFilter(Presence.class), new NotFilter(new PacketExtensionFilter( + private static final StanzaFilter PRESENCES_WITHOUT_CAPS = new AndFilter(new StanzaTypeFilter(Presence.class), new NotFilter(new StanzaExtensionFilter( ELEMENT, NAMESPACE))); - private static final PacketFilter PRESENCES = PacketTypeFilter.PRESENCE; + private static final StanzaFilter PRESENCES = StanzaTypeFilter.PRESENCE; /** * Map of "node + '#' + hash" to DiscoverInfo data @@ -482,7 +482,7 @@ public class EntityCapsManager extends Manager { final List identities = new LinkedList(ServiceDiscoveryManager.getInstanceFor(connection).getIdentities()); sdm.setNodeInformationProvider(entityNode + '#' + currentCapsVersion, new AbstractNodeInformationProvider() { List features = sdm.getFeatures(); - List packetExtensions = sdm.getExtendedInfoAsList(); + List packetExtensions = sdm.getExtendedInfoAsList(); @Override public List getNodeFeatures() { return features; @@ -492,7 +492,7 @@ public class EntityCapsManager extends Manager { return identities; } @Override - public List getNodePacketExtensions() { + public List getNodePacketExtensions() { return packetExtensions; } }); @@ -553,7 +553,7 @@ public class EntityCapsManager extends Manager { */ protected static boolean verifyPacketExtensions(DiscoverInfo info) { List foundFormTypes = new LinkedList(); - for (PacketExtension pe : info.getExtensions()) { + for (ExtensionElement pe : info.getExtensions()) { if (pe.getNamespace().equals(DataForm.NAMESPACE)) { DataForm df = (DataForm) pe; for (FormField f : df.getFields()) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/packet/CapsExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/packet/CapsExtension.java index 03369ccdb..4c1bb701e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/packet/CapsExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/packet/CapsExtension.java @@ -17,13 +17,13 @@ package org.jivesoftware.smackx.caps.packet; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; /** * A XEP-0115 Entity Capabilities extension. */ -public class CapsExtension implements PacketExtension { +public class CapsExtension implements ExtensionElement { public static final String NAMESPACE = "http://jabber.org/protocol/caps"; public static final String ELEMENT = "c"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/provider/CapsExtensionProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/provider/CapsExtensionProvider.java index 1835d5e10..0eba8f4e2 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/provider/CapsExtensionProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/caps/provider/CapsExtensionProvider.java @@ -19,13 +19,13 @@ package org.jivesoftware.smackx.caps.provider; import java.io.IOException; import org.jivesoftware.smack.SmackException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.caps.EntityCapsManager; import org.jivesoftware.smackx.caps.packet.CapsExtension; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -public class CapsExtensionProvider extends PacketExtensionProvider { +public class CapsExtensionProvider extends ExtensionElementProvider { public CapsExtension parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateManager.java index 0dd4278e7..bc0aab9b7 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/ChatStateManager.java @@ -29,10 +29,10 @@ import org.jivesoftware.smack.chat.ChatManager; import org.jivesoftware.smack.chat.ChatManagerListener; import org.jivesoftware.smack.chat.ChatMessageListener; import org.jivesoftware.smack.filter.NotFilter; -import org.jivesoftware.smack.filter.PacketExtensionFilter; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaExtensionFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.Message; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smackx.chatstates.packet.ChatStateExtension; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; @@ -55,7 +55,7 @@ public class ChatStateManager extends Manager { private static final Map INSTANCES = new WeakHashMap(); - private static final PacketFilter filter = new NotFilter(new PacketExtensionFilter(NAMESPACE)); + private static final StanzaFilter filter = new NotFilter(new StanzaExtensionFilter(NAMESPACE)); /** * Returns the ChatStateManager related to the XMPPConnection and it will create one if it does @@ -96,7 +96,7 @@ public class ChatStateManager extends Manager { /** * Sets the current state of the provided chat. This method will send an empty bodied Message - * packet with the state attached as a {@link org.jivesoftware.smack.packet.PacketExtension}, if + * packet with the state attached as a {@link org.jivesoftware.smack.packet.ExtensionElement}, if * and only if the new chat state is different than the last state. * * @param newState the new state of the chat @@ -170,7 +170,7 @@ public class ChatStateManager extends Manager { } public void processMessage(Chat chat, Message message) { - PacketExtension extension = message.getExtension(NAMESPACE); + ExtensionElement extension = message.getExtension(NAMESPACE); if (extension == null) { return; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/packet/ChatStateExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/packet/ChatStateExtension.java index 3e6e456eb..8aac8339c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/packet/ChatStateExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/chatstates/packet/ChatStateExtension.java @@ -18,8 +18,8 @@ package org.jivesoftware.smackx.chatstates.packet; import org.jivesoftware.smackx.chatstates.ChatState; -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.util.XmlStringBuilder; import org.xmlpull.v1.XmlPullParser; @@ -30,7 +30,7 @@ import org.xmlpull.v1.XmlPullParser; * @author Alexander Wenckus * @see org.jivesoftware.smackx.chatstates.ChatState */ -public class ChatStateExtension implements PacketExtension { +public class ChatStateExtension implements ExtensionElement { public static final String NAMESPACE = "http://jabber.org/protocol/chatstates"; @@ -66,7 +66,7 @@ public class ChatStateExtension implements PacketExtension { return xml; } - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { @Override public ChatStateExtension parse(XmlPullParser parser, int initialDepth) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/packet/AdHocCommandData.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/packet/AdHocCommandData.java index fc58c8088..28d67fdd4 100755 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/packet/AdHocCommandData.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/packet/AdHocCommandData.java @@ -18,7 +18,7 @@ package org.jivesoftware.smackx.commands.packet; import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smackx.commands.AdHocCommand; import org.jivesoftware.smackx.commands.AdHocCommand.Action; import org.jivesoftware.smackx.commands.AdHocCommand.SpecificErrorCondition; @@ -237,7 +237,7 @@ public class AdHocCommandData extends IQ { return sessionID; } - public static class SpecificError implements PacketExtension { + public static class SpecificError implements ExtensionElement { public static final String namespace = "http://jabber.org/protocol/commands"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/provider/AdHocCommandDataProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/provider/AdHocCommandDataProvider.java index 541705258..f95c46aca 100755 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/provider/AdHocCommandDataProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/commands/provider/AdHocCommandDataProvider.java @@ -22,7 +22,7 @@ import java.io.IOException; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.packet.XMPPError; import org.jivesoftware.smack.provider.IQProvider; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smackx.commands.AdHocCommand; import org.jivesoftware.smackx.commands.AdHocCommand.Action; @@ -119,42 +119,42 @@ public class AdHocCommandDataProvider extends IQProvider { return adHocCommandData; } - public static class BadActionError extends PacketExtensionProvider { + public static class BadActionError extends ExtensionElementProvider { @Override public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth) { return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.badAction); } } - public static class MalformedActionError extends PacketExtensionProvider { + public static class MalformedActionError extends ExtensionElementProvider { @Override public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth) { return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.malformedAction); } } - public static class BadLocaleError extends PacketExtensionProvider { + public static class BadLocaleError extends ExtensionElementProvider { @Override public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth) { return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.badLocale); } } - public static class BadPayloadError extends PacketExtensionProvider { + public static class BadPayloadError extends ExtensionElementProvider { @Override public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth) { return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.badPayload); } } - public static class BadSessionIDError extends PacketExtensionProvider { + public static class BadSessionIDError extends ExtensionElementProvider { @Override public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth) { return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.badSessionid); } } - public static class SessionExpiredError extends PacketExtensionProvider { + public static class SessionExpiredError extends ExtensionElementProvider { @Override public AdHocCommandData.SpecificError parse(XmlPullParser parser, int initialDepth) { return new AdHocCommandData.SpecificError(AdHocCommand.SpecificErrorCondition.sessionExpired); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/DelayInformationManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/DelayInformationManager.java index 9a828c10d..fcd8fa08c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/DelayInformationManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/DelayInformationManager.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.delay; import java.util.Date; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smackx.delay.packet.DelayInformation; /** @@ -95,7 +95,7 @@ public class DelayInformationManager { * @return true if the stanza got delayed. */ public static boolean isDelayedStanza(Stanza packet) { - PacketExtension packetExtension = getDelayInformation(packet); + ExtensionElement packetExtension = getDelayInformation(packet); return packetExtension != null; } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/filter/DelayedStanzaFilter.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/filter/DelayedStanzaFilter.java index 5355c2ec6..433d157a2 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/filter/DelayedStanzaFilter.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/filter/DelayedStanzaFilter.java @@ -17,21 +17,21 @@ package org.jivesoftware.smackx.delay.filter; import org.jivesoftware.smack.filter.NotFilter; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smackx.delay.DelayInformationManager; /** * Filters stanza with delay information, ie. stanzas that got delayed for some reason */ -public class DelayedStanzaFilter implements PacketFilter { +public class DelayedStanzaFilter implements StanzaFilter { - public static final PacketFilter INSTANCE = new DelayedStanzaFilter(); + public static final StanzaFilter INSTANCE = new DelayedStanzaFilter(); /** * Filters stanzas that got not delayed, ie. have no delayed information */ - public static final PacketFilter NOT_DELAYED_STANZA = new NotFilter(INSTANCE); + public static final StanzaFilter NOT_DELAYED_STANZA = new NotFilter(INSTANCE); private DelayedStanzaFilter() { } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/packet/DelayInformation.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/packet/DelayInformation.java index cdcb83da4..8786bef17 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/packet/DelayInformation.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/packet/DelayInformation.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.delay.packet; import java.util.Date; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; import org.jxmpp.util.XmppDateTime; @@ -35,7 +35,7 @@ import org.jxmpp.util.XmppDateTime; * @author Gaston Dombiak * @author Florian Schmaus */ -public class DelayInformation implements PacketExtension { +public class DelayInformation implements ExtensionElement { public static final String ELEMENT = "delay"; public static final String NAMESPACE = "urn:xmpp:delay"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/provider/AbstractDelayInformationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/provider/AbstractDelayInformationProvider.java index 991bb49aa..812a790d8 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/provider/AbstractDelayInformationProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/delay/provider/AbstractDelayInformationProvider.java @@ -21,12 +21,12 @@ import java.text.ParseException; import java.util.Date; import org.jivesoftware.smack.SmackException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.delay.packet.DelayInformation; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -public abstract class AbstractDelayInformationProvider extends PacketExtensionProvider { +public abstract class AbstractDelayInformationProvider extends ExtensionElementProvider { @Override public final DelayInformation parse(XmlPullParser parser, diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/AbstractNodeInformationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/AbstractNodeInformationProvider.java index 7cfb6d2fd..426b59fde 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/AbstractNodeInformationProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/AbstractNodeInformationProvider.java @@ -16,7 +16,7 @@ */ package org.jivesoftware.smackx.disco; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.jivesoftware.smackx.disco.packet.DiscoverItems; @@ -40,7 +40,7 @@ public abstract class AbstractNodeInformationProvider implements NodeInformation return null; } - public List getNodePacketExtensions() { + public List getNodePacketExtensions() { return null; } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/NodeInformationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/NodeInformationProvider.java index 41c2d7855..42c68ddb4 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/NodeInformationProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/NodeInformationProvider.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.disco; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.jivesoftware.smackx.disco.packet.DiscoverItems; @@ -68,5 +68,5 @@ public interface NodeInformationProvider { * * @return a list of the packet extensions defined in the node. */ - List getNodePacketExtensions(); + List getNodePacketExtensions(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java index 267bd2e11..339e3755e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/ServiceDiscoveryManager.java @@ -27,7 +27,7 @@ import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler; import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.XMPPError; import org.jivesoftware.smackx.caps.EntityCapsManager; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; @@ -445,10 +445,10 @@ public class ServiceDiscoveryManager extends Manager { * * @return the data form as List of PacketExtensions */ - public List getExtendedInfoAsList() { - List res = null; + public List getExtendedInfoAsList() { + List res = null; if (extendedInfo != null) { - res = new ArrayList(1); + res = new ArrayList(1); res.add(extendedInfo); } return res; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/provider/DiscoverInfoProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/provider/DiscoverInfoProvider.java index 8707485a7..40f9587d3 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/provider/DiscoverInfoProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/disco/provider/DiscoverInfoProvider.java @@ -61,7 +61,7 @@ public class DiscoverInfoProvider extends IQProvider { } // Otherwise, it must be a packet extension. else { - PacketParserUtils.addPacketExtension(discoverInfo, parser); + PacketParserUtils.addExtensionElement(discoverInfo, parser); } } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals("identity")) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java index 25ff808c4..cd957db1d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/FaultTolerantNegotiator.java @@ -36,7 +36,7 @@ import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; 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.Stanza; import org.jivesoftware.smackx.si.packet.StreamInitiation; @@ -51,8 +51,8 @@ public class FaultTolerantNegotiator extends StreamNegotiator { private final StreamNegotiator primaryNegotiator; private final StreamNegotiator secondaryNegotiator; private final XMPPConnection connection; - private PacketFilter primaryFilter; - private PacketFilter secondaryFilter; + private StanzaFilter primaryFilter; + private StanzaFilter secondaryFilter; public FaultTolerantNegotiator(XMPPConnection connection, StreamNegotiator primary, StreamNegotiator secondary) { @@ -61,7 +61,7 @@ public class FaultTolerantNegotiator extends StreamNegotiator { this.connection = connection; } - public PacketFilter getInitiationPacketFilter(String from, String streamID) { + public StanzaFilter getInitiationPacketFilter(String from, String streamID) { if (primaryFilter == null || secondaryFilter == null) { primaryFilter = primaryNegotiator.getInitiationPacketFilter(from, streamID); secondaryFilter = secondaryNegotiator.getInitiationPacketFilter(from, streamID); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IBBTransferNegotiator.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IBBTransferNegotiator.java index 578f5ffdd..c2895b2f5 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IBBTransferNegotiator.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/IBBTransferNegotiator.java @@ -24,11 +24,12 @@ import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.filter.AndFilter; +import org.jivesoftware.smack.filter.FlexibleStanzaTypeFilter; import org.jivesoftware.smack.filter.FromMatchesFilter; -import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Stanza; +import org.jivesoftware.smack.util.Objects; import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamManager; import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamRequest; import org.jivesoftware.smackx.bytestreams.ibb.InBandBytestreamSession; @@ -81,7 +82,7 @@ public class IBBTransferNegotiator extends StreamNegotiator { return negotiateIncomingStream(streamInitiation); } - public PacketFilter getInitiationPacketFilter(String from, String streamID) { + public StanzaFilter getInitiationPacketFilter(String from, String streamID) { /* * this method is always called prior to #negotiateIncomingStream() so * the In-Band Bytestream initiation listener must ignore the next @@ -111,27 +112,19 @@ public class IBBTransferNegotiator extends StreamNegotiator { * This PacketFilter accepts an incoming In-Band Bytestream open request * with a specified session ID. */ - private static class IBBOpenSidFilter extends PacketTypeFilter { + private static class IBBOpenSidFilter extends FlexibleStanzaTypeFilter { - private String sessionID; + private final String sessionID; public IBBOpenSidFilter(String sessionID) { - super(Open.class); - if (sessionID == null) { - throw new IllegalArgumentException("StreamID cannot be null"); - } - this.sessionID = sessionID; + this.sessionID = Objects.requireNonNull(sessionID, "sessionID must not be null"); } - public boolean accept(Stanza packet) { - if (super.accept(packet)) { - Open bytestream = (Open) packet; - - // packet must by of type SET and contains the given session ID - return this.sessionID.equals(bytestream.getSessionID()) - && IQ.Type.set.equals(bytestream.getType()); - } - return false; + @Override + protected boolean acceptSpecific(Open bytestream) { + // packet must by of type SET and contains the given session ID + return this.sessionID.equals(bytestream.getSessionID()) + && IQ.Type.set.equals(bytestream.getType()); } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/Socks5TransferNegotiator.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/Socks5TransferNegotiator.java index efaa9b6e8..0cc7aa400 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/Socks5TransferNegotiator.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/Socks5TransferNegotiator.java @@ -27,9 +27,9 @@ import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.filter.AndFilter; +import org.jivesoftware.smack.filter.FlexibleStanzaTypeFilter; import org.jivesoftware.smack.filter.FromMatchesFilter; -import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.util.Objects; @@ -85,7 +85,7 @@ public class Socks5TransferNegotiator extends StreamNegotiator { } @Override - public PacketFilter getInitiationPacketFilter(final String from, String streamID) { + public StanzaFilter getInitiationPacketFilter(final String from, String streamID) { /* * this method is always called prior to #negotiateIncomingStream() so the SOCKS5 * InitiationListener must ignore the next SOCKS5 Bytestream request with the given session @@ -126,27 +126,20 @@ public class Socks5TransferNegotiator extends StreamNegotiator { /** * This PacketFilter accepts an incoming SOCKS5 Bytestream request with a specified session ID. */ - private static class BytestreamSIDFilter extends PacketTypeFilter { + private static class BytestreamSIDFilter extends FlexibleStanzaTypeFilter { private final String sessionID; public BytestreamSIDFilter(String sessionID) { - super(Bytestream.class); this.sessionID = Objects.requireNonNull(sessionID, "SessionID cannot be null"); } @Override - public boolean accept(Stanza packet) { - if (super.accept(packet)) { - Bytestream bytestream = (Bytestream) packet; - - // packet must by of type SET and contains the given session ID - return this.sessionID.equals(bytestream.getSessionID()) - && IQ.Type.set.equals(bytestream.getType()); - } - return false; + protected boolean acceptSpecific(Bytestream bytestream) { + // packet must by of type SET and contains the given session ID + return this.sessionID.equals(bytestream.getSessionID()) + && IQ.Type.set.equals(bytestream.getType()); } - } /** diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/StreamNegotiator.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/StreamNegotiator.java index 66df77f02..0fff1304c 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/StreamNegotiator.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/filetransfer/StreamNegotiator.java @@ -23,7 +23,7 @@ import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException.XMPPErrorException; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smackx.si.packet.StreamInitiation; @@ -94,7 +94,7 @@ public abstract class StreamNegotiator { * @return The PacketFilter that will return the packet relatable to the stream * initiation. */ - public abstract PacketFilter getInitiationPacketFilter(String from, String streamID); + public abstract StanzaFilter getInitiationPacketFilter(String from, String streamID); abstract InputStream negotiateIncomingStream(Stanza streamInitiation) throws XMPPErrorException, diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/packet/Forwarded.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/packet/Forwarded.java index 5117b95fa..47ef8a713 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/packet/Forwarded.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/packet/Forwarded.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.forward.packet; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smackx.delay.packet.DelayInformation; @@ -27,7 +27,7 @@ import org.jivesoftware.smackx.delay.packet.DelayInformation; * @author Georg Lukas * @see XEP-0297: Stanza Forwarding */ -public class Forwarded implements PacketExtension { +public class Forwarded implements ExtensionElement { public static final String NAMESPACE = "urn:xmpp:forward:0"; public static final String ELEMENT = "forwarded"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/provider/ForwardedProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/provider/ForwardedProvider.java index 69febd966..0a2b3a237 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/provider/ForwardedProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/forward/provider/ForwardedProvider.java @@ -22,7 +22,7 @@ import java.util.logging.Logger; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smackx.delay.packet.DelayInformation; import org.jivesoftware.smackx.delay.provider.DelayInformationProvider; @@ -31,12 +31,12 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; /** - * This class implements the {@link PacketExtensionProvider} to parse + * This class implements the {@link ExtensionElementProvider} to parse * forwarded messages from a packet. It will return a {@link Forwarded} packet extension. * * @author Georg Lukas */ -public class ForwardedProvider extends PacketExtensionProvider { +public class ForwardedProvider extends ExtensionElementProvider { private static final Logger LOGGER = Logger.getLogger(ForwardedProvider.class.getName()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java index b067f4dc2..392046b8b 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqlast/LastActivityManager.java @@ -28,7 +28,7 @@ import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smack.Manager; import org.jivesoftware.smack.XMPPConnectionRegistry; import org.jivesoftware.smack.XMPPException.XMPPErrorException; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler; import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode; import org.jivesoftware.smack.packet.IQ; @@ -92,7 +92,7 @@ import org.jivesoftware.smackx.iqlast.packet.LastActivity; public class LastActivityManager extends Manager { private static final Map instances = new WeakHashMap(); // private static final PacketFilter IQ_GET_LAST_FILTER = new AndFilter(IQTypeFilter.GET, -// new PacketTypeFilter(LastActivity.class)); +// new StanzaTypeFilter(LastActivity.class)); private static boolean enabledPerDefault = true; @@ -149,7 +149,7 @@ public class LastActivityManager extends Manager { break; } } - }, PacketTypeFilter.PRESENCE); + }, StanzaTypeFilter.PRESENCE); connection.addPacketSendingListener(new PacketListener() { @Override @@ -159,7 +159,7 @@ public class LastActivityManager extends Manager { if (message.getType() == Message.Type.error) return; resetIdleTime(); } - }, PacketTypeFilter.MESSAGE); + }, StanzaTypeFilter.MESSAGE); // Register a listener for a last activity query connection.registerIQRequestHandler(new AbstractIqRequestHandler(LastActivity.ELEMENT, LastActivity.NAMESPACE, diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/packet/Registration.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/packet/Registration.java index fe78b61b8..7267db2b9 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/packet/Registration.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/packet/Registration.java @@ -20,7 +20,7 @@ package org.jivesoftware.smackx.iqregister.packet; import java.util.Map; import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; /** * Represents registration packets. An empty GET query will cause the server to return information @@ -100,7 +100,7 @@ public class Registration extends IQ { return xml; } - public static class Feature implements PacketExtension { + public static class Feature implements ExtensionElement { public static final String ELEMENT = "register"; public static final String NAMESPACE = "http://jabber.org/features/iq-register"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/provider/RegistrationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/provider/RegistrationProvider.java index 2df60a139..9bdf5f7b6 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/provider/RegistrationProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/provider/RegistrationProvider.java @@ -24,7 +24,7 @@ import java.util.Map; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smackx.iqregister.packet.Registration; @@ -38,7 +38,7 @@ public class RegistrationProvider extends IQProvider { throws XmlPullParserException, IOException, SmackException { String instruction = null; Map fields = new HashMap(); - List packetExtensions = new LinkedList(); + List packetExtensions = new LinkedList(); outerloop: while (true) { int eventType = parser.next(); @@ -62,7 +62,7 @@ public class RegistrationProvider extends IQProvider { } // Otherwise, it must be a packet extension. else { - PacketParserUtils.addPacketExtension(packetExtensions, parser); + PacketParserUtils.addExtensionElement(packetExtensions, parser); } } else if (eventType == XmlPullParser.END_TAG) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/provider/RegistrationStreamFeatureProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/provider/RegistrationStreamFeatureProvider.java index a1e54be3d..c4b19f8e3 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/provider/RegistrationStreamFeatureProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/iqregister/provider/RegistrationStreamFeatureProvider.java @@ -16,11 +16,11 @@ */ package org.jivesoftware.smackx.iqregister.provider; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.iqregister.packet.Registration; import org.xmlpull.v1.XmlPullParser; -public class RegistrationStreamFeatureProvider extends PacketExtensionProvider { +public class RegistrationStreamFeatureProvider extends ExtensionElementProvider { @Override public Registration.Feature parse(XmlPullParser parser, int initialDepth) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java index 362e2704d..2adf0d419 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/packet/JivePropertiesExtension.java @@ -27,7 +27,7 @@ import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smack.util.stringencoder.Base64; @@ -38,7 +38,7 @@ import org.jivesoftware.smack.util.stringencoder.Base64; * Serializable interface). * */ -public class JivePropertiesExtension implements PacketExtension { +public class JivePropertiesExtension implements ExtensionElement { /** * Namespace used to store packet properties. */ diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/provider/JivePropertiesExtensionProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/provider/JivePropertiesExtensionProvider.java index 986c41994..ffc83653e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/provider/JivePropertiesExtensionProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/jiveproperties/provider/JivePropertiesExtensionProvider.java @@ -24,14 +24,14 @@ import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.util.stringencoder.Base64; import org.jivesoftware.smackx.jiveproperties.JivePropertiesManager; import org.jivesoftware.smackx.jiveproperties.packet.JivePropertiesExtension; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -public class JivePropertiesExtensionProvider extends PacketExtensionProvider { +public class JivePropertiesExtensionProvider extends ExtensionElementProvider { private static final Logger LOGGER = Logger.getLogger(JivePropertiesExtensionProvider.class.getName()); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java index 6679f3587..7f79ec6d0 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChat.java @@ -47,9 +47,9 @@ import org.jivesoftware.smack.filter.FromMatchesFilter; import org.jivesoftware.smack.filter.MessageTypeFilter; import org.jivesoftware.smack.filter.MessageWithSubjectFilter; import org.jivesoftware.smack.filter.NotFilter; -import org.jivesoftware.smack.filter.PacketExtensionFilter; -import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaFilter; +import org.jivesoftware.smack.filter.StanzaExtensionFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.filter.ToFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Message; @@ -108,12 +108,12 @@ public class MultiUserChat { * the groupchat participants, i.e. it filters only the bare JID of the from * attribute against the JID of the MUC. */ - private final PacketFilter fromRoomFilter; + private final StanzaFilter fromRoomFilter; /** * Same as {@link #fromRoomFilter} together with {@link MessageTypeFilter#GROUPCHAT}. */ - private final PacketFilter fromRoomGroupchatFilter; + private final StanzaFilter fromRoomGroupchatFilter; private final PacketListener presenceInterceptor; private final PacketListener messageListener; @@ -291,19 +291,19 @@ public class MultiUserChat { joinPresence.addExtension(mucInitialPresence); // Wait for a presence packet back from the server. - PacketFilter responseFilter = new AndFilter(FromMatchesFilter.createFull(room + "/" - + nickname), new PacketTypeFilter(Presence.class)); + StanzaFilter responseFilter = new AndFilter(FromMatchesFilter.createFull(room + "/" + + nickname), new StanzaTypeFilter(Presence.class)); // Setup the messageListeners and presenceListeners *before* the join presence is send. connection.addSyncPacketListener(messageListener, fromRoomGroupchatFilter); connection.addSyncPacketListener(presenceListener, new AndFilter(fromRoomFilter, - PacketTypeFilter.PRESENCE)); + StanzaTypeFilter.PRESENCE)); connection.addSyncPacketListener(subjectListener, new AndFilter(fromRoomFilter, MessageWithSubjectFilter.INSTANCE)); - connection.addSyncPacketListener(declinesListener, new AndFilter(new PacketExtensionFilter(MUCUser.ELEMENT, + connection.addSyncPacketListener(declinesListener, new AndFilter(new StanzaExtensionFilter(MUCUser.ELEMENT, MUCUser.NAMESPACE), new NotFilter(MessageTypeFilter.ERROR))); connection.addPacketInterceptor(presenceInterceptor, new AndFilter(new ToFilter(room), - PacketTypeFilter.PRESENCE)); + StanzaTypeFilter.PRESENCE)); messageCollector = connection.createPacketCollector(fromRoomGroupchatFilter); Presence presence; @@ -855,10 +855,10 @@ public class MultiUserChat { joinPresence.setTo(room + "/" + nickname); // Wait for a presence packet back from the server. - PacketFilter responseFilter = + StanzaFilter responseFilter = new AndFilter( FromMatchesFilter.createFull(room + "/" + nickname), - new PacketTypeFilter(Presence.class)); + new StanzaTypeFilter(Presence.class)); PacketCollector response = connection.createPacketCollectorAndSend(responseFilter, joinPresence); // Wait up to a certain number of seconds for a reply. If there is a negative reply, an // exception will be thrown @@ -1707,7 +1707,7 @@ public class MultiUserChat { Message message = createMessage(); message.setSubject(subject); // Wait for an error or confirmation message back from the server. - PacketFilter responseFilter = new AndFilter(fromRoomGroupchatFilter, new PacketFilter() { + StanzaFilter responseFilter = new AndFilter(fromRoomGroupchatFilter, new StanzaFilter() { @Override public boolean accept(Stanza packet) { Message msg = (Message) packet; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java index be0a414f5..ea46e4ce5 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/MultiUserChatManager.java @@ -37,10 +37,10 @@ import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.filter.AndFilter; import org.jivesoftware.smack.filter.MessageTypeFilter; -import org.jivesoftware.smack.filter.PacketExtensionFilter; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaExtensionFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.filter.NotFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smackx.disco.AbstractNodeInformationProvider; @@ -100,7 +100,7 @@ public class MultiUserChatManager extends Manager { return multiUserChatManager; } - private static final PacketFilter INVITATION_FILTER = new AndFilter(PacketTypeFilter.MESSAGE, new PacketExtensionFilter(new MUCUser()), + private static final StanzaFilter INVITATION_FILTER = new AndFilter(StanzaTypeFilter.MESSAGE, new StanzaExtensionFilter(new MUCUser()), new NotFilter(MessageTypeFilter.ERROR)); private final Set invitationsListeners = new CopyOnWriteArraySet(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/GroupChatInvitation.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/GroupChatInvitation.java index b4ed52f32..59d0e7ba6 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/GroupChatInvitation.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/GroupChatInvitation.java @@ -20,8 +20,8 @@ package org.jivesoftware.smackx.muc.packet; import java.io.IOException; import org.jivesoftware.smack.packet.Stanza; -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.util.XmlStringBuilder; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -39,12 +39,12 @@ import org.xmlpull.v1.XmlPullParserException; * con.sendPacket(message); * * - * To listen for group chat invitations, use a PacketExtensionFilter for the + * To listen for group chat invitations, use a StanzaExtensionFilter for the * x element name and jabber:x:conference namespace, as in the * following code example: * *
- * PacketFilter filter = new PacketExtensionFilter("x", "jabber:x:conference");
+ * PacketFilter filter = new StanzaExtensionFilter("x", "jabber:x:conference");
  * // Create a packet collector or packet listeners using the filter...
  * 
* @@ -55,7 +55,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Matt Tucker */ -public class GroupChatInvitation implements PacketExtension { +public class GroupChatInvitation implements ExtensionElement { /** * Element name of the packet extension. @@ -128,7 +128,7 @@ public class GroupChatInvitation implements PacketExtension { return packet.getExtension(ELEMENT, NAMESPACE); } - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { @Override public GroupChatInvitation parse(XmlPullParser parser, diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCInitialPresence.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCInitialPresence.java index 9fecb4335..99ac34959 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCInitialPresence.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCInitialPresence.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.muc.packet; import org.jivesoftware.smack.packet.NamedElement; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; import org.jxmpp.util.XmppDateTime; @@ -37,7 +37,7 @@ import java.util.Date; * @author Gaston Dombiak * @see MUCInitialPresence#setHistory(MUCInitialPresence.History) */ -public class MUCInitialPresence implements PacketExtension { +public class MUCInitialPresence implements ExtensionElement { public static final String ELEMENT = "x"; public static final String NAMESPACE = "http://jabber.org/protocol/muc"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCUser.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCUser.java index 21bc82ef9..88cbd0ce0 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCUser.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/packet/MUCUser.java @@ -25,7 +25,7 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; /** @@ -34,7 +34,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder; * * @author Gaston Dombiak */ -public class MUCUser implements PacketExtension { +public class MUCUser implements ExtensionElement { public static final String ELEMENT = "x"; public static final String NAMESPACE = MUCInitialPresence.NAMESPACE + "#user"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/MUCOwnerProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/MUCOwnerProvider.java index cfac31cc0..9b476b1ad 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/MUCOwnerProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/MUCOwnerProvider.java @@ -49,7 +49,7 @@ public class MUCOwnerProvider extends IQProvider { } // Otherwise, it must be a packet extension. else { - PacketParserUtils.addPacketExtension(mucOwner, parser); + PacketParserUtils.addExtensionElement(mucOwner, parser); } } else if (eventType == XmlPullParser.END_TAG) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/MUCUserProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/MUCUserProvider.java index ba670e6f2..6564254cf 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/MUCUserProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/muc/provider/MUCUserProvider.java @@ -20,7 +20,7 @@ package org.jivesoftware.smackx.muc.provider; import java.io.IOException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.muc.packet.MUCUser; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -31,7 +31,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Gaston Dombiak */ -public class MUCUserProvider extends PacketExtensionProvider { +public class MUCUserProvider extends ExtensionElementProvider { /** * Parses a MUCUser packet (extension sub-packet). diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/nick/packet/Nick.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/nick/packet/Nick.java index 7cd01d42a..b5bbb22f6 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/nick/packet/Nick.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/nick/packet/Nick.java @@ -18,18 +18,18 @@ package org.jivesoftware.smackx.nick.packet; import java.io.IOException; -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.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; /** - * A minimalistic implementation of a {@link PacketExtension} for nicknames. + * A minimalistic implementation of a {@link ExtensionElement} for nicknames. * * @author Guus der Kinderen, guus.der.kinderen@gmail.com * @see XEP-0172: User Nickname */ -public class Nick implements PacketExtension { +public class Nick implements ExtensionElement { public static final String NAMESPACE = "http://jabber.org/protocol/nick"; @@ -94,7 +94,7 @@ public class Nick implements PacketExtension { return buf.toString(); } - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { @Override public Nick parse(XmlPullParser parser, int initialDepth) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java index 8fdf948d0..f47817b08 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/OfflineMessageManager.java @@ -23,9 +23,9 @@ import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.filter.AndFilter; -import org.jivesoftware.smack.filter.PacketExtensionFilter; -import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaExtensionFilter; +import org.jivesoftware.smack.filter.StanzaFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; @@ -60,8 +60,8 @@ public class OfflineMessageManager { private final XMPPConnection connection; - private static final PacketFilter PACKET_FILTER = new AndFilter(new PacketExtensionFilter( - new OfflineMessageInfo()), PacketTypeFilter.MESSAGE); + private static final StanzaFilter PACKET_FILTER = new AndFilter(new StanzaExtensionFilter( + new OfflineMessageInfo()), StanzaTypeFilter.MESSAGE); public OfflineMessageManager(XMPPConnection connection) { this.connection = connection; @@ -146,7 +146,7 @@ public class OfflineMessageManager { request.addItem(item); } // Filter offline messages that were requested by this request - PacketFilter messageFilter = new AndFilter(PACKET_FILTER, new PacketFilter() { + StanzaFilter messageFilter = new AndFilter(PACKET_FILTER, new StanzaFilter() { public boolean accept(Stanza packet) { OfflineMessageInfo info = (OfflineMessageInfo) packet.getExtension("offline", namespace); @@ -186,7 +186,7 @@ public class OfflineMessageManager { request.setFetch(true); PacketCollector resultCollector = connection.createPacketCollectorAndSend(request); - PacketCollector.Configuration messageCollectorConfiguration = PacketCollector.newConfiguration().setPacketFilter(PACKET_FILTER).setCollectorToReset(resultCollector); + PacketCollector.Configuration messageCollectorConfiguration = PacketCollector.newConfiguration().setStanzaFilter(PACKET_FILTER).setCollectorToReset(resultCollector); PacketCollector messageCollector = connection.createPacketCollector(messageCollectorConfiguration); List messages = null; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageInfo.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageInfo.java index 8500b8ab4..d8e88af70 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageInfo.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/offline/packet/OfflineMessageInfo.java @@ -19,8 +19,8 @@ package org.jivesoftware.smackx.offline.packet; import java.io.IOException; -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.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -32,7 +32,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Gaston Dombiak */ -public class OfflineMessageInfo implements PacketExtension { +public class OfflineMessageInfo implements ExtensionElement { private String node = null; @@ -88,7 +88,7 @@ public class OfflineMessageInfo implements PacketExtension { return buf.toString(); } - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { /** * Parses a OfflineMessageInfo packet (extension sub-packet). diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/PEPManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/PEPManager.java index 3e476b047..eb2083737 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/PEPManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/PEPManager.java @@ -23,8 +23,8 @@ import java.util.List; import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.filter.PacketExtensionFilter; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaExtensionFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.IQ.Type; @@ -64,7 +64,7 @@ public class PEPManager { private XMPPConnection connection; - private PacketFilter packetFilter = new PacketExtensionFilter("event", "http://jabber.org/protocol/pubsub#event"); + private StanzaFilter packetFilter = new StanzaExtensionFilter("event", "http://jabber.org/protocol/pubsub#event"); private PacketListener packetListener; /** diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPEvent.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPEvent.java index c455e0416..f2b4575ef 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPEvent.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPEvent.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.pep.packet; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; /** * Represents XMPP Personal Event Protocol packets.

@@ -27,7 +27,7 @@ import org.jivesoftware.smack.packet.PacketExtension; * * @author Jeff Williams */ -public class PEPEvent implements PacketExtension { +public class PEPEvent implements ExtensionElement { PEPItem item; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPItem.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPItem.java index 0156bd957..138c9412a 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPItem.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/packet/PEPItem.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.pep.packet; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; /** * Represents XMPP Personal Event Protocol packets.

@@ -27,7 +27,7 @@ import org.jivesoftware.smack.packet.PacketExtension; * * @author Jeff Williams */ -public abstract class PEPItem implements PacketExtension { +public abstract class PEPItem implements ExtensionElement { String id; abstract String getNode(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/provider/PEPProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/provider/PEPProvider.java index e19f0b773..8786bb26f 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/provider/PEPProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pep/provider/PEPProvider.java @@ -22,8 +22,8 @@ import java.util.HashMap; import java.util.Map; 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.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -41,11 +41,11 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Jeff Williams */ -public class PEPProvider extends PacketExtensionProvider { +public class PEPProvider extends ExtensionElementProvider { - private static final Map> nodeParsers = new HashMap>(); + private static final Map> nodeParsers = new HashMap>(); - public static void registerPEPParserExtension(String node, PacketExtensionProvider pepItemParser) { + public static void registerPEPParserExtension(String node, ExtensionElementProvider pepItemParser) { nodeParsers.put(node, pepItemParser); } @@ -60,9 +60,9 @@ public class PEPProvider extends PacketExtensionProvider { * @throws SmackException */ @Override - public PacketExtension parse(XmlPullParser parser, int initialDepth) + public ExtensionElement parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException { - PacketExtension pepItem = null; + ExtensionElement pepItem = null; boolean done = false; while (!done) { int eventType = parser.next(); @@ -72,7 +72,7 @@ public class PEPProvider extends PacketExtensionProvider { // Figure out the node for this event. String node = parser.getAttributeValue("", "node"); // Get the parser for this kind of node, and if found then parse the node. - PacketExtensionProvider nodeParser = nodeParsers.get(node); + ExtensionElementProvider nodeParser = nodeParsers.get(node); if (nodeParser != null) { pepItem = nodeParser.parse(parser); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java index 3b539d918..391523e1a 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/PrivacyListManager.java @@ -35,8 +35,8 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.filter.AndFilter; import org.jivesoftware.smack.filter.IQResultReplyFilter; import org.jivesoftware.smack.filter.IQTypeFilter; -import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler; import org.jivesoftware.smack.iqrequest.IQRequestHandler.Mode; import org.jivesoftware.smack.packet.IQ; @@ -65,9 +65,9 @@ import org.jivesoftware.smackx.privacy.packet.PrivacyItem; public class PrivacyListManager extends Manager { public static final String NAMESPACE = Privacy.NAMESPACE; - public static final PacketFilter PRIVACY_FILTER = new PacketTypeFilter(Privacy.class); + public static final StanzaFilter PRIVACY_FILTER = new StanzaTypeFilter(Privacy.class); - private static final PacketFilter PRIVACY_RESULT = new AndFilter(IQTypeFilter.RESULT, PRIVACY_FILTER); + private static final StanzaFilter PRIVACY_RESULT = new AndFilter(IQTypeFilter.RESULT, PRIVACY_FILTER); // Keep the list of instances of this class. private static final Map INSTANCES = new WeakHashMap(); @@ -128,7 +128,7 @@ public class PrivacyListManager extends Manager { public void processPacket(Stanza packet) throws NotConnectedException { XMPPConnection connection = connection(); Privacy privacy = (Privacy) packet; - PacketFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection); + StanzaFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection); final String activeListName = privacy.getActiveName(); final boolean declinceActiveList = privacy.isDeclineActiveList(); connection.addOneTimeSyncCallback(new PacketListener() { @@ -150,7 +150,7 @@ public class PrivacyListManager extends Manager { public void processPacket(Stanza packet) throws NotConnectedException { XMPPConnection connection = connection(); Privacy privacy = (Privacy) packet; - PacketFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection); + StanzaFilter iqResultReplyFilter = new IQResultReplyFilter(privacy, connection); final String defaultListName = privacy.getDefaultName(); final boolean declinceDefaultList = privacy.isDeclineDefaultList(); connection.addOneTimeSyncCallback(new PacketListener() { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/filter/SetActiveListFilter.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/filter/SetActiveListFilter.java index 2499cc88c..9699ce3cb 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/filter/SetActiveListFilter.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/filter/SetActiveListFilter.java @@ -16,11 +16,11 @@ */ package org.jivesoftware.smackx.privacy.filter; -import org.jivesoftware.smack.filter.FlexiblePacketTypeFilter; +import org.jivesoftware.smack.filter.FlexibleStanzaTypeFilter; import org.jivesoftware.smack.packet.IQ.Type; import org.jivesoftware.smackx.privacy.packet.Privacy; -public class SetActiveListFilter extends FlexiblePacketTypeFilter { +public class SetActiveListFilter extends FlexibleStanzaTypeFilter { public static final SetActiveListFilter INSTANCE = new SetActiveListFilter(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/filter/SetDefaultListFilter.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/filter/SetDefaultListFilter.java index cac736902..5988d1427 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/filter/SetDefaultListFilter.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/privacy/filter/SetDefaultListFilter.java @@ -16,11 +16,11 @@ */ package org.jivesoftware.smackx.privacy.filter; -import org.jivesoftware.smack.filter.FlexiblePacketTypeFilter; +import org.jivesoftware.smack.filter.FlexibleStanzaTypeFilter; import org.jivesoftware.smack.packet.IQ.Type; import org.jivesoftware.smackx.privacy.packet.Privacy; -public class SetDefaultListFilter extends FlexiblePacketTypeFilter { +public class SetDefaultListFilter extends FlexibleStanzaTypeFilter { public static final SetDefaultListFilter INSTANCE = new SetDefaultListFilter(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Affiliation.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Affiliation.java index ce4159b7c..8686dab6d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Affiliation.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Affiliation.java @@ -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; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigurationEvent.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigurationEvent.java index 0b26decd8..8e0b5444a 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigurationEvent.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ConfigurationEvent.java @@ -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 configuration element of a pubsub message event which @@ -49,11 +49,11 @@ public class ConfigurationEvent extends NodeExtension implements EmbeddedPacketE return form; } - public List getExtensions() + public List getExtensions() { if (getConfiguration() == null) return Collections.emptyList(); else - return Arrays.asList(((PacketExtension)getConfiguration().getDataFormToSend())); + return Arrays.asList(((ExtensionElement)getConfiguration().getDataFormToSend())); } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EmbeddedPacketExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EmbeddedPacketExtension.java index 546536c6e..969441137 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EmbeddedPacketExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EmbeddedPacketExtension.java @@ -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 getExtensions(); + List getExtensions(); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElement.java index b3e0b136b..8684085ae 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/EventElement.java @@ -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 getExtensions() + public List getExtensions() { - return Arrays.asList(new PacketExtension[]{getEvent()}); + return Arrays.asList(new ExtensionElement[]{getEvent()}); } public NodeExtension getEvent() diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemsExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemsExtension.java index 64dca28dd..2f273e77f 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemsExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/ItemsExtension.java @@ -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 items; + protected List 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 items) + public ItemsExtension(ItemsElementType itemsType, String nodeId, List 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 items, boolean notify) + public ItemsExtension(String nodeId, List 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 getExtensions() + public List getExtensions() { - return (List)getItems(); + return (List)getItems(); } /** @@ -135,7 +135,7 @@ public class ItemsExtension extends NodeExtension implements EmbeddedPacketExten * * return List of {@link Item}, {@link RetractItem}, or null */ - public List getItems() + public List 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()); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java index ee9aa2777..cf3b98ff5 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/LeafNode.java @@ -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 List getItems() throws NoResponseException, XMPPErrorException, NotConnectedException { - return getItems((List) null, (List) null); + return getItems((List) null, (List) null); } /** @@ -169,8 +169,8 @@ public class LeafNode extends Node * @throws XMPPErrorException * @throws NotConnectedException */ - public List getItems(List additionalExtensions, - List returnedExtensions) throws NoResponseException, + public List getItems(List additionalExtensions, + List 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 List getItems(PubSub request, - List returnedExtensions) throws NoResponseException, + List returnedExtensions) throws NoResponseException, XMPPErrorException, NotConnectedException { PubSub result = con.createPacketCollectorAndSend(request).nextResultOrThrow(); ItemsExtension itemsElem = result.getExtension(PubSubElementType.ITEMS); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java index 8c4a57900..088f11c65 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/Node.java @@ -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 getSubscriptions(List additionalExtensions, Collection returnedExtensions) + public List getSubscriptions(List additionalExtensions, Collection returnedExtensions) throws NoResponseException, XMPPErrorException, NotConnectedException { return getSubscriptions(additionalExtensions, returnedExtensions, null); } @@ -206,18 +206,18 @@ abstract public class Node * Retrieve Subscriptions List * @since 4.1 */ - public List getSubscriptionsAsOwner(List additionalExtensions, - Collection returnedExtensions) throws NoResponseException, XMPPErrorException, + public List getSubscriptionsAsOwner(List additionalExtensions, + Collection returnedExtensions) throws NoResponseException, XMPPErrorException, NotConnectedException { return getSubscriptions(additionalExtensions, returnedExtensions, PubSubNamespace.OWNER); } - private List getSubscriptions(List additionalExtensions, - Collection returnedExtensions, PubSubNamespace pubSubNamespace) + private List getSubscriptions(List additionalExtensions, + Collection 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 getAffiliations(List additionalExtensions, Collection returnedExtensions) + public List getAffiliations(List additionalExtensions, Collection 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 extList = event.getExtensions(); + List 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 secondLevelList = ((EmbeddedPacketExtension)embedEvent).getExtensions(); + List secondLevelList = ((EmbeddedPacketExtension)embedEvent).getExtensions(); if (secondLevelList.size() > 0 && secondLevelList.get(0).getElementName().equals(secondElement)) return true; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeExtension.java index a707f642a..a115eaa35 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/NodeExtension.java @@ -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; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PayloadItem.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PayloadItem.java index e8b7eebd1..e0f5865f1 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PayloadItem.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PayloadItem.java @@ -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 extends Item +public class PayloadItem extends Item { private E payload; /** * Create an Item 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 extends Item * Create an Item 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 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 extends Item * Get the payload associated with this Item. 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() { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java index 5c12865bf..fa509dc69 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/PubSubManager.java @@ -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 extList, PubSubNamespace ns) throws NoResponseException, XMPPErrorException, NotConnectedException + static PubSub sendPubsubPacket(XMPPConnection con, String to, Type type, List 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); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/RetractItem.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/RetractItem.java index 7f32965ff..4f20a5597 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/RetractItem.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/RetractItem.java @@ -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; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SimplePayload.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SimplePayload.java index 689b5e9cb..40296b918 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SimplePayload.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/SimplePayload.java @@ -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; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/packet/PubSub.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/packet/PubSub.java index ed979cc82..1684f188b 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/packet/PubSub.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/packet/PubSub.java @@ -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 getExtension(PubSubElementType elem) + public 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; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/AffiliationProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/AffiliationProvider.java index df4659c75..03dfcfa1d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/AffiliationProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/AffiliationProvider.java @@ -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 { @Override - protected Affiliation createReturnExtension(String currentElement, String currentNamespace, Map attributeMap, List content) + protected Affiliation createReturnExtension(String currentElement, String currentNamespace, Map attributeMap, List content) { return new Affiliation(attributeMap.get("node"), Affiliation.Type.valueOf(attributeMap.get("affiliation"))); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/AffiliationsProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/AffiliationsProvider.java index 35b4bde5c..195cbc8a7 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/AffiliationsProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/AffiliationsProvider.java @@ -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 attributeMap, List content) + protected AffiliationsExtension createReturnExtension(String currentElement, String currentNamespace, Map attributeMap, List content) { return new AffiliationsExtension((List)content); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ConfigEventProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ConfigEventProvider.java index 8b2044732..e6cb6f7ca 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ConfigEventProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ConfigEventProvider.java @@ -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 { @Override - protected ConfigurationEvent createReturnExtension(String currentElement, String currentNamespace, Map attMap, List content) + protected ConfigurationEvent createReturnExtension(String currentElement, String currentNamespace, Map attMap, List content) { if (content.size() == 0) return new ConfigurationEvent(attMap.get("node")); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/EventProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/EventProvider.java index 621bab98a..2fbcb9373 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/EventProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/EventProvider.java @@ -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 { @Override - protected EventElement createReturnExtension(String currentElement, String currentNamespace, Map attMap, List content) + protected EventElement createReturnExtension(String currentElement, String currentNamespace, Map attMap, List content) { return new EventElement(EventElementType.valueOf(content.get(0).getElementName()), (NodeExtension)content.get(0)); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/FormNodeProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/FormNodeProvider.java index 8bb2d0613..86f16bd6e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/FormNodeProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/FormNodeProvider.java @@ -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 { @Override - protected FormNode createReturnExtension(String currentElement, String currentNamespace, Map attributeMap, List content) + protected FormNode createReturnExtension(String currentElement, String currentNamespace, Map attributeMap, List content) { return new FormNode(FormNodeType.valueOfFromElementName(currentElement, currentNamespace), attributeMap.get("node"), new Form((DataForm)content.iterator().next())); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java index 17a170cb1..490d104b2 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemProvider.java @@ -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 item 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 smack.providers for its element name and namespace. If no + * {@link ExtensionElementProvider} is registered in smack.providers 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 +public class ItemProvider extends ExtensionElementProvider { @Override public Item parse(XmlPullParser parser, int initialDepth) @@ -57,7 +57,7 @@ public class ItemProvider extends PacketExtensionProvider String payloadElemName = parser.getName(); String payloadNS = parser.getNamespace(); - final PacketExtensionProvider extensionProvider = ProviderManager.getExtensionProvider(payloadElemName, payloadNS); + final ExtensionElementProvider extensionProvider = ProviderManager.getExtensionProvider(payloadElemName, payloadNS); if (extensionProvider == null) { CharSequence payloadText = PacketParserUtils.parseElement(parser, true); @@ -65,7 +65,7 @@ public class ItemProvider extends PacketExtensionProvider } else { - return new PayloadItem(id, node, extensionProvider.parse(parser)); + return new PayloadItem(id, node, extensionProvider.parse(parser)); } } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemsProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemsProvider.java index 4a13d86c3..6c52862d3 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemsProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/ItemsProvider.java @@ -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 { @Override - protected ItemsExtension createReturnExtension(String currentElement, String currentNamespace, Map attributeMap, List content) + protected ItemsExtension createReturnExtension(String currentElement, String currentNamespace, Map attributeMap, List content) { return new ItemsExtension(ItemsExtension.ItemsElementType.items, attributeMap.get("node"), content); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/PubSubProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/PubSubProvider.java index 43a357ddc..48730b8be 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/PubSubProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/PubSubProvider.java @@ -47,7 +47,7 @@ public class PubSubProvider extends IQProvider 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) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/RetractEventProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/RetractEventProvider.java index 583422c72..f329caf0d 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/RetractEventProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/RetractEventProvider.java @@ -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 { @Override - protected RetractItem createReturnExtension(String currentElement, String currentNamespace, Map attributeMap, List content) + protected RetractItem createReturnExtension(String currentElement, String currentNamespace, Map attributeMap, List content) { return new RetractItem(attributeMap.get("id")); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SimpleNodeProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SimpleNodeProvider.java index 0e586574c..31782fa11 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SimpleNodeProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SimpleNodeProvider.java @@ -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 { @Override - protected NodeExtension createReturnExtension(String currentElement, String currentNamespace, Map attributeMap, List content) + protected NodeExtension createReturnExtension(String currentElement, String currentNamespace, Map attributeMap, List content) { return new NodeExtension(PubSubElementType.valueOfFromElemName(currentElement, currentNamespace), attributeMap.get("node")); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SubscriptionProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SubscriptionProvider.java index 8ae2d6981..b5c87ea4f 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SubscriptionProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SubscriptionProvider.java @@ -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 +public class SubscriptionProvider extends ExtensionElementProvider { @Override public Subscription parse(XmlPullParser parser, int initialDepth) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SubscriptionsProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SubscriptionsProvider.java index e65878b0f..69e4fb183 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SubscriptionsProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/pubsub/provider/SubscriptionsProvider.java @@ -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 attributeMap, List content) + protected SubscriptionsExtension createReturnExtension(String currentElement, String currentNamespace, Map attributeMap, List content) { return new SubscriptionsExtension(attributeMap.get("node"), (List)content); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceipt.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceipt.java index 43de59616..6b239da84 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceipt.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceipt.java @@ -20,7 +20,7 @@ import java.util.List; import java.util.Map; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.provider.EmbeddedExtensionProvider; import org.jivesoftware.smack.util.XmlStringBuilder; @@ -30,7 +30,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder; * * @author Georg Lukas */ -public class DeliveryReceipt implements PacketExtension +public class DeliveryReceipt implements ExtensionElement { public static final String NAMESPACE = "urn:xmpp:receipts"; public static final String ELEMENT = "received"; @@ -101,7 +101,7 @@ public class DeliveryReceipt implements PacketExtension @Override protected DeliveryReceipt createReturnExtension(String currentElement, String currentNamespace, - Map attributeMap, List content) + Map attributeMap, List content) { return new DeliveryReceipt(attributeMap.get("id")); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java index 7393c4bd5..2e6e5cfa0 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptManager.java @@ -31,9 +31,9 @@ import org.jivesoftware.smack.XMPPConnectionRegistry; import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.filter.AndFilter; import org.jivesoftware.smack.filter.MessageTypeFilter; -import org.jivesoftware.smack.filter.PacketExtensionFilter; -import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaFilter; +import org.jivesoftware.smack.filter.StanzaExtensionFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.roster.Roster; @@ -67,10 +67,10 @@ import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; */ public class DeliveryReceiptManager extends Manager { - private static final PacketFilter MESSAGES_WITH_DEVLIERY_RECEIPT_REQUEST = new AndFilter(PacketTypeFilter.MESSAGE, - new PacketExtensionFilter(new DeliveryReceiptRequest())); - private static final PacketFilter MESSAGES_WITH_DELIVERY_RECEIPT = new AndFilter(PacketTypeFilter.MESSAGE, - new PacketExtensionFilter(DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE)); + private static final StanzaFilter MESSAGES_WITH_DEVLIERY_RECEIPT_REQUEST = new AndFilter(StanzaTypeFilter.MESSAGE, + new StanzaExtensionFilter(new DeliveryReceiptRequest())); + private static final StanzaFilter MESSAGES_WITH_DELIVERY_RECEIPT = new AndFilter(StanzaTypeFilter.MESSAGE, + new StanzaExtensionFilter(DeliveryReceipt.ELEMENT, DeliveryReceipt.NAMESPACE)); private static Map instances = new WeakHashMap(); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptRequest.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptRequest.java index 6c467f043..622f003fb 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptRequest.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/receipts/DeliveryReceiptRequest.java @@ -20,9 +20,9 @@ import java.io.IOException; 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.id.StanzaIdUtil; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -32,7 +32,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Georg Lukas */ -public class DeliveryReceiptRequest implements PacketExtension +public class DeliveryReceiptRequest implements ExtensionElement { public static final String ELEMENT = "request"; @@ -93,7 +93,7 @@ public class DeliveryReceiptRequest implements PacketExtension /** * This Provider parses and returns DeliveryReceiptRequest packets. */ - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { @Override public DeliveryReceiptRequest parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/RSMManager.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/RSMManager.java index 8cb49adf1..dba8e662e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/RSMManager.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/RSMManager.java @@ -20,31 +20,31 @@ import java.util.Collection; import java.util.LinkedList; import java.util.List; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.PacketUtil; import org.jivesoftware.smackx.rsm.packet.RSMSet; import org.jivesoftware.smackx.rsm.packet.RSMSet.PageDirection; public class RSMManager { - Collection page(int max) { - List packetExtensions = new LinkedList(); + Collection page(int max) { + List packetExtensions = new LinkedList(); packetExtensions.add(new RSMSet(max)); return packetExtensions; } - Collection continuePage(int max, Collection returnedExtensions) { + Collection continuePage(int max, Collection returnedExtensions) { return continuePage(max, returnedExtensions, null); } - Collection continuePage(int max, - Collection returnedExtensions, - Collection additionalExtensions) { + Collection continuePage(int max, + Collection returnedExtensions, + Collection additionalExtensions) { if (returnedExtensions == null) { throw new IllegalArgumentException("returnedExtensions must no be null"); } if (additionalExtensions == null) { - additionalExtensions = new LinkedList(); + additionalExtensions = new LinkedList(); } RSMSet resultRsmSet = PacketUtil.extensionElementFrom(returnedExtensions, RSMSet.ELEMENT, RSMSet.NAMESPACE); if (resultRsmSet == null) { diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/packet/RSMSet.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/packet/RSMSet.java index dfb76f113..5f65b9b90 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/packet/RSMSet.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/packet/RSMSet.java @@ -17,10 +17,10 @@ package org.jivesoftware.smackx.rsm.packet; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; -public class RSMSet implements PacketExtension { +public class RSMSet implements ExtensionElement { public static final String ELEMENT = "set"; public static final String NAMESPACE = "http://jabber.org/protocol/rsm"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/provider/RSMSetProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/provider/RSMSetProvider.java index c9668cf43..8cc90bb24 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/provider/RSMSetProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/rsm/provider/RSMSetProvider.java @@ -18,13 +18,13 @@ package org.jivesoftware.smackx.rsm.provider; import java.io.IOException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smackx.rsm.packet.RSMSet; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -public class RSMSetProvider extends PacketExtensionProvider { +public class RSMSetProvider extends ExtensionElementProvider { @Override public RSMSet parse(XmlPullParser parser, int initialDepth) diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java index 5c58aa6dd..2df760b8e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/search/UserSearch.java @@ -141,7 +141,7 @@ public class UserSearch extends SimpleIQ { else if (eventType == XmlPullParser.START_TAG && parser.getNamespace().equals("jabber:x:data")) { // Otherwise, it must be a packet extension. search = new UserSearch(); - PacketParserUtils.addPacketExtension(search, parser); + PacketParserUtils.addExtensionElement(search, parser); } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals("query")) { @@ -194,7 +194,7 @@ public class UserSearch extends SimpleIQ { } } else if (eventType == XmlPullParser.START_TAG && parser.getNamespace().equals("jabber:x:data")) { - PacketParserUtils.addPacketExtension(search, parser); + PacketParserUtils.addExtensionElement(search, parser); done = true; } } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/Header.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/Header.java index 41840ef26..3b7613713 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/Header.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/Header.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.shim.packet; import org.jivesoftware.smack.packet.NamedElement; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; /** @@ -25,7 +25,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder; * @author Robin Collier */ -public class Header implements PacketExtension { +public class Header implements ExtensionElement { public static final String ELEMENT = "header"; private final String name; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/HeadersExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/HeadersExtension.java index ebaf1fa1a..14ae89c17 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/HeadersExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/packet/HeadersExtension.java @@ -20,7 +20,7 @@ import java.util.Collections; 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.XmlStringBuilder; /** @@ -30,7 +30,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder; * * @author Robin Collier */ -public class HeadersExtension implements PacketExtension { +public class HeadersExtension implements ExtensionElement { public static final String ELEMENT = "headers"; public static final String NAMESPACE = "http://jabber.org/protocol/shim"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/provider/HeaderProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/provider/HeaderProvider.java index f43b8f846..800af7653 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/provider/HeaderProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/provider/HeaderProvider.java @@ -18,7 +18,7 @@ package org.jivesoftware.smackx.shim.provider; import java.io.IOException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.shim.packet.Header; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -28,7 +28,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Robin Collier */ -public class HeaderProvider extends PacketExtensionProvider

{ +public class HeaderProvider extends ExtensionElementProvider
{ @Override public Header parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { String name = parser.getAttributeValue(null, "name"); diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/provider/HeadersProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/provider/HeadersProvider.java index a1ca25a78..ca47147eb 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/provider/HeadersProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/shim/provider/HeadersProvider.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.shim.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.shim.packet.Header; import org.jivesoftware.smackx.shim.packet.HeadersExtension; @@ -35,7 +35,7 @@ public class HeadersProvider extends EmbeddedExtensionProvider @SuppressWarnings("unchecked") @Override protected HeadersExtension createReturnExtension(String currentElement, String currentNamespace, - Map attributeMap, List content) { + Map attributeMap, List content) { return new HeadersExtension((List
) content); } diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/si/packet/StreamInitiation.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/si/packet/StreamInitiation.java index bb405ee7b..b96368410 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/si/packet/StreamInitiation.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/si/packet/StreamInitiation.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.si.packet; import java.util.Date; import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.StringUtils; import org.jxmpp.util.XmppDateTime; import org.jivesoftware.smackx.xdata.packet.DataForm; @@ -195,7 +195,7 @@ public class StreamInitiation extends IQ { * * @author Alexander Wenckus */ - public static class File implements PacketExtension { + public static class File implements ExtensionElement { private final String name; @@ -370,7 +370,7 @@ public class StreamInitiation extends IQ { * @author Alexander Wenckus * */ - public class Feature implements PacketExtension { + public class Feature implements ExtensionElement { private final DataForm data; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java index 3323fedda..c439cb759 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/packet/DataForm.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.xdata.packet; import org.jivesoftware.smack.packet.Element; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smackx.xdata.FormField; @@ -34,7 +34,7 @@ import java.util.Locale; * * @author Gaston Dombiak */ -public class DataForm implements PacketExtension { +public class DataForm implements ExtensionElement { public static final String NAMESPACE = "jabber:x:data"; public static final String ELEMENT = "x"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/provider/DataFormProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/provider/DataFormProvider.java index e94775d00..3c44e3b8e 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/provider/DataFormProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdata/provider/DataFormProvider.java @@ -18,7 +18,7 @@ package org.jivesoftware.smackx.xdata.provider; import org.jivesoftware.smack.SmackException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.roster.packet.RosterPacket; import org.jivesoftware.smack.roster.provider.RosterPacketProvider; import org.jivesoftware.smackx.xdata.FormField; @@ -39,7 +39,7 @@ import java.util.List; * * @author Gaston Dombiak */ -public class DataFormProvider extends PacketExtensionProvider { +public class DataFormProvider extends ExtensionElementProvider { @Override public DataForm parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayout.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayout.java index bf42b39c1..d26732bc4 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayout.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatalayout/packet/DataLayout.java @@ -20,7 +20,7 @@ import java.util.ArrayList; import java.util.List; import org.jivesoftware.smack.packet.NamedElement; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; /** @@ -31,7 +31,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder; * * @author Anno van Vliet */ -public class DataLayout implements PacketExtension { +public class DataLayout implements ExtensionElement { public static final String ELEMENT = "page"; public static final String NAMESPACE = "http://jabber.org/protocol/xdata-layout"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatavalidation/packet/ValidateElement.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatavalidation/packet/ValidateElement.java index abe765ebb..2d0899e10 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatavalidation/packet/ValidateElement.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xdatavalidation/packet/ValidateElement.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.xdatavalidation.packet; import org.jivesoftware.smack.packet.NamedElement; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.NumberUtil; import org.jivesoftware.smack.util.StringUtils; import org.jivesoftware.smack.util.XmlStringBuilder; @@ -33,7 +33,7 @@ import org.jivesoftware.smackx.xdatavalidation.ValidationConsistencyException; * * @author Anno van Vliet */ -public abstract class ValidateElement implements PacketExtension { +public abstract class ValidateElement implements ExtensionElement { public static final String DATATYPE_XS_STRING = "xs:string"; public static final String ELEMENT = "validate"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/packet/XHTMLExtension.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/packet/XHTMLExtension.java index 41158f82d..3132e5d28 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/packet/XHTMLExtension.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/packet/XHTMLExtension.java @@ -18,7 +18,7 @@ package org.jivesoftware.smackx.xhtmlim.packet; import org.jivesoftware.smack.packet.Message; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; import java.util.ArrayList; @@ -35,7 +35,7 @@ import java.util.List; * * @author Gaston Dombiak */ -public class XHTMLExtension implements PacketExtension { +public class XHTMLExtension implements ExtensionElement { public static final String ELEMENT = "html"; public static final String NAMESPACE = "http://jabber.org/protocol/xhtml-im"; diff --git a/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProvider.java b/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProvider.java index 105a1f5b3..50634b0e4 100644 --- a/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProvider.java +++ b/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProvider.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.xhtmlim.provider; import org.jivesoftware.smack.packet.Message; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smackx.xhtmlim.packet.XHTMLExtension; import org.xmlpull.v1.XmlPullParser; @@ -30,7 +30,7 @@ import java.io.IOException; * * @author Florian Schmaus */ -public class XHTMLExtensionProvider extends PacketExtensionProvider { +public class XHTMLExtensionProvider extends ExtensionElementProvider { @Override public XHTMLExtension parse(XmlPullParser parser, int initialDepth) throws IOException, XmlPullParserException { diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/amp/AMPExtensionTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/amp/AMPExtensionTest.java index f7b8ef454..9b343c5a4 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/amp/AMPExtensionTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/amp/AMPExtensionTest.java @@ -16,7 +16,7 @@ */ package org.jivesoftware.smackx.amp; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smackx.amp.packet.AMPExtension; import org.jivesoftware.smackx.amp.provider.AMPExtensionProvider; import org.junit.Before; @@ -70,7 +70,7 @@ public class AMPExtensionTest { assertEquals(XmlPullParser.START_TAG, parser.next()); assertEquals(AMPExtension.ELEMENT, parser.getName()); - PacketExtension extension = ampProvider.parse(parser); + ExtensionElement extension = ampProvider.parse(parser); assertTrue(extension instanceof AMPExtension); AMPExtension amp = (AMPExtension) extension; @@ -89,7 +89,7 @@ public class AMPExtensionTest { assertEquals(XmlPullParser.START_TAG, parser.next()); assertEquals(AMPExtension.ELEMENT, parser.getName()); - PacketExtension extension = ampProvider.parse(parser); + ExtensionElement extension = ampProvider.parse(parser); assertTrue(extension instanceof AMPExtension); AMPExtension amp = (AMPExtension) extension; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ItemValidationTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ItemValidationTest.java index a12645a38..0c6ffc108 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ItemValidationTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/pubsub/ItemValidationTest.java @@ -22,7 +22,7 @@ import static org.junit.Assert.assertTrue; import org.jivesoftware.smack.ThreadedDummyConnection; import org.jivesoftware.smack.packet.Stanza; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smackx.InitExtensions; import org.jivesoftware.smackx.pubsub.packet.PubSubNamespace; @@ -104,7 +104,7 @@ public class ItemValidationTest extends InitExtensions { ""); Stanza message = PacketParserUtils.parseMessage(parser); - PacketExtension eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns()); + ExtensionElement eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns()); assertTrue(eventExt instanceof EventElement); EventElement event = (EventElement) eventExt; @@ -113,7 +113,7 @@ public class ItemValidationTest extends InitExtensions { assertTrue(event.getExtensions().get(0) instanceof ItemsExtension); assertEquals(1, ((ItemsExtension)event.getExtensions().get(0)).items.size()); - PacketExtension itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0); + ExtensionElement itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0); assertTrue(itemExt instanceof Item); assertEquals("testid1", ((Item)itemExt).getId()); } @@ -135,9 +135,9 @@ public class ItemValidationTest extends InitExtensions { ""); Stanza message = PacketParserUtils.parseMessage(parser); - PacketExtension eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns()); + ExtensionElement eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns()); EventElement event = (EventElement) eventExt; - PacketExtension itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0); + ExtensionElement itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0); assertTrue(itemExt instanceof PayloadItem); PayloadItem item = (PayloadItem)itemExt; @@ -182,9 +182,9 @@ public class ItemValidationTest extends InitExtensions { ""); Stanza message = PacketParserUtils.parseMessage(parser); - PacketExtension eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns()); + ExtensionElement eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns()); EventElement event = (EventElement) eventExt; - PacketExtension itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0); + ExtensionElement itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0); assertTrue(itemExt instanceof PayloadItem); PayloadItem item = (PayloadItem)itemExt; @@ -215,7 +215,7 @@ public class ItemValidationTest extends InitExtensions { ""); Stanza message = PacketParserUtils.parseMessage(parser); - PacketExtension eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns()); + ExtensionElement eventExt = message.getExtension(PubSubNamespace.EVENT.getXmlns()); assertTrue(eventExt instanceof EventElement); EventElement event = (EventElement) eventExt; @@ -224,7 +224,7 @@ public class ItemValidationTest extends InitExtensions { assertTrue(event.getExtensions().get(0) instanceof ItemsExtension); assertEquals(1, ((ItemsExtension)event.getExtensions().get(0)).items.size()); - PacketExtension itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0); + ExtensionElement itemExt = ((ItemsExtension)event.getExtensions().get(0)).items.get(0); assertTrue(itemExt instanceof PayloadItem); PayloadItem item = (PayloadItem)itemExt; diff --git a/smack-extensions/src/test/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProviderTest.java b/smack-extensions/src/test/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProviderTest.java index c81dc4ad7..3fd25cd36 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProviderTest.java +++ b/smack-extensions/src/test/java/org/jivesoftware/smackx/xhtmlim/provider/XHTMLExtensionProviderTest.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.xhtmlim.provider; import static org.jivesoftware.smack.test.util.CharsequenceEquals.equalsCharSequence; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.PacketParserUtils; import org.jivesoftware.smackx.xhtmlim.packet.XHTMLExtension; import org.junit.Test; @@ -40,7 +40,7 @@ public class XHTMLExtensionProviderTest { parser.next(); XHTMLExtensionProvider provider = new XHTMLExtensionProvider(); - PacketExtension extension = provider.parse(parser, parser.getDepth()); + ExtensionElement extension = provider.parse(parser, parser.getDepth()); assertThat(extension, instanceOf(XHTMLExtension.class)); XHTMLExtension attachmentsInfo = (XHTMLExtension) extension; diff --git a/smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java b/smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java index bba1cfed2..edd85e959 100644 --- a/smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java +++ b/smack-extensions/src/test/java/org/jivesoftware/util/ConnectionUtils.java @@ -27,7 +27,7 @@ import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException.XMPPErrorException; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.XMPPError; @@ -75,7 +75,7 @@ public class ConnectionUtils { // mock packet collector final PacketCollector collector = mock(PacketCollector.class); - when(connection.createPacketCollector(isA(PacketFilter.class))).thenReturn( + when(connection.createPacketCollector(isA(StanzaFilter.class))).thenReturn( collector); Answer collectorAndSend = new Answer() { @Override diff --git a/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java b/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java index 778ca8598..72e826587 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/chat/ChatManager.java @@ -32,11 +32,11 @@ import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.filter.AndFilter; -import org.jivesoftware.smack.filter.FlexiblePacketTypeFilter; +import org.jivesoftware.smack.filter.FlexibleStanzaTypeFilter; import org.jivesoftware.smack.filter.FromMatchesFilter; import org.jivesoftware.smack.filter.MessageTypeFilter; import org.jivesoftware.smack.filter.OrFilter; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.filter.ThreadFilter; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Message.Type; @@ -97,7 +97,7 @@ public class ChatManager extends Manager{ BARE_JID; } - private final PacketFilter packetFilter = new OrFilter(MessageTypeFilter.CHAT, new FlexiblePacketTypeFilter() { + private final StanzaFilter packetFilter = new OrFilter(MessageTypeFilter.CHAT, new FlexibleStanzaTypeFilter() { @Override protected boolean acceptSpecific(Message message) { @@ -134,8 +134,8 @@ public class ChatManager extends Manager{ private Set chatManagerListeners = new CopyOnWriteArraySet(); - private Map interceptors - = new WeakHashMap(); + private Map interceptors + = new WeakHashMap(); private ChatManager(XMPPConnection connection) { super(connection); @@ -352,8 +352,8 @@ public class ChatManager extends Manager{ } void sendMessage(Chat chat, Message message) throws NotConnectedException { - for(Map.Entry interceptor : interceptors.entrySet()) { - PacketFilter filter = interceptor.getValue(); + for(Map.Entry interceptor : interceptors.entrySet()) { + StanzaFilter filter = interceptor.getValue(); if(filter != null && filter.accept(message)) { interceptor.getKey().processMessage(message); } @@ -379,7 +379,7 @@ public class ChatManager extends Manager{ addOutgoingMessageInterceptor(messageInterceptor, null); } - public void addOutgoingMessageInterceptor(MessageListener messageInterceptor, PacketFilter filter) { + public void addOutgoingMessageInterceptor(MessageListener messageInterceptor, StanzaFilter filter) { if (messageInterceptor == null) { return; } diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java index 06a63392f..afbf43250 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/Roster.java @@ -46,8 +46,8 @@ import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.SmackException.NotLoggedInException; import org.jivesoftware.smack.XMPPConnectionRegistry; import org.jivesoftware.smack.XMPPException.XMPPErrorException; -import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.iqrequest.AbstractIqRequestHandler; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.IQ.Type; @@ -112,7 +112,7 @@ public class Roster extends Manager { return roster; } - private static final PacketFilter PRESENCE_PACKET_FILTER = new PacketTypeFilter(Presence.class); + private static final StanzaFilter PRESENCE_PACKET_FILTER = StanzaTypeFilter.PRESENCE; private static boolean rosterLoadedAtLoginDefault = true; diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterVer.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterVer.java index 91a1cb7fd..7a0c55cb5 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterVer.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/packet/RosterVer.java @@ -16,10 +16,10 @@ */ package org.jivesoftware.smack.roster.packet; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.util.XmlStringBuilder; -public class RosterVer implements PacketExtension { +public class RosterVer implements ExtensionElement { public static final String ELEMENT = "ver"; public static final String NAMESPACE = "urn:xmpp:features:rosterver"; diff --git a/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/RosterVerStreamFeatureProvider.java b/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/RosterVerStreamFeatureProvider.java index f59a61706..fe741277f 100644 --- a/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/RosterVerStreamFeatureProvider.java +++ b/smack-im/src/main/java/org/jivesoftware/smack/roster/provider/RosterVerStreamFeatureProvider.java @@ -19,12 +19,12 @@ package org.jivesoftware.smack.roster.provider; import java.io.IOException; import org.jivesoftware.smack.SmackException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.roster.packet.RosterVer; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -public class RosterVerStreamFeatureProvider extends PacketExtensionProvider { +public class RosterVerStreamFeatureProvider extends ExtensionElementProvider { @Override public RosterVer parse(XmlPullParser parser, int initialDepth) diff --git a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/provider/JingleProviderTest.java b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/provider/JingleProviderTest.java index 6d86a640f..bfc187e18 100644 --- a/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/provider/JingleProviderTest.java +++ b/smack-jingle-old/src/integration-test/java/org/jivesoftware/smackx/jingle/provider/JingleProviderTest.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.jingle.provider; import org.jivesoftware.smack.PacketCollector; import org.jivesoftware.smack.SmackConfiguration; import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.provider.IQProvider; import org.jivesoftware.smack.provider.ProviderManager; @@ -69,7 +69,7 @@ public class JingleProviderTest extends SmackTestCase { iqSent.setType(IQ.Type.get); // Create a filter and a collector... - PacketFilter filter = new PacketTypeFilter(IQ.class); + PacketFilter filter = new StanzaTypeFilter(IQ.class); PacketCollector collector = getConnection(0).createPacketCollector(filter); System.out.println("Testing if a Jingle IQ can be sent and received..."); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java index fb9f12957..8242eac9f 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleManager.java @@ -27,7 +27,7 @@ import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnectionRegistry; import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.Presence; @@ -441,7 +441,7 @@ public class JingleManager implements JingleSessionListener { * establish a new session. */ private void initJingleSessionRequestListeners() { - PacketFilter initRequestFilter = new PacketFilter() { + StanzaFilter initRequestFilter = new StanzaFilter() { // Return true if we accept this packet public boolean accept(Stanza pin) { if (pin instanceof IQ) { diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java index 99606c8b6..5dd80e2fa 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java @@ -30,7 +30,7 @@ import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPException; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.XMPPError; @@ -79,7 +79,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList PacketListener packetListener; - PacketFilter packetFilter; + StanzaFilter packetFilter; protected List jingleMediaManagers = null; @@ -676,7 +676,7 @@ public class JingleSession extends JingleNegotiator implements MediaReceivedList } }; - packetFilter = new PacketFilter() { + packetFilter = new StanzaFilter() { public boolean accept(Stanza packet) { if (packet instanceof IQ) { diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContent.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContent.java index e689a9d23..f57e75470 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContent.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContent.java @@ -21,14 +21,14 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; /** * Jingle content. * * @author Jeff Williams */ -public class JingleContent implements PacketExtension { +public class JingleContent implements ExtensionElement { public static final String NODENAME = "content"; public static final String CREATOR = "creator"; diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentDescription.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentDescription.java index ccceef77e..1fca00466 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentDescription.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentDescription.java @@ -16,7 +16,7 @@ */ package org.jivesoftware.smackx.jingleold.packet; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smackx.jingleold.media.PayloadType; import java.util.ArrayList; @@ -29,7 +29,7 @@ import java.util.List; * * @author Alvaro Saurin */ -public abstract class JingleContentDescription implements PacketExtension { +public abstract class JingleContentDescription implements ExtensionElement { // static diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentInfo.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentInfo.java index d38c9e3e4..3e32b794b 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentInfo.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleContentInfo.java @@ -16,7 +16,7 @@ */ package org.jivesoftware.smackx.jingleold.packet; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smackx.jingleold.media.ContentInfo; /** @@ -24,7 +24,7 @@ import org.jivesoftware.smackx.jingleold.media.ContentInfo; * * @author Alvaro Saurin */ -public class JingleContentInfo implements PacketExtension { +public class JingleContentInfo implements ExtensionElement { protected ContentInfo mediaInfoElement; diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleDescription.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleDescription.java index b15004b3b..f8c106d98 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleDescription.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleDescription.java @@ -22,7 +22,7 @@ import java.util.Iterator; import java.util.List; import java.util.logging.Logger; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smackx.jingleold.media.PayloadType; /** @@ -30,7 +30,7 @@ import org.jivesoftware.smackx.jingleold.media.PayloadType; * * @author Alvaro Saurin */ -public abstract class JingleDescription implements PacketExtension { +public abstract class JingleDescription implements ExtensionElement { private static final Logger LOGGER = Logger.getLogger(JingleDescription.class.getName()); diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleError.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleError.java index 7562165fb..e868ebede 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleError.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleError.java @@ -19,12 +19,12 @@ package org.jivesoftware.smackx.jingleold.packet; import java.util.Locale; -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.smackx.jingleold.media.ContentInfo; import org.xmlpull.v1.XmlPullParser; -public class JingleError implements PacketExtension { +public class JingleError implements ExtensionElement { public static String NAMESPACE = "urn:xmpp:tmp:jingle:errors"; @@ -122,9 +122,9 @@ public class JingleError implements PacketExtension { return NAMESPACE; } - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { - private PacketExtension audioInfo; + private ExtensionElement audioInfo; /** * Empty constructor. @@ -136,8 +136,8 @@ public class JingleError implements PacketExtension { * Parse a JingleDescription.Audio extension. */ @Override - public PacketExtension parse(XmlPullParser parser, int initialDepth) { - PacketExtension result = null; + public ExtensionElement parse(XmlPullParser parser, int initialDepth) { + ExtensionElement result = null; if (audioInfo != null) { result = audioInfo; diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleTransport.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleTransport.java index a5303f24c..67d6e72a1 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleTransport.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/packet/JingleTransport.java @@ -16,7 +16,7 @@ */ package org.jivesoftware.smackx.jingleold.packet; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smackx.jingleold.nat.ICECandidate; import org.jivesoftware.smackx.jingleold.nat.TransportCandidate; @@ -30,7 +30,7 @@ import java.util.List; * * @author Alvaro Saurin */ -public class JingleTransport implements PacketExtension { +public class JingleTransport implements ExtensionElement { // static diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentDescriptionProvider.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentDescriptionProvider.java index 720c9e421..966c71dfd 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentDescriptionProvider.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentDescriptionProvider.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.jingleold.provider; import java.io.IOException; import org.jivesoftware.smack.SmackException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.jingleold.media.PayloadType; import org.jivesoftware.smackx.jingleold.packet.JingleContentDescription; import org.jivesoftware.smackx.jingleold.packet.JingleContentDescription.JinglePayloadType; @@ -31,7 +31,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Alvaro Saurin */ -public abstract class JingleContentDescriptionProvider extends PacketExtensionProvider { +public abstract class JingleContentDescriptionProvider extends ExtensionElementProvider { /** * Parse a iq/jingle/description/payload-type element. diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentInfoProvider.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentInfoProvider.java index 87f9555ca..5c492f442 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentInfoProvider.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentInfoProvider.java @@ -16,8 +16,8 @@ */ package org.jivesoftware.smackx.jingleold.provider; -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.smackx.jingleold.media.ContentInfo; import org.jivesoftware.smackx.jingleold.packet.JingleContentInfo; import org.xmlpull.v1.XmlPullParser; @@ -32,9 +32,9 @@ public class JingleContentInfoProvider { /** * JingleDescription.Audio info provider */ - public static class Audio extends PacketExtensionProvider { + public static class Audio extends ExtensionElementProvider { - private final PacketExtension audioInfo; + private final ExtensionElement audioInfo; /** * Empty constructor. @@ -48,7 +48,7 @@ public class JingleContentInfoProvider { * * @param audioInfo the jmf info */ - public Audio(final PacketExtension audioInfo) { + public Audio(final ExtensionElement audioInfo) { super(); this.audioInfo = audioInfo; } @@ -57,8 +57,8 @@ public class JingleContentInfoProvider { * Parse a JingleDescription.Audio extension. */ @Override - public PacketExtension parse(XmlPullParser parser, int initialDepth) { - PacketExtension result = null; + public ExtensionElement parse(XmlPullParser parser, int initialDepth) { + ExtensionElement result = null; if (audioInfo != null) { result = audioInfo; diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentProvider.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentProvider.java index 1895512ae..382c743c6 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentProvider.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleContentProvider.java @@ -16,7 +16,7 @@ */ package org.jivesoftware.smackx.jingleold.provider; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.jingleold.packet.JingleContent; import org.xmlpull.v1.XmlPullParser; @@ -25,7 +25,7 @@ import org.xmlpull.v1.XmlPullParser; * * @author Jeff Williams */ -public class JingleContentProvider extends PacketExtensionProvider { +public class JingleContentProvider extends ExtensionElementProvider { /** * Parse a JingleContent extension. diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleDescriptionProvider.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleDescriptionProvider.java index a4b7644fa..c81b9339c 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleDescriptionProvider.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleDescriptionProvider.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.jingleold.provider; import java.io.IOException; import org.jivesoftware.smack.SmackException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.jingleold.media.PayloadType; import org.jivesoftware.smackx.jingleold.packet.JingleDescription; import org.xmlpull.v1.XmlPullParser; @@ -30,7 +30,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Alvaro Saurin */ -public abstract class JingleDescriptionProvider extends PacketExtensionProvider { +public abstract class JingleDescriptionProvider extends ExtensionElementProvider { /** * Parse a iq/jingle/description/payload-type element. diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleProvider.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleProvider.java index 1a9a41e19..41926e641 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleProvider.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleProvider.java @@ -21,7 +21,7 @@ import java.io.IOException; import org.jivesoftware.smack.SmackException; import org.jivesoftware.smack.provider.IQProvider; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.jingleold.JingleActionEnum; import org.jivesoftware.smackx.jingleold.packet.Jingle; import org.jivesoftware.smackx.jingleold.packet.JingleContent; @@ -61,7 +61,7 @@ public class JingleProvider extends IQProvider { JingleDescriptionProvider jdpAudio = new JingleDescriptionProvider.Audio(); JingleTransportProvider jtpRawUdp = new JingleTransportProvider.RawUdp(); JingleTransportProvider jtpIce = new JingleTransportProvider.Ice(); - PacketExtensionProvider jmipAudio = new JingleContentInfoProvider.Audio(); + ExtensionElementProvider jmipAudio = new JingleContentInfoProvider.Audio(); int eventType; String elementName; diff --git a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleTransportProvider.java b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleTransportProvider.java index fa5aaa7b3..0c2fad5ac 100644 --- a/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleTransportProvider.java +++ b/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/provider/JingleTransportProvider.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.jingleold.provider; import java.io.IOException; import org.jivesoftware.smack.SmackException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.jingleold.nat.ICECandidate; import org.jivesoftware.smackx.jingleold.nat.TransportCandidate; import org.jivesoftware.smackx.jingleold.packet.JingleTransport; @@ -32,7 +32,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Alvaro Saurin */ -public abstract class JingleTransportProvider extends PacketExtensionProvider { +public abstract class JingleTransportProvider extends ExtensionElementProvider { /** * Obtain the corresponding TransportNegotiator instance. diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/MetaData.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/MetaData.java index 37d953220..528e16632 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/MetaData.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/MetaData.java @@ -22,12 +22,12 @@ import java.util.Map; import org.jivesoftware.smackx.workgroup.util.MetaDataUtils; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; /** * MetaData packet extension. */ -public class MetaData implements PacketExtension { +public class MetaData implements ExtensionElement { /** * Element name of the packet extension. diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java index f5a475fca..8363717e2 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java @@ -22,8 +22,8 @@ import org.jivesoftware.smackx.workgroup.packet.AgentStatusRequest; import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.packet.Presence; import org.jxmpp.util.XmppStringUtils; @@ -73,11 +73,11 @@ public class AgentRoster { listeners = new ArrayList(); presenceMap = new HashMap>(); // Listen for any roster packets. - PacketFilter rosterFilter = new PacketTypeFilter(AgentStatusRequest.class); + StanzaFilter rosterFilter = new StanzaTypeFilter(AgentStatusRequest.class); connection.addAsyncPacketListener(new AgentStatusListener(), rosterFilter); // Listen for any presence packets. connection.addAsyncPacketListener(new PresencePacketListener(), - new PacketTypeFilter(Presence.class)); + new StanzaTypeFilter(Presence.class)); // Send request for roster. AgentStatusRequest request = new AgentStatusRequest(); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java index b23ccd277..96d04357d 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentSession.java @@ -40,8 +40,8 @@ import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.filter.AndFilter; import org.jivesoftware.smack.filter.FromMatchesFilter; import org.jivesoftware.smack.filter.OrFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; -import org.jivesoftware.smack.packet.DefaultPacketExtension; +import org.jivesoftware.smack.filter.StanzaTypeFilter; +import org.jivesoftware.smack.packet.DefaultExtensionElement; import org.jivesoftware.smack.packet.IQ; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Stanza; @@ -142,10 +142,10 @@ public class AgentSession { // Create a filter to listen for packets we're interested in. OrFilter filter = new OrFilter( - new PacketTypeFilter(OfferRequestProvider.OfferRequestPacket.class), - new PacketTypeFilter(OfferRevokeProvider.OfferRevokePacket.class), - new PacketTypeFilter(Presence.class), - new PacketTypeFilter(Message.class)); + new StanzaTypeFilter(OfferRequestProvider.OfferRequestPacket.class), + new StanzaTypeFilter(OfferRevokeProvider.OfferRevokePacket.class), + new StanzaTypeFilter(Presence.class), + new StanzaTypeFilter(Message.class)); packetListener = new PacketListener() { public void processPacket(Stanza packet) { @@ -298,11 +298,11 @@ public class AgentSession { if (online) { presence = new Presence(Presence.Type.available); presence.setTo(workgroupJID); - presence.addExtension(new DefaultPacketExtension(AgentStatus.ELEMENT_NAME, + presence.addExtension(new DefaultExtensionElement(AgentStatus.ELEMENT_NAME, AgentStatus.NAMESPACE)); PacketCollector collector = this.connection.createPacketCollectorAndSend(new AndFilter( - new PacketTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)), presence); + new StanzaTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)), presence); presence = (Presence)collector.nextResultOrThrow(); @@ -316,7 +316,7 @@ public class AgentSession { presence = new Presence(Presence.Type.unavailable); presence.setTo(workgroupJID); - presence.addExtension(new DefaultPacketExtension(AgentStatus.ELEMENT_NAME, + presence.addExtension(new DefaultExtensionElement(AgentStatus.ELEMENT_NAME, AgentStatus.NAMESPACE)); connection.sendPacket(presence); } @@ -394,14 +394,14 @@ public class AgentSession { presence.setStatus(status); } // Send information about max chats and current chats as a packet extension. - DefaultPacketExtension agentStatus = new DefaultPacketExtension(AgentStatus.ELEMENT_NAME, + DefaultExtensionElement agentStatus = new DefaultExtensionElement(AgentStatus.ELEMENT_NAME, AgentStatus.NAMESPACE); agentStatus.setValue("max-chats", "" + maxChats); presence.addExtension(agentStatus); presence.addExtension(new MetaData(this.metaData)); PacketCollector collector = this.connection.createPacketCollectorAndSend(new AndFilter( - new PacketTypeFilter(Presence.class), + new StanzaTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)), presence); collector.nextResultOrThrow(); @@ -444,7 +444,7 @@ public class AgentSession { } presence.addExtension(new MetaData(this.metaData)); - PacketCollector collector = this.connection.createPacketCollectorAndSend(new AndFilter(new PacketTypeFilter(Presence.class), + PacketCollector collector = this.connection.createPacketCollectorAndSend(new AndFilter(new StanzaTypeFilter(Presence.class), FromMatchesFilter.create(workgroupJID)), presence); collector.nextResultOrThrow(); @@ -741,7 +741,7 @@ public class AgentSession { } // Notify agent packets gives an overview of agent activity in a queue. - DefaultPacketExtension notifyAgents = (DefaultPacketExtension)presence.getExtension("notify-agents", "http://jabber.org/protocol/workgroup"); + DefaultExtensionElement notifyAgents = (DefaultExtensionElement)presence.getExtension("notify-agents", "http://jabber.org/protocol/workgroup"); if (notifyAgents != null) { int currentChats = Integer.parseInt(notifyAgents.getValue("current-chats")); int maxChats = Integer.parseInt(notifyAgents.getValue("max-chats")); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/forms/WorkgroupForm.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/forms/WorkgroupForm.java index 31ca3dfc4..29c585151 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/forms/WorkgroupForm.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/ext/forms/WorkgroupForm.java @@ -60,7 +60,7 @@ public class WorkgroupForm extends SimpleIQ { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { // Parse the packet extension - PacketParserUtils.addPacketExtension(answer, parser); + PacketParserUtils.addExtensionElement(answer, parser); } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals(ELEMENT_NAME)) { diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/AgentStatus.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/AgentStatus.java index 360e595d6..63cb33148 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/AgentStatus.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/AgentStatus.java @@ -26,8 +26,8 @@ import java.util.Iterator; import java.util.List; import java.util.TimeZone; -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.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -36,7 +36,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Matt Tucker */ -public class AgentStatus implements PacketExtension { +public class AgentStatus implements ExtensionElement { private static final SimpleDateFormat UTC_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss"); @@ -223,7 +223,7 @@ public class AgentStatus implements PacketExtension { /** * Packet extension provider for AgentStatus packets. */ - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { @Override public AgentStatus parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException { diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/MetaDataProvider.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/MetaDataProvider.java index 4a1ad2c65..c9b6f8fc2 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/MetaDataProvider.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/MetaDataProvider.java @@ -23,7 +23,7 @@ import java.util.Map; import org.jivesoftware.smackx.workgroup.MetaData; import org.jivesoftware.smackx.workgroup.util.MetaDataUtils; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -32,7 +32,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author loki der quaeler */ -public class MetaDataProvider extends PacketExtensionProvider { +public class MetaDataProvider extends ExtensionElementProvider { /** * PacketExtensionProvider implementation diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java index eb6b9765e..e201daf83 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueDetails.java @@ -19,8 +19,8 @@ package org.jivesoftware.smackx.workgroup.packet; import org.jivesoftware.smackx.workgroup.QueueUser; 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.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -37,7 +37,7 @@ import java.util.logging.Logger; * Queue details packet extension, which contains details about the users * currently in a queue. */ -public class QueueDetails implements PacketExtension { +public class QueueDetails implements ExtensionElement { private static final Logger LOGGER = Logger.getLogger(QueueDetails.class.getName()); /** @@ -143,7 +143,7 @@ public class QueueDetails implements PacketExtension { /** * Provider class for QueueDetails packet extensions. */ - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { @Override public QueueDetails parse(XmlPullParser parser, diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueOverview.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueOverview.java index 8461c3303..2d9935a4a 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueOverview.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueOverview.java @@ -19,8 +19,8 @@ package org.jivesoftware.smackx.workgroup.packet; import org.jivesoftware.smackx.workgroup.agent.WorkgroupQueue; 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.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -29,7 +29,7 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; -public class QueueOverview implements PacketExtension { +public class QueueOverview implements ExtensionElement { /** * Element name of the packet extension. @@ -117,7 +117,7 @@ public class QueueOverview implements PacketExtension { return buf.toString(); } - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { @Override public QueueOverview parse(XmlPullParser parser, diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueUpdate.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueUpdate.java index db21ab904..debf402b4 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueUpdate.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/QueueUpdate.java @@ -19,8 +19,8 @@ package org.jivesoftware.smackx.workgroup.packet; import java.io.IOException; -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.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -29,7 +29,7 @@ import org.xmlpull.v1.XmlPullParserException; * status notifications -- position updates, and estimated time * left in the queue updates. */ -public class QueueUpdate implements PacketExtension { +public class QueueUpdate implements ExtensionElement { /** * Element name of the packet extension. @@ -90,7 +90,7 @@ public class QueueUpdate implements PacketExtension { return NAMESPACE; } - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { @Override public QueueUpdate parse(XmlPullParser parser, int initialDepth) diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomInvitation.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomInvitation.java index 8f4c587d8..c03544ef0 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomInvitation.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomInvitation.java @@ -20,9 +20,9 @@ package org.jivesoftware.smackx.workgroup.packet; import java.io.IOException; import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.util.XmlStringBuilder; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -32,7 +32,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Gaston Dombiak */ -public class RoomInvitation implements PacketExtension { +public class RoomInvitation implements ExtensionElement { /** * Element name of the packet extension. @@ -158,7 +158,7 @@ public class RoomInvitation implements PacketExtension { } } - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { @Override public RoomInvitation parse(XmlPullParser parser, diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomTransfer.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomTransfer.java index 6144f7a25..8b4b4d9d8 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomTransfer.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/RoomTransfer.java @@ -20,9 +20,9 @@ package org.jivesoftware.smackx.workgroup.packet; import java.io.IOException; import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.IQ.IQChildElementXmlStringBuilder; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.util.XmlStringBuilder; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -32,7 +32,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Gaston Dombiak */ -public class RoomTransfer implements PacketExtension { +public class RoomTransfer implements ExtensionElement { /** * Element name of the packet extension. @@ -158,7 +158,7 @@ public class RoomTransfer implements PacketExtension { } } - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { @Override public RoomTransfer parse(XmlPullParser parser, diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/SessionID.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/SessionID.java index 0930fd961..e869690cd 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/SessionID.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/SessionID.java @@ -19,12 +19,12 @@ package org.jivesoftware.smackx.workgroup.packet; import java.io.IOException; -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.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -public class SessionID implements PacketExtension { +public class SessionID implements ExtensionElement { /** * Element name of the packet extension. @@ -64,7 +64,7 @@ public class SessionID implements PacketExtension { return buf.toString(); } - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { @Override public SessionID parse(XmlPullParser parser, int initialDepth) diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/TranscriptSearch.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/TranscriptSearch.java index d3485fdd8..79fd4c2d1 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/TranscriptSearch.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/TranscriptSearch.java @@ -64,7 +64,7 @@ public class TranscriptSearch extends SimpleIQ { int eventType = parser.next(); if (eventType == XmlPullParser.START_TAG) { // Parse the packet extension - PacketParserUtils.addPacketExtension(answer, parser); + PacketParserUtils.addExtensionElement(answer, parser); } else if (eventType == XmlPullParser.END_TAG) { if (parser.getName().equals(ELEMENT_NAME)) { diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/UserID.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/UserID.java index 145a0519d..3e2a6499f 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/UserID.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/UserID.java @@ -19,12 +19,12 @@ package org.jivesoftware.smackx.workgroup.packet; import java.io.IOException; -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.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; -public class UserID implements PacketExtension { +public class UserID implements ExtensionElement { /** * Element name of the packet extension. @@ -64,7 +64,7 @@ public class UserID implements PacketExtension { return buf.toString(); } - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { @Override public UserID parse(XmlPullParser parser, int initialDepth) diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/WorkgroupInformation.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/WorkgroupInformation.java index 00a9208a8..9b19b2fb8 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/WorkgroupInformation.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/packet/WorkgroupInformation.java @@ -19,8 +19,8 @@ package org.jivesoftware.smackx.workgroup.packet; import java.io.IOException; -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.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -28,7 +28,7 @@ import org.xmlpull.v1.XmlPullParserException; * A packet extension that contains information about the user and agent in a * workgroup chat. The packet extension is attached to group chat invitations. */ -public class WorkgroupInformation implements PacketExtension { +public class WorkgroupInformation implements ExtensionElement { /** * Element name of the packet extension. @@ -68,7 +68,7 @@ public class WorkgroupInformation implements PacketExtension { return buf.toString(); } - public static class Provider extends PacketExtensionProvider { + public static class Provider extends ExtensionElementProvider { /** * PacketExtensionProvider implementation diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java index 25156da22..05d5b1b71 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/user/Workgroup.java @@ -31,12 +31,12 @@ import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.filter.AndFilter; import org.jivesoftware.smack.filter.FromMatchesFilter; -import org.jivesoftware.smack.filter.PacketFilter; -import org.jivesoftware.smack.filter.PacketTypeFilter; +import org.jivesoftware.smack.filter.StanzaFilter; +import org.jivesoftware.smack.filter.StanzaTypeFilter; import org.jivesoftware.smack.packet.IQ; 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.Presence; import org.jivesoftware.smackx.disco.ServiceDiscoveryManager; import org.jivesoftware.smackx.disco.packet.DiscoverInfo; @@ -140,7 +140,7 @@ public class Workgroup { }); // Register a packet listener for all the messages sent to this client. - PacketFilter typeFilter = new PacketTypeFilter(Message.class); + StanzaFilter typeFilter = new StanzaTypeFilter(Message.class); connection.addAsyncPacketListener(new PacketListener() { public void processPacket(Stanza packet) { @@ -179,8 +179,8 @@ public class Workgroup { public boolean isAvailable() throws NoResponseException, XMPPErrorException, NotConnectedException { Presence directedPresence = new Presence(Presence.Type.available); directedPresence.setTo(workgroupJID); - PacketFilter typeFilter = new PacketTypeFilter(Presence.class); - PacketFilter fromFilter = FromMatchesFilter.create(workgroupJID); + StanzaFilter typeFilter = new StanzaTypeFilter(Presence.class); + StanzaFilter fromFilter = FromMatchesFilter.create(workgroupJID); PacketCollector collector = connection.createPacketCollectorAndSend(new AndFilter(fromFilter, typeFilter), directedPresence); @@ -496,8 +496,8 @@ public class Workgroup { if (packet instanceof Message) { Message msg = (Message)packet; // Check to see if the user left the queue. - PacketExtension pe = msg.getExtension("depart-queue", "http://jabber.org/protocol/workgroup"); - PacketExtension queueStatus = msg.getExtension("queue-status", "http://jabber.org/protocol/workgroup"); + ExtensionElement pe = msg.getExtension("depart-queue", "http://jabber.org/protocol/workgroup"); + ExtensionElement queueStatus = msg.getExtension("queue-status", "http://jabber.org/protocol/workgroup"); if (pe != null) { fireQueueDepartedEvent(); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java index 732307bde..561ab508d 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/MessageEventManager.java @@ -32,8 +32,8 @@ import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.filter.AndFilter; import org.jivesoftware.smack.filter.MessageTypeFilter; import org.jivesoftware.smack.filter.NotFilter; -import org.jivesoftware.smack.filter.PacketExtensionFilter; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaExtensionFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smackx.xevent.packet.MessageEvent; @@ -52,7 +52,7 @@ public class MessageEventManager extends Manager { private static final Map INSTANCES = new WeakHashMap<>(); - private static final PacketFilter PACKET_FILTER = new AndFilter(new PacketExtensionFilter( + private static final StanzaFilter PACKET_FILTER = new AndFilter(new StanzaExtensionFilter( new MessageEvent()), new NotFilter(MessageTypeFilter.ERROR)); private List messageEventNotificationListeners = new CopyOnWriteArrayList(); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/packet/MessageEvent.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/packet/MessageEvent.java index 6d18c6ea8..a58c65474 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/packet/MessageEvent.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/packet/MessageEvent.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.xevent.packet; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import java.util.ArrayList; import java.util.List; @@ -53,7 +53,7 @@ import java.util.List; * * @author Gaston Dombiak */ -public class MessageEvent implements PacketExtension { +public class MessageEvent implements ExtensionElement { public static final String NAMESPACE = "jabber:x:event"; public static final String ELEMENT = "x"; diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/provider/MessageEventProvider.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/provider/MessageEventProvider.java index 1b9e4e413..ba2304b96 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/provider/MessageEventProvider.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xevent/provider/MessageEventProvider.java @@ -19,7 +19,7 @@ package org.jivesoftware.smackx.xevent.provider; import java.io.IOException; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.xevent.packet.MessageEvent; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -30,7 +30,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Gaston Dombiak */ -public class MessageEventProvider extends PacketExtensionProvider { +public class MessageEventProvider extends ExtensionElementProvider { /** * Parses a MessageEvent packet (extension sub-packet). diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/RosterExchangeManager.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/RosterExchangeManager.java index 5569c27de..09ccadab1 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/RosterExchangeManager.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/RosterExchangeManager.java @@ -27,8 +27,8 @@ import java.util.WeakHashMap; import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smack.SmackException.NotConnectedException; import org.jivesoftware.smack.XMPPConnection; -import org.jivesoftware.smack.filter.PacketExtensionFilter; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaExtensionFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.roster.Roster; @@ -52,7 +52,7 @@ public class RosterExchangeManager { private final static Map INSTANCES = new WeakHashMap<>(); - private final static PacketFilter PACKET_FILTER = new PacketExtensionFilter(ELEMENT, NAMESPACE); + private final static StanzaFilter PACKET_FILTER = new StanzaExtensionFilter(ELEMENT, NAMESPACE); private final Set rosterExchangeListeners = Collections.synchronizedSet(new HashSet()); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/packet/RosterExchange.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/packet/RosterExchange.java index ea4ad201b..1baed7bda 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/packet/RosterExchange.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/packet/RosterExchange.java @@ -17,7 +17,7 @@ package org.jivesoftware.smackx.xroster.packet; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.roster.Roster; import org.jivesoftware.smack.roster.RosterEntry; import org.jivesoftware.smack.roster.RosterGroup; @@ -48,7 +48,7 @@ import java.util.List; * * @author Gaston Dombiak */ -public class RosterExchange implements PacketExtension { +public class RosterExchange implements ExtensionElement { private List remoteRosterEntries = new ArrayList(); diff --git a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/provider/RosterExchangeProvider.java b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/provider/RosterExchangeProvider.java index 45fd9274e..9eca95521 100644 --- a/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/provider/RosterExchangeProvider.java +++ b/smack-legacy/src/main/java/org/jivesoftware/smackx/xroster/provider/RosterExchangeProvider.java @@ -20,7 +20,7 @@ package org.jivesoftware.smackx.xroster.provider; import java.io.IOException; import java.util.ArrayList; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smackx.xroster.RemoteRosterEntry; import org.jivesoftware.smackx.xroster.packet.RosterExchange; import org.xmlpull.v1.XmlPullParser; @@ -32,7 +32,7 @@ import org.xmlpull.v1.XmlPullParserException; * * @author Gaston Dombiak */ -public class RosterExchangeProvider extends PacketExtensionProvider { +public class RosterExchangeProvider extends ExtensionElementProvider { /** * Parses a RosterExchange packet (extension sub-packet). diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/packet/StreamManagement.java b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/packet/StreamManagement.java index c92925d9b..46d85a140 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/packet/StreamManagement.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/packet/StreamManagement.java @@ -17,14 +17,14 @@ package org.jivesoftware.smack.sm.packet; import org.jivesoftware.smack.packet.FullStreamElement; -import org.jivesoftware.smack.packet.PacketExtension; +import org.jivesoftware.smack.packet.ExtensionElement; import org.jivesoftware.smack.packet.XMPPError; import org.jivesoftware.smack.util.XmlStringBuilder; public class StreamManagement { public static final String NAMESPACE = "urn:xmpp:sm:3"; - public static class StreamManagementFeature implements PacketExtension { + public static class StreamManagementFeature implements ExtensionElement { public static final String ELEMENT = "sm"; public static final StreamManagementFeature INSTANCE = new StreamManagementFeature(); diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/AfterXStanzas.java b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/AfterXStanzas.java index 72d7056ba..527d3123a 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/AfterXStanzas.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/AfterXStanzas.java @@ -16,10 +16,10 @@ */ package org.jivesoftware.smack.sm.predicates; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.Stanza; -public class AfterXStanzas implements PacketFilter { +public class AfterXStanzas implements StanzaFilter { final int count; int currentCount; diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ForEveryMessage.java b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ForEveryMessage.java index 86d37191e..7bd3d1443 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ForEveryMessage.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ForEveryMessage.java @@ -16,11 +16,11 @@ */ package org.jivesoftware.smack.sm.predicates; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.Message; import org.jivesoftware.smack.packet.Stanza; -public class ForEveryMessage implements PacketFilter { +public class ForEveryMessage implements StanzaFilter { public static final ForEveryMessage INSTANCE = new ForEveryMessage(); diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ForEveryStanza.java b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ForEveryStanza.java index 8e5555f2c..24f923752 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ForEveryStanza.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ForEveryStanza.java @@ -16,10 +16,10 @@ */ package org.jivesoftware.smack.sm.predicates; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.Stanza; -public class ForEveryStanza implements PacketFilter { +public class ForEveryStanza implements StanzaFilter { public static final ForEveryStanza INSTANCE = new ForEveryStanza(); diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ForMatchingPredicateOrAfterXStanzas.java b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ForMatchingPredicateOrAfterXStanzas.java index dcea27701..837b5c8a4 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ForMatchingPredicateOrAfterXStanzas.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ForMatchingPredicateOrAfterXStanzas.java @@ -16,15 +16,15 @@ */ package org.jivesoftware.smack.sm.predicates; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.Stanza; -public class ForMatchingPredicateOrAfterXStanzas implements PacketFilter { +public class ForMatchingPredicateOrAfterXStanzas implements StanzaFilter { - private final PacketFilter predicate; + private final StanzaFilter predicate; private final AfterXStanzas afterXStanzas; - public ForMatchingPredicateOrAfterXStanzas(PacketFilter predicate, int count) { + public ForMatchingPredicateOrAfterXStanzas(StanzaFilter predicate, int count) { this.predicate = predicate; this.afterXStanzas = new AfterXStanzas(count); } diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/OnceForThisStanza.java b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/OnceForThisStanza.java index cb33c0ecf..15c00004c 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/OnceForThisStanza.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/OnceForThisStanza.java @@ -16,18 +16,18 @@ */ package org.jivesoftware.smack.sm.predicates; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.Stanza; import org.jivesoftware.smack.tcp.XMPPTCPConnection; import org.jivesoftware.smack.util.StringUtils; -public class OnceForThisStanza implements PacketFilter { +public class OnceForThisStanza implements StanzaFilter { private final String id; private final XMPPTCPConnection connection; public static void setup(XMPPTCPConnection connection, Stanza packet) { - PacketFilter packetFilter = new OnceForThisStanza(connection, packet); + StanzaFilter packetFilter = new OnceForThisStanza(connection, packet); connection.addRequestAckPredicate(packetFilter); } diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/Predicate.java b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/Predicate.java index 420924e6c..767886820 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/Predicate.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/Predicate.java @@ -16,11 +16,11 @@ */ package org.jivesoftware.smack.sm.predicates; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; public class Predicate { - public static PacketFilter forMessagesOrAfter5Stanzas() { + public static StanzaFilter forMessagesOrAfter5Stanzas() { return new ForMatchingPredicateOrAfterXStanzas(ForEveryMessage.INSTANCE, 5); } diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ShortcutPredicates.java b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ShortcutPredicates.java index c9fdb2c43..2e05bbc99 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ShortcutPredicates.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/predicates/ShortcutPredicates.java @@ -20,31 +20,31 @@ import java.util.Collection; import java.util.LinkedHashSet; import java.util.Set; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.packet.Stanza; -public class ShortcutPredicates implements PacketFilter { +public class ShortcutPredicates implements StanzaFilter { - private final Set predicates = new LinkedHashSet(); + private final Set predicates = new LinkedHashSet(); public ShortcutPredicates() { } - public ShortcutPredicates(Collection predicates) { + public ShortcutPredicates(Collection predicates) { this.predicates.addAll(predicates); } - public boolean addPredicate(PacketFilter predicate) { + public boolean addPredicate(StanzaFilter predicate) { return predicates.add(predicate); } - public boolean removePredicate(PacketFilter prediacte) { + public boolean removePredicate(StanzaFilter prediacte) { return predicates.remove(prediacte); } @Override public boolean accept(Stanza packet) { - for (PacketFilter predicate : predicates) { + for (StanzaFilter predicate : predicates) { if (predicate.accept(packet)) { return true; } diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/provider/StreamManagementStreamFeatureProvider.java b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/provider/StreamManagementStreamFeatureProvider.java index 46e5d2497..14f836b71 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/sm/provider/StreamManagementStreamFeatureProvider.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/sm/provider/StreamManagementStreamFeatureProvider.java @@ -16,11 +16,11 @@ */ package org.jivesoftware.smack.sm.provider; -import org.jivesoftware.smack.provider.PacketExtensionProvider; +import org.jivesoftware.smack.provider.ExtensionElementProvider; import org.jivesoftware.smack.sm.packet.StreamManagement.StreamManagementFeature; import org.xmlpull.v1.XmlPullParser; -public class StreamManagementStreamFeatureProvider extends PacketExtensionProvider { +public class StreamManagementStreamFeatureProvider extends ExtensionElementProvider { @Override public StreamManagementFeature parse(XmlPullParser parser, diff --git a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java index 75be75283..9380d9b44 100644 --- a/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java +++ b/smack-tcp/src/main/java/org/jivesoftware/smack/tcp/XMPPTCPConnection.java @@ -38,7 +38,7 @@ import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException.XMPPErrorException; import org.jivesoftware.smack.compress.packet.Compressed; import org.jivesoftware.smack.compression.XMPPInputOutputStream; -import org.jivesoftware.smack.filter.PacketFilter; +import org.jivesoftware.smack.filter.StanzaFilter; import org.jivesoftware.smack.compress.packet.Compress; import org.jivesoftware.smack.packet.Element; import org.jivesoftware.smack.packet.IQ; @@ -279,7 +279,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { * order in which they are invoked in order to determine if an ack request should be send or not. *

*/ - private final Set requestAckPredicates = new LinkedHashSet(); + private final Set requestAckPredicates = new LinkedHashSet(); private final XMPPTCPConnectionConfiguration config; @@ -534,7 +534,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { protected void sendPacketInternal(Stanza packet) throws NotConnectedException { packetWriter.sendStreamElement(packet); if (isSmEnabled()) { - for (PacketFilter requestAckPredicate : requestAckPredicates) { + for (StanzaFilter requestAckPredicate : requestAckPredicates) { if (requestAckPredicate.accept(packet)) { requestSmAcknowledgementInternal(); break; @@ -1487,7 +1487,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { * @param predicate the predicate to add. * @return if the predicate was not already active. */ - public boolean addRequestAckPredicate(PacketFilter predicate) { + public boolean addRequestAckPredicate(StanzaFilter predicate) { synchronized (requestAckPredicates) { return requestAckPredicates.add(predicate); } @@ -1498,7 +1498,7 @@ public class XMPPTCPConnection extends AbstractXMPPConnection { * @param predicate the predicate to remove. * @return true if the predicate was removed. */ - public boolean removeRequestAckPredicate(PacketFilter predicate) { + public boolean removeRequestAckPredicate(StanzaFilter predicate) { synchronized (requestAckPredicates) { return requestAckPredicates.remove(predicate); }