1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-28 23:27:57 +01:00

core: delete deprecated filters

Those where deprecated in 2015 with d4a6d8e65 ("Rename
PacketFilter (and implementing classes) and PacketExtension"), now it
is time to delete them.
This commit is contained in:
Florian Schmaus 2020-04-13 20:52:07 +02:00
parent aea95d3401
commit 988954a9db
4 changed files with 0 additions and 259 deletions

View file

@ -1,79 +0,0 @@
/**
*
* Copyright 2003-2007 Jive Software.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smack.filter;
import org.jivesoftware.smack.packet.ExtensionElement;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.util.StringUtils;
/**
* Filters for packets with a particular type of stanza extension.
*
* @author Matt Tucker
* @deprecated use {@link StanzaExtensionFilter} instead.
*/
@Deprecated
public class PacketExtensionFilter implements StanzaFilter {
private final String elementName;
private final String namespace;
/**
* Creates a new stanza extension filter. Packets will pass the filter if
* they have a stanza extension that matches the specified element name
* and namespace.
*
* @param elementName the XML element name of the stanza extension.
* @param namespace the XML namespace of the stanza extension.
*/
public PacketExtensionFilter(String elementName, String namespace) {
StringUtils.requireNotNullNorEmpty(namespace, "namespace must not be null nor empty");
this.elementName = elementName;
this.namespace = namespace;
}
/**
* Creates a new stanza 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 stanza extension.
*/
public PacketExtensionFilter(String namespace) {
this(null, namespace);
}
/**
* Creates a new stanza extension filter for the given stanza extension.
*
* @param packetExtension TODO javadoc me please
*/
public PacketExtensionFilter(ExtensionElement packetExtension) {
this(packetExtension.getElementName(), packetExtension.getNamespace());
}
@Override
public boolean accept(Stanza packet) {
return packet.hasExtension(elementName, namespace);
}
@Override
public String toString() {
return getClass().getSimpleName() + ": element=" + elementName + " namespace=" + namespace;
}
}

View file

@ -1,51 +0,0 @@
/**
*
* Copyright 2003-2007 Jive Software.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smack.filter;
/**
* Defines a way to filter packets for particular attributes. Stanza filters are used when
* constructing stanza listeners or collectors -- the filter defines what packets match the criteria
* of the collector or listener for further stanza processing.
* <p>
* Several simple filters are pre-defined. These filters can be logically combined for more complex
* stanza filtering by using the {@link org.jivesoftware.smack.filter.AndFilter AndFilter} and
* {@link org.jivesoftware.smack.filter.OrFilter OrFilter} filters. It's also possible to define
* your own filters by implementing this interface. The code example below creates a trivial filter
* for packets with a specific ID (real code should use {@link StanzaIdFilter} instead).
*
* <pre>
* // Use an anonymous inner class to define a stanza filter that returns
* // all packets that have a stanza ID of &quot;RS145&quot;.
* PacketFilter myFilter = new PacketFilter() {
* public boolean accept(Packet packet) {
* return &quot;RS145&quot;.equals(packet.getStanzaId());
* }
* };
* // Create a new stanza collector using the filter we created.
* StanzaCollector myCollector = packetReader.createStanzaCollector(myFilter);
* </pre>
*
* @see org.jivesoftware.smack.StanzaCollector
* @see org.jivesoftware.smack.StanzaListener
* @author Matt Tucker
* @deprecated use {@link StanzaFilter}
*/
@Deprecated
public interface PacketFilter extends StanzaFilter {
}

View file

@ -1,66 +0,0 @@
/**
*
* Copyright 2003-2007 Jive Software.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smack.filter;
import org.jivesoftware.smack.packet.Stanza;
import org.jivesoftware.smack.util.StringUtils;
/**
* Filters for packets with a particular stanza ID.
*
* @author Matt Tucker
* @deprecated use {@link StanzaIdFilter} instead.
*/
@Deprecated
public class PacketIDFilter implements StanzaFilter {
private final String packetID;
/**
* Creates a new stanza ID filter using the specified packet's ID.
*
* @param packet the stanza which the ID is taken from.
* @deprecated use {@link StanzaIdFilter#StanzaIdFilter(Stanza)} instead.
*/
@Deprecated
public PacketIDFilter(Stanza packet) {
this(packet.getStanzaId());
}
/**
* Creates a new stanza ID filter using the specified stanza ID.
*
* @param packetID the stanza ID to filter for.
* @deprecated use {@link StanzaIdFilter#StanzaIdFilter(Stanza)} instead.
*/
@Deprecated
public PacketIDFilter(String packetID) {
StringUtils.requireNotNullNorEmpty(packetID, "Packet ID must not be null nor empty.");
this.packetID = packetID;
}
@Override
public boolean accept(Stanza packet) {
return packetID.equals(packet.getStanzaId());
}
@Override
public String toString() {
return getClass().getSimpleName() + ": id=" + packetID;
}
}

View file

@ -1,63 +0,0 @@
/**
*
* Copyright 2003-2007 Jive Software.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jivesoftware.smack.filter;
import org.jivesoftware.smack.packet.Message;
import org.jivesoftware.smack.packet.Presence;
import org.jivesoftware.smack.packet.Stanza;
/**
* Filters for packets of a particular type. The type is given as a Class object, so
* example types would:
* <ul>
* <li><code>Message.class</code>
* <li><code>IQ.class</code>
* <li><code>Presence.class</code>
* </ul>
*
* @author Matt Tucker
* @deprecated use {@link StanzaTypeFilter} instead.
*/
@Deprecated
public class PacketTypeFilter implements StanzaFilter {
public static final PacketTypeFilter PRESENCE = new PacketTypeFilter(Presence.class);
public static final PacketTypeFilter MESSAGE = new PacketTypeFilter(Message.class);
private final Class<? extends Stanza> packetType;
/**
* Creates a new stanza type filter that will filter for packets that are the
* same type as <code>packetType</code>.
*
* @param packetType the Class type.
*/
public PacketTypeFilter(Class<? extends Stanza> packetType) {
this.packetType = packetType;
}
@Override
public boolean accept(Stanza packet) {
return packetType.isInstance(packet);
}
@Override
public String toString() {
return getClass().getSimpleName() + ": " + packetType.getName();
}
}