mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-09-09 17:19:39 +02:00
Substitute 'packet' with 'stanza(/packet)' in javadoc
This commit is contained in:
parent
0ca4e8b72a
commit
5e86db4f80
168 changed files with 650 additions and 650 deletions
|
@ -37,7 +37,7 @@ public class IQTest extends SmackTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check that the server responds a 503 error code when the client sends an IQ packet with an
|
||||
* Check that the server responds a 503 error code when the client sends an IQ stanza(/packet) with an
|
||||
* invalid namespace.
|
||||
*/
|
||||
public void testInvalidNamespace() {
|
||||
|
|
|
@ -49,7 +49,7 @@ public class PacketIDFilterTest extends TestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Wraps the MockPacket class to always give an expected packet ID field.
|
||||
* Wraps the MockPacket class to always give an expected stanza(/packet) ID field.
|
||||
*/
|
||||
private class MockIDPacket extends MockPacket {
|
||||
private String id;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package org.jivesoftware.smack.packet;
|
||||
|
||||
/**
|
||||
* A mock implementation of the Packet abstract class. Implements toXML() by returning null.
|
||||
* A mock implementation of the Stanza(/Packet) abstract class. Implements toXML() by returning null.
|
||||
*/
|
||||
public class MockPacket extends Packet {
|
||||
|
||||
|
|
|
@ -128,24 +128,24 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
private final Collection<PacketCollector> collectors = new ConcurrentLinkedQueue<PacketCollector>();
|
||||
|
||||
/**
|
||||
* List of PacketListeners that will be notified synchronously when a new packet was received.
|
||||
* List of PacketListeners that will be notified synchronously when a new stanza(/packet) was received.
|
||||
*/
|
||||
private final Map<StanzaListener, ListenerWrapper> syncRecvListeners = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* List of PacketListeners that will be notified asynchronously when a new packet was received.
|
||||
* List of PacketListeners that will be notified asynchronously when a new stanza(/packet) was received.
|
||||
*/
|
||||
private final Map<StanzaListener, ListenerWrapper> asyncRecvListeners = new LinkedHashMap<>();
|
||||
|
||||
/**
|
||||
* List of PacketListeners that will be notified when a new packet was sent.
|
||||
* List of PacketListeners that will be notified when a new stanza(/packet) was sent.
|
||||
*/
|
||||
private final Map<StanzaListener, ListenerWrapper> sendListeners =
|
||||
new HashMap<StanzaListener, ListenerWrapper>();
|
||||
|
||||
/**
|
||||
* List of PacketListeners that will be notified when a new packet is about to be
|
||||
* sent to the server. These interceptors may modify the packet before it is being
|
||||
* List of PacketListeners that will be notified when a new stanza(/packet) is about to be
|
||||
* sent to the server. These interceptors may modify the stanza(/packet) before it is being
|
||||
* actually sent to the server.
|
||||
*/
|
||||
private final Map<StanzaListener, InterceptorWrapper> interceptors =
|
||||
|
@ -260,7 +260,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
);
|
||||
|
||||
/**
|
||||
* A executor service used to invoke the callbacks of synchronous packet listeners. We use a executor service to
|
||||
* A executor service used to invoke the callbacks of synchronous stanza(/packet) listeners. We use a executor service to
|
||||
* decouple incoming stanza processing from callback invocation. It is important that order of callback invocation
|
||||
* is the same as the order of the incoming stanzas. Therefore we use a <i>single</i> threaded executor service.
|
||||
*/
|
||||
|
@ -376,7 +376,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
|
||||
/**
|
||||
* Logs in to the server using the strongest SASL mechanism supported by
|
||||
* the server. If more than the connection's default packet timeout elapses in each step of the
|
||||
* the server. If more than the connection's default stanza(/packet) timeout elapses in each step of the
|
||||
* authentication process without a response from the server, a
|
||||
* {@link SmackException.NoResponseException} will be thrown.
|
||||
* <p>
|
||||
|
@ -655,10 +655,10 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
* by closing the stream. The XMPPConnection can still be used for connecting to the server
|
||||
* again. A custom unavailable presence is useful for communicating offline presence
|
||||
* information such as "On vacation". Typically, just the status text of the presence
|
||||
* packet is set with online information, but most XMPP servers will deliver the full
|
||||
* presence packet with whatever data is set.
|
||||
* stanza(/packet) is set with online information, but most XMPP servers will deliver the full
|
||||
* presence stanza(/packet) with whatever data is set.
|
||||
*
|
||||
* @param unavailablePresence the presence packet to send during shutdown.
|
||||
* @param unavailablePresence the presence stanza(/packet) to send during shutdown.
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public synchronized void disconnect(Presence unavailablePresence) throws NotConnectedException {
|
||||
|
@ -795,12 +795,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* Process all packet listeners for sending packets.
|
||||
* Process all stanza(/packet) listeners for sending packets.
|
||||
* <p>
|
||||
* Compared to {@link #firePacketInterceptors(Stanza)}, the listeners will be invoked in a new thread.
|
||||
* </p>
|
||||
*
|
||||
* @param packet the packet to process.
|
||||
* @param packet the stanza(/packet) to process.
|
||||
*/
|
||||
@SuppressWarnings("javadoc")
|
||||
protected void firePacketSendingListeners(final Stanza packet) {
|
||||
|
@ -851,12 +851,12 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* Process interceptors. Interceptors may modify the packet that is about to be sent.
|
||||
* Since the thread that requested to send the packet will invoke all interceptors, it
|
||||
* Process interceptors. Interceptors may modify the stanza(/packet) that is about to be sent.
|
||||
* Since the thread that requested to send the stanza(/packet) will invoke all interceptors, it
|
||||
* is important that interceptors perform their work as soon as possible so that the
|
||||
* thread does not remain blocked for a long period.
|
||||
*
|
||||
* @param packet the packet that is going to be sent to the server
|
||||
* @param packet the stanza(/packet) that is going to be sent to the server
|
||||
*/
|
||||
private void firePacketInterceptors(Stanza packet) {
|
||||
List<StanzaListener> interceptorsToInvoke = new LinkedList<StanzaListener>();
|
||||
|
@ -962,11 +962,11 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* Processes a packet after it's been fully parsed by looping through the installed
|
||||
* packet collectors and listeners and letting them examine the packet to see if
|
||||
* Processes a stanza(/packet) after it's been fully parsed by looping through the installed
|
||||
* stanza(/packet) collectors and listeners and letting them examine the stanza(/packet) to see if
|
||||
* they are a match with the filter.
|
||||
*
|
||||
* @param packet the packet to process.
|
||||
* @param packet the stanza(/packet) to process.
|
||||
*/
|
||||
protected void processPacket(Stanza packet) {
|
||||
assert(packet != null);
|
||||
|
@ -976,7 +976,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* A runnable to notify all listeners and packet collectors of a packet.
|
||||
* A runnable to notify all listeners and stanza(/packet) collectors of a packet.
|
||||
*/
|
||||
private class ListenerNotification implements Runnable {
|
||||
|
||||
|
@ -993,9 +993,9 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
|
||||
/**
|
||||
* Invoke {@link PacketCollector#processPacket(Stanza)} for every
|
||||
* PacketCollector with the given packet. Also notify the receive listeners with a matching packet filter about the packet.
|
||||
* PacketCollector with the given packet. Also notify the receive listeners with a matching stanza(/packet) filter about the packet.
|
||||
*
|
||||
* @param packet the packet to notify the PacketCollectors and receive listeners about.
|
||||
* @param packet the stanza(/packet) to notify the PacketCollectors and receive listeners about.
|
||||
*/
|
||||
protected void invokePacketCollectorsAndNotifyRecvListeners(final Stanza packet) {
|
||||
if (packet instanceof IQ) {
|
||||
|
@ -1210,7 +1210,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* A wrapper class to associate a packet filter with a listener.
|
||||
* A wrapper class to associate a stanza(/packet) filter with a listener.
|
||||
*/
|
||||
protected static class ListenerWrapper {
|
||||
|
||||
|
@ -1218,9 +1218,9 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
private final StanzaFilter packetFilter;
|
||||
|
||||
/**
|
||||
* Create a class which associates a packet filter with a listener.
|
||||
* Create a class which associates a stanza(/packet) filter with a listener.
|
||||
*
|
||||
* @param packetListener the packet listener.
|
||||
* @param packetListener the stanza(/packet) listener.
|
||||
* @param packetFilter the associated filter or null if it listen for all packets.
|
||||
*/
|
||||
public ListenerWrapper(StanzaListener packetListener, StanzaFilter packetFilter) {
|
||||
|
@ -1238,7 +1238,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* A wrapper class to associate a packet filter with an interceptor.
|
||||
* A wrapper class to associate a stanza(/packet) filter with an interceptor.
|
||||
*/
|
||||
protected static class InterceptorWrapper {
|
||||
|
||||
|
@ -1246,7 +1246,7 @@ public abstract class AbstractXMPPConnection implements XMPPConnection {
|
|||
private final StanzaFilter packetFilter;
|
||||
|
||||
/**
|
||||
* Create a class which associates a packet filter with an interceptor.
|
||||
* Create a class which associates a stanza(/packet) filter with an interceptor.
|
||||
*
|
||||
* @param packetInterceptor the interceptor.
|
||||
* @param packetFilter the associated filter or null if it intercepts all packets.
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.jivesoftware.smack.packet.Stanza;
|
|||
* use than a {@link StanzaListener} when you need to wait for a specific
|
||||
* result.<p>
|
||||
*
|
||||
* Each packet collector will queue up a configured number of packets for processing before
|
||||
* Each stanza(/packet) collector will queue up a configured number of packets for processing before
|
||||
* older packets are automatically dropped. The default number is retrieved by
|
||||
* {@link SmackConfiguration#getPacketCollectorSize()}.
|
||||
*
|
||||
|
@ -49,7 +49,7 @@ public class PacketCollector {
|
|||
private final ArrayBlockingQueue<Stanza> resultQueue;
|
||||
|
||||
/**
|
||||
* The packet collector which timeout for the next result will get reset once this collector collects a stanza.
|
||||
* The stanza(/packet) collector which timeout for the next result will get reset once this collector collects a stanza.
|
||||
*/
|
||||
private final PacketCollector collectorToReset;
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class PacketCollector {
|
|||
private boolean cancelled = false;
|
||||
|
||||
/**
|
||||
* Creates a new packet collector. If the packet filter is <tt>null</tt>, then
|
||||
* Creates a new stanza(/packet) collector. If the stanza(/packet) filter is <tt>null</tt>, then
|
||||
* all packets will match this collector.
|
||||
*
|
||||
* @param connection the connection the collector is tied to.
|
||||
|
@ -72,9 +72,9 @@ public class PacketCollector {
|
|||
}
|
||||
|
||||
/**
|
||||
* Explicitly cancels the packet collector so that no more results are
|
||||
* queued up. Once a packet collector has been cancelled, it cannot be
|
||||
* re-enabled. Instead, a new packet collector must be created.
|
||||
* Explicitly cancels the stanza(/packet) collector so that no more results are
|
||||
* queued up. Once a stanza(/packet) collector has been cancelled, it cannot be
|
||||
* re-enabled. Instead, a new stanza(/packet) collector must be created.
|
||||
*/
|
||||
public void cancel() {
|
||||
// If the packet collector has already been cancelled, do nothing.
|
||||
|
@ -85,10 +85,10 @@ public class PacketCollector {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the packet filter associated with this packet collector. The packet
|
||||
* Returns the stanza(/packet) filter associated with this stanza(/packet) collector. The packet
|
||||
* filter is used to determine what packets are queued as results.
|
||||
*
|
||||
* @return the packet filter.
|
||||
* @return the stanza(/packet) filter.
|
||||
* @deprecated use {@link #getStanzaFilter()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
|
@ -107,11 +107,11 @@ public class PacketCollector {
|
|||
}
|
||||
|
||||
/**
|
||||
* Polls to see if a packet is currently available and returns it, or
|
||||
* Polls to see if a stanza(/packet) is currently available and returns it, or
|
||||
* immediately returns <tt>null</tt> if no packets are currently in the
|
||||
* result queue.
|
||||
*
|
||||
* @return the next packet result, or <tt>null</tt> if there are no more
|
||||
* @return the next stanza(/packet) result, or <tt>null</tt> if there are no more
|
||||
* results.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -120,7 +120,7 @@ public class PacketCollector {
|
|||
}
|
||||
|
||||
/**
|
||||
* Polls to see if a packet is currently available and returns it, or
|
||||
* Polls to see if a stanza(/packet) is currently available and returns it, or
|
||||
* immediately returns <tt>null</tt> if no packets are currently in the
|
||||
* result queue.
|
||||
* <p>
|
||||
|
@ -139,7 +139,7 @@ public class PacketCollector {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the next available packet. The method call will block (not return) until a packet is
|
||||
* Returns the next available packet. The method call will block (not return) until a stanza(/packet) is
|
||||
* available.
|
||||
*
|
||||
* @return the next available packet.
|
||||
|
@ -173,7 +173,7 @@ public class PacketCollector {
|
|||
|
||||
/**
|
||||
* Returns the next available packet. The method call will block (not return)
|
||||
* until a packet is available or the <tt>timeout</tt> has elapsed. If the
|
||||
* until a stanza(/packet) is available or the <tt>timeout</tt> has elapsed. If the
|
||||
* timeout elapses without a result, <tt>null</tt> will be returned.
|
||||
*
|
||||
* @param timeout the timeout in milliseconds.
|
||||
|
@ -201,7 +201,7 @@ public class PacketCollector {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the next available packet. The method call will block until a packet is available or
|
||||
* Returns the next available packet. The method call will block until a stanza(/packet) is available or
|
||||
* the connections reply timeout has elapsed. If the timeout elapses without a result,
|
||||
* <tt>null</tt> will be returned. This method does also cancel the PacketCollector.
|
||||
*
|
||||
|
@ -214,10 +214,10 @@ public class PacketCollector {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the next available packet. The method call will block until a packet is available or
|
||||
* Returns the next available packet. The method call will block until a stanza(/packet) is available or
|
||||
* the <tt>timeout</tt> has elapsed. This method does also cancel the PacketCollector.
|
||||
*
|
||||
* @param timeout the amount of time to wait for the next packet (in milleseconds).
|
||||
* @param timeout the amount of time to wait for the next stanza(/packet) (in milleseconds).
|
||||
* @return the next available packet.
|
||||
* @throws NoResponseException if there was no response from the server.
|
||||
* @throws XMPPErrorException in case an error response.
|
||||
|
@ -235,7 +235,7 @@ public class PacketCollector {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the number of collected stanzas this packet collector has collected so far.
|
||||
* Get the number of collected stanzas this stanza(/packet) collector has collected so far.
|
||||
*
|
||||
* @return the count of collected stanzas.
|
||||
* @since 4.1
|
||||
|
@ -245,10 +245,10 @@ public class PacketCollector {
|
|||
}
|
||||
|
||||
/**
|
||||
* Processes a packet to see if it meets the criteria for this packet collector.
|
||||
* If so, the packet is added to the result queue.
|
||||
* Processes a stanza(/packet) to see if it meets the criteria for this stanza(/packet) collector.
|
||||
* If so, the stanza(/packet) is added to the result queue.
|
||||
*
|
||||
* @param packet the packet to process.
|
||||
* @param packet the stanza(/packet) to process.
|
||||
*/
|
||||
protected void processPacket(Stanza packet) {
|
||||
if (packetFilter == null || packetFilter.accept(packet)) {
|
||||
|
@ -269,9 +269,9 @@ public class PacketCollector {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get a new packet collector configuration instance.
|
||||
* Get a new stanza(/packet) collector configuration instance.
|
||||
*
|
||||
* @return a new packet collector configuration.
|
||||
* @return a new stanza(/packet) collector configuration.
|
||||
*/
|
||||
public static Configuration newConfiguration() {
|
||||
return new Configuration();
|
||||
|
@ -286,7 +286,7 @@ public class PacketCollector {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the packet filter used by this collector. If <code>null</code>, then all packets will
|
||||
* Set the stanza(/packet) filter used by this collector. If <code>null</code>, then all packets will
|
||||
* get collected by this collector.
|
||||
*
|
||||
* @param packetFilter
|
||||
|
@ -302,7 +302,7 @@ public class PacketCollector {
|
|||
* Set the stanza filter used by this collector. If <code>null</code>, then all stanzas will
|
||||
* get collected by this collector.
|
||||
*
|
||||
* @param stanzaFilter
|
||||
* @param packetFilter
|
||||
* @return a reference to this configuration.
|
||||
*/
|
||||
public Configuration setStanzaFilter(StanzaFilter stanzaFilter) {
|
||||
|
|
|
@ -124,7 +124,7 @@ public final class SmackConfiguration {
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the default max size of a packet collector before it will delete
|
||||
* Gets the default max size of a stanza(/packet) collector before it will delete
|
||||
* the older packets.
|
||||
*
|
||||
* @return The number of packets to queue before deleting older packets.
|
||||
|
@ -134,7 +134,7 @@ public final class SmackConfiguration {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the default max size of a packet collector before it will delete
|
||||
* Sets the default max size of a stanza(/packet) collector before it will delete
|
||||
* the older packets.
|
||||
*
|
||||
* @param collectorSize the number of packets to queue before deleting older packets.
|
||||
|
|
|
@ -55,8 +55,8 @@ public class SmackException extends Exception {
|
|||
}
|
||||
|
||||
/**
|
||||
* Exception thrown always when there was no response to an request within the packet reply timeout of the used
|
||||
* connection instance. You can modify (e.g. increase) the packet reply timeout with
|
||||
* Exception thrown always when there was no response to an request within the stanza(/packet) reply timeout of the used
|
||||
* connection instance. You can modify (e.g. increase) the stanza(/packet) reply timeout with
|
||||
* {@link XMPPConnection#setPacketReplyTimeout(long)}.
|
||||
*/
|
||||
public static class NoResponseException extends SmackException {
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.jivesoftware.smack.packet.Stanza;
|
|||
|
||||
/**
|
||||
* Provides a mechanism to listen for packets that pass a specified filter.
|
||||
* This allows event-style programming -- every time a new packet is found,
|
||||
* This allows event-style programming -- every time a new stanza(/packet) is found,
|
||||
* the {@link #processPacket(Stanza)} method will be called. This is the
|
||||
* opposite approach to the functionality provided by a {@link PacketCollector}
|
||||
* which lets you block while waiting for results.
|
||||
|
@ -39,14 +39,14 @@ import org.jivesoftware.smack.packet.Stanza;
|
|||
public interface StanzaListener {
|
||||
|
||||
/**
|
||||
* Process the next packet sent to this packet listener.
|
||||
* Process the next stanza(/packet) sent to this stanza(/packet) listener.
|
||||
* <p>
|
||||
* A single thread is responsible for invoking all listeners, so
|
||||
* it's very important that implementations of this method not block
|
||||
* for any extended period of time.
|
||||
* </p>
|
||||
*
|
||||
* @param packet the packet to process.
|
||||
* @param packet the stanza(/packet) to process.
|
||||
*/
|
||||
public void processPacket(Stanza packet) throws NotConnectedException;
|
||||
|
||||
|
|
|
@ -154,9 +154,9 @@ public interface XMPPConnection {
|
|||
public boolean isUsingCompression();
|
||||
|
||||
/**
|
||||
* Sends the specified packet to the server.
|
||||
* Sends the specified stanza(/packet) to the server.
|
||||
*
|
||||
* @param packet the packet to send.
|
||||
* @param packet the stanza(/packet) to send.
|
||||
* @throws NotConnectedException
|
||||
* @deprecated use {@link #sendStanza(Stanza)} instead.
|
||||
*/
|
||||
|
@ -166,7 +166,7 @@ public interface XMPPConnection {
|
|||
/**
|
||||
* Sends the specified stanza to the server.
|
||||
*
|
||||
* @param stanza the stanza to send.
|
||||
* @param packet the stanza to send.
|
||||
* @throws NotConnectedException if the connection is not connected.
|
||||
*/
|
||||
public void sendStanza(Stanza stanza) throws NotConnectedException;
|
||||
|
@ -200,79 +200,79 @@ public interface XMPPConnection {
|
|||
public void removeConnectionListener(ConnectionListener connectionListener);
|
||||
|
||||
/**
|
||||
* Creates a new packet collector collecting packets that are replies to <code>packet</code>.
|
||||
* Does also send <code>packet</code>. The packet filter for the collector is an
|
||||
* {@link IQReplyFilter}, guaranteeing that packet id and JID in the 'from' address have
|
||||
* Creates a new stanza(/packet) collector collecting packets that are replies to <code>packet</code>.
|
||||
* Does also send <code>packet</code>. The stanza(/packet) filter for the collector is an
|
||||
* {@link IQReplyFilter}, guaranteeing that stanza(/packet) id and JID in the 'from' address have
|
||||
* expected values.
|
||||
*
|
||||
* @param packet the packet to filter responses from
|
||||
* @return a new packet collector.
|
||||
* @param packet the stanza(/packet) to filter responses from
|
||||
* @return a new stanza(/packet) collector.
|
||||
* @throws NotConnectedException
|
||||
*/
|
||||
public PacketCollector createPacketCollectorAndSend(IQ packet) throws NotConnectedException;
|
||||
|
||||
/**
|
||||
* Creates a new packet collector for this connection. A packet filter determines
|
||||
* Creates a new stanza(/packet) collector for this connection. A stanza(/packet) filter determines
|
||||
* which packets will be accumulated by the collector. A PacketCollector is
|
||||
* more suitable to use than a {@link StanzaListener} when you need to wait for
|
||||
* a specific result.
|
||||
*
|
||||
* @param packetFilter the packet filter to use.
|
||||
* @param packet the packet to send right after the collector got created
|
||||
* @return a new packet collector.
|
||||
* @param packetFilter the stanza(/packet) filter to use.
|
||||
* @param packet the stanza(/packet) to send right after the collector got created
|
||||
* @return a new stanza(/packet) collector.
|
||||
*/
|
||||
public PacketCollector createPacketCollectorAndSend(StanzaFilter packetFilter, Stanza packet)
|
||||
throws NotConnectedException;
|
||||
|
||||
/**
|
||||
* Creates a new packet collector for this connection. A packet filter
|
||||
* Creates a new stanza(/packet) collector for this connection. A stanza(/packet) filter
|
||||
* determines which packets will be accumulated by the collector. A
|
||||
* PacketCollector is more suitable to use than a {@link StanzaListener}
|
||||
* when you need to wait for a specific result.
|
||||
* <p>
|
||||
* <b>Note:</b> If you send a Packet right after using this method, then
|
||||
* <b>Note:</b> If you send a Stanza(/Packet) right after using this method, then
|
||||
* consider using
|
||||
* {@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.
|
||||
* </p>
|
||||
*
|
||||
* @param packetFilter the packet filter to use.
|
||||
* @return a new packet collector.
|
||||
* @param packetFilter the stanza(/packet) filter to use.
|
||||
* @return a new stanza(/packet) collector.
|
||||
*/
|
||||
public PacketCollector createPacketCollector(StanzaFilter packetFilter);
|
||||
|
||||
/**
|
||||
* Create a new packet collector with the given packet collector configuration.
|
||||
* Create a new stanza(/packet) collector with the given stanza(/packet) collector configuration.
|
||||
* <p>
|
||||
* Please make sure to cancel the collector when it is no longer required. See also
|
||||
* {@link #createPacketCollector(StanzaFilter)}.
|
||||
* </p>
|
||||
*
|
||||
* @param configuration the packet collector configuration.
|
||||
* @return a new packet collector.
|
||||
* @param configuration the stanza(/packet) collector configuration.
|
||||
* @return a new stanza(/packet) collector.
|
||||
* @since 4.1
|
||||
*/
|
||||
public PacketCollector createPacketCollector(PacketCollector.Configuration configuration);
|
||||
|
||||
/**
|
||||
* Remove a packet collector of this connection.
|
||||
* Remove a stanza(/packet) collector of this connection.
|
||||
*
|
||||
* @param collector a packet collectors which was created for this connection.
|
||||
* @param collector a stanza(/packet) collectors which was created for this connection.
|
||||
*/
|
||||
public void removePacketCollector(PacketCollector collector);
|
||||
|
||||
/**
|
||||
* Registers a packet listener with this connection.
|
||||
* Registers a stanza(/packet) listener with this connection.
|
||||
* <p>
|
||||
* 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
|
||||
* This method has been deprecated. It is important to differentiate between using an asynchronous stanza(/packet) listener
|
||||
* (preferred where possible) and a synchronous stanza(/packet) lister. Refer
|
||||
* {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)} and
|
||||
* {@link #addSyncStanzaListener(StanzaListener, StanzaFilter)} for more information.
|
||||
* </p>
|
||||
*
|
||||
* @param packetListener the packet listener to notify of new received packets.
|
||||
* @param packetFilter the packet filter to use.
|
||||
* @param packetListener the stanza(/packet) listener to notify of new received packets.
|
||||
* @param packetFilter the stanza(/packet) filter to use.
|
||||
* @deprecated use {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)} or
|
||||
* {@link #addSyncStanzaListener(StanzaListener, StanzaFilter)}.
|
||||
*/
|
||||
|
@ -280,107 +280,107 @@ public interface XMPPConnection {
|
|||
public void addPacketListener(StanzaListener packetListener, StanzaFilter packetFilter);
|
||||
|
||||
/**
|
||||
* Removes a packet listener for received packets from this connection.
|
||||
* Removes a stanza(/packet) listener for received packets from this connection.
|
||||
*
|
||||
* @param packetListener the packet listener to remove.
|
||||
* @return true if the packet listener was removed
|
||||
* @param packetListener the stanza(/packet) listener to remove.
|
||||
* @return true if the stanza(/packet) listener was removed
|
||||
* @deprecated use {@link #removeAsyncStanzaListener(StanzaListener)} or {@link #removeSyncStanzaListener(StanzaListener)}.
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean removePacketListener(StanzaListener packetListener);
|
||||
|
||||
/**
|
||||
* Registers a <b>synchronous</b> packet listener with this connection. A packet listener will be invoked only 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.
|
||||
* Registers a <b>synchronous</b> stanza(/packet) listener with this connection. A stanza(/packet) listener will be invoked only when
|
||||
* an incoming stanza(/packet) is received. A stanza(/packet) filter determines which packets will be delivered to the listener. If
|
||||
* the same stanza(/packet) listener is added again with a different filter, only the new filter will be used.
|
||||
* <p>
|
||||
* <b>Important:</b> This packet listeners will be called in the same <i>single</i> 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
|
||||
* <b>Important:</b> This stanza(/packet) listeners will be called in the same <i>single</i> thread that processes all
|
||||
* incoming stanzas. Only use this kind of stanza(/packet) filter if it does not perform any XMPP activity that waits for a
|
||||
* response. Consider using {@link #addAsyncStanzaListener(StanzaListener, 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.
|
||||
* </p>
|
||||
*
|
||||
* @param packetListener the packet listener to notify of new received packets.
|
||||
* @param packetFilter the packet filter to use.
|
||||
* @param packetListener the stanza(/packet) listener to notify of new received packets.
|
||||
* @param packetFilter the stanza(/packet) filter to use.
|
||||
* @see #addPacketInterceptor(StanzaListener, StanzaFilter)
|
||||
* @since 4.1
|
||||
*/
|
||||
public void addSyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter);
|
||||
|
||||
/**
|
||||
* Removes a packet listener for received packets from this connection.
|
||||
* Removes a stanza(/packet) listener for received packets from this connection.
|
||||
*
|
||||
* @param packetListener the packet listener to remove.
|
||||
* @return true if the packet listener was removed
|
||||
* @param packetListener the stanza(/packet) listener to remove.
|
||||
* @return true if the stanza(/packet) listener was removed
|
||||
* @since 4.1
|
||||
*/
|
||||
public boolean removeSyncStanzaListener(StanzaListener packetListener);
|
||||
|
||||
/**
|
||||
* Registers an <b>asynchronous</b> packet listener with this connection. A packet listener will be invoked only
|
||||
* 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.
|
||||
* Registers an <b>asynchronous</b> stanza(/packet) listener with this connection. A stanza(/packet) listener will be invoked only
|
||||
* when an incoming stanza(/packet) is received. A stanza(/packet) filter determines which packets will be delivered to the listener.
|
||||
* If the same stanza(/packet) listener is added again with a different filter, only the new filter will be used.
|
||||
* <p>
|
||||
* Unlike {@link #addAsyncStanzaListener(StanzaListener, 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
|
||||
* Unlike {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)} stanza(/packet) listeners added with this method will be
|
||||
* invoked asynchronously in their own thread. Use this method if the order of the stanza(/packet) listeners must not depend
|
||||
* on the order how the stanzas where received.
|
||||
* </p>
|
||||
*
|
||||
* @param packetListener the packet listener to notify of new received packets.
|
||||
* @param packetFilter the packet filter to use.
|
||||
* @param packetListener the stanza(/packet) listener to notify of new received packets.
|
||||
* @param packetFilter the stanza(/packet) filter to use.
|
||||
* @see #addPacketInterceptor(StanzaListener, StanzaFilter)
|
||||
* @since 4.1
|
||||
*/
|
||||
public void addAsyncStanzaListener(StanzaListener packetListener, StanzaFilter packetFilter);
|
||||
|
||||
/**
|
||||
* Removes an <b>asynchronous</b> packet listener for received packets from this connection.
|
||||
* Removes an <b>asynchronous</b> stanza(/packet) listener for received packets from this connection.
|
||||
*
|
||||
* @param packetListener the packet listener to remove.
|
||||
* @return true if the packet listener was removed
|
||||
* @param packetListener the stanza(/packet) listener to remove.
|
||||
* @return true if the stanza(/packet) listener was removed
|
||||
* @since 4.1
|
||||
*/
|
||||
public boolean removeAsyncStanzaListener(StanzaListener packetListener);
|
||||
|
||||
/**
|
||||
* Registers a packet listener with this connection. The listener will be
|
||||
* notified of every packet that this connection sends. A packet filter determines
|
||||
* Registers a stanza(/packet) listener with this connection. The listener will be
|
||||
* notified of every stanza(/packet) that this connection sends. A stanza(/packet) filter determines
|
||||
* which packets will be delivered to the listener. Note that the thread
|
||||
* that writes packets will be used to invoke the listeners. Therefore, each
|
||||
* packet listener should complete all operations quickly or use a different
|
||||
* stanza(/packet) listener should complete all operations quickly or use a different
|
||||
* thread for processing.
|
||||
*
|
||||
* @param packetListener the packet listener to notify of sent packets.
|
||||
* @param packetFilter the packet filter to use.
|
||||
* @param packetListener the stanza(/packet) listener to notify of sent packets.
|
||||
* @param packetFilter the stanza(/packet) filter to use.
|
||||
*/
|
||||
public void addPacketSendingListener(StanzaListener packetListener, StanzaFilter packetFilter);
|
||||
|
||||
/**
|
||||
* Removes a packet listener for sending packets from this connection.
|
||||
* Removes a stanza(/packet) listener for sending packets from this connection.
|
||||
*
|
||||
* @param packetListener the packet listener to remove.
|
||||
* @param packetListener the stanza(/packet) listener to remove.
|
||||
*/
|
||||
public void removePacketSendingListener(StanzaListener packetListener);
|
||||
|
||||
/**
|
||||
* Registers a packet interceptor with this connection. The interceptor will be
|
||||
* invoked every time a packet is about to be sent by this connection. Interceptors
|
||||
* may modify the packet to be sent. A packet filter determines which packets
|
||||
* Registers a stanza(/packet) interceptor with this connection. The interceptor will be
|
||||
* invoked every time a stanza(/packet) is about to be sent by this connection. Interceptors
|
||||
* may modify the stanza(/packet) to be sent. A stanza(/packet) filter determines which packets
|
||||
* will be delivered to the interceptor.
|
||||
*
|
||||
* <p>
|
||||
* NOTE: For a similar functionality on incoming packets, see {@link #addAsyncStanzaListener(StanzaListener, StanzaFilter)}.
|
||||
*
|
||||
* @param packetInterceptor the packet interceptor to notify of packets about to be sent.
|
||||
* @param packetFilter the packet filter to use.
|
||||
* @param packetInterceptor the stanza(/packet) interceptor to notify of packets about to be sent.
|
||||
* @param packetFilter the stanza(/packet) filter to use.
|
||||
*/
|
||||
public void addPacketInterceptor(StanzaListener packetInterceptor, StanzaFilter packetFilter);
|
||||
|
||||
/**
|
||||
* Removes a packet interceptor.
|
||||
* Removes a stanza(/packet) interceptor.
|
||||
*
|
||||
* @param packetInterceptor the packet interceptor to remove.
|
||||
* @param packetInterceptor the stanza(/packet) interceptor to remove.
|
||||
*/
|
||||
public void removePacketInterceptor(StanzaListener packetInterceptor);
|
||||
|
||||
|
@ -388,15 +388,15 @@ public interface XMPPConnection {
|
|||
* Returns the current value of the reply timeout in milliseconds for request for this
|
||||
* XMPPConnection instance.
|
||||
*
|
||||
* @return the packet reply timeout in milliseconds
|
||||
* @return the stanza(/packet) reply timeout in milliseconds
|
||||
*/
|
||||
public long getPacketReplyTimeout();
|
||||
|
||||
/**
|
||||
* Set the packet reply timeout in milliseconds. In most cases, Smack will throw a
|
||||
* Set the stanza(/packet) reply timeout in milliseconds. In most cases, Smack will throw a
|
||||
* {@link NoResponseException} if no reply to a request was received within the timeout period.
|
||||
*
|
||||
* @param timeout the packet reply timeout in milliseconds
|
||||
* @param timeout the stanza(/packet) reply timeout in milliseconds
|
||||
*/
|
||||
public void setPacketReplyTimeout(long timeout);
|
||||
|
||||
|
@ -442,12 +442,12 @@ public interface XMPPConnection {
|
|||
public FromMode getFromMode();
|
||||
|
||||
/**
|
||||
* Get the feature packet extensions for a given stream feature of the
|
||||
* Get the feature stanza(/packet) extensions for a given stream feature of the
|
||||
* server, or <code>null</code> if the server doesn't support that feature.
|
||||
*
|
||||
* @param element
|
||||
* @param namespace
|
||||
* @return a packet extensions of the feature or <code>null</code>
|
||||
* @return a stanza(/packet) extensions of the feature or <code>null</code>
|
||||
*/
|
||||
public <F extends ExtensionElement> F getFeature(String element, String namespace);
|
||||
|
||||
|
@ -468,7 +468,7 @@ public interface XMPPConnection {
|
|||
* has been elapsed.
|
||||
* </p>
|
||||
*
|
||||
* @param stanza the stanza to send (required)
|
||||
* @param packet the stanza to send (required)
|
||||
* @param replyFilter the filter used to determine response stanza (required)
|
||||
* @param callback the callback invoked if there is a response (required)
|
||||
* @throws NotConnectedException
|
||||
|
@ -484,7 +484,7 @@ public interface XMPPConnection {
|
|||
* with a {@link SmackException.NoResponseException}. The callback will be invoked at most once.
|
||||
* </p>
|
||||
*
|
||||
* @param stanza the stanza to send (required)
|
||||
* @param packet the stanza to send (required)
|
||||
* @param replyFilter the filter used to determine response stanza (required)
|
||||
* @param callback the callback invoked if there is a response (required)
|
||||
* @param exceptionCallback the callback invoked if there is an exception (optional)
|
||||
|
@ -501,7 +501,7 @@ public interface XMPPConnection {
|
|||
* with a {@link SmackException.NoResponseException}. The callback will be invoked at most once.
|
||||
* </p>
|
||||
*
|
||||
* @param stanza the stanza to send (required)
|
||||
* @param packet the stanza to send (required)
|
||||
* @param replyFilter the filter used to determine response stanza (required)
|
||||
* @param callback the callback invoked if there is a response (required)
|
||||
* @param exceptionCallback the callback invoked if there is an exception (optional)
|
||||
|
@ -559,9 +559,9 @@ public interface XMPPConnection {
|
|||
|
||||
/**
|
||||
* Add a callback that is called exactly once and synchronously with the incoming stanza that matches the given
|
||||
* packet filter.
|
||||
* stanza(/packet) filter.
|
||||
*
|
||||
* @param callback the callback invoked once the packet filter matches a stanza.
|
||||
* @param callback the callback invoked once the stanza(/packet) filter matches a stanza.
|
||||
* @param packetFilter the filter to match stanzas or null to match all.
|
||||
*/
|
||||
public void addOneTimeSyncCallback(StanzaListener callback, StanzaFilter packetFilter);
|
||||
|
|
|
@ -78,7 +78,7 @@ public interface SmackDebugger {
|
|||
|
||||
/**
|
||||
* Returns the thread that will listen for all incoming packets and write them to the GUI.
|
||||
* This is what we call "interpreted" packet data, since it's the packet data as Smack sees
|
||||
* This is what we call "interpreted" stanza(/packet) data, since it's the stanza(/packet) data as Smack sees
|
||||
* it and not as it's coming in as raw XML.
|
||||
*
|
||||
* @return the PacketListener that will listen for all incoming packets and write them to
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jivesoftware.smack.filter;
|
|||
import org.jivesoftware.smack.packet.Stanza;
|
||||
|
||||
/**
|
||||
* Implements the logical AND operation over two or more packet filters.
|
||||
* Implements the logical AND operation over two or more stanza(/packet) filters.
|
||||
* In other words, packets pass this filter if they pass <b>all</b> of the filters.
|
||||
*
|
||||
* @author Matt Tucker
|
||||
|
|
|
@ -26,7 +26,7 @@ import org.jxmpp.util.XmppStringUtils;
|
|||
* Filter for packets where the "from" field exactly matches a specified JID. If the specified
|
||||
* address is a bare JID then the filter will match any address whose bare JID matches the
|
||||
* specified JID. But if the specified address is a full JID then the filter will only match
|
||||
* if the sender of the packet matches the specified resource.
|
||||
* if the sender of the stanza(/packet) matches the specified resource.
|
||||
*
|
||||
* @author Gaston Dombiak
|
||||
*/
|
||||
|
@ -44,7 +44,7 @@ public class FromMatchesFilter implements StanzaFilter {
|
|||
* filter address. The second parameter specifies whether the full or the bare addresses are
|
||||
* compared.
|
||||
*
|
||||
* @param address The address to filter for. If <code>null</code> is given, the packet must not
|
||||
* @param address The address to filter for. If <code>null</code> is given, the stanza(/packet) must not
|
||||
* have a from address.
|
||||
* @param matchBare
|
||||
*/
|
||||
|
@ -58,7 +58,7 @@ public class FromMatchesFilter implements StanzaFilter {
|
|||
* the filter address with the bare from address. Otherwise, compares the filter address
|
||||
* with the full from address.
|
||||
*
|
||||
* @param address The address to filter for. If <code>null</code> is given, the packet must not
|
||||
* @param address The address to filter for. If <code>null</code> is given, the stanza(/packet) must not
|
||||
* have a from address.
|
||||
*/
|
||||
public static FromMatchesFilter create(String address) {
|
||||
|
@ -69,7 +69,7 @@ public class FromMatchesFilter implements StanzaFilter {
|
|||
* Creates a filter matching on the "from" field. Compares the bare version of from and filter
|
||||
* address.
|
||||
*
|
||||
* @param address The address to filter for. If <code>null</code> is given, the packet must not
|
||||
* @param address The address to filter for. If <code>null</code> is given, the stanza(/packet) must not
|
||||
* have a from address.
|
||||
*/
|
||||
public static FromMatchesFilter createBare(String address) {
|
||||
|
@ -82,7 +82,7 @@ public class FromMatchesFilter implements StanzaFilter {
|
|||
* Creates a filter matching on the "from" field. Compares the full version of from and filter
|
||||
* address.
|
||||
*
|
||||
* @param address The address to filter for. If <code>null</code> is given, the packet must not
|
||||
* @param address The address to filter for. If <code>null</code> is given, the stanza(/packet) must not
|
||||
* have a from address.
|
||||
*/
|
||||
public static FromMatchesFilter createFull(String address) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.jxmpp.util.XmppStringUtils;
|
|||
/**
|
||||
* Filters for packets which are a valid reply to an IQ request.
|
||||
* <p>
|
||||
* Such a packet must have the same packet id and must be an IQ packet of type
|
||||
* Such a stanza(/packet) must have the same stanza(/packet) id and must be an IQ stanza(/packet) of type
|
||||
* <code>RESULT</code> or <code>ERROR</code>. Moreover, it is necessary to check
|
||||
* the <code>from</code> address to ignore forged replies.
|
||||
* <p>
|
||||
|
@ -61,7 +61,7 @@ public class IQReplyFilter implements StanzaFilter {
|
|||
/**
|
||||
* Filters for packets which are a valid reply to an IQ request.
|
||||
* <p>
|
||||
* Such a packet must have the same packet id and must be an IQ packet of type
|
||||
* Such a stanza(/packet) must have the same stanza(/packet) id and must be an IQ stanza(/packet) of type
|
||||
* <code>RESULT</code> or <code>ERROR</code>. Moreover, it is necessary to check
|
||||
* the <code>from</code> address to ignore forged replies.
|
||||
* <p>
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.jivesoftware.smack.packet.IQ.Type;
|
|||
import org.jivesoftware.smack.util.Objects;
|
||||
|
||||
/**
|
||||
* A filter for IQ packet types. Returns true only if the packet is an IQ packet
|
||||
* A filter for IQ stanza(/packet) types. Returns true only if the stanza(/packet) is an IQ packet
|
||||
* and it matches the type provided in the constructor.
|
||||
*
|
||||
* @author Alexander Wenckus
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.jivesoftware.smack.packet.Stanza;
|
|||
import org.jivesoftware.smack.util.Objects;
|
||||
|
||||
/**
|
||||
* Implements the logical NOT operation on a packet filter. In other words, packets
|
||||
* Implements the logical NOT operation on a stanza(/packet) filter. In other words, packets
|
||||
* pass this filter if they do not pass the supplied filter.
|
||||
*
|
||||
* @author Matt Tucker
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jivesoftware.smack.filter;
|
|||
import org.jivesoftware.smack.packet.Stanza;
|
||||
|
||||
/**
|
||||
* Implements the logical OR operation over two or more packet filters. In
|
||||
* Implements the logical OR operation over two or more stanza(/packet) filters. In
|
||||
* other words, packets pass this filter if they pass <b>any</b> of the filters.
|
||||
*
|
||||
* @author Matt Tucker
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.jivesoftware.smack.packet.ExtensionElement;
|
|||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Filters for packets with a particular type of packet extension.
|
||||
* Filters for packets with a particular type of stanza(/packet) extension.
|
||||
*
|
||||
* @author Matt Tucker
|
||||
* @deprecated use {@link StanzaExtensionFilter} instead.
|
||||
|
@ -34,12 +34,12 @@ public class PacketExtensionFilter implements StanzaFilter {
|
|||
private final String namespace;
|
||||
|
||||
/**
|
||||
* Creates a new packet extension filter. Packets will pass the filter if
|
||||
* they have a packet extension that matches the specified element name
|
||||
* Creates a new stanza(/packet) extension filter. Packets will pass the filter if
|
||||
* they have a stanza(/packet) extension that matches the specified element name
|
||||
* and namespace.
|
||||
*
|
||||
* @param elementName the XML element name of the packet extension.
|
||||
* @param namespace the XML namespace of the packet extension.
|
||||
* @param elementName the XML element name of the stanza(/packet) extension.
|
||||
* @param namespace the XML namespace of the stanza(/packet) extension.
|
||||
*/
|
||||
public PacketExtensionFilter(String elementName, String namespace) {
|
||||
StringUtils.requireNotNullOrEmpty(namespace, "namespace must not be null or empty");
|
||||
|
@ -49,17 +49,17 @@ public class PacketExtensionFilter implements StanzaFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new packet extension filter. Packets will pass the filter if they have a packet
|
||||
* Creates a new stanza(/packet) extension filter. Packets will pass the filter if they have a packet
|
||||
* extension that matches the specified namespace.
|
||||
*
|
||||
* @param namespace the XML namespace of the packet extension.
|
||||
* @param namespace the XML namespace of the stanza(/packet) extension.
|
||||
*/
|
||||
public PacketExtensionFilter(String namespace) {
|
||||
this(null, namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new packet extension filter for the given packet extension.
|
||||
* Creates a new stanza(/packet) extension filter for the given stanza(/packet) extension.
|
||||
*
|
||||
* @param packetExtension
|
||||
*/
|
||||
|
|
|
@ -18,25 +18,25 @@
|
|||
package org.jivesoftware.smack.filter;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* of the collector or listener for further packet processing.
|
||||
* Defines a way to filter packets for particular attributes. Stanza(/Packet) filters are used when
|
||||
* constructing stanza(/packet) listeners or collectors -- the filter defines what packets match the criteria
|
||||
* of the collector or listener for further stanza(/packet) processing.
|
||||
* <p>
|
||||
* Several simple filters are pre-defined. These filters can be logically combined for more complex
|
||||
* packet filtering by using the {@link org.jivesoftware.smack.filter.AndFilter AndFilter} and
|
||||
* stanza(/packet) 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 packets with a specific ID (real code should use {@link StanzaIdFilter} instead).
|
||||
*
|
||||
* <pre>
|
||||
* // Use an anonymous inner class to define a packet filter that returns
|
||||
* // all packets that have a packet ID of "RS145".
|
||||
* // Use an anonymous inner class to define a stanza(/packet) filter that returns
|
||||
* // all packets that have a stanza(/packet) ID of "RS145".
|
||||
* PacketFilter myFilter = new PacketFilter() {
|
||||
* public boolean accept(Packet packet) {
|
||||
* return "RS145".equals(packet.getStanzaId());
|
||||
* }
|
||||
* };
|
||||
* // Create a new packet collector using the filter we created.
|
||||
* // Create a new stanza(/packet) collector using the filter we created.
|
||||
* PacketCollector myCollector = packetReader.createPacketCollector(myFilter);
|
||||
* </pre>
|
||||
*
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.jivesoftware.smack.packet.Stanza;
|
|||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Filters for packets with a particular packet ID.
|
||||
* Filters for packets with a particular stanza(/packet) ID.
|
||||
*
|
||||
* @author Matt Tucker
|
||||
* @deprecated use {@link StanzaIdFilter} instead.
|
||||
|
@ -32,9 +32,9 @@ public class PacketIDFilter implements StanzaFilter {
|
|||
private final String packetID;
|
||||
|
||||
/**
|
||||
* Creates a new packet ID filter using the specified packet's ID.
|
||||
* Creates a new stanza(/packet) ID filter using the specified packet's ID.
|
||||
*
|
||||
* @param packet the packet which the ID is taken from.
|
||||
* @param packet the stanza(/packet) which the ID is taken from.
|
||||
* @deprecated use {@link StanzaIdFilter#StanzaIdFilter(Stanza)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
|
@ -43,9 +43,9 @@ public class PacketIDFilter implements StanzaFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a new packet ID filter using the specified packet ID.
|
||||
* Creates a new stanza(/packet) ID filter using the specified stanza(/packet) ID.
|
||||
*
|
||||
* @param packetID the packet ID to filter for.
|
||||
* @param packetID the stanza(/packet) ID to filter for.
|
||||
* @deprecated use {@link StanzaIdFilter#StanzaIdFilter(Stanza)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
|
|
|
@ -42,7 +42,7 @@ public class PacketTypeFilter implements StanzaFilter {
|
|||
private final Class<? extends Stanza> packetType;
|
||||
|
||||
/**
|
||||
* Creates a new packet type filter that will filter for packets that are the
|
||||
* Creates a new stanza(/packet) type filter that will filter for packets that are the
|
||||
* same type as <tt>packetType</tt>.
|
||||
*
|
||||
* @param packetType the Class type.
|
||||
|
|
|
@ -21,7 +21,7 @@ import org.jivesoftware.smack.packet.Presence.Type;
|
|||
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
|
||||
* A filter for Presence types. Returns true only if the stanza is an Presence stanza(/packet) and it matches the type provided in the
|
||||
* constructor.
|
||||
*/
|
||||
public class PresenceTypeFilter extends FlexibleStanzaTypeFilter<Presence> {
|
||||
|
|
|
@ -51,7 +51,7 @@ public interface StanzaFilter {
|
|||
/**
|
||||
* Tests whether or not the specified stanza should pass the filter.
|
||||
*
|
||||
* @param stanza the packet to test.
|
||||
* @param packet the stanza(/packet) to test.
|
||||
* @return true if and only if <tt>stanza</tt> passes the filter.
|
||||
*/
|
||||
public boolean accept(Stanza stanza);
|
||||
|
|
|
@ -32,7 +32,7 @@ public class StanzaIdFilter implements StanzaFilter {
|
|||
/**
|
||||
* Creates a new stanza ID filter using the specified stanza's ID.
|
||||
*
|
||||
* @param stanza the stanza which the ID is taken from.
|
||||
* @param packet the stanza which the ID is taken from.
|
||||
*/
|
||||
public StanzaIdFilter(Stanza stanza) {
|
||||
this(stanza.getStanzaId());
|
||||
|
@ -41,7 +41,7 @@ public class StanzaIdFilter implements StanzaFilter {
|
|||
/**
|
||||
* Creates a new stanza ID filter using the specified stanza ID.
|
||||
*
|
||||
* @param stanzaID the stanza ID to filter for.
|
||||
* @param packetID the stanza ID to filter for.
|
||||
*/
|
||||
public StanzaIdFilter(String stanzaID) {
|
||||
this.stanzaId = StringUtils.requireNotNullOrEmpty(stanzaID, "Stanza ID must not be null or empty.");
|
||||
|
|
|
@ -42,7 +42,7 @@ public final class StanzaTypeFilter implements StanzaFilter {
|
|||
private final Class<? extends Stanza> packetType;
|
||||
|
||||
/**
|
||||
* Creates a new packet type filter that will filter for packets that are the
|
||||
* Creates a new stanza(/packet) type filter that will filter for packets that are the
|
||||
* same type as <tt>packetType</tt>.
|
||||
*
|
||||
* @param packetType the Class type.
|
||||
|
|
|
@ -84,11 +84,11 @@ public class AbstractError {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the first packet extension that matches the specified element name and
|
||||
* Returns the first stanza(/packet) extension that matches the specified element name and
|
||||
* namespace, or <tt>null</tt> if it doesn't exist.
|
||||
*
|
||||
* @param elementName the XML element name of the packet extension.
|
||||
* @param namespace the XML element namespace of the packet extension.
|
||||
* @param elementName the XML element name of the stanza(/packet) extension.
|
||||
* @param namespace the XML element namespace of the stanza(/packet) extension.
|
||||
* @return the extension, or <tt>null</tt> if it doesn't exist.
|
||||
*/
|
||||
public <PE extends ExtensionElement> PE getExtension(String elementName, String namespace) {
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
package org.jivesoftware.smack.packet;
|
||||
|
||||
/**
|
||||
* IQ packet used by Smack to bind a resource and to obtain the jid assigned by the server.
|
||||
* There are two ways to bind a resource. One is simply sending an empty Bind packet where the
|
||||
* IQ stanza(/packet) used by Smack to bind a resource and to obtain the jid assigned by the server.
|
||||
* There are two ways to bind a resource. One is simply sending an empty Bind stanza(/packet) where the
|
||||
* server will assign a new resource for this connection. The other option is to set a desired
|
||||
* resource but the server may return a modified version of the sent resource.<p>
|
||||
*
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
|||
/**
|
||||
* 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.<p>
|
||||
* instances of this class will be returned when getting stanza(/packet) extensions.<p>
|
||||
*
|
||||
* This class provides a very simple representation of an XML sub-document. Each element
|
||||
* is a key in a Map with its CDATA being the value. For example, given the following
|
||||
|
@ -53,7 +53,7 @@ public class DefaultExtensionElement implements ExtensionElement {
|
|||
private Map<String,String> map;
|
||||
|
||||
/**
|
||||
* Creates a new generic packet extension.
|
||||
* Creates a new generic stanza(/packet) extension.
|
||||
*
|
||||
* @param elementName the name of the element of the XML sub-document.
|
||||
* @param namespace the namespace of the element.
|
||||
|
@ -66,7 +66,7 @@ public class DefaultExtensionElement implements ExtensionElement {
|
|||
/**
|
||||
* Returns the XML element name of the extension sub-packet root element.
|
||||
*
|
||||
* @return the XML element name of the packet extension.
|
||||
* @return the XML element name of the stanza(/packet) extension.
|
||||
*/
|
||||
public String getElementName() {
|
||||
return elementName;
|
||||
|
@ -75,7 +75,7 @@ public class DefaultExtensionElement implements ExtensionElement {
|
|||
/**
|
||||
* Returns the XML namespace of the extension sub-packet root element.
|
||||
*
|
||||
* @return the XML namespace of the packet extension.
|
||||
* @return the XML namespace of the stanza(/packet) extension.
|
||||
*/
|
||||
public String getNamespace() {
|
||||
return namespace;
|
||||
|
@ -95,7 +95,7 @@ public class DefaultExtensionElement implements ExtensionElement {
|
|||
|
||||
/**
|
||||
* Returns an unmodifiable collection of the names that can be used to get
|
||||
* values of the packet extension.
|
||||
* values of the stanza(/packet) extension.
|
||||
*
|
||||
* @return the names.
|
||||
*/
|
||||
|
@ -107,7 +107,7 @@ public class DefaultExtensionElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns a packet extension value given a name.
|
||||
* Returns a stanza(/packet) extension value given a name.
|
||||
*
|
||||
* @param name the name.
|
||||
* @return the value.
|
||||
|
@ -120,7 +120,7 @@ public class DefaultExtensionElement implements ExtensionElement {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets a packet extension value using the given name.
|
||||
* Sets a stanza(/packet) extension value using the given name.
|
||||
*
|
||||
* @param name the name.
|
||||
* @param value the value.
|
||||
|
|
|
@ -19,14 +19,14 @@ package org.jivesoftware.smack.packet;
|
|||
|
||||
/**
|
||||
* 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.
|
||||
* carry a namespace and is usually included as child element of an stanza(/packet) extension.
|
||||
*/
|
||||
public interface Element {
|
||||
|
||||
/**
|
||||
* Returns the XML representation of this Element.
|
||||
*
|
||||
* @return the packet extension as XML.
|
||||
* @return the stanza(/packet) extension as XML.
|
||||
*/
|
||||
public CharSequence toXML();
|
||||
}
|
||||
|
|
|
@ -25,12 +25,12 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
|||
/**
|
||||
* The base IQ (Info/Query) packet. IQ packets are used to get and set information
|
||||
* on the server, including authentication, roster operations, and creating
|
||||
* accounts. Each IQ packet has a specific type that indicates what type of action
|
||||
* accounts. Each IQ stanza(/packet) has a specific type that indicates what type of action
|
||||
* is being taken: "get", "set", "result", or "error".<p>
|
||||
*
|
||||
* IQ packets can contain a single child element that exists in a specific XML
|
||||
* namespace. The combination of the element name and namespace determines what
|
||||
* type of IQ packet it is. Some example IQ subpacket snippets:<ul>
|
||||
* type of IQ stanza(/packet) it is. Some example IQ subpacket snippets:<ul>
|
||||
*
|
||||
* <li><query xmlns="jabber:iq:auth"> -- an authentication IQ.
|
||||
* <li><query xmlns="jabber:iq:private"> -- a private storage IQ.
|
||||
|
@ -165,7 +165,7 @@ public abstract class IQ extends Stanza {
|
|||
/**
|
||||
* This method must be overwritten by IQ subclasses to create their child content. It is important that the builder
|
||||
* <b>does not include the final end element</b>. This will be done automatically by IQChildelementXmlStringBuilder
|
||||
* after eventual existing packet extensions have been added.
|
||||
* after eventual existing stanza(/packet) extensions have been added.
|
||||
* <p>
|
||||
* For example to create an IQ with a extra attribute and an additional child element
|
||||
* </p>
|
||||
|
@ -195,7 +195,7 @@ public abstract class IQ extends Stanza {
|
|||
* xml.attribute("myAttribute", "myAttributeValue");
|
||||
* xml.setEmptyElement();
|
||||
* </pre>
|
||||
* If your IQ does not contain any attributes or child elements (besides packet extensions), consider sub-classing
|
||||
* If your IQ does not contain any attributes or child elements (besides stanza(/packet) extensions), consider sub-classing
|
||||
* {@link SimpleIQ} instead.
|
||||
*
|
||||
* @param xml a pre-created builder which already has the child element and the 'xmlns' attribute set.
|
||||
|
@ -206,7 +206,7 @@ public abstract class IQ extends Stanza {
|
|||
/**
|
||||
* Convenience method to create a new empty {@link Type#result IQ.Type.result}
|
||||
* IQ based on a {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}
|
||||
* IQ. The new packet will be initialized with:<ul>
|
||||
* IQ. The new stanza(/packet) will be initialized with:<ul>
|
||||
* <li>The sender set to the recipient of the originating IQ.
|
||||
* <li>The recipient set to the sender of the originating IQ.
|
||||
* <li>The type set to {@link Type#result IQ.Type.result}.
|
||||
|
@ -215,7 +215,7 @@ public abstract class IQ extends Stanza {
|
|||
* </ul>
|
||||
*
|
||||
* @param request the {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set} IQ packet.
|
||||
* @throws IllegalArgumentException if the IQ packet does not have a type of
|
||||
* @throws IllegalArgumentException if the IQ stanza(/packet) does not have a type of
|
||||
* {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}.
|
||||
* @return a new {@link Type#result IQ.Type.result} IQ based on the originating IQ.
|
||||
*/
|
||||
|
@ -226,7 +226,7 @@ public abstract class IQ extends Stanza {
|
|||
/**
|
||||
* Convenience method to create a new {@link Type#error IQ.Type.error} IQ
|
||||
* based on a {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}
|
||||
* IQ. The new packet will be initialized with:<ul>
|
||||
* IQ. The new stanza(/packet) will be initialized with:<ul>
|
||||
* <li>The sender set to the recipient of the originating IQ.
|
||||
* <li>The recipient set to the sender of the originating IQ.
|
||||
* <li>The type set to {@link Type#error IQ.Type.error}.
|
||||
|
@ -237,7 +237,7 @@ public abstract class IQ extends Stanza {
|
|||
*
|
||||
* @param request the {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set} IQ packet.
|
||||
* @param error the error to associate with the created IQ packet.
|
||||
* @throws IllegalArgumentException if the IQ packet does not have a type of
|
||||
* @throws IllegalArgumentException if the IQ stanza(/packet) does not have a type of
|
||||
* {@link Type#get IQ.Type.get} or {@link Type#set IQ.Type.set}.
|
||||
* @return a new {@link Type#error IQ.Type.error} IQ based on the originating IQ.
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smack.packet;
|
|||
|
||||
/**
|
||||
* 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.
|
||||
* carry a namespace and is usually included as child element of an stanza(/packet) extension.
|
||||
*/
|
||||
public interface NamedElement extends Element {
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ public interface Packet extends TopLevelStreamElement {
|
|||
public String getPacketID();
|
||||
|
||||
/**
|
||||
* Sets the unique ID of the packet. To indicate that a packet has no id
|
||||
* Sets the unique ID of the packet. To indicate that a stanza(/packet) has no id
|
||||
* pass <code>null</code> as the packet's id value.
|
||||
*
|
||||
* @param id the unique ID for the packet.
|
||||
|
@ -63,39 +63,39 @@ public interface Packet extends TopLevelStreamElement {
|
|||
public void setPacketID(String packetID);
|
||||
|
||||
/**
|
||||
* Returns who the packet is being sent "to", or <tt>null</tt> if
|
||||
* Returns who the stanza(/packet) is being sent "to", or <tt>null</tt> if
|
||||
* the value is not set. The XMPP protocol often makes the "to"
|
||||
* attribute optional, so it does not always need to be set.<p>
|
||||
*
|
||||
* @return who the packet is being sent to, or <tt>null</tt> if the
|
||||
* @return who the stanza(/packet) is being sent to, or <tt>null</tt> if the
|
||||
* value has not been set.
|
||||
*/
|
||||
public String getTo();
|
||||
|
||||
/**
|
||||
* Sets who the packet is being sent "to". The XMPP protocol often makes
|
||||
* Sets who the stanza(/packet) is being sent "to". The XMPP protocol often makes
|
||||
* the "to" attribute optional, so it does not always need to be set.
|
||||
*
|
||||
* @param to who the packet is being sent to.
|
||||
* @param to who the stanza(/packet) is being sent to.
|
||||
*/
|
||||
public void setTo(String to);
|
||||
|
||||
/**
|
||||
* Returns who the packet is being sent "from" or <tt>null</tt> if
|
||||
* Returns who the stanza(/packet) is being sent "from" or <tt>null</tt> if
|
||||
* the value is not set. The XMPP protocol often makes the "from"
|
||||
* attribute optional, so it does not always need to be set.<p>
|
||||
*
|
||||
* @return who the packet is being sent from, or <tt>null</tt> if the
|
||||
* @return who the stanza(/packet) is being sent from, or <tt>null</tt> if the
|
||||
* value has not been set.
|
||||
*/
|
||||
public String getFrom();
|
||||
|
||||
/**
|
||||
* Sets who the packet is being sent "from". The XMPP protocol often
|
||||
* Sets who the stanza(/packet) is being sent "from". The XMPP protocol often
|
||||
* makes the "from" attribute optional, so it does not always need to
|
||||
* be set.
|
||||
*
|
||||
* @param from who the packet is being sent to.
|
||||
* @param from who the stanza(/packet) is being sent to.
|
||||
*/
|
||||
public void setFrom(String from);
|
||||
|
||||
|
@ -128,16 +128,16 @@ public interface Packet extends TopLevelStreamElement {
|
|||
public void setLanguage(String language);
|
||||
|
||||
/**
|
||||
* Returns a copy of the packet extensions attached to the packet.
|
||||
* Returns a copy of the stanza(/packet) extensions attached to the packet.
|
||||
*
|
||||
* @return the packet extensions.
|
||||
* @return the stanza(/packet) extensions.
|
||||
*/
|
||||
public List<ExtensionElement> getExtensions();
|
||||
|
||||
/**
|
||||
* Return a set of all extensions with the given element name <emph>and</emph> namespace.
|
||||
* <p>
|
||||
* Changes to the returned set will update the packet extensions, if the returned set is not the empty set.
|
||||
* Changes to the returned set will update the stanza(/packet) extensions, if the returned set is not the empty set.
|
||||
* </p>
|
||||
*
|
||||
* @param elementName the element name, must not be null.
|
||||
|
@ -148,20 +148,20 @@ public interface Packet extends TopLevelStreamElement {
|
|||
public Set<ExtensionElement> getExtensions(String elementName, String namespace);
|
||||
|
||||
/**
|
||||
* Returns the first extension of this packet that has the given namespace.
|
||||
* Returns the first extension of this stanza(/packet) that has the given namespace.
|
||||
* <p>
|
||||
* When possible, use {@link #getExtension(String,String)} instead.
|
||||
* </p>
|
||||
*
|
||||
* @param namespace the namespace of the extension that is desired.
|
||||
* @return the packet extension with the given namespace.
|
||||
* @return the stanza(/packet) extension with the given namespace.
|
||||
*/
|
||||
public ExtensionElement getExtension(String namespace);
|
||||
|
||||
/**
|
||||
* Returns the first packet extension that matches the specified element name and
|
||||
* Returns the first stanza(/packet) extension that matches the specified element name and
|
||||
* namespace, or <tt>null</tt> if it doesn't exist. If the provided elementName is null,
|
||||
* only the namespace is matched. Packet extensions are
|
||||
* only the namespace is matched. Stanza(/Packet) 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
|
||||
|
@ -169,59 +169,59 @@ public interface Packet extends TopLevelStreamElement {
|
|||
* 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 stanza(/packet) extension. (May be null)
|
||||
* @param namespace the XML element namespace of the stanza(/packet) extension.
|
||||
* @return the extension, or <tt>null</tt> if it doesn't exist.
|
||||
*/
|
||||
public <PE extends ExtensionElement> PE getExtension(String elementName, String namespace);
|
||||
/**
|
||||
* Adds a packet extension to the packet. Does nothing if extension is null.
|
||||
* Adds a stanza(/packet) extension to the packet. Does nothing if extension is null.
|
||||
*
|
||||
* @param extension a packet extension.
|
||||
* @param extension a stanza(/packet) extension.
|
||||
*/
|
||||
public void addExtension(ExtensionElement extension);
|
||||
|
||||
/**
|
||||
* Adds a collection of packet extensions to the packet. Does nothing if extensions is null.
|
||||
* Adds a collection of stanza(/packet) extensions to the packet. Does nothing if extensions is null.
|
||||
*
|
||||
* @param extensions a collection of packet extensions
|
||||
* @param extensions a collection of stanza(/packet) extensions
|
||||
*/
|
||||
public void addExtensions(Collection<ExtensionElement> extensions);
|
||||
|
||||
/**
|
||||
* Check if a packet extension with the given element and namespace exists.
|
||||
* Check if a stanza(/packet) extension with the given element and namespace exists.
|
||||
* <p>
|
||||
* The argument <code>elementName</code> may be null.
|
||||
* </p>
|
||||
*
|
||||
* @param elementName
|
||||
* @param namespace
|
||||
* @return true if a packet extension exists, false otherwise.
|
||||
* @return true if a stanza(/packet) extension exists, false otherwise.
|
||||
*/
|
||||
public boolean hasExtension(String elementName, String namespace);
|
||||
|
||||
/**
|
||||
* Check if a packet extension with the given namespace exists.
|
||||
* Check if a stanza(/packet) extension with the given namespace exists.
|
||||
*
|
||||
* @param namespace
|
||||
* @return true if a packet extension exists, false otherwise.
|
||||
* @return true if a stanza(/packet) extension exists, false otherwise.
|
||||
*/
|
||||
public boolean hasExtension(String namespace);
|
||||
|
||||
/**
|
||||
* Remove the packet extension with the given elementName and namespace.
|
||||
* Remove the stanza(/packet) extension with the given elementName and namespace.
|
||||
*
|
||||
* @param elementName
|
||||
* @param namespace
|
||||
* @return the removed packet extension or null.
|
||||
* @return the removed stanza(/packet) extension or null.
|
||||
*/
|
||||
public ExtensionElement removeExtension(String elementName, String namespace);
|
||||
|
||||
/**
|
||||
* Removes a packet extension from the packet.
|
||||
* Removes a stanza(/packet) extension from the packet.
|
||||
*
|
||||
* @param extension the packet extension to remove.
|
||||
* @return the removed packet extension or null.
|
||||
* @param extension the stanza(/packet) extension to remove.
|
||||
* @return the removed stanza(/packet) extension or null.
|
||||
*/
|
||||
public ExtensionElement removeExtension(ExtensionElement extension);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ import org.jivesoftware.smack.util.TypedCloneable;
|
|||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
/**
|
||||
* Represents XMPP presence packets. Every presence packet has a type, which is one of
|
||||
* Represents XMPP presence packets. Every presence stanza(/packet) has a type, which is one of
|
||||
* the following values:
|
||||
* <ul>
|
||||
* <li>{@link Presence.Type#available available} -- (Default) indicates the user is available to
|
||||
|
@ -36,7 +36,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
|||
* sender's presence.
|
||||
* <li>{@link Presence.Type#unsubscribed unsubscribed} -- grant removal of subscription to
|
||||
* sender's presence.
|
||||
* <li>{@link Presence.Type#error error} -- the presence packet contains an error message.
|
||||
* <li>{@link Presence.Type#error error} -- the presence stanza(/packet) contains an error message.
|
||||
* </ul><p>
|
||||
*
|
||||
* A number of attributes are optional:
|
||||
|
@ -299,7 +299,7 @@ public final class Presence extends Stanza implements TypedCloneable<Presence> {
|
|||
unsubscribed,
|
||||
|
||||
/**
|
||||
* The presence packet contains an error message.
|
||||
* The presence stanza(/packet) contains an error message.
|
||||
*/
|
||||
error,
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package org.jivesoftware.smack.packet;
|
|||
import org.jivesoftware.smack.util.XmlStringBuilder;
|
||||
|
||||
/**
|
||||
* IQ packet that will be sent to the server to establish a session.<p>
|
||||
* IQ stanza(/packet) that will be sent to the server to establish a session.<p>
|
||||
*
|
||||
* If a server supports sessions, it MUST include a <i>session</i> element in the
|
||||
* stream features it advertises to a client after the completion of stream authentication.
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.Locale;
|
|||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Base class for XMPP Stanzas, which are called Packet in older versions of Smack (i.e. < 4.1).
|
||||
* Base class for XMPP Stanzas, which are called Stanza(/Packet) in older versions of Smack (i.e. < 4.1).
|
||||
* <p>
|
||||
* Every stanza has a unique ID (which is automatically generated, but can be overridden). Stanza
|
||||
* IDs are required for IQ stanzas and recommended for presence and message stanzas. Optionally, the
|
||||
|
@ -113,7 +113,7 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the unique ID of the packet. To indicate that a packet has no id
|
||||
* Sets the unique ID of the packet. To indicate that a stanza(/packet) has no id
|
||||
* pass <code>null</code> as the packet's id value.
|
||||
*
|
||||
* @param id the unique ID for the packet.
|
||||
|
@ -148,11 +148,11 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns who the packet is being sent "to", or <tt>null</tt> if
|
||||
* Returns who the stanza(/packet) is being sent "to", or <tt>null</tt> if
|
||||
* the value is not set. The XMPP protocol often makes the "to"
|
||||
* attribute optional, so it does not always need to be set.<p>
|
||||
*
|
||||
* @return who the packet is being sent to, or <tt>null</tt> if the
|
||||
* @return who the stanza(/packet) is being sent to, or <tt>null</tt> if the
|
||||
* value has not been set.
|
||||
*/
|
||||
public String getTo() {
|
||||
|
@ -160,21 +160,21 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets who the packet is being sent "to". The XMPP protocol often makes
|
||||
* Sets who the stanza(/packet) is being sent "to". The XMPP protocol often makes
|
||||
* the "to" attribute optional, so it does not always need to be set.
|
||||
*
|
||||
* @param to who the packet is being sent to.
|
||||
* @param to who the stanza(/packet) is being sent to.
|
||||
*/
|
||||
public void setTo(String to) {
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns who the packet is being sent "from" or <tt>null</tt> if
|
||||
* Returns who the stanza(/packet) is being sent "from" or <tt>null</tt> if
|
||||
* the value is not set. The XMPP protocol often makes the "from"
|
||||
* attribute optional, so it does not always need to be set.<p>
|
||||
*
|
||||
* @return who the packet is being sent from, or <tt>null</tt> if the
|
||||
* @return who the stanza(/packet) is being sent from, or <tt>null</tt> if the
|
||||
* value has not been set.
|
||||
*/
|
||||
public String getFrom() {
|
||||
|
@ -182,11 +182,11 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets who the packet is being sent "from". The XMPP protocol often
|
||||
* Sets who the stanza(/packet) is being sent "from". The XMPP protocol often
|
||||
* makes the "from" attribute optional, so it does not always need to
|
||||
* be set.
|
||||
*
|
||||
* @param from who the packet is being sent to.
|
||||
* @param from who the stanza(/packet) is being sent to.
|
||||
*/
|
||||
public void setFrom(String from) {
|
||||
this.from = from;
|
||||
|
@ -244,7 +244,7 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
/**
|
||||
* Return a set of all extensions with the given element name <emph>and</emph> namespace.
|
||||
* <p>
|
||||
* Changes to the returned set will update the packet extensions, if the returned set is not the empty set.
|
||||
* Changes to the returned set will update the stanza(/packet) extensions, if the returned set is not the empty set.
|
||||
* </p>
|
||||
*
|
||||
* @param elementName the element name, must not be null.
|
||||
|
@ -260,13 +260,13 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the first extension of this packet that has the given namespace.
|
||||
* Returns the first extension of this stanza(/packet) that has the given namespace.
|
||||
* <p>
|
||||
* When possible, use {@link #getExtension(String,String)} instead.
|
||||
* </p>
|
||||
*
|
||||
* @param namespace the namespace of the extension that is desired.
|
||||
* @return the packet extension with the given namespace.
|
||||
* @return the stanza(/packet) extension with the given namespace.
|
||||
*/
|
||||
public ExtensionElement getExtension(String namespace) {
|
||||
return PacketUtil.extensionElementFrom(getExtensions(), null, namespace);
|
||||
|
@ -304,9 +304,9 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds a packet extension to the packet. Does nothing if extension is null.
|
||||
* Adds a stanza(/packet) extension to the packet. Does nothing if extension is null.
|
||||
*
|
||||
* @param extension a packet extension.
|
||||
* @param extension a stanza(/packet) extension.
|
||||
*/
|
||||
public void addExtension(ExtensionElement extension) {
|
||||
if (extension == null) return;
|
||||
|
@ -317,9 +317,9 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds a collection of packet extensions to the packet. Does nothing if extensions is null.
|
||||
* Adds a collection of stanza(/packet) extensions to the packet. Does nothing if extensions is null.
|
||||
*
|
||||
* @param extensions a collection of packet extensions
|
||||
* @param extensions a collection of stanza(/packet) extensions
|
||||
*/
|
||||
public void addExtensions(Collection<ExtensionElement> extensions) {
|
||||
if (extensions == null) return;
|
||||
|
@ -329,14 +329,14 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if a packet extension with the given element and namespace exists.
|
||||
* Check if a stanza(/packet) extension with the given element and namespace exists.
|
||||
* <p>
|
||||
* The argument <code>elementName</code> may be null.
|
||||
* </p>
|
||||
*
|
||||
* @param elementName
|
||||
* @param namespace
|
||||
* @return true if a packet extension exists, false otherwise.
|
||||
* @return true if a stanza(/packet) extension exists, false otherwise.
|
||||
*/
|
||||
public boolean hasExtension(String elementName, String namespace) {
|
||||
if (elementName == null) {
|
||||
|
@ -349,10 +349,10 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Check if a packet extension with the given namespace exists.
|
||||
* Check if a stanza(/packet) extension with the given namespace exists.
|
||||
*
|
||||
* @param namespace
|
||||
* @return true if a packet extension exists, false otherwise.
|
||||
* @return true if a stanza(/packet) extension exists, false otherwise.
|
||||
*/
|
||||
public boolean hasExtension(String namespace) {
|
||||
synchronized (packetExtensions) {
|
||||
|
@ -366,11 +366,11 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Remove the packet extension with the given elementName and namespace.
|
||||
* Remove the stanza(/packet) extension with the given elementName and namespace.
|
||||
*
|
||||
* @param elementName
|
||||
* @param namespace
|
||||
* @return the removed packet extension or null.
|
||||
* @return the removed stanza(/packet) extension or null.
|
||||
*/
|
||||
public ExtensionElement removeExtension(String elementName, String namespace) {
|
||||
String key = XmppStringUtils.generateKey(elementName, namespace);
|
||||
|
@ -380,10 +380,10 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Removes a packet extension from the packet.
|
||||
* Removes a stanza(/packet) extension from the packet.
|
||||
*
|
||||
* @param extension the packet extension to remove.
|
||||
* @return the removed packet extension or null.
|
||||
* @param extension the stanza(/packet) extension to remove.
|
||||
* @return the removed stanza(/packet) extension or null.
|
||||
*/
|
||||
public ExtensionElement removeExtension(ExtensionElement extension) {
|
||||
return removeExtension(extension.getElementName(), extension.getNamespace());
|
||||
|
@ -397,10 +397,10 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
|
||||
/**
|
||||
* Returns the extension sub-packets (including properties data) as an XML
|
||||
* String, or the Empty String if there are no packet extensions.
|
||||
* String, or the Empty String if there are no stanza(/packet) extensions.
|
||||
*
|
||||
* @return the extension sub-packets as XML or the Empty String if there
|
||||
* are no packet extensions.
|
||||
* are no stanza(/packet) extensions.
|
||||
*/
|
||||
protected final XmlStringBuilder getExtensionsXML() {
|
||||
XmlStringBuilder xml = new XmlStringBuilder();
|
||||
|
@ -433,7 +433,7 @@ public abstract class Stanza implements TopLevelStreamElement, Packet {
|
|||
}
|
||||
|
||||
/**
|
||||
* Append an XMPPError is this packet has one set.
|
||||
* Append an XMPPError is this stanza(/packet) has one set.
|
||||
*
|
||||
* @param xml the XmlStringBuilder to append the error to.
|
||||
*/
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.jivesoftware.smack.util.XmlStringBuilder;
|
|||
|
||||
/**
|
||||
* Represents an XMPP error sub-packet. Typically, a server responds to a request that has
|
||||
* problems by sending the packet back and including an error packet. Each error has a type,
|
||||
* problems by sending the stanza(/packet) back and including an error packet. Each error has a type,
|
||||
* error condition as well as as an optional text explanation. Typical errors are:<p>
|
||||
*
|
||||
* <table border=1>
|
||||
|
@ -112,7 +112,7 @@ public class XMPPError extends AbstractError {
|
|||
* @param type the error type.
|
||||
* @param condition the error condition.
|
||||
* @param descriptiveTexts
|
||||
* @param extensions list of packet extensions
|
||||
* @param extensions list of stanza(/packet) extensions
|
||||
*/
|
||||
public XMPPError(Condition condition, String conditionText, String errorGenerator, Type type, Map<String, String> descriptiveTexts,
|
||||
List<ExtensionElement> extensions) {
|
||||
|
|
|
@ -23,7 +23,7 @@ package org.jivesoftware.smack.parsing;
|
|||
* place the parser after the faulty stanza.
|
||||
*
|
||||
* Subclasses may or may not override certain methods of this class. Each of these methods will receive the exception
|
||||
* that caused the parsing error and an instance of an Unparsed Packet type. The latter can be used to inspect the
|
||||
* that caused the parsing error and an instance of an Unparsed Stanza(/Packet) type. The latter can be used to inspect the
|
||||
* stanza that caused the parsing error by using the getContent() (for example {@link UnparsablePacket#getContent()})
|
||||
* method.
|
||||
*
|
||||
|
@ -37,7 +37,7 @@ public abstract class ParsingExceptionCallback {
|
|||
/**
|
||||
* Called when parsing an message stanza caused an exception.
|
||||
*
|
||||
* @param stanzaData
|
||||
* @param packetData
|
||||
* the raw message stanza data that caused the exception
|
||||
* @throws Exception
|
||||
*/
|
||||
|
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smack.provider;
|
|||
import org.jivesoftware.smack.packet.ExtensionElement;
|
||||
|
||||
/**
|
||||
* Defines the information required to register a packet extension Provider with the {@link ProviderManager} when using the
|
||||
* Defines the information required to register a stanza(/packet) extension Provider with the {@link ProviderManager} when using the
|
||||
* {@link ProviderLoader}.
|
||||
*
|
||||
* @author Robin Collier
|
||||
|
|
|
@ -64,7 +64,7 @@ import org.jxmpp.util.XmppStringUtils;
|
|||
* interface, or extend the IQ class. In the former case, each IQProvider is responsible for
|
||||
* parsing the raw XML stream to create an IQ instance. In the latter case, bean introspection
|
||||
* is used to try to automatically set properties of the IQ instance using the values found
|
||||
* in the IQ packet XML. For example, an XMPP time packet resembles the following:
|
||||
* in the IQ stanza(/packet) XML. For example, an XMPP time stanza(/packet) resembles the following:
|
||||
* <pre>
|
||||
* <iq type='result' to='joe@example.com' from='mary@example.com' id='time_1'>
|
||||
* <query xmlns='jabber:iq:time'>
|
||||
|
@ -74,13 +74,13 @@ import org.jxmpp.util.XmppStringUtils;
|
|||
* </query>
|
||||
* </iq></pre>
|
||||
*
|
||||
* In order for this packet to be automatically mapped to the Time object listed in the
|
||||
* In order for this stanza(/packet) to be automatically mapped to the Time object listed in the
|
||||
* providers file above, it must have the methods setUtc(String), setTz(String), and
|
||||
* setDisplay(String). The introspection service will automatically try to convert the String
|
||||
* value from the XML into a boolean, int, long, float, double, or Class depending on the
|
||||
* type the IQ instance expects.<p>
|
||||
*
|
||||
* A pluggable system for packet extensions, child elements in a custom namespace for
|
||||
* A pluggable system for stanza(/packet) extensions, child elements in a custom namespace for
|
||||
* message and presence packets, also exists. Each extension provider
|
||||
* is registered with a name space in the smack.providers file as in the following example:
|
||||
*
|
||||
|
@ -95,12 +95,12 @@ import org.jxmpp.util.XmppStringUtils;
|
|||
* </smackProviders></pre>
|
||||
*
|
||||
* If multiple provider entries attempt to register to handle the same element name and namespace,
|
||||
* the first entry loaded from the classpath will take precedence. Whenever a packet extension
|
||||
* the first entry loaded from the classpath will take precedence. Whenever a stanza(/packet) extension
|
||||
* is found in a packet, parsing will be passed to the correct provider. Each provider
|
||||
* can either implement the PacketExtensionProvider interface or be a standard Java Bean. In
|
||||
* the former case, each extension provider is responsible for parsing the raw XML stream to
|
||||
* contruct an object. In the latter case, bean introspection is used to try to automatically
|
||||
* set the properties of th class using the values in the packet extension sub-element. When an
|
||||
* set the properties of th class using the values in the stanza(/packet) extension sub-element. When an
|
||||
* extension provider is not registered for an element name and namespace combination, Smack will
|
||||
* store all top-level elements of the sub-packet in DefaultPacketExtension object and then
|
||||
* attach it to the packet.<p>
|
||||
|
@ -146,7 +146,7 @@ public final class ProviderManager {
|
|||
/**
|
||||
* Returns the IQ provider registered to the specified XML element name and namespace.
|
||||
* For example, if a provider was registered to the element name "query" and the
|
||||
* namespace "jabber:iq:time", then the following packet would trigger the provider:
|
||||
* namespace "jabber:iq:time", then the following stanza(/packet) would trigger the provider:
|
||||
*
|
||||
* <pre>
|
||||
* <iq type='result' to='joe@example.com' from='mary@example.com' id='time_1'>
|
||||
|
@ -220,9 +220,9 @@ public final class ProviderManager {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the packet extension provider registered to the specified XML element name
|
||||
* Returns the stanza(/packet) extension provider registered to the specified XML element name
|
||||
* and namespace. For example, if a provider was registered to the element name "x" and the
|
||||
* namespace "jabber:x:event", then the following packet would trigger the provider:
|
||||
* namespace "jabber:x:event", then the following stanza(/packet) would trigger the provider:
|
||||
*
|
||||
* <pre>
|
||||
* <message to='romeo@montague.net' id='message_1'>
|
||||
|
@ -273,7 +273,7 @@ public final class ProviderManager {
|
|||
*
|
||||
* @param elementName the XML element name.
|
||||
* @param namespace the XML namespace.
|
||||
* @return the key of the removed packet extension provider
|
||||
* @return the key of the removed stanza(/packet) extension provider
|
||||
*/
|
||||
public static String removeExtensionProvider(String elementName, String namespace) {
|
||||
String key = getKey(elementName, namespace);
|
||||
|
|
|
@ -138,7 +138,7 @@ public class PacketParserUtils {
|
|||
* connection is optional and is used to return feature-not-implemented errors for unknown IQ stanzas.
|
||||
*
|
||||
* @param parser
|
||||
* @return a packet which is either a Message, IQ or Presence.
|
||||
* @return a stanza(/packet) which is either a Message, IQ or Presence.
|
||||
* @throws XmlPullParserException
|
||||
* @throws SmackException
|
||||
* @throws IOException
|
||||
|
@ -906,7 +906,7 @@ public class PacketParserUtils {
|
|||
* Parses an extension element.
|
||||
*
|
||||
* @param elementName the XML element name of the extension element.
|
||||
* @param namespace the XML namespace of the packet extension.
|
||||
* @param namespace the XML namespace of the stanza(/packet) extension.
|
||||
* @param parser the XML parser, positioned at the starting element of the extension.
|
||||
* @return an extension element.
|
||||
*/
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.jivesoftware.smack.packet.TopLevelStreamElement;
|
|||
*
|
||||
* Packets that should be processed by the client to simulate a received stanza
|
||||
* can be delivered using the {@linkplain #processPacket(Stanza)} method.
|
||||
* It invokes the registered packet interceptors and listeners.
|
||||
* It invokes the registered stanza(/packet) interceptors and listeners.
|
||||
*
|
||||
* @see XMPPConnection
|
||||
* @author Guenther Niess
|
||||
|
@ -150,7 +150,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the first packet that's sent through {@link #sendStanza(Stanza)}
|
||||
* Returns the first stanza(/packet) that's sent through {@link #sendStanza(Stanza)}
|
||||
* and that has not been returned by earlier calls to this method.
|
||||
*
|
||||
* @return a sent packet.
|
||||
|
@ -160,7 +160,7 @@ public class DummyConnection extends AbstractXMPPConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the first packet that's sent through {@link #sendStanza(Stanza)}
|
||||
* Returns the first stanza(/packet) that's sent through {@link #sendStanza(Stanza)}
|
||||
* and that has not been returned by earlier calls to this method. This
|
||||
* method will block for up to the specified number of seconds if no packets
|
||||
* have been sent yet.
|
||||
|
@ -178,11 +178,11 @@ public class DummyConnection extends AbstractXMPPConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* Processes a packet through the installed packet collectors and listeners
|
||||
* and letting them examine the packet to see if they are a match with the
|
||||
* Processes a stanza(/packet) through the installed stanza(/packet) collectors and listeners
|
||||
* and letting them examine the stanza(/packet) to see if they are a match with the
|
||||
* filter.
|
||||
*
|
||||
* @param packet the packet to process.
|
||||
* @param packet the stanza(/packet) to process.
|
||||
*/
|
||||
public void processPacket(Stanza packet) {
|
||||
if (SmackConfiguration.DEBUG) {
|
||||
|
|
|
@ -62,8 +62,8 @@ public class ThreadedDummyConnection extends DummyConnection {
|
|||
}
|
||||
|
||||
/**
|
||||
* Calling this method will cause the next sendStanza call with an IQ packet to timeout.
|
||||
* This is accomplished by simply stopping the auto creating of the reply packet
|
||||
* Calling this method will cause the next sendStanza call with an IQ stanza(/packet) to timeout.
|
||||
* This is accomplished by simply stopping the auto creating of the reply stanza(/packet)
|
||||
* or processing one that was entered via {@link #processPacket(Stanza)}.
|
||||
*/
|
||||
public void setTimeout() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue